GeographicLib-1.52/00README.txt0000644000771000077100000000364614064202371015664 0ustar ckarneyckarneyA library for geographic projections. Written by Charles Karney and licensed under the MIT/X11 License. For more information, see https://geographiclib.sourceforge.io/ 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/*.hpp headers for the library src/*.cpp implementation for the library examples/ examples for each class tools/ command-line utilities Makefile.mk -- Unix/Linux makefiles configure -- autoconf configuration script CMakeLists.txt -- cmake configuration files cmake/ support files for building with CMake windows/ project files for building under Windows (but CMake is preferred) maxima/ Maxima code for generating series expansions, etc. matlab/ geographiclib/ *.m, private/*.m -- Matlab implementation of some classes geographiclib-legacy/ *.{m,cpp} -- legacy Matlab routines doc/ files for generating documentation with Doxygen man/ man pages for the utilities python/GeographicLib/*.py -- Python implementation of geodesic routines java/.../*.java -- Java implementation of geodesic routines js/ src/*.js -- JavaScript implementation of geodesic routines samples/*.html -- demonstrations of the JavaScript interface legacy/ C/ -- C implementation of geodesic routines Fortran/ -- Fortran implementation of geodesic routines dotnet/ NETGeographicLib/*.{cpp,h} -- .NET wrapper for GeographicLib examples/ CS/*.cs -- simple C# examples for each class ManagedCPP/*.cpp -- Managed C++ examples for each class VB/*.vb -- simple Visual Basic examples for each class Projection/ -- a more complex C# application GeographicLib-1.52/AUTHORS0000644000771000077100000000145714064202371015074 0ustar ckarneyckarneyCharles Karney Francesco Paolo Lovergine (autoconfiscation) Mathieu Peyréga (help with gravity models) Andrew MacIntyre (python/setup.py) Skip Breidbach (maven support for Java) Scott Heiman (.NET wrappers + C# examples) Chris Bennight (deploying Java library) Sebastian Mattheis (gnomonic projection in Java) Yurij Mikhalevich (node.js port) Phil Miller (putting tests into python/setup.py) Jonathan Takahashi (boost-python sample) William Wall (Javascript wrapper doc) Thomas Warner (Excel wrapper) GeographicLib-1.52/CMakeLists.txt0000644000771000077100000005763214064202371016572 0ustar ckarneyckarneyproject (GeographicLib) # Version information set (PROJECT_VERSION_MAJOR 1) set (PROJECT_VERSION_MINOR 52) set (PROJECT_VERSION_PATCH 0) set (PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") if (PROJECT_VERSION_PATCH GREATER 0) set (PROJECT_VERSION "${PROJECT_VERSION}.${PROJECT_VERSION_PATCH}") endif () if (DEFINED CPACK_PACKAGE_VERSION_COUNT) # majic (version 0.1.9 and later) invokes cmake defining, e.g., # -D CPACK_PACKAGE_VERSION=1.37-001-SNAPSHOT # -D CPACK_PACKAGE_VERSION_COUNT=2 # -D CPACK_PACKAGE_VERSION_MAJOR=1 # -D CPACK_PACKAGE_VERSION_MINOR=36 # -D CPACK_PACKAGE_VERSION_SUFFIX=-001-SNAPSHOT # Check that the version numbers are consistent. if (CPACK_PACKAGE_VERSION_COUNT EQUAL 2) set (CPACK_PACKAGE_VERSION_PATCH 0) elseif (CPACK_PACKAGE_VERSION_COUNT LESS 2) message (FATAL_ERROR "CPACK_PACKAGE_VERSION_COUNT must be 2 or more") endif () if (NOT ( CPACK_PACKAGE_VERSION_MAJOR EQUAL PROJECT_VERSION_MAJOR AND CPACK_PACKAGE_VERSION_MINOR EQUAL PROJECT_VERSION_MINOR AND CPACK_PACKAGE_VERSION_PATCH EQUAL PROJECT_VERSION_PATCH)) message (FATAL_ERROR "Inconsistency in CPACK and PROJECT version numbers") endif () set (PROJECT_VERSION ${CPACK_PACKAGE_VERSION}) else () set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) set (CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) endif () # The library version tracks the numbering given by libtool in the # autoconf set up. set (LIBVERSION_API 19) set (LIBVERSION_BUILD 19.2.0) string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) cmake_minimum_required (VERSION 3.7.0) # This version was released 2016-11-11 # User-settable variables # (1) COMMON_INSTALL_PATH governs the installation convention. If it # is on ON (the Linux default), the installation is to a common # directory, e.g., /usr/local. If it is OFF (the Windows default), # the installation directory contains the package name, e.g., # c:/pkg/GeographicLib-1.22. The installation directories for the # documentation, cmake configuration, python and matlab interfaces all # depend on the variable with deeper paths relative to # CMAKE_INSTALL_PREFIX being used when it's ON. if (WIN32) option (COMMON_INSTALL_PATH "Use a common installation path for packages" OFF) else () option (COMMON_INSTALL_PATH "Use a common installation path for packages" ON) endif () # (2) PACKAGE_PATH and INSTALL_PATH have now been removed # (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} which (since Windows # Vista) is C:/ProgramData. set (GEOGRAPHICLIB_DATA "C:/ProgramData/GeographicLib" CACHE PATH "Location for data for GeographicLib") else () set (GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib" CACHE PATH "Location for data for GeographicLib") endif () # (4) Build which libraries? Possible values are SHARED, STATIC, BOTH. if (MSVC) set (GEOGRAPHICLIB_LIB_TYPE STATIC CACHE STRING "Types of library generated: SHARED, STATIC (default), or BOTH") else () set (GEOGRAPHICLIB_LIB_TYPE SHARED CACHE STRING "Types of library generated: SHARED (default), STATIC, or BOTH") endif () set_property (CACHE GEOGRAPHICLIB_LIB_TYPE PROPERTY STRINGS "SHARED" "STATIC" "BOTH") if (GEOGRAPHICLIB_LIB_TYPE STREQUAL "BOTH") set (GEOGRAPHICLIB_SHARED_LIB ON) set (GEOGRAPHICLIB_STATIC_LIB ON) set (GEOGRAPHICLIB_LIB_TYPE_VAL 2) elseif (GEOGRAPHICLIB_LIB_TYPE STREQUAL "SHARED") set (GEOGRAPHICLIB_SHARED_LIB ON) set (GEOGRAPHICLIB_STATIC_LIB OFF) set (GEOGRAPHICLIB_LIB_TYPE_VAL 1) elseif (GEOGRAPHICLIB_LIB_TYPE STREQUAL "STATIC") set (GEOGRAPHICLIB_SHARED_LIB OFF) set (GEOGRAPHICLIB_STATIC_LIB ON) set (GEOGRAPHICLIB_LIB_TYPE_VAL 0) else () message (FATAL_ERROR "Bad value of GEOGRAPHICLIB_LIB_TYPE, \"${GEOGRAPHICLIB_LIB_TYPE}\" " "(should be SHARED, STATIC or BOTH)") endif () if (GEOGRAPHICLIB_STATIC_LIB) set (PROJECT_STATIC_LIBRARIES GeographicLib_STATIC) set (PROJECT_STATIC_DEFINITIONS -DGEOGRAPHICLIB_SHARED_LIB=0) else () set (PROJECT_STATIC_LIBRARIES) set (PROJECT_STATIC_DEFINITIONS) endif () if (GEOGRAPHICLIB_SHARED_LIB) set (PROJECT_SHARED_LIBRARIES GeographicLib_SHARED) set (PROJECT_LIBRARIES ${PROJECT_SHARED_LIBRARIES}) set (PROJECT_SHARED_DEFINITIONS -DGEOGRAPHICLIB_SHARED_LIB=1) set (PROJECT_DEFINITIONS ${PROJECT_SHARED_DEFINITIONS}) else () set (PROJECT_SHARED_LIBRARIES) set (PROJECT_LIBRARIES ${PROJECT_STATIC_LIBRARIES}) set (PROJECT_SHARED_DEFINITIONS) set (PROJECT_DEFINITIONS ${PROJECT_STATIC_DEFINITIONS}) endif () set (PROJECT_INTERFACE_LIBRARIES GeographicLib) set (PROJECT_ALL_LIBRARIES ${PROJECT_STATIC_LIBRARIES} ${PROJECT_SHARED_LIBRARIES} ${PROJECT_INTERFACE_LIBRARIES}) # (5) Create the documentation? This depends on whether doxygen can be # found. If this is OFF, then links will be provided to the online # documentation on Sourceforge. option (GEOGRAPHICLIB_DOCUMENTATION "Use doxygen to create the documentation" OFF) # (6) Build .NET wrapper library NETGeographicLib. This only applies to # Windows. Default is OFF, because, currently, most people don't use # this interface. option (BUILD_NETGEOGRAPHICLIB "Build NETGeographicLib library" OFF) # (7) Set the default "real" precision. This should probably be left # at 2 (double). set (GEOGRAPHICLIB_PRECISION 2 CACHE STRING "Precision: 1 = float, 2 = double, 3 = extended, 4 = quadruple, 5 = variable") set_property (CACHE GEOGRAPHICLIB_PRECISION PROPERTY STRINGS 1 2 3 4 5) # (8) When making a binary package, should we include the debug version # of the library? This applies to MSVC only, because that's the # platform where debug and release compilations do not inter-operate. # It requires building as follows: # cmake --build . --config Debug --target ALL_BUILD # cmake --build . --config Release --target ALL_BUILD # cmake --build . --config Release --target PACKAGE option (PACKAGE_DEBUG_LIBS "Include debug versions of library in binary package" OFF) # (9) Try to link against boost when building the examples. The # NearestNeighbor example optionally uses the Boost library. Set to ON, # if you want to exercise this functionality. Default is OFF, so that # cmake configuration isn't slowed down looking for Boost. option (USE_BOOST_FOR_EXAMPLES "Look for Boost library when compiling examples" OFF) # (10) On Mac OS X, build multiple architectures? Set to ON to build # i386 and x86_64. Default is OFF, meaning build for default # architecture. option (APPLE_MULTIPLE_ARCHITECTURES "Build multiple architectures for Apple systems" OFF) # (11) Convert warnings into errors? Default is OFF. If the tests # directory is present you get this behavior regardless. option (CONVERT_WARNINGS_TO_ERRORS "Convert warnings into errors?" OFF) set (LIBNAME Geographic) if (MSVC OR CMAKE_CONFIGURATION_TYPES) # For multi-config systems and for Visual Studio, the debug version of # the library is called Geographic_d. set (CMAKE_DEBUG_POSTFIX _d) endif () if (EXISTS ${PROJECT_SOURCE_DIR}/tests/CMakeLists.txt) set (DEVELOPER ON) else () set (DEVELOPER OFF) endif () if (NOT MSVC) # Set the run time path for shared libraries for non-Windows machines. # (1) include link path for external packages (not needed with # GeographicLib because there are no external packages). This only # makes sense for native builds. if (NOT CMAKE_CROSSCOMPILING) set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) endif () # (2) include installed path for GeographicLib. if (NOT APPLE) # Use relative path so that package is relocatable set (CMAKE_INSTALL_RPATH "\$ORIGIN/../lib${LIB_SUFFIX}") else () # cmake 2.8.12 introduced a way to make the package relocatable. # See also INSTALL_RPATH property on the tools. set (CMAKE_MACOSX_RPATH ON) endif () endif () include (CheckTypeSize) check_type_size ("long double" LONG_DOUBLE BUILTIN_TYPES_ONLY) check_type_size ("double" DOUBLE BUILTIN_TYPES_ONLY) if (HAVE_LONG_DOUBLE AND (LONG_DOUBLE GREATER DOUBLE)) set (GEOGRAPHICLIB_HAVE_LONG_DOUBLE TRUE) else () set (GEOGRAPHICLIB_HAVE_LONG_DOUBLE FALSE) endif () include (TestBigEndian) test_big_endian (GEOGRAPHICLIB_WORDS_BIGENDIAN) # We require C++11 set (CMAKE_CXX_STANDARD 11) set (CMAKE_CXX_STANDARD_REQUIRED ON) if (GEOGRAPHICLIB_PRECISION EQUAL 4) set (CMAKE_CXX_EXTENSIONS ON) # Need gnu++11 for quadmath else () set (CMAKE_CXX_EXTENSIONS OFF) # Otherwise stick with the standard endif () # Make the compiler more picky. include (CheckCXXCompilerFlag) if (MSVC) string (REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # Turn on parallel builds for Visual Studio set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /MP") else () set (FLOAT_CONVERSION_FLAG "-Wfloat-conversion") check_cxx_compiler_flag (${FLOAT_CONVERSION_FLAG} FLOAT_CONVERSION) if (NOT FLOAT_CONVERSION) set (FLOAT_CONVERSION_FLAG) endif () set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra ${FLOAT_CONVERSION_FLAG}") endif () if (DEVELOPER OR CONVERT_WARNINGS_TO_ERRORS) if (MSVC) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /WX") set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /WX") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /WX") else () set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") endif () endif () # Tell Intel compiler to do arithmetic accurately. This is needed to # stop the compiler from ignoring parentheses in expressions like # (a + b) + c and from simplifying 0.0 + x to x (which is wrong if # x = -0.0). if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") if (MSVC) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:precise /Qdiag-disable:11074,11076") else () set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -diag-disable=11074,11076") endif () endif () include (CheckCXXSourceCompiles) if (MSVC) set (CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS} /WX") else () set (CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS} -Werror") if (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) # Flags for CMAKE_CXX_STANDARD are added here by default set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++0x") endif () endif () # Check whether the C++11 math functions: std::expm1, std::atanh, # etc. are available. These functions are required. check_cxx_source_compiles ( "#include int main() { int q = 0; return int(std::hypot(3.0, 4.0) + std::expm1(0.5) + std::log1p(2.0) + std::asinh(10.0) + std::atanh(0.8) + std::cbrt(8.0) + std::fma(1.0, 2.0, 3.0) + std::remquo(100.0, 90.0, &q) + std::remainder(100.0, 90.0) + std::copysign(1.0, -0.0) + std::round(3.5)) + std::isfinite(4.0) + std::isnan(0.0) + int(std::lround(-3.5)); }\n" CXX11_MATH) if (NOT CXX11_MATH) message (FATAL_ERROR "Missing C++11 math functions") endif () # Check whether the C++11 static_assert macro is available. This # capability is required. check_cxx_source_compiles ( "#include int main() { static_assert(true, \"static assert test\"); return 0; }\n" CXX11_STATIC_ASSERT) if (NOT CXX11_STATIC_ASSERT) message (FATAL_ERROR "Missing C++11 static_assert") endif () # Include directories are specified via target_include_directories in src. if (USE_BOOST_FOR_EXAMPLES) # quad precision numbers appeared in Boost 1.54. Various # workarounds stopped being needed with Boost 1.64. find_package (Boost 1.64 COMPONENTS serialization) elseif (GEOGRAPHICLIB_PRECISION EQUAL 4) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") find_package (Boost 1.64) endif () endif () set (HIGHPREC_LIBRARIES) if (GEOGRAPHICLIB_PRECISION EQUAL 1) message (WARNING "Compiling with floats which results in poor accuracy") elseif (GEOGRAPHICLIB_PRECISION EQUAL 2) # This is the default elseif (GEOGRAPHICLIB_PRECISION EQUAL 3) if (WIN32) message (WARNING "Cannot support long double on Windows, switching to double") set (GEOGRAPHICLIB_PRECISION 2) endif () elseif (GEOGRAPHICLIB_PRECISION EQUAL 4) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (Boost_FOUND) set (HIGHPREC_LIBRARIES quadmath) endif () endif () if (NOT HIGHPREC_LIBRARIES) message (WARNING "Cannot support quad precision, switching to double") set (GEOGRAPHICLIB_PRECISION 2) endif () elseif (GEOGRAPHICLIB_PRECISION EQUAL 5) # Install MPFR C++ version 3.6.5 (2016-12-19) or later from # http://www.holoborodko.com/pavel/mpfr and install mpreal.h in the # include directory. NOTE: MPFR C++ is covered by the GPL; be sure # to abide by the terms of this license. # # For Linux, use system versions of mpfr and gmp. For Apple, use # brew install mpfr. Recent versions of mpfr (3.0 or later) work # fine. For Windows, download MPFR-MPIR-x86-x64-MSVC2010.zip from # the MPFR C++ site and unpack in the top-level directory. The # Windows build only works with GEOGRAPHICLIB_LIB_TYPE=STATIC. # NOTE: mpfr, gmp, and mpir are covered by the LGPL; be sure to # abide by the terms of this license. # # Need Visual Studio 12 2013 or later, g++ 4.5 or later; not sure # about clang. if (WIN32) if (MSVC AND NOT MSVC_VERSION LESS 1800) if (CMAKE_SIZEOF_VOID_P EQUAL 8) set (_ARCH x64) else () set (_ARCH Win32) endif () include_directories (mpfr_mpir_x86_x64_msvc2010/mpfr mpfr_mpir_x86_x64_msvc2010/mpir/dll/${_ARCH}/Release) # These are C libraries so it's OK to use release versions for # debug builds. Also these work for later versions of Visual # Studio (specifically version 12). link_directories (mpfr_mpir_x86_x64_msvc2010/mpfr/dll/${_ARCH}/Release mpfr_mpir_x86_x64_msvc2010/mpir/dll/${_ARCH}/Release) set (HIGHPREC_LIBRARIES mpfr mpir) # Suppress the myriad of "conditional expression is constant" # warnings set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4127") endif () else () if (APPLE) include_directories (/usr/local/include) link_directories (/usr/local/lib) endif () # g++ before 4.5 doesn't work (no explicit cast operator) if (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5)) set (HIGHPREC_LIBRARIES mpfr gmp) endif () endif () if (NOT HIGHPREC_LIBRARIES) message (WARNING "Cannot support mpfr, switching to double") set (GEOGRAPHICLIB_PRECISION 2) endif () endif () if (APPLE AND APPLE_MULTIPLE_ARCHITECTURES) if (CMAKE_SYSTEM_PROCESSOR MATCHES "i.86" OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86") set (CMAKE_OSX_ARCHITECTURES "i386;x86_64") endif () endif () # Create a Config.h to expose system information to the compiler configure_file ( include/GeographicLib/Config.h.in include/GeographicLib/Config.h @ONLY) # The documentation depends on doxygen. if (GEOGRAPHICLIB_DOCUMENTATION) set (DOXYGEN_SKIP_DOT ON) # Version 1.8.7 or later needed for … find_package (Doxygen 1.8.7) # For JavaScript documentation find_program (JSDOC jsdoc) # For Python documentation find_program (SPHINX sphinx-build) endif () # 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. Skip Apple here because # man/makeusage.sh uses "head --lines -4" to drop the last 4 lines of a # file and there's no simple equivalent for MacOSX if (NOT WIN32 AND NOT APPLE) find_program (HAVE_POD2MAN pod2man) find_program (HAVE_POD2HTML pod2html) find_program (HAVE_COL col) endif () if (HAVE_POD2MAN AND HAVE_POD2HTML AND HAVE_COL) set (MAINTAINER ON) else () set (MAINTAINER OFF) endif () if (MAINTAINER) add_custom_target (distrib-all) add_dependencies (distrib-all distrib-man) endif () if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) # Set a default build type for single-configuration cmake generators # if no build type is set. set (CMAKE_BUILD_TYPE Release) endif () # Set output directories for Windows so that executables and dlls are # put in the same place if (WIN32) # static libaries set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") # shared libraries set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") # executables and dlls set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") endif () # The list of tools (to be installed into, e.g., /usr/local/bin) set (TOOLS CartConvert ConicProj GeodesicProj GeoConvert GeodSolve GeoidEval Gravity MagneticField Planimeter RhumbSolve 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_property (GLOBAL PROPERTY USE_FOLDERS ON) # The list of subdirectories to process add_subdirectory (src) add_subdirectory (include/GeographicLib) add_subdirectory (tools) add_subdirectory (man) add_subdirectory (doc) add_subdirectory (js) add_subdirectory (matlab) add_subdirectory (python/geographiclib) add_subdirectory (examples) if (MSVC AND BUILD_NETGEOGRAPHICLIB) if (GEOGRAPHICLIB_PRECISION EQUAL 2) set (NETGEOGRAPHICLIB_LIBRARIES NETGeographicLib) set (NETLIBNAME NETGeographic) add_subdirectory (dotnet/NETGeographicLib) add_subdirectory (dotnet/examples/ManagedCPP) else () message (WARNING "Build of NETGeographicLib only works with doubles") endif () endif () add_subdirectory (cmake) if (DEVELOPER) add_subdirectory (tests) endif () # 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 () set (CMAKE_INSTALL_DEBUG_LIBRARIES ON) include (InstallRequiredSystemLibraries) # The configuration of CPack is via variable that need to be set before # the include (CPack). set (CPACK_PACKAGE_CONTACT charles@karney.com) set (CPACK_PACKAGE_VENDOR "GeographicLib") set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "GeographicLib 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}/[^/]*\\\\.(xml|html|css|kmz|pdf)\$" "${PROJECT_SOURCE_DIR}/(autogen|biblio)\\\\.sh\$" "${PROJECT_SOURCE_DIR}/(robots.txt|geodesic-biblio.txt|makefile-admin|[^/]*\\\\.png)\$" "${PROJECT_SOURCE_DIR}/matlab/.*blurb.txt\$") set (CPACK_SOURCE_GENERATOR TGZ) set (CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE.txt) set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${PROJECT_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 "https://geographiclib.sourceforge.io") set (CPACK_NSIS_HELP_LINK "mailto:charles@karney.com") # No provision for accommodating different compiler versions. However # the Visual Studio 14 2015 build works also with Visual Studio 15 # 2017 and Visual Studio 16 2019. if (CMAKE_SIZEOF_VOID_P EQUAL 8) set (CPACK_NSIS_INSTALL_ROOT "C:\\\\Program Files") set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-win64") set (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} x64 ${PROJECT_VERSION}") set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME}-x64-${PROJECT_VERSION}") else () set (CPACK_NSIS_INSTALL_ROOT "C:\\\\Program Files (x86)") set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-win32") set (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} win32 ${PROJECT_VERSION}") set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${PROJECT_NAME}-win32-${PROJECT_VERSION}") endif () set (CPACK_NSIS_DISPLAY_NAME ${CPACK_NSIS_PACKAGE_NAME}) set (CPACK_NSIS_MENU_LINKS "https://geographiclib.sourceforge.io/${PROJECT_VERSION}/index.html" "Library documentation" "https://geographiclib.sourceforge.io/${PROJECT_VERSION}/utilities.html" "Utilities documentation" "https://geographiclib.sourceforge.io" "GeographicLib home page" "https://sourceforge.net/projects/geographiclib/" "Main project page") set (CPACK_NSIS_MODIFY_PATH ON) elseif (APPLE) # Not tested set (CPACK_GENERATOR Bundle) 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 && sed -e "s/Unconfigured/${PROJECT_VERSION}/" -e "s/MAJOR .*/MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}/" -e "s/MINOR .*/MINOR ${CPACK_PACKAGE_VERSION_MINOR}/" -e "s/PATCH .*/PATCH ${CPACK_PACKAGE_VERSION_PATCH}/" include/GeographicLib/Config.h > include/GeographicLib/Config.h.new && mv include/GeographicLib/Config.h.new include/GeographicLib/Config.h COMMAND cd _CPack_Packages/Linux-Source/TGZ/${CPACK_SOURCE_PACKAGE_FILE_NAME} && touch man/[A-Za-z]*.usage man/[A-Za-z]*.1 man/[A-Za-z]*.1.html && chmod -R g-w . 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 ${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME}.zip && rsync -a --delete _CPack_Packages/Linux-Source/TGZ/${CPACK_SOURCE_PACKAGE_FILE_NAME} _CPack_Packages/Linux-Source/TGZ.DOS/ && cd _CPack_Packages/Linux-Source/TGZ.DOS && find . -type f | egrep -v '/\(compile|config[^/]*|depcomp|install-sh|missing|[Mm]akefile[^/]*|[^/]*\\.\(ac|am|csproj|eps|kmz|m4|pdf|png|resx|settings|sh|sln|vcproj|vcxproj\)\)$$' | xargs unix2dos -q -k && 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 () # The test suite -- split into a separate file because it's rather large. # N.B. Many of the tests fail with GEOGRAPHICLIB_PRECISION = 1 (float). include (tools/tests.cmake) GeographicLib-1.52/INSTALL0000644000771000077100000000013614064202371015046 0ustar ckarneyckarneyFor installation instructions, open https://geographiclib.sourceforge.io/html/install.html GeographicLib-1.52/LICENSE.txt0000644000771000077100000000220114064202371015633 0ustar ckarneyckarneyThe MIT License (MIT); this license applies to GeographicLib, versions 1.12 and later. Copyright (c) 2008-2021, 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.52/Makefile.am0000644000771000077100000000357414064202371016062 0ustar ckarneyckarney# # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src man tools doc js include matlab python cmake examples EXTRA_DIST = AUTHORS 00README.txt LICENSE.txt NEWS INSTALL README.md \ Makefile.mk CMakeLists.txt windows maxima doc legacy java js dotnet \ wrapper # Install the pkg-config file; the directory is set using # PKG_INSTALLDIR in configure.ac. pkgconfig_DATA = cmake/geographiclib.pc dist-hook: rm -rf $(distdir)/doc/html $(distdir)/doc/manpages \ $(distdir)/doc/GeographicLib.dox find $(distdir)/maxima -type f -name '*.lsp' | xargs rm -rf rm -rf $(distdir)/java/targets find $(distdir)/java -type f -name '*.class' | xargs rm -rf find $(distdir)/wrapper -mindepth 2 -type d | xargs rm -rf find $(distdir)/wrapper -type f -name '*.o' -o -name '*.mex*' | \ xargs rm -f 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 sed -e "s/Unconfigured/$(PACKAGE_VERSION)/" \ -e "s/MAJOR .*/MAJOR ${GEOGRAPHICLIB_VERSION_MAJOR}/" \ -e "s/MINOR .*/MINOR ${GEOGRAPHICLIB_VERSION_MINOR}/" \ -e "s/PATCH .*/PATCH ${GEOGRAPHICLIB_VERSION_PATCH}/" \ $(top_srcdir)/include/GeographicLib/Config.h > \ $(distdir)/include/GeographicLib/Config.h # Custom rules all-local: man doc install-data-local: install-doc doc: man $(MAKE) -C doc doc install-doc: $(MAKE) -C doc install-doc man: $(MAKE) -C man man .PHONY: doc install-doc man install-matlab install-python GeographicLib-1.52/Makefile.mk0000644000771000077100000000262614064202371016071 0ustar ckarneyckarneyMAKEFILE := $(lastword $(MAKEFILE_LIST)) MAKE := $(MAKE) -f $(MAKEFILE) PREFIX = /usr/local SUBDIRS = src man tools doc js ALLDIRS = include $(SUBDIRS) maxima matlab python cmake all: src man tools js $(SUBDIRS): $(MAKE) -C $@ tools: src install: install-headers install-lib install-tools install-man install-cmake \ install-doc install-js install-matlab install-python clean: clean-src clean-tools clean-doc clean-js clean-man clean-matlab \ clean-python 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-js: js $(MAKE) -C js 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-js: $(MAKE) -C js clean clean-man: $(MAKE) -C man clean clean-matlab: matlab $(MAKE) -C matlab clean clean-python: python $(MAKE) -C python clean VERSION:=$(shell grep '\bVERSION=' configure | cut -f2 -d\' | head -1) .PHONY: all $(SUBDIRS) install clean \ install-headers install-lib install-tools install-man install-cmake \ install-doc install-js install-matlab install-python \ clean-src clean-tools clean-doc clean-js clean-man clean-matlab \ clean-python GeographicLib-1.52/NEWS0000644000771000077100000022761514064202371014531 0ustar ckarneyckarneyA reverse chronological list of changes to GeographicLib For more information, see https://geographiclib.sourceforge.io/ The current version of the library is 1.52 Changes between 1.52 (released 2021-06-22) and 1.51 versions: * Add MagneticModel::FieldGeocentric and MagneticCircle::FieldGeocentric to return the field in geocentric coordinates (thanks to Marcelo Banik de Padua). * Document realistic errors for PolygonAreaT and Planimeter. * Geodesic routines: be more aggressive in preventing negative s12 and m12 for short lines (all languages). * Fix bug in AlbersEqualArea for extreme prolate ellipsoids (plus general cleanup in the code). * Thanks to Thomas Warner, a sample of wrapping the C++ library, so it's accessible in Excel, is given in wrapper/Excel. * Minor changes + Work around inaccuracies in hypot routines in Visual Studio (win32), Python, and JavaScript. + Initialize reference argument to remquo (C++ and C). + Get ready to retire unused _exact in RhumbLine. + Declare RhumbLine copy constructor "= default". + Use C++11 "= delete" idiom to delete copy assignment and copy constructors in RhumbLine, Geoid, GravityModel, MagneticModel. + Fix MGRS::Forward to work around aggressive optimization leading to incorrect rounding. + Fix plain makefiles, Makefile.mk, so that PREFIX is handled properly. + Make cmake's GeographicLib_LIBRARIES point to namespace versions. * NOTE: In the next version (tentatively 2.0), I plan to split up the git repository and the packaging of GeographicLib into separate entities for each language. This will simplify development and deployment of the library. * WARNING: The .NET version of GeographicLib will not be supported in the next version. Changes between 1.51 (released 2020-11-22) and 1.50.1 versions: * C++11 compiler required for C++ library. As a consequence: + The workaround implementations for C++11 routines (Math::hypot, Math::expm1, Math::log1p, Math::asinh, Math::atanh, Math::copysign, Math::cbrt, Math::remainder, Math::remquo, Math::round, Math::lround, Math::fma, Math::isfinite, and Math::isnan) are now deprecated. Just use the versions in the std:: namespace instead. + SphericalEngine class, fix the namespace for using streamoff. + Some templated functions, e.g., Math::degree(), now have default template parameters, T = Math::real. * C99 compiler required for C library. * Reduce memory footprint in Java implementation. * New form of Utility::ParseLine to allow the syntax "KEY = VAL". * Add International Geomagnetic Reference Field (13th generation), igrf13, which approximates the main magnetic field of the earth for the period 1900-2025. * More symbols allowed with DMS decoding in C++, JS, and cgi-bin packages; see DMS::Decode. * Fix bug in cgi-bin argument processing which causes "+" to be misinterpreted. * Required minium version of CMake is now 3.7.0 (released 2016-11-11). This is to work around a bug in find_package for cmake 3.4 and 3.5. Changes between 1.50.1 (released 2019-12-13) and 1.50 versions: * Add the World Magnetic Model 2020, wmm2020, covering the period 2020-2025. This is now the model returned by MagneticModel::DefaultMagneticName and is default magnetic model for MagneticField (replacing wmm2015v2 which is only valid thru the end of 2019). * Include float instantiations of those templated Math functions which migrated to Math.cpp in version 1.50. * WARNING: The next version of GeographicLib will require a C++11 compliant compiler. This means that the minimum version of Visual Studio will be Visual Studio 12 2013. (This repeats the warning given with version 1.50. It didn't apply to this version because this is a minor update.) Changes between 1.50 (released 2019-09-24) and 1.49 versions: * BUG fixes: + Java + JavaScript implementations of PolygonArea::TestEdge counted the pole encirclings wrong. + Fix typo in JavaScript implementation which affected unsigned areas. + Adding edges to a polygon counted pole encirclings inconsistent with the way the adding point counted them. This might have caused an incorrect result if a polygon vertex had longitude = 0. This affected all implementations except Fortran and MATLAB). + GARS::Forward: fix BUG in handling of longitude = +/-180d. + Fix bug in Rhumb class and RhumbSolve(1) utiity which caused incorrect area to be reported if an endpoint is at a pole. Thanks to Natalia Sabourova for reporting this. + Fix bug in MATLAB routine mgrs_inv which resulted in incorrect results for UPS zones with prec = -1. + In geodreckon.m geoddistance.m, suppress (innocuous) "warning: division by zero" messages from Octave. + In python implementation, work around problems caused by sin(inf) and fmod(inf) raising exceptions. + Geoid class, fix the use of streamoff. * The PolygonArea class, the Planimeter utility, and their equivalents in C, Fortran, MATLAB, Java, JavaScript, Python, and Maxima can now handle arbitrarily complex polygons. In the case of self-intersecting polygons the area is accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. * Changes in gravity and magnetic model handling + SphericalEngine::coeff::readcoeffs takes new optional argument truncate. + The constructors for GravityModel and MagneticModel allow the maximum degree and order to be specified. The array of coefficients will then be truncated if necessary. + GravityModel::Degree(), GravityModel::Order(), MagneticModel::Degree(), MagneticModel::Order() return the maximum degree and order of all the components of a GravityModel or MagneticModel. + Gravity and MagneticField utilities accept -N and -M options to to allow the maximum degree and order to be specified. * The GeodSolve allows fractional distances to be entered as fractions (with the -F flag). * MajorRadius() methods are now called EquatorialRadius() for the C++, Java, and .NET libraries. "Equatorial" is more descriptive in the case of prolate ellipsoids. MajorRadius() is retained for backward compatibility for C++ and Java but is deprecated. * Minimum version updates: + CMake = 3.1.0, released 2014-12-15. + Minimum g++ version = 4.8.0, released 2013-03-22. + Visual Studio 10 2010 (haven't been able to check Visual Studio 2008 for a long time). + WARNING: The next version of GeographicLib will require a C++11 compliant compiler. This means that the minimum version of Visual Studio will be Visual Studio 12 2013. + Minimum boost version = 1.64 needed for GEOGRAPHICLIB_PRECISION = 4. + Java = 1.6; this allows the removal of epsilon, min, hypot, log1p, copysign, cbrt from GeoMath. * CMake updates: + Fine tune Visual Studio compatibility check in find_package(GeographicLib); this allows GeographicLib compiled with Visual Studio 14 2015 to be used with a project compiled with Visual Studio 15 2017 and 16 2019. + Suppress warnings with dotnet build. + Change CMake target names and add an interface library (thanks to Matthew Woehlke). + Remove pre-3.1.0 cruft and update the documentation to remove the need to call include_dirctories. + Add _d suffix to example and test programs. + Changer installation path for binary installer to the Windows default. + Add support for Intel compiler (for C++, C, Fortran). This entails supplying the -fp-model precise flag to prevent the compiler from incorrectly simplying (a + b) + c and 0.0 + x. * Add version 2 of the World Magnetic Model 2015, wmm2015v2. This is now the default magnetic model for MagneticField (replacing wmm2015 which is now deprecated). Coming in 2019-12: the wmm2020 model. * The -f flag in the scripts geographiclib-get-geoids, geographiclib-get-gravity, and geographiclib-get-magnetic, allows you to load new models (not yet in the set defined by "all"). This is in addition to its original role of allowing you to overwrite existing models. * Changes in math function support: + Move some of the functionality from Math.hpp to Math.cpp to make compilation of package which depend on GeographicLib less sensitive to the current compiler environment. + Add Math::remainder, Math::remquo, Math::round, and Math::lround. Also add implementations of remainder, remquo to C implementation. + Math::cbrt, Math::atanh, and Math::asinh now preserve the sign of -0. (Also: C, Java, JavaScript, Python, MATLAB. Not necessary: Fortran because sign is a built-in function.) + JavaScript: fall back to Math.hypot, Math.cbrt, Math.log1p, Math.atanh if they are available. * When parsing DMS strings ignore various non-breaking spaces (C++ and JavaScript). * Improve code coverage in the tests of geodesic algorithms (C++, C, Java, JavaScript, Python, MATLAB, Fortran). * Old deprecated NormalGravity::NormalGravity constructor removed. * Additions to the documentation: + add documentation links to ge{distance,reckon}.m; + clarify which solution is returned for Geocentric::Reverse. Changes between 1.49 (released 2017-10-05) and 1.48 versions: * Add the Enhanced Magnetic Model 2017, emm2017. This is valid for 2000 thru the end of 2021. * Avoid potential problems with the order of initializations in DMS, GARS, Geohash, Georef, MGRS, OSGB, SphericalEngine; this only would have been an issue if GeographicLib objects were instantiated globally. Now no GeographicLib initialization code should be run prior to the entry of main(). * To support the previous fix, add an overload, Utility::lookup(const char* s, char c). * NearestNeighbor::Search throws an error if pts is the wrong size (instead of merely returning no results). * Use complex arithmetic for Clenshaw sums in TransverseMercator and tranmerc_{fwd,inv}.m. * Changes in cmake support: + fix compiler flags for GEOGRAPHICLIB_PRECISION = 4; + add CONVERT_WARNINGS_TO_ERRORS option (default OFF), if ON then compiler warnings are treated as errors. * Fix warnings about implicit conversions of doubles to bools in C++, C, and JavaScript packages. * Binary installers for Windows now use Visual Studio 14 2015. Changes between 1.48 (released 2017-04-09) and 1.47 versions: * The "official" URL for GeographicLib is now https://geographiclib.sourceforge.io (instead of http://geographiclib.sourceforge.net). * The default range for longitude and azimuth is now (-180d, 180d], instead of [-180d, 180d). This was already the case for the C++ library; now the change has been made to the other implementations (C, Fortran, Java, JavaScript, Python, MATLAB, and Maxima). * Changes to NearestNeighbor: + fix BUG in reading a NearestNeighbor object from a stream which sometimes incorrectly caused a "Bad index" exception to be thrown; + add operator<<, operator>>, swap, std::swap(NearestNeighbor&, NearestNeighbor&); * Additions to the documentation: + add documentation on finding nearest neighbors; + normal gravity documentation is now on its own page and now has an illustrative figure; + document the truncation error in the series for auxiliary latitudes. * Fix BUGS in MATLAB function geodreckon with mixed scalar and array arguments. * Workaround bug in math.fmod for Python 2.7 on 32-bit Windows machines. * Changes in cmake support: + add USE_BOOST_FOR_EXAMPLES option (default OFF), if ON search for Boost libraries for building examples; + add APPLE_MULTIPLE_ARCHITECTURES option (default OFF), if ON build for both i386 and x86_64 on Mac OS X systems; + don't add flag for C++11 for g++ 6.0 (since it's not needed). * Fix compiler warnings with Visual Studio 2017 and for the C library. Changes between 1.47 (released 2017-02-15) and 1.46 versions: * Add NearestNeighbor class. * Improve accuracy of area calculation (fixing a flaw introduced in version 1.46); fix applied in Geodesic, GeodesicExact, and the implementations in C, Fortran, Java, JavaScript, Python, MATLAB, and Maxima. * Generalize NormalGravity to allow oblate and prolate ellipsoids. As a consequence a new form of constructor has been introduced and the old form is now deprecated (and because the signatures of the two constructors are similar, the compiler will warn about the use of the old one). * Changes in Math class: + Math::sincosd, Math::sind, Math::cosd only return -0 for the case sin(-0); + Math::atan2d and Math::AngNormalize return results in (-180deg, 180deg]; this may affect the longitudes and azimuth returned by several other functions. * Add Utility::trim() and Utility::val(); Utility::num() is now DEPRECATED. * Changes in cmake support: + remove support of PACKAGE_PATH and INSTALL_PATH in cmake configuration; + fix to FindGeographicLib.cmake to make it work on Debian systems; + use $ (cmake version >= 3.1); + use NAMESPACE for exported targets; + geographiclib-config.cmake exports GEOGRAPHICLIB_DATA, GEOGRAPHICLIB_PRECISION, and GeographicLib_HIGHPREC_LIBRARIES. * Add pkg-config support for cmake and autoconf builds. * Minor fixes: + fix the order of declarations in C library, incorporating the patches in version 1.46.1; + fix the packaging of the python library, incorporating the patches in version 1.46.3; + restrict junit dependency in the Java package to testing scope (thanks to Mick Killianey); + various behind-the-scenes fixes to EllipticFunction; + fix documentation and default install location for Windows binary installers; + fix clang compiler warnings in GeodesicExactC4 and TransverseMercator. Changes between 1.46 (released 2016-02-15) and 1.45 versions: * The following BUGS have been fixed: + the -w flag to Planimeter(1) was being ignored; + in the Java package, the wrong longitude was being returned with direct geodesic calculation with a negative distance when starting point was at a pole (this bug was introduced in version 1.44); + in the JavaScript package, PolygonArea.TestEdge contained a misspelling of a variable name and other typos (problem found by threepointone). * INCOMPATIBLE CHANGES: + make the -w flag (to swap the default order of latitude and longitude) a toggle for all utility programs; + the -a option to GeodSolve(1) now toggles (instead of sets) arc mode; + swap order coslon and sinlon arguments in CircularEngine class. * Remove deprecated functionality: + remove gradient calculation from the Geoid class and GeoidEval(1) (this was inaccurate and of dubious utility); + remove reciprocal flattening functions, InverseFlattening in many classes and Constants::WGS84_r(); stop treating flattening > 1 as the reciprocal flattening in constructors; + remove DMS::Decode(string), DMS::DecodeFraction, EllipticFunction:m, EllipticFunction:m1, Math::extradigits, Math::AngNormalize2, PolygonArea::TestCompute; + stop treating LONG_NOWRAP as an alias for LONG_UNROLL in Geodesic (and related classes) and Rhumb; + stop treating full/schmidt as aliases for FULL/SCHMIDT in SphericalEngine (and related classes); + remove qmake project file src/GeographicLib.pro because QtCreator can handle cmake projects now; + remove deprecated Visual Studio 2005 project and solution files. * Changes to GeodesicLine and GeodesicLineExact classes; these changes (1) simplify the process of computing waypoints on a geodesic given two endpoints and (2) allow a GeodesicLine to be defined which is consistent with the solution of the inverse problem (in particular Geodesic::InverseLine the specification of south-going lines which pass the poles in a westerly direction by setting sin alpha_1 = -0): + the class stores the distance s13 and arc length a13 to a reference point 3; by default these quantities are NaNs; + GeodesicLine::SetDistance (and GeodesicLine::SetArc) specify the distance (and arc length) to point 3; + GeodesicLine::Distance (and GeodesicLine::Arc) return the distance (and arc length) to point 3; + new methods Geodesic::InverseLine and Geodesic::DirectLine return a GeodesicLine with the reference point 3 defined as point 2 of the corresponding geodesic calculation; + these changes are also included in the C, Java, JavaScript, and Python packages. * Other changes to the geodesic routines: + more accurate solution of the inverse problem when longitude difference is close to 180deg (also in C, Fortran, Java, JavaScript, Python, MATLAB, and Maxima packages); + more accurate calculation of lon2 in the inverse calculation with LONG_UNROLL (also in Java, JavaScript, Python packages). * Changes to GeodSolve(1) utility: + the -I and -D options now specify geodesic line calculation via the standard inverse or direct geodesic problems; + rename -l flag to -L to parallel the new -I and -D flags (-l is is retained for backward compatibility but is deprecated), and similarly for RhumbSolve(1); + the -F flag (in conjunction with the -I or -D flags) specifies that distances read on standard input are fractions of s13 or a13; + the -a option now toggles arc mode (noted above); + the -w option now toggles longitude first mode (noted above). * Changes to Math class: + Math::copysign added; + add overloaded version of Math::AngDiff which returns the error in the difference. This allows a more accurate treatment of inverse geodesic problem when lon12 is close to 180deg; + Math::AngRound now converts tiny negative numbers to -0 (instead of +0), however -0 is still converted to +0. * Add -S and -T options to GeoConvert(1). * Add Sphinx documentation for Python package. * Samples of wrapping the C++ library, so it's accessible in other languages, are given in wrapper/C, wrapper/python, and wrapper/matlab. * Binary installers for Windows now use Visual Studio 12 2013. * Remove top-level pom.xml from release (it was specific to SRI). * A reminder: because of the JavaScript changes introduced in version 1.45, you should remove the following installation directories from your system: + Windows: ${CMAKE_INSTALL_PREFIX}/doc/scripts + Others: ${CMAKE_INSTALL_PREFIX}/share/doc/GeographicLib/scripts Changes between 1.45 (released 2015-09-30) and 1.44 versions: * Fix BUG in solution of inverse geodesic caused by misbehavior of some versions of Visual Studio on Windows (fmod(-0.0, 360.0) returns +0.0 instead of -0.0) and Octave (sind(-0.0) returns +0.0 instead of -0.0). These bugs were exposed because max(-0.0, +0.0) returns -0.0 for some languages. * Geodesic::Inverse now correctly returns NaNs if one of the latitudes is a NaN. * Changes to JavaScript package: + thanks to help from Yurij Mikhalevich, it is a now a node package that can be installed with npm; + make install now installs the node package in lib/node_modules/geographiclib; + add unit tests using mocha; + add documentation via JSDoc; + fix bug Geodesic.GenInverse (this bug, introduced in version 1.44, resulted in the wrong azimuth being reported for points at the pole). * Changes to Java package: + add implementation of ellipsoidal Gnomonic projection (courtesy of Sebastian Mattheis); + add unit tests using JUnit; + Math.toRadians and Math.toDegrees are used instead of GeoMath.degree (which is now removed), as a result... + Java version 1.2 (released 1998-12) or later is now required. * Changes to Python package: + add unit tests using the unittest framework; + fixed bug in normalization of the area. * Changes to MATLAB package: + fix array size mismatch in geoddistance by avoiding calls to subfunctions with zero-length arrays; + fix tranmerc_{fwd,inv} so that they work with arrays and mixed array/scalar arguments; + work around Octave problem which causes mgrs_fwd to return garbage with prec = 10 or 11; + add geographiclib_test.m to run a test suite. * Behavior of substituting 1/f for f if f > 1 is now deprecated. This behavior has been removed from the JavaScript, C, and Python implementations (it was never documented). Maxima, MATLAB, and Fortran implementations never included this behavior. * Other changes: + fix bug, introduced in version 1.42, in the C++ implementation to the computation of area which causes NaNs to be returned in the case of a sphere; + fixed bug, introduced in version 1.44, in the detection of C++11 math functions in configure.ac; + throw error on non-convergence in Gnomonic::Reverse if GEOGRAPHICLIB_PRECISION > 3; + add geod_polygon_clear to C library; + turn illegal latitudes into NaNs for Fortran library; + add test suites for the C and Fortran libraries. Changes between 1.44 (released 2015-08-14) and 1.43 versions: * Various changes to improve accuracy, e.g., by minimizing round-off errors: + Add Math::sincosd, Math::sind, Math::cosd which take their arguments in degrees. These functions do exact range reduction and thus they obey exactly the elementary properties of the trigonometric functions, e.g., sin 9d = cos 81d = - sin 123456789d. + Math::AngNormalize now works for any angles, instead of angles in the range [-540d, 540d); the function Math::AngNormalize2 is now deprecated. + This means that there is now no restriction on longitudes and azimuths; any values can be used. + Improve the accuracy of Math::atan2d. + DMS::Decode avoids unnecessary round-off errors; thus 7:33:36 and 7.56 result in identical values. DMS::Encode rounds ties to even. These changes have also been made to DMS.js. + More accurate rounding in MGRS::Reverse and mgrs_inv.m; this change only makes a difference at sub-meter precisions. + With MGRS::Forward and mgrs_fwd.m, ensure that digits in lower precision results match those at higher precision; as a result, strings of trailing 9s are less likely to be generated. This change only makes a difference at sub-meter precisions. + Replace the series for A2 in the Geodesic class with one with smaller truncation errors. + Geodesic::Inverse sets s12 to zero for coincident points at pole (instead of returning a tiny quantity). + Math::LatFix returns its argument if it is in [-90d, 90d]; if not, it returns NaN. + Using Math::LatFix, routines which don't check their arguments now interpret a latitude outside the legal range of [-90d, 90d] as a NaN; such routines will return NaNs instead of finite but incorrect results; caution: code that (dangerously) relied on the "reasonable" results being returned for values of the latitude outside the allowed range will now malfunction. * All the utility programs accept the -w option to swap the latitude-longitude order on input and output (and where appropriate on the command-line arguments). CartConvert now accepts the -p option to set the precision; now all of the utilities except GeoidEval accept -p. * Add classes for GARS, the Global Area Reference System, and for Georef, the World Geographic Reference System. * Changes to DMS::Decode and DMS.js: + tighten up the rules: o 30:70.0 and 30:60 are illegal (minutes and second must be strictly less than 60), however o 30:60.0 and 30:60. are legal (floating point 60 is OK, since it might have been generated by rounding 59.99...); + generalize a+b concept, introduced in version 1.42, to any number of pieces; thus 8+0:40-0:0:10 is interpreted as 8:39:50. * Documentation fixes: + update man pages to refer to GeoConvert(1) on handling of geographic coordinates; + document limitations of the series used for TransverseMercator; + hide the documentation of the computation of the gradient of the geoid height (now deprecated) in the Geoid class; + warn about the possible misinterpretation of 7.0E+1 by DMS::Decode; + swaplatlong optional argument of DMS::DecodeLatLon and various functions in the GeoCoords class is now called longfirst; + require Doxygen 1.8.7 or later. * More systematic treatment of version numbers: + Python: __init__.py defines __version__ and __version_info__; + JavaScript: o Math.js defines Constants.version and Constants.version_string; o version number included as comment in packed script geographiclib.js; o geod-calc.html and geod-google.html report the version number; o https://geographiclib.sourceforge.io/scripts/ gives access to earlier versions of geographiclib.js as geographiclib-m.nn.js; + Fortran: add geover subroutine to return version numbers; + Maxima: geodesic.mac defines geod_version; + CGI scripts: these report the version numbers of the utilities. * BUG FIXES: + NormalGravity now works properly for a sphere (omega = f = J2 = 0), instead of returning NaNs (problem found by htallon); + CassiniSoldner::Forward and cassini_fwd.m now returns the correct azimuth for points at the pole. * MATLAB-specific fixes: + mgrs_fwd now treats treats prec > 11 as prec = 11; + illegal letter combinations are now correctly detected by mgrs_inv; + fixed bug where mgrs_inv returned the wrong results for prec = 0 strings and center = 0; + mgrs_inv now decodes prec = 11 strings properly; + routines now return array results with the right shape; + routines now properly handle mixed scalar and array arguments. * Add Accumulator::operator*=(T y). * Geohash uses "invalid" instead of "nan" when the latitude or longitude is a nan. Changes between 1.43 (released 2015-05-23) and 1.42 versions: * Add the Enhanced Magnetic Model 2015, emm2015. This is valid for 2000 thru the end of 2019. This required some changes in the MagneticModel and MagneticCircle classes; so this model cannot be used with versions of GeographicLib prior to 1.43. * Fix BLUNDER in PolarStereographic constructor introduced in version 1.42. This affected UTMUPS conversions for UPS which could be incorrect by up to 0.5 km. * Changes in the LONG_NOWRAP option (added in version 1.39) in the Geodesic and GeodesicLine classes: + The option is now called LONG_UNROLL (a less negative sounding term); the original name, LONG_NOWRAP, is retained for backwards compatibility. + There were two bad BUGS in the implementation of this capability: (a) it gave incorrect results for west-going geodesics; (b) the option was ignored if used directly via the GeodesicLine class. The first bug affected the implementations in all languages. The second affected the implementation in C++ (GeodesicLine and GeodesicLineExact), JavaScript, Java, C, Python. These bugs have now been FIXED. + The GeodSolve utility now accepts a -u option, which turns on the LONG_UNROLL treatment. With this option lon1 is reported as entered and lon2 is given such that lon2 - lon1 indicates how often and in what sense the geodesic has encircled the earth. (This option also affects the value of longitude reported when an inverse calculation is run with the -f option.) + The inverse calculation with the JavaScript and python libraries similarly sets lon1 and lon2 in output dictionary respecting the LONG_UNROLL flag. + The online version of GeodSolve now offers an option to unroll the longitude. + To support these changes DMS::DecodeLatLon no longer reduces the longitude to the range [-180deg, 180deg) and Math::AngRound now coverts -0 to +0. * Add Math::polyval (also to C, Java, JavaScript, Fortran, python versions of the library; this is a built-in function for MATLAB/Octave). This evaluates a polynomial using Horner's method. The Maxima-generated code fragments for the evaluation of series in the Geodesic, TransverseMercator, and Rhumb classes and MATLAB routines for great ellipses have been replaced by Maxima-generated arrays of polynomial coefficients which are used as input to Math::polyval. * Add MGRS::Check() to verify that a, f, k_UTM, and k_UPS are consistent with the assumptions in the UTMUPS and MGRS classes. This is invoked with GeoConvert --version. (This function was added to document and check the assumptions used in the UTMUPS and MGRS classes in case they are extended to deal with ellipsoids other than WS84.) * MATLAB function mgrs_inv now takes an optional center argument and strips white space from both beginning and end of the string. * Minor internal changes: + GeodSolve sets the geodesic mask so that unnecessary calculations are avoided; + some routines have migrated into a math class for for python, Java, JavaScript libraries. * A reminder: because of changes in the installation directories for non-Windows systems introduced in version 1.42, you should remove the following directories from your system: + ${CMAKE_INSTALL_PREFIX}/share/cmake/GeographicLib* + ${CMAKE_INSTALL_PREFIX}/libexec/GeographicLib/matlab Changes between 1.42 (released 2015-04-28) and 1.41 versions: * DMS::Decode allows a single addition or subtraction operation, e.g., 70W+0:0:15. This affects the GeoCoords class and the utilities (which use the DMS class for reading coordinates). * Add Math::norm, Math::AngRound, Math::tand, Math::atan2d, Math::eatanhe, Math::taupf, Math::tauf, Math::fma and remove duplicated (but private) functionality from other classes. * On non-Windows systems, the cmake config-style find_package files are now installed under ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} instead of ${CMAKE_INSTALL_PREFIX}/share, because the files are architecture-specific. This change will let 32-bit and 64-bit versions coexist on the same machine (in lib and lib64). You should remove the versions in the old "share" location. * MATLAB changes: + provide native MATLAB implementations for compiled interface functions; + the compiled MATLAB interface is now deprecated and so the MATLAB_COMPILER option in the cmake build has been removed; + reorganize directories, so that o matlab/geographiclib contains the native matlab code; o matlab/geographiclib-legacy contains wrapper functions to mimic the previous compiled functionality; + the installed MATLAB code mirrors this layout, but the parent installation directory on non-Windows systems is ${CMAKE_INSTALL_PREFIX}/share (instead of ${CMAKE_INSTALL_PREFIX}/libexec), because the files are now architecture independent; + matlab/geographiclib is now packaged and distributed as MATLAB File Exchange package 50605 (this supersedes three earlier MATLAB packages); + point fix for geodarea.m to correct bug in area of polygons which encircle a pole multiple times (released as version 1.41.1 of MATLAB File Exchange package 39108, 2014-04-22). * artifactId for Java package changed from GeographicLib to GeographicLib-Java and the package is now deployed to Maven Central (thanks to Chris Bennight for help on this). * Fix autoconf mismatch of version numbers (which were inconsistent in versions 1.40 and 1.41). * Mark the computation of the gradient of the geoid height in the Geoid class and the GeoidEval utility as deprecated. * Work around the boost-quadmath bug with setprecision(0). * Deprecate use of Visual Studio 2005 "-vc8" project files in the windows directory. Changes between 1.41 (released 2015-03-09) and 1.40 versions: * Fix bug in Rhumb::Inverse (with exact = true) and related functions which causes the wrong distance to be reported if one of the end points is at a pole. Thanks to Thomas Murray for reporting this. * Add International Geomagnetic Reference Field (12th generation), which approximates the main magnetic field of the earth for the period 1900-2020. * Split information about Jacobi's conformal projection to a separate section and include more material. Changes between 1.40 (released 2014-12-18) and 1.39 versions: * Add the World Magnetic Model 2015, wmm2015. This is now the default magnetic model for MagneticField (replacing wmm2010 which is valid thru the end of 2014). * Geodesic::Inverse didn't return NaN if one of the longitudes was a NaN (bug introduced in version 1.25). Fixed in the C++, Java, JavaScript, C, Fortran, and Python implementations of the geodesic routines. This bug was not present in the Matlab version. * Fix bug in Utility::readarray and Utility::writearray which caused an exception in debug mode with zero-sized arrays. * Fix BLUNDER in OSGB::GridReference (found by kalderami) where the wrong result was returned if the easting or northing was negative. * OSGB::GridReference now returns "INVALID" if either coordinate is NaN. Similarly a grid reference starting with "IN" results in NaNs for the coordinates. * Default constructor for GeoCoords corresponds to an undefined position (latitude and longitude = NaN), instead of the north pole. * Add an online version of RhumbSolve at https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve. * Additions to the documentation: + documentation on Jacobi's conformal projection; + a page on Auxiliary latitudes (actually, this was added in version 1.39); + document the use of two single quotes to stand for a double quote in DMS (this feature was introduced in version 1.13). * The Matlab function, geographiclibinterface, which compiles the wrapper routines for Matlab now works with Matlab 2014b on a Mac. Changes between 1.39 (released 2014-11-11) and 1.38 versions: * GeographicLib usually normalizes longitudes to the range [-180deg, 180deg). However, when solving the direct geodesic and rhumb line problems, it is sometimes necessary to know how many lines the line encircled the earth by returning the longitude "unwrapped". So the following changes have been made: + add a LONG_NOWRAP flag to mask enums for the outmask arguments for Geodesic, GeodesicLine, Rhumb, and RhumbLine; + similar changes have been made to the Python, Javascript, and Java implementations of the geodesic routines; + for the C, Fortran, and Matlab implementations the arcmode argument to the routines was generalized to allow a combination of ARCMODE and LONG_NOWRAP bits; + the Maxima version now returns the longitude unwrapped. These changes were necessary to fix the PolygonAreaT::AddEdge (see the next item). * Changes in area calculations: + fix BUG in PolygonAreaT::AddEdge (also in C, Java, Javascript, and Python implementations) which sometimes causes the wrong area to be returned if the edge spanned more than 180deg; + add area calculation to the Rhumb and RhumbLine classes and the RhumbSolve utility; + add PolygonAreaRhumb typedef for PolygonAreaT; + add -R option to Planimeter to use PolygonAreaRhumb (and -G option for the default geodesic polygon); + fix BLUNDER in area calculation in Matlab routine geodreckon; + add area calculation to Matlab/Octave routines for great ellipses. * Fix bad BUG in Geohash::Reverse; this was introduced in version 1.37 and affected all platforms where unsigned longs are 32-bits. Thanks to Christian Csar for reporting and diagnosing this. * Binary installers for Windows are now built with Visual Studio 11 2012 (instead of Visual Studio 10 2010). Compiled Matlab support still with version 2013a (64-bit). * Update GeographicLib.pro for builds with qmake to include all the source files. * Cmake updates: + include cross-compiling checks in cmake config file; + improve the way unsuitable versions are reported; + include_directories (${GeographicLib_INCLUDE_DIRS}) is no longer necessary with cmake 2.8.11 or later. * legacy/Fortran now includes drop-in replacements for the geodesic utilities from the NGS. * geographiclib-get-{geoids,gravity,magnetic} with no arguments now print the usage instead of loading the minimal sets. * Utility::date(const std::string&, int&, int&, int&) and hence the MagneticField utility accepts the string "now" as a legal time (meaning today). Changes between 1.38 (released 2014-10-02) and 1.37 versions: * On MacOSX, the installed package is relocatable (for cmake version 2.8.12 and later). * On Mac OSX, GeographicLib can be installed using homebrew. * In cmake builds under Windows, set the output directories so that binaries and shared libraries are together. * Accept the minus sign as a synonym for - in DMS.{cpp,js}. * The cmake configuration file geographiclib-depends.cmake has been renamed to geographiclib-targets.cmake. * Matlab/Octave routines for great ellipses added. * Provide man pages for geographiclib-get-{geoids,gravity,magnetic}. Changes between 1.37 (released 2014-08-08) and 1.36 versions: * Add support for high precision arithmetic. * INCOMPATIBLE CHANGE: the static instantiations of various classes for the WGS84 ellipsoid have been changed to a "construct on first use idiom". This avoids a lot of wasteful initialization before the user's code starts. Unfortunately it means that existing source code that relies on any of the following static variables will need to be changed to a function call: + AlbersEqualArea::AzimuthalEqualAreaNorth + AlbersEqualArea::AzimuthalEqualAreaSouth + AlbersEqualArea::CylindricalEqualArea + Ellipsoid::WGS84 + Geocentric::WGS84 + Geodesic::WGS84 + GeodesicExact::WGS84 + LambertConformalConic::Mercator + NormalGravity::GRS80 + NormalGravity::WGS84 + PolarStereographic::UPS + TransverseMercator::UTM + TransverseMercatorExact::UTM Thus, occurrences of, for example, const Geodesic& geod = Geodesic::WGS84; // version 1.36 and earlier need to be changed to const Geodesic& geod = Geodesic::WGS84(); // version 1.37 and later (note the parentheses!); alternatively use // works with all versions const Geodesic geod(Constants::WGS84_a(), Constants::WGS84_a()); * Incompatible change: the environment variables {GEOID,GRAVITY,MAGNETIC}_{NAME,PATH} are now prefixed with GEOGRAPHICLIB_. * Incompatible change for Windows XP: retire the Windows XP common data path. If you're still using Windows XP, then you might have to move the folder C:\Documents and Settings\All Users\Application Data\GeographicLib to C:\ProgramData\GeographicLib. * All macro names affecting the compilation now start with GEOGRAPHICLIB_; this applies to GEOID_DEFAULT_NAME, GRAVITY_DEFAULT_NAME, MAGNETIC_DEFAULT_NAME, PGM_PIXEL_WIDTH, HAVE_LONG_DOUBLE, STATIC_ASSERT, WORDS_BIGENDIAN. * Changes to PolygonArea: + introduce PolygonAreaT which takes a geodesic class as a parameter; + PolygonArea and PolygonAreaExact are typedef'ed to PolygonAreaT and PolygonAreaT; + add -E option to Planimeter to use PolygonAreaExact; + add -Q option to Planimeter to calculate the area on the authalic sphere. * Add -p option to Planimeter, ConicProj, GeodesicProj, TransverseMercatorProj. * Add Rhumb and RhumbLine classes and the RhumbSolve utility. * Minor changes to NormalGravity: + add J2ToFlattening and FlatteningToJ2; + use Newton's method to determine f from J2; + in constructor, allow omega = 0 (i.e., treat the spherical case). * Add grs80 GravityModel. * Make geographiclib-get-{geoids,gravity,magnetic} scripts work on MacOS. * Minor changes: + simplify cross-platform support for C++11 mathematical functions; + change way area coefficients are given in GeodesicExact to improve compile times; + enable searching the online documentation; + add macros GEOGRAPHICLIB_VERSION and GEOGRAPHICLIB_VERSION_NUM; + add solution and project files for Visual Studio Express 2010. Changes between 1.36 (released 2014-05-13) and 1.35 versions: * Changes to comply with NGA's prohibition of the use of the upper-case letters N/S to designate the hemisphere when displaying UTM/UPS coordinates: + UTMUPS::DecodeZone allows north/south as hemisphere designators (in addition to n/s); + UTMUPS::EncodeZone now encodes the hemisphere in lower case (to distinguish this use from a grid zone designator); + UTMUPS::EncodeZone takes an optional parameter abbrev to indicate whether to use n/s or north/south as the hemisphere designator; + GeoCoords::UTMUPSRepresentation and AltUTMUPSRepresentation similarly accept the abbrev parameter; + GeoConvert uses the flags -a and -l to govern whether UTM/UPS output uses n/s (the -a flag) or north/south (the -l flag) to denote the hemisphere; + Fixed a bug what allowed +3N to be accepted as an alternation UTM zone designation (instead of 3N). WARNING: The use of lower case n/s for the hemisphere might cause compatibility problems. However DecodeZone has always accepted either case; so the issue will only arise with other software reading the zone information. To avoid possible misinterpretation of the zone designator, consider calling EncodeZone with abbrev = false and GeoConvert with -l, so that north/south are used to denote the hemisphere. * MGRS::Forward with prec = -1 will produce a grid zone designation. Similarly MGRS::Reverse will decode a grid zone designation (and return prec = -1). * Stop using the throw() declaration specification which is deprecated in C++11. * Add missing std:: qualifications to copy in LocalCartesion and Geocentric headers (bug found by Clemens). Changes between 1.35 (released 2014-03-13) and 1.34 versions: * Fix blunder in UTMUPS::EncodeEPSG (found by Ben Adler). * Matlab wrapper routines geodesic{direct,inverse,line} switch to "exact" routes if |f| > 0.02. * GeodSolve.cgi allows ellipsoid to be set (and uses the -E option for GeodSolve). * Set title in HTML versions of man pages for the utility programs. * Changes in cmake support: + add _d to names of executables in debug mode of Visual Studio; + add support for Android (cmake-only), thanks to Pullan Yu; + check CPACK version numbers supplied on command line; + configured version of project-config.cmake.in is project-config.cmake (instead of geographiclib-config.cmake), to prevent find_package incorrectly using this file; + fix tests with multi-line output; + this release includes a file, pom.xml, which is used by an experimental build system (based on maven) at SRI. Changes between 1.34 (released 2013-12-11) and 1.33 versions: * Many changes in cmake support: + minimum version of cmake needed increased to 2.8.4 (which was released in 2011-02); + allow building both shared and static librarys with -D GEOGRAPHICLIB_LIB_TYPE=BOTH; + both shared and static libraries (Release plus Debug) included in binary installer; + find_package uses COMPONENTS and GeographicLib_USE_STATIC_LIBS to select the library to use; + find_package version checking allows nmake and Visual Studio generators to interoperate on Windows; + find_package (GeographicLib ...) requires that GeographicLib be capitalized correctly; + on Unix/Linux, don't include the version number in directory for the cmake configuration files; + defaults for GEOGRAPHICLIB_DOCUMENTATION and BUILD_NETGEOGRAPHICLIB are now OFF; + the GEOGRAPHICLIB_EXAMPLES configuration parameter is no longer used; cmake always configures to build the examples, but they are not built by default (instead build targets: exampleprograms and netexamples); + matlab-all target renamed to matlabinterface; + the configuration parameters PACKAGE_PATH and INSTALL_PATH are now deprecated (use CMAKE_INSTALL_PREFIX instead); + on Linux, the installed package is relocatable; + on MacOSX, the installed utilities can find the shared library. * Use a more precise value for OSGB::CentralScale(). * Add Arc routines to python interface. * The Geod utility has been removed; the same functionality lives on with GeodSolve (introduced in version 1.30). Changes between 1.33 (released 2013-10-08) and 1.32 versions: * Add NETGeographic .NET wrapper library (courtesy of Scott Heiman). * Make inspector functions in GeographicLib::Ellipsoid const. * Add Accumulator.cpp to instantiate GeographicLib::Accumulator. * Defer some of the initialization of GeographicLib::OSGB to when it is first called. * Fix bug in autoconf builds under MacOS. Changes between 1.32 (released 2013-07-12) and 1.31 versions: * Generalize C interface for polygon areas to allow vertices to be specified incrementally. * Fix way flags for C++11 support are determined. Changes between 1.31 (released 2013-07-01) and 1.30 versions: * Changes breaking binary compatibility (source compatibility is maintained): + overloaded versions of DMS::Encode, EllipticFunction::EllipticFunction, and GeoCoords::DMSRepresentation, have been eliminated by the use of optional arguments; + correct the declaration of first arg to UTMUPS::DecodeEPSG. * FIX BUG in GeographicLib::GravityCircle constructor (found by Mathieu Peyréga) which caused bogus results for the gravity disturbance and gravity anomaly vectors. (This only affected calculations using GravityCircle. GravityModel calculations did not suffer from this bug.) * Improvements to the build: + add macros GEOGRAPHICLIB_VERSION_{MAJOR,MINOR,PATCH} to Config.h; + fix documentation for new version of perlpod; + improving setting of runtime path for Unix-like systems with cmake; + install PDB files when compiling with Visual Studio to aid debugging; + Windows binary release now uses Matlab R2013a (64-bit) and uses the -largeArrayDims option. * Changes to the geodesic routines: + add Java implementation of the geodesic routines (thanks to Skip Breidbach for the maven support); + FIX BUG: avoid altering input args in Fortran implementation; + more systematic treatment of very short geodesic; + fixes to python port so that they work with version 3.x, in addition to 2.x (courtesy of Amato); + accumulate the perimeter and area of polygons via a double-wide accumulator in Fortran, C, and Matlab implementations (this is already included in the other implementations); + port PolygonArea::AddEdge and PolygonArea::TestEdge to JavaScript and python interfaces; + include documentation on short geodesics. * Unix scripts for downloading datasets, geographiclib-get-{geoids,gravity,magnetic}, skip already download models by default, unless the -f flag is given. * FIX BUGS: meridian convergence and scale returned by TransverseMercatorExact was wrong at a pole. * Improve efficiency of MGRS::Forward by avoiding the calculation of the latitude if possible (adapting an idea of Craig Rollins). * Fixes to the way the Matlab interface routines are built (thanks to Phil Miller and Chris F.). Changes between 1.30 (released 2013-02-27) and 1.29 versions: * Changes to geodesic routines: + fix BUG in fail-safe mechanisms in Geodesic::Inverse; + the command line utility Geod is now called GeodSolve; + allow addition of polygon edges in PolygonArea; + add full Maxima implementation of geodesic algorithms. Changes between 1.29 (released 2013-01-16) and 1.28 versions: * Changes to allow compilation with libc++ (courtesy of Kal Conley). * Add description of geodesics on triaxial ellipsoid to documentation. * Update journal reference for "Algorithms for geodesics". Changes between 1.28 (released 2012-12-11) and 1.27 versions: * Changes to geodesic routines: + compute longitude difference exactly; + hence fix BUG in area calculations for polygons with vertices very close to the prime meridian; + fix BUG is geoddistance.m where the value of m12 was wrong for meridional geodesics; + add Matlab implementations of the geodesic projections; + remove unneeded special code for geodesics which start at a pole; + include polygon area routine in C and Fortran implementations; + add doxygen documentation for C and Fortran libraries. Changes between 1.27 (released 2012-11-29) and 1.26 versions: * Changes to geodesic routines: + add native Matlab implementations: geoddistance.m, geodreckon.m, geodarea.m; + add C and Fortran implementations; + improve the solution of the direct problem so that the series solution is accurate to round off for |f| < 1/50; + tighten up the convergence criteria for solution of the inverse problem; + no longer signal failures of convergence with NaNs (a slightly less accurate answer is returned instead). * Fix DMS::Decode double rounding BUG. * On MacOSX platforms with the cmake configuration, universal binaries are built. Changes between 1.26 (released 2012-10-22) and 1.25 versions: * Replace the series used for geodesic areas by one with better convergence (this only makes an appreciable difference if |f| > 1/150). Changes between 1.25 (released 2012-10-16) and 1.24 versions: * Changes to geodesic calculations: + restart Newton's method in Geodesic::Inverse when it goes awry; + back up Newton's method with the bisection method; + Geodesic::Inverse now converges for any value of f; + add GeodesicExact and GeodesicLineExact which are formulated in terms of elliptic integrals and thus yield accurate results even for very eccentric ellipsoids; + the -E option to Geod invokes these exact classes. * Add functionality to EllipticFunction: + add all the traditional elliptic integrals; + remove restrictions on argument range for incomplete elliptic integrals; + allow imaginary modulus for elliptic integrals and elliptic functions; + make interface to the symmetric elliptic integrals public. * Allow GeographicLib::Ellipsoid to be copied. * Changes to the build tools: + cmake uses folders in Visual Studio to reduce clutter; + allow precision of reals to be set in cmake; + fail gracefully in the absence of pod documentation tools; + remove support for maintainer tasks in Makefile.mk; + upgrade to automake 1.11.6 to fix the "make distcheck" security vulnerability; see http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-3386 Changes between 1.24 (released 2012-09-22) and 1.23 versions: * Allow the specification of the hemisphere in UTM coordinates in order to provide continuity across the equator: + add UTMUPS::Transfer; + add GeoCoords::UTMUPSRepresentation(bool, int) and GeoCoords::AltUTMUPSRepresentation(bool, int); + use the hemisphere letter in, e.g., GeoConvert -u -z 31N. * Add UTMUPS::DecodeEPSG and UTMUPS::EncodeEPSG. * cmake changes: + restore support for cmake 2.4.x; + explicitly check version of doxygen. * Fix building under cygwin. * Document restrictions on f in the Introduction. * Fix python interface to work with version 2.6.x. Changes between 1.23 (released 2012-07-17) and 1.22 versions: * Documentation changes: + remove html documentation from distribution and use web links if doxygen is not available; + use doxygen tags to document exceptions; + begin migrating the documentation to using Greek letters where appropriate (requires doxygen 1.8.1.2 or later). * Add Math::AngNormalize and Math::AngNormalize2; the allowed range for longitudes and azimuths widened to [-540d, 540d). * DMS::Decode understands more unicode symbols. * Geohash uses geohash code "nan" to stand for not a number. * Add Ellipsoid::NormalCurvatureRadius. * Various fixes in LambertConformalConic, TransverseMercator, PolarStereographic, and Ellipsoid to handle reverse projections of points near infinity. * Fix programming blunder in LambertConformalConic::Forward (incorrect results were returned if the tangent latitude was negative). Changes between 1.22 (released 2012-05-27) and 1.21 versions: * Add Geohash and Ellipsoid classes. * Fix bug in AlbersEqualArea of very prolate ellipsoids (b^2 > 2 a^2). * cmake changes: + optionally use PACKAGE_PATH and INSTALL_PATH to determine CMAKE_INSTALL_PREFIX; + use COMMON_INSTALL_PATH to determine layout of installation directories; + as a consequence, the installation paths for the documentation, and python and matlab interfaces are shortened for Windows; + zip source distribution now uses DOS line endings; + the tests work in debug mode for Windows; + default setting of GEOGRAPHICLIB_DATA does not depend on CMAKE_INSTALL_PREFIX; + add a cmake configuration for build tree. 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 aggressive 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 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 https://geographiclib.sourceforge.io * 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.52/README.md0000644000771000077100000000034714064202371015300 0ustar ckarneyckarneyGeographicLib ============= A C++ library for geographic projections. The web site for the package is > https://geographiclib.sourceforge.io The API for the library is documented at > https://geographiclib.sourceforge.io/html GeographicLib-1.52/cmake/CMakeLists.txt0000644000771000077100000001065214064202371017641 0ustar ckarneyckarney# config file support for find_package (GeographicLib). This needs to # deal with two environments: (1) finding the build tree and (2) # finding the install tree. geographiclib-config.cmake detects which # situation it is handing by looking at @PROJECT_ROOT_DIR@. If # this is an absolute path, it's in the build tree; otherwise, it's in the # install tree. (Note that the whole install tree can be relocated.) # Variables needed by ${PROJECT_NAME_LOWER}-config-version.cmake if (MSVC) # For checking the compatibility of MSVC_TOOLSET_VERSION; see # https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp # Assume major version number is obtained by dropping the last decimal # digit. math (EXPR MSVC_TOOLSET_MAJOR "${MSVC_TOOLSET_VERSION}/10") else () set (MSVC_TOOLSET_VERSION 0) set (MSVC_TOOLSET_MAJOR 0) endif () if (CMAKE_CROSSCOMPILING) # Ensure that all "true" (resp. "false") settings are represented by # the same string. set (CMAKE_CROSSCOMPILING_STR "ON") else () set (CMAKE_CROSSCOMPILING_STR "OFF") endif () # geographiclib-config.cmake for the build tree set (PROJECT_ROOT_DIR "${PROJECT_BINARY_DIR}") set (PROJECT_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/include" "${PROJECT_SOURCE_DIR}/include") if (PROJECT_STATIC_LIBRARIES) set (CONFIG_STATIC_LIBRARIES "${PROJECT_NAME}::${PROJECT_STATIC_LIBRARIES}") else () set (CONFIG_STATIC_LIBRARIES) endif () if (PROJECT_SHARED_LIBRARIES) set (CONFIG_SHARED_LIBRARIES "${PROJECT_NAME}::${PROJECT_SHARED_LIBRARIES}") else () set (CONFIG_SHARED_LIBRARIES) endif () configure_file (project-config.cmake.in "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake" @ONLY) configure_file (project-config-version.cmake.in "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" @ONLY) export (TARGETS ${PROJECT_ALL_LIBRARIES} ${TOOLS} FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-legacy-targets.cmake") export (TARGETS ${PROJECT_ALL_LIBRARIES} ${TOOLS} NAMESPACE ${PROJECT_NAME}:: FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-targets.cmake") # geographiclib-config.cmake for the install tree. It's installed in # ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative # path to the root from there. (Note that the whole install tree can # be relocated.) if (COMMON_INSTALL_PATH) # Install under lib${LIB_SUFFIX} so that 32-bit and 64-bit packages # can be installed on a single machine. set (INSTALL_CMAKE_DIR "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}") else () set (INSTALL_CMAKE_DIR "cmake") endif () # Find root of install tree relative to INSTALL_CMAKE_DIR file (RELATIVE_PATH PROJECT_ROOT_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}") # strip trailing slash get_filename_component (PROJECT_ROOT_DIR "${PROJECT_ROOT_DIR}/." PATH) # @PROJECT_INCLUDE_DIRS@ is not used in the install tree; reset # it to prevent the source and build paths appearing in the installed # config files set (PROJECT_INCLUDE_DIRS) configure_file (project-config.cmake.in project-config.cmake @ONLY) configure_file (project-config-version.cmake.in project-config-version.cmake @ONLY) install (FILES "${CMAKE_CURRENT_BINARY_DIR}/project-config.cmake" DESTINATION "${INSTALL_CMAKE_DIR}" RENAME "${PROJECT_NAME_LOWER}-config.cmake") install (FILES "${CMAKE_CURRENT_BINARY_DIR}/project-config-version.cmake" DESTINATION "${INSTALL_CMAKE_DIR}" RENAME "${PROJECT_NAME_LOWER}-config-version.cmake") # Make information about the cmake targets (the library and the tools) # available. install (EXPORT targets FILE ${PROJECT_NAME_LOWER}-legacy-targets.cmake DESTINATION "${INSTALL_CMAKE_DIR}") install (EXPORT targets NAMESPACE ${PROJECT_NAME}:: FILE ${PROJECT_NAME_LOWER}-targets.cmake DESTINATION "${INSTALL_CMAKE_DIR}") if (MSVC AND PACKAGE_DEBUG_LIBS) install (FILES "${PROJECT_BINARY_DIR}/cmake/CMakeFiles/Export/cmake/${PROJECT_NAME_LOWER}-targets-debug.cmake" DESTINATION "${INSTALL_CMAKE_DIR}" CONFIGURATIONS Release) endif () # Support for pkgconfig/geographiclib.pc set (prefix ${CMAKE_INSTALL_PREFIX}) set (exec_prefix "\${prefix}") set (libdir "\${exec_prefix}/lib${LIB_SUFFIX}") set (includedir "\${prefix}/include") set (bindir "\${exec_prefix}/bin") set (PACKAGE_NAME "${PROJECT_NAME}") set (PACKAGE_VERSION "${PROJECT_VERSION}") configure_file (project.pc.in geographiclib.pc @ONLY) install (FILES "${CMAKE_CURRENT_BINARY_DIR}/geographiclib.pc" DESTINATION "lib${LIB_SUFFIX}/pkgconfig") GeographicLib-1.52/cmake/FindGeographicLib.cmake0000644000771000077100000000313414064202371021400 0ustar ckarneyckarney# Look for GeographicLib # # Set # GeographicLib_FOUND = 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 (_ROOT_DIR "${GeographicLib_LIBRARY_DIRS}" PATH) set (GeographicLib_INCLUDE_DIRS "${_ROOT_DIR}/include") set (GeographicLib_BINARY_DIRS "${_ROOT_DIR}/bin") if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h") # On Debian systems the library is in e.g., # /usr/lib/x86_64-linux-gnu/libGeographic.so # so try stripping another element off _ROOT_DIR get_filename_component (_ROOT_DIR "${_ROOT_DIR}" PATH) set (GeographicLib_INCLUDE_DIRS "${_ROOT_DIR}/include") set (GeographicLib_BINARY_DIRS "${_ROOT_DIR}/bin") if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h") unset (GeographicLib_INCLUDE_DIRS) unset (GeographicLib_LIBRARIES) unset (GeographicLib_LIBRARY_DIRS) unset (GeographicLib_BINARY_DIRS) endif () endif () unset (_ROOT_DIR) 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.52/cmake/Makefile.am0000644000771000077100000000055714064202371017140 0ustar ckarneyckarney# # Makefile.am # # Copyright (C) 2011, Charles Karney cmakedir=$(datadir)/cmake/GeographicLib install: $(INSTALL) -d $(DESTDIR)$(cmakedir) $(INSTALL) -m 644 $(srcdir)/FindGeographicLib.cmake \ $(DESTDIR)$(cmakedir) EXTRA_DIST = Makefile.mk CMakeLists.txt FindGeographicLib.cmake \ project-config-version.cmake.in project-config.cmake.in GeographicLib-1.52/cmake/Makefile.mk0000644000771000077100000000032014064202371017136 0ustar ckarneyckarneyDEST = $(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.52/cmake/project-config-version.cmake.in0000644000771000077100000000730414064202371023104 0ustar ckarneyckarney# Version checking for @PROJECT_NAME@ set (PACKAGE_VERSION "@PROJECT_VERSION@") set (PACKAGE_VERSION_MAJOR "@PROJECT_VERSION_MAJOR@") set (PACKAGE_VERSION_MINOR "@PROJECT_VERSION_MINOR@") set (PACKAGE_VERSION_PATCH "@PROJECT_VERSION_PATCH@") # These variable definitions parallel those in @PROJECT_NAME@'s # cmake/CMakeLists.txt. if (MSVC) # For checking the compatibility of MSVC_TOOLSET_VERSION; see # https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp # Assume major version number is obtained by dropping the last decimal # digit. math (EXPR MSVC_TOOLSET_MAJOR "${MSVC_TOOLSET_VERSION}/10") endif () if (CMAKE_CROSSCOMPILING) # Ensure that all "true" (resp. "false") settings are represented by # the same string. set (CMAKE_CROSSCOMPILING_STR "ON") else () set (CMAKE_CROSSCOMPILING_STR "OFF") endif () if (NOT PACKAGE_FIND_NAME STREQUAL "@PROJECT_NAME@") # Check package name (in particular, because of the way cmake finds # package config files, the capitalization could easily be "wrong"). # This is necessary to ensure that the automatically generated # variables, e.g., _FOUND, are consistently spelled. set (REASON "package = @PROJECT_NAME@, NOT ${PACKAGE_FIND_NAME}") set (PACKAGE_VERSION_UNSUITABLE TRUE) elseif (NOT (APPLE OR (NOT DEFINED CMAKE_SIZEOF_VOID_P) OR CMAKE_SIZEOF_VOID_P EQUAL @CMAKE_SIZEOF_VOID_P@)) # Reject if there's a 32-bit/64-bit mismatch (not necessary with Apple # since a multi-architecture library is built for that platform). set (REASON "sizeof(*void) = @CMAKE_SIZEOF_VOID_P@") set (PACKAGE_VERSION_UNSUITABLE TRUE) elseif (MSVC AND NOT ( # toolset version must be at least as great as @PROJECT_NAME@'s MSVC_TOOLSET_VERSION GREATER_EQUAL @MSVC_TOOLSET_VERSION@ # and major versions must match AND MSVC_TOOLSET_MAJOR EQUAL @MSVC_TOOLSET_MAJOR@ )) # Reject if there's a mismatch in MSVC compiler versions set (REASON "MSVC_TOOLSET_VERSION = @MSVC_TOOLSET_VERSION@") set (PACKAGE_VERSION_UNSUITABLE TRUE) elseif (NOT CMAKE_CROSSCOMPILING_STR STREQUAL "@CMAKE_CROSSCOMPILING_STR@") # Reject if there's a mismatch in ${CMAKE_CROSSCOMPILING} set (REASON "cross-compiling = @CMAKE_CROSSCOMPILING@") set (PACKAGE_VERSION_UNSUITABLE TRUE) elseif (CMAKE_CROSSCOMPILING AND NOT (CMAKE_SYSTEM_NAME STREQUAL "@CMAKE_SYSTEM_NAME@" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "@CMAKE_SYSTEM_PROCESSOR@")) # Reject if cross-compiling and there's a mismatch in the target system set (REASON "target = @CMAKE_SYSTEM_NAME@-@CMAKE_SYSTEM_PROCESSOR@") 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 () set (@PROJECT_NAME@_SHARED_FOUND @GEOGRAPHICLIB_SHARED_LIB@) set (@PROJECT_NAME@_STATIC_FOUND @GEOGRAPHICLIB_STATIC_LIB@) set (@PROJECT_NAME@_NETGeographicLib_FOUND @BUILD_NETGEOGRAPHICLIB@) # Check for the components requested. The convention is that # @PROJECT_NAME@_${comp}_FOUND should be true for all the required # components. if (@PROJECT_NAME@_FIND_COMPONENTS) foreach (comp ${@PROJECT_NAME@_FIND_COMPONENTS}) if (@PROJECT_NAME@_FIND_REQUIRED_${comp} AND NOT @PROJECT_NAME@_${comp}_FOUND) set (REASON "without ${comp}") set (PACKAGE_VERSION_UNSUITABLE TRUE) endif () endforeach () endif () # If unsuitable, append the reason to the package version so that it's # visible to the user. if (PACKAGE_VERSION_UNSUITABLE) set (PACKAGE_VERSION "${PACKAGE_VERSION} (${REASON})") endif () GeographicLib-1.52/cmake/project-config.cmake.in0000644000771000077100000001065414064202371021423 0ustar ckarneyckarney# Configure @PROJECT_NAME@ # # Set # @PROJECT_NAME@_FOUND = @PROJECT_NAME_UPPER@_FOUND = 1 # @PROJECT_NAME@_INCLUDE_DIRS = /usr/local/include # @PROJECT_NAME@_SHARED_LIBRARIES = GeographicLib_SHARED (or empty) # @PROJECT_NAME@_STATIC_LIBRARIES = GeographicLib_STATIC (or empty) # @PROJECT_NAME@_LIBRARY_DIRS = /usr/local/lib # @PROJECT_NAME@_BINARY_DIRS = /usr/local/bin # @PROJECT_NAME@_VERSION = 1.34 (for example) # @PROJECT_NAME_UPPER@_DATA = /usr/local/share/GeographicLib (for example) # Depending on @PROJECT_NAME@_USE_STATIC_LIBS # @PROJECT_NAME@_LIBRARIES = ${@PROJECT_NAME@_SHARED_LIBRARIES}, if OFF # @PROJECT_NAME@_LIBRARIES = ${@PROJECT_NAME@_STATIC_LIBRARIES}, if ON # If only one of the libraries is provided, then # @PROJECT_NAME@_USE_STATIC_LIBS is ignored. # # Since cmake 2.8.11 or later, there's no need to include # include_directories (${GeographicLib_INCLUDE_DIRS}) # The variables are retained for information. # # The following variables are only relevant if the library has been # compiled with a default precision different from double: # @PROJECT_NAME_UPPER@_PRECISION = the precision of the library (usually 2) # @PROJECT_NAME@_HIGHPREC_LIBRARIES = the libraries need for high precision message (STATUS "Reading ${CMAKE_CURRENT_LIST_FILE}") # @PROJECT_NAME@_VERSION is set by version file message (STATUS "@PROJECT_NAME@ configuration, version ${@PROJECT_NAME@_VERSION}") # Tell the user project where to find our headers and libraries get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) if (IS_ABSOLUTE "@PROJECT_ROOT_DIR@") # This is an uninstalled package (still in the build tree) set (_ROOT "@PROJECT_ROOT_DIR@") set (@PROJECT_NAME@_INCLUDE_DIRS "@PROJECT_INCLUDE_DIRS@") set (@PROJECT_NAME@_LIBRARY_DIRS "${_ROOT}/src") set (@PROJECT_NAME@_BINARY_DIRS "${_ROOT}/tools") else () # This is an installed package; figure out the paths relative to the # current directory. get_filename_component (_ROOT "${_DIR}/@PROJECT_ROOT_DIR@" ABSOLUTE) set (@PROJECT_NAME@_INCLUDE_DIRS "${_ROOT}/include") set (@PROJECT_NAME@_LIBRARY_DIRS "${_ROOT}/lib@LIB_SUFFIX@") set (@PROJECT_NAME@_BINARY_DIRS "${_ROOT}/bin") endif () set (@PROJECT_NAME_UPPER@_DATA "@GEOGRAPHICLIB_DATA@") set (@PROJECT_NAME_UPPER@_PRECISION @GEOGRAPHICLIB_PRECISION@) set (@PROJECT_NAME@_HIGHPREC_LIBRARIES "@HIGHPREC_LIBRARIES@") set (@PROJECT_NAME@_SHARED_LIBRARIES @CONFIG_SHARED_LIBRARIES@) set (@PROJECT_NAME@_STATIC_LIBRARIES @CONFIG_STATIC_LIBRARIES@) # Read in the exported definition of the library include ("${_DIR}/@PROJECT_NAME_LOWER@-legacy-targets.cmake") include ("${_DIR}/@PROJECT_NAME_LOWER@-targets.cmake") # For interoperability with older installations of GeographicLib and # with packages which depend on GeographicLib, @PROJECT_NAME@_LIBRARIES # etc. still point to the non-namespace variables. Tentatively plan to # transition to namespace variables as follows: # # * namespace targets were introduced with version 1.47 (2017-02-15) # * switch @PROJECT_NAME@_LIBRARIES to point to namespace variable after # 2020-02 # * remove non-namespace variables after 2023-02 unset (_ROOT) unset (_DIR) if ((NOT @PROJECT_NAME@_SHARED_LIBRARIES) OR (@PROJECT_NAME@_USE_STATIC_LIBS AND @PROJECT_NAME@_STATIC_LIBRARIES)) set (@PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_STATIC_LIBRARIES}) message (STATUS " \${@PROJECT_NAME@_LIBRARIES} set to static library") else () set (@PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_SHARED_LIBRARIES}) message (STATUS " \${@PROJECT_NAME@_LIBRARIES} set to shared library") endif () set (@PROJECT_NAME@_NETGeographicLib_LIBRARIES @NETGEOGRAPHICLIB_LIBRARIES@) # Check for the components requested. This only supports components # STATIC, SHARED, and NETGeographicLib by checking the value of # @PROJECT_NAME@_${comp}_LIBRARIES. No need to check if the component # is required or not--the version file took care of that. # @PROJECT_NAME@_${comp}_FOUND is set appropriately for each component. if (@PROJECT_NAME@_FIND_COMPONENTS) foreach (comp ${@PROJECT_NAME@_FIND_COMPONENTS}) if (@PROJECT_NAME@_${comp}_LIBRARIES) set (@PROJECT_NAME@_${comp}_FOUND 1) message (STATUS "@PROJECT_NAME@ component ${comp} found") else () set (@PROJECT_NAME@_${comp}_FOUND 0) message (WARNING "@PROJECT_NAME@ component ${comp} not found") endif () endforeach () endif () # @PROJECT_NAME@_FOUND is set to 1 automatically set (@PROJECT_NAME_UPPER@_FOUND 1) # for backwards compatibility GeographicLib-1.52/cmake/project.pc.in0000644000771000077100000000046114064202371017475 0ustar ckarneyckarneyprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ bindir=@bindir@ Name: @PACKAGE_NAME@ Description: A library for geographic projections Version: @PACKAGE_VERSION@ URL: https://geographiclib.sourceforge.io Requires: Libs: -L${libdir} -lGeographic Cflags: -I${includedir} GeographicLib-1.52/cmake/Makefile.in0000644000771000077100000003202014064202402017132 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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 VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = geographiclib.pc CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/project.pc.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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@ pkgconfigdir = @pkgconfigdir@ 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 CMakeLists.txt FindGeographicLib.cmake \ project-config-version.cmake.in project-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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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): geographiclib.pc: $(top_builddir)/config.status $(srcdir)/project.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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 \ cscopelist-am ctags-am 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 \ tags-am uninstall uninstall-am .PRECIOUS: Makefile 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.52/configure.ac0000644000771000077100000000525314064202371016310 0ustar ckarneyckarneydnl dnl Copyright (C) 2009, Francesco P. Lovergine AC_INIT([GeographicLib],[1.52],[charles@karney.com]) AC_CANONICAL_SYSTEM AC_PREREQ(2.61) AC_CONFIG_SRCDIR(src/Geodesic.cpp) AC_CONFIG_MACRO_DIR(m4) AM_INIT_AUTOMAKE GEOGRAPHICLIB_VERSION_MAJOR=1 GEOGRAPHICLIB_VERSION_MINOR=52 GEOGRAPHICLIB_VERSION_PATCH=0 AC_DEFINE_UNQUOTED([GEOGRAPHICLIB_VERSION_MAJOR], [$GEOGRAPHICLIB_VERSION_MAJOR],[major version number]) AC_DEFINE_UNQUOTED([GEOGRAPHICLIB_VERSION_MINOR], [$GEOGRAPHICLIB_VERSION_MINOR],[minor version number]) AC_DEFINE_UNQUOTED([GEOGRAPHICLIB_VERSION_PATCH], [$GEOGRAPHICLIB_VERSION_PATCH],[patch number]) AC_SUBST(GEOGRAPHICLIB_VERSION_MAJOR) AC_SUBST(GEOGRAPHICLIB_VERSION_MINOR) AC_SUBST(GEOGRAPHICLIB_VERSION_PATCH) 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=21 LT_REVISION=0 LT_AGE=2 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 AX_CXX_COMPILE_STDCXX_11([noext],[mandatory]) AC_PROG_LIBTOOL AC_LANG_CPLUSPLUS # Checks for long double AC_TYPE_LONG_DOUBLE # Check endianness AC_C_BIGENDIAN # Check flag for accurate arithmetic with Intel compiler. This is # needed to stop the compiler from ignoring parentheses in expressions # like (a + b) + c and from simplifying 0.0 + x to x (which is wrong if # x = -0.0). AX_CHECK_COMPILE_FLAG([-fp-model precise -diag-disable=11074,11076], [CXXFLAGS="$CXXFLAGS -fp-model precise -diag-disable=11074,11076"],, [-Werror]) # Check for doxygen. Version 1.8.7 or later needed for … AC_CHECK_PROGS([DOXYGEN], [doxygen]) AM_CONDITIONAL([HAVE_DOXYGEN], [test "$DOXYGEN" && test `"$DOXYGEN" --version | sed 's/\b\([[0-9]]\)\b/0\1/g'` '>' 01.08.06.99]) AC_CHECK_PROGS([POD2MAN], [pod2man]) AC_CHECK_PROGS([POD2HTML], [pod2html]) AC_CHECK_PROGS([COL], [col]) AM_CONDITIONAL([HAVE_PODPROGS], [test "$POD2MAN" -a "$POD2HTML" -a "$COL"]) dnl dnl Add here new file to be generated dnl AC_CONFIG_FILES([ Makefile src/Makefile include/Makefile tools/Makefile doc/Makefile js/Makefile man/Makefile matlab/Makefile python/Makefile cmake/Makefile examples/Makefile ]) PKG_PROG_PKG_CONFIG PKG_INSTALLDIR AC_CONFIG_FILES([cmake/geographiclib.pc:cmake/project.pc.in]) AC_OUTPUT GeographicLib-1.52/doc/CMakeLists.txt0000644000771000077100000001345014064202371017325 0ustar ckarneyckarney# Where the html versions of the man pages (extension .1.html) are # found. set (MANDIR ${PROJECT_BINARY_DIR}/man) # Build up a list of the .1.html files. set (HTMLMAN) foreach (TOOL ${TOOLS}) set (HTMLMAN ${HTMLMAN} ${MANDIR}/${TOOL}.1.html) endforeach () if (COMMON_INSTALL_PATH) set (INSTALL_DOC_DIR "share/doc/GeographicLib") else () set (INSTALL_DOC_DIR "doc") endif () # 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 html/index.html # as the make target. To make this target, copy the non-doxygen # generated files into html/. Run doxfile.in thru 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. file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html-stage) if (DOXYGEN_FOUND) set (DOCTARGETS) configure_file (GeographicLib.dox.in GeographicLib.dox @ONLY) configure_file (doxyfile.in doxyfile @ONLY) file (GLOB CXXSOURCES ../src/[A-Za-z]*.cpp ../include/GeographicLib/[A-Za-z]*.hpp ../tools/[A-Za-z]*.cpp ../examples/[A-Za-z]*.cpp ../examples/[A-Za-z]*.hpp) file (GLOB EXTRA_FILES ../maxima/[A-Za-z]*.mac tmseries30.html geodseries30.html ../LICENSE.txt) file (GLOB FIGURES *.png *.svg *.gif) file (COPY ${EXTRA_FILES} DESTINATION html-stage) add_custom_target (cxxdoc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html) add_dependencies (cxxdoc htmlman) add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxyfile ${CMAKE_CURRENT_BINARY_DIR}/GeographicLib.dox ${CXXSOURCES} ${EXTRA_FILES} ${FIGURES} ${HTMLMAN} COMMAND ${CMAKE_COMMAND} -E remove_directory html COMMAND ${CMAKE_COMMAND} -E copy_directory html-stage html COMMAND ${DOXYGEN_EXECUTABLE} doxyfile > doxygen.log COMMENT "Generating C++ documentation tree") set (DOCTARGETS ${DOCTARGETS} cxxdoc) configure_file (doxyfile-c.in doxyfile-c @ONLY) file (GLOB CSOURCES ../legacy/C/*.[ch]) add_custom_target (cdoc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/C/index.html) add_dependencies (cdoc cxxdoc) add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/C/index.html DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxyfile-c geodesic-c.dox ${CSOURCES} COMMAND ${DOXYGEN_EXECUTABLE} doxyfile-c > doxygen-c.log COMMENT "Generating C documentation tree") set (DOCTARGETS ${DOCTARGETS} cdoc) configure_file (doxyfile-for.in doxyfile-for @ONLY) file (GLOB FORTRANSOURCES ../legacy/Fortran/*.for ../legacy/Fortran/*.inc) add_custom_target (fortrandoc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/Fortran/index.html) add_dependencies (fortrandoc cxxdoc) add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/Fortran/index.html DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxyfile-for geodesic-for.dox ${FORTRANSOURCES} COMMAND ${DOXYGEN_EXECUTABLE} doxyfile-for > doxygen-for.log COMMENT "Generating Fortran documentation tree") set (DOCTARGETS ${DOCTARGETS} fortrandoc) configure_file (doxyfile-net.in doxyfile-net @ONLY) file (GLOB DOTNETSOURCES ../dotnet/NETGeographicLib/*.cpp ../dotnet/NETGeographicLib/*.h ../dotnet/examples/CS/*.cs ../dotnet/examples/ManagedCPP/*.cpp ../dotnet/examples/VB/*.vb) add_custom_target (dotnetdoc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/NET/index.html) add_dependencies (dotnetdoc cxxdoc) add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/NET/index.html DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxyfile-net NETGeographicLib.dox ${DOTNETSOURCES} COMMAND ${DOXYGEN_EXECUTABLE} doxyfile-net > doxygen-net.log COMMENT "Generating .NET documentation tree") set (DOCTARGETS ${DOCTARGETS} dotnetdoc) if (JSDOC) file (GLOB JSSOURCES ../js/src/*.js ../js/GeographicLib.md ../js/doc/*.md) add_custom_target (jsdoc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/js/index.html) add_dependencies (jsdoc cxxdoc) add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/js/index.html DEPENDS ${JSSOURCES} COMMAND ${JSDOC} --verbose -d html/js -u ${PROJECT_SOURCE_DIR}/js/doc -c ${PROJECT_SOURCE_DIR}/js/conf.json -R ${PROJECT_SOURCE_DIR}/js/GeographicLib.md ${PROJECT_SOURCE_DIR}/js/src > jsdoc.log COMMENT "Generating JavaScript documentation tree") set (DOCTARGETS ${DOCTARGETS} jsdoc) endif () if (SPHINX) file (GLOB PYTHONSOURCES ../python/geographiclib/*.py ../python/doc/*.rst ../python/doc/conf.py) add_custom_target (pythondoc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/python/index.html) add_dependencies (pythondoc cxxdoc) add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/python/index.html DEPENDS ${PYTHONSOURCES} COMMAND ${SPHINX} -v -b html -d python-doctree ${PROJECT_SOURCE_DIR}/python/doc html/python > pythondoc.log COMMENT "Generating python documentation tree") set (DOCTARGETS ${DOCTARGETS} pythondoc) endif () add_custom_target (doc ALL) add_dependencies (doc ${DOCTARGETS}) install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${INSTALL_DOC_DIR}) else () file (COPY ../LICENSE.txt DESTINATION html) # Need to absolute path on destination to support old versions of cmake configure_file (index.html.in html/index.html) configure_file (utilities.html.in html/utilities.html) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/html/LICENSE.txt ${CMAKE_CURRENT_BINARY_DIR}/html/index.html ${CMAKE_CURRENT_BINARY_DIR}/html/utilities.html DESTINATION ${INSTALL_DOC_DIR}/html) endif () GeographicLib-1.52/doc/GeographicLib.dox.in0000644000771000077100000154276614064202371020427 0ustar ckarneyckarney// -*- text -*- /** * \file GeographicLib.dox * \brief Documentation for GeographicLib * * Written by Charles Karney and licensed under the * MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace GeographicLib { /** \mainpage GeographicLib library \author Charles F. F. Karney (charles@karney.com) \version @PROJECT_VERSION@ \date 2021-06-22 The documentation for other versions is available at https://geographiclib.sourceforge.io/m.nn/ for versions numbers m.nn ≥ 1.0. \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., WMM2020) calculations, and for solving geodesic problems. The emphasis is on returning accurate results with errors close to round-off (about 5--15 nanometers). 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. Also included is a .NET wrapper library NETGeographicLib which exposes the functionality to .NET applications. 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 nor does it perform datum conversions; instead use PROJ. On the other hand, it does provide the core functionality offered by GEOTRANS. \section download Download The main project page is at - https://sourceforge.net/projects/geographiclib . The code is available for download at - GeographicLib-@PROJECT_VERSION@.tar.gz - GeographicLib-@PROJECT_VERSION@.zip . as either a compressed tar file (tar.gz) or a zip file. (The two archives have identical contents, except that the zip file has DOS line endings.) Alternatively you can get the latest release using git \verbatim git clone git://git.code.sourceforge.net/p/geographiclib/code geographiclib \endverbatim Each release is tagged, e.g., with r@PROJECT_VERSION@. There are also binary installers available for some platforms. See \ref binaryinst. GeographicLib is licensed under the MIT/X11 License; see LICENSE.txt for the terms. For more information on GeographicLib, see - https://geographiclib.sourceforge.io/. \section citint Citing GeographicLib When citing GeographicLib, use (adjust the version number and date as appropriate) - C. F. F. Karney, GeographicLib, Version @PROJECT_VERSION@ (2021-06-22), https://geographiclib.sourceforge.io/@PROJECT_VERSION@ \section contents Contents - \ref intro - \ref install - \ref start - \ref utilities - \ref organization - \ref other - \ref geoid - \ref gravity - \ref normalgravity - \ref magnetic - \ref geodesic - \ref nearest - \ref triaxial - \ref jacobi - \ref rhumb - \ref greatellipse - \ref transversemercator - \ref geocentric - \ref auxlat - \ref highprec - \ref changes
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. In 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, Geodesic::Inverse works for anti-podal points. Similarly, 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 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 C++11 compliant versions of g++ under Linux, with Apple LLVM 7.0.2 under Mac OS X, and with MS Visual Studio 14 (2015), 15 (2017), and 16 (2019) compiled for 32 bit and 64 bit on Windows. 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. The bulk of the testing has used geographically relevant values of the flattening. Thus, you can expect close to full accuracy for −0.01 ≤ \e f ≤ 0.01 (but note that TransverseMercatorExact is restricted to \e f > 0). However, reasonably accurate results can be expected if −0.1 ≤ \e f ≤ 0.1. Outside this range, you should attempt to verify the accuracy of the routines independently. Two types of problems may occur with larger values of f: - Some classes, specifically Geodesic, GeodesicLine, and TransverseMercator, use series expansions using \e f as a small parameter. The accuracy of these routines will degrade as \e f becomes large. - Even when exact formulas are used, many of the classes need to invert the exact formulas (e.g., to invert a projection), typically, using Newton's method. This usually provides an essentially exact inversion. However, the choice of starting guess and the exit conditions have been tuned to cover small values of \e f and the inversion may be incorrect if \e f is large. Undoubtedly, bugs lurk in this code and in the documentation. Please report any you find to charles@karney.com.
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, under Mac OS X with Xcode, and under Windows with Visual Studio 2015 and later. It should compile on any systems with a C++11 compliant compiler. First download either GeographicLib-@PROJECT_VERSION@.tar.gz or GeographicLib-@PROJECT_VERSION@.zip (or GeographicLib-@PROJECT_VERSION@-win32.exe or GeographicLib-@PROJECT_VERSION@-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 binaryinst. Use this installation method if you only need to use the \ref utilities supplied with GeographicLib. - \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 maintenance 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-vc14 for Visual Studio 14 (2015), 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, version 3.7.0 or later, 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 be one of the standard packages and can be installed by a command like \verbatim yum install cmake \endverbatim (executed as root). The minimum version of cmake supported for building GeographicLib is 3.1.0 (which was released on 2014-12-15). On other systems, download a binary installer from https://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. It is known to work also for Visual Studio 2017 Build Tools. Here are the steps to compile and install GeographicLib: - Unpack the source, running one of \verbatim tar xfpz GeographicLib-@PROJECT_VERSION@.tar.gz unzip -q GeographicLib-@PROJECT_VERSION@.zip \endverbatim then enter the directory created with \verbatim cd GeographicLib-@PROJECT_VERSION@ \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 something like \verbatim cmake -G "Visual Studio 14" -A win32 \ -D CMAKE_INSTALL_PREFIX="C:/Program Files (x86)/GeographicLib-@PROJECT_VERSION@" \ .. cmake -G "Visual Studio 14" -A x64 \ -D CMAKE_INSTALL_PREFIX="C:/Program Files/GeographicLib-@PROJECT_VERSION@" \ ..\endverbatim The definitions of CMAKE_INSTALL_PREFIX point to system directories. You might instead prefer to install to a user directory such as C:/Users/jsmith/projects/GeographicLib-@PROJECT_VERSION@. 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 - COMMON_INSTALL_PATH governs the installation convention. If it is on ON (the Linux default), the installation is to a common directory, e.g., /usr/local. If it is OFF (the Windows default), the installation directory contains the package name, e.g., C:/Program Files/GeographicLib-@PROJECT_VERSION@. The installation directories for the documentation, cmake configuration, Python and MATLAB interfaces all depend on the variable with deeper paths relative to CMAKE_INSTALL_PREFIX being used when it's ON: - cmake configuration: OFF cmake; ON: lib/cmake/GeographicLib; - documentation: OFF: doc/html; ON: share/doc/GeographicLib/html; - JavaScript interface: OFF: node_modules; ON: lib/node_modules; - Python interface: OFF: python; ON: lib/python/site-packages; - MATLAB interface: OFF: matlab; ON: share/matlab. . - CMAKE_INSTALL_PREFIX (default: /usr/local on non-Windows systems, C:/Program Files (x86)/GeographicLib on Windows systems) specifies where the library will be installed. For Windows systems, you might want to use a prefix which includes the compiler version, in order to keep the libraries built with different versions of the compiler in distinct locations. If you just want to try the library to see if it suits your needs, pick, for example, CMAKE_INSTALL_PREFIX=/tmp/geographic. - GEOGRAPHICLIB_DATA (default: /usr/local/share/GeographicLib for non-Windows systems, C:/ProgramData/GeographicLib for Windows systems) specifies the default location for the various datasets for use by Geoid, GravityModel, and MagneticModel. See \ref geoidinst, \ref gravityinst, and \ref magneticinst for more information. - GEOGRAPHICLIB_LIB_TYPE (allowed values: SHARED, STATIC, or BOTH), specifies the types of libraries build. The default is STATIC for Windows and SHARED otherwise. If building GeographicLib for system-wide use, BOTH is recommended, because this provides users with the choice of which library to use. - 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.) - GEOGRAPHICLIB_DOCUMENTATION (default: OFF). If set to ON, then html documentation is created from the source files, provided a sufficiently recent version of doxygen can be found. Otherwise, the html documentation will redirect to the appropriate version of the online documentation. - BUILD_NETGEOGRAPHICLIB (default: OFF). If set to ON, build the managed C++ wrapper library NETGeographicLib. This only makes sense for Windows systems. - GEOGRAPHICLIB_PRECISION specifies the precision to be used for "real" (i.e., floating point) numbers. Here are the possible values -# float (24-bit precision); typically this is far to inaccurate for geodetic applications. -# double precision (53-bit precision, the default). -# long double (64-bit precision); this does not apply for Visual Studio (long double is the same as double with that compiler). -# quad precision (113-bit precision). -# arbitrary precision. . See \ref highprec for additional information about the last two values. Nearly all the testing has been carried out with doubles and that's the recommended configuration. In particular you should avoid "installing" the library with a precision different from double. - USE_BOOST_FOR_EXAMPLES (default: OFF). If set to ON, then the Boost library is searched for in order to build the NearestNeighbor example. - APPLE_MULTIPLE_ARCHITECTURES (default: OFF). If set to ON, build for i386 and x86_64 and Mac OS X systems. Otherwise, build for the default architecture. - CONVERT_WARNINGS_TO_ERRORS (default: OFF). If set to ON, then compiler warnings are treated as errors. (This happens also if you are a "developer", i.e., if the file tests/CMakeLists.txt is present.) . - Build and install the software. In non-IDE environments, run \verbatim make # compile the library and utilities make test # run some tests make install # as root, if CMAKE_INSTALL_PREFIX is a system directory \endverbatim Possible additional targets are \verbatim make dist make exampleprograms make netexamples (supported only for Release configuration) \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 install (RUN_TESTS and INSTALL are in the CMakePredefinedTargets folder). Alternatively (for example, if you are using the Visual Studio 2017 Build Tools), you run the Visual Studio compiler from the command line with \verbatim cmake --build . --config Release --target ALL_BUILD cmake --build . --config Release --target RUN_TESTS cmake --build . --config Release --target INSTALL \endverbatim For maximum flexibility, it's a good idea to build and install both the Debug and Release versions of the library (in that order). The installation directories will then contain the release versions of the tools and both versions (debug and release) of the libraries. If you use cmake to configure and build your programs, then the right version of the library (debug vs. release) will automatically be used. - 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.) For documentation, open in a web browser PREFIX/share/doc/GeographicLib/html/index.html, if COMMON_INSTALL_PATH is ON, or PREFIX/doc/index.html, otherwise. - With cmake 3.13 and later, cmake can create the build directory for you. This allows you to configure and run the build on Windows with \verbatim cmake -G "Visual Studio 14" -A x64 -S . -B BUILD cmake --build BUILD --config Release --target ALL_BUILD \endverbatim or on Linux with \verbatim cmake -S . -B BUILD make -C BUILD -j4 \endverbatim \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-@PROJECT_VERSION@.tar.gz \endverbatim then enter the directory created \verbatim cd GeographicLib-@PROJECT_VERSION@ \endverbatim - Create a separate build directory and enter it, for example, \verbatim mkdir BUILD cd BUILD \endverbatim - Configure the software, specifying 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. 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-@PROJECT_VERSION@.tar.gz \endverbatim then enter the directory created \verbatim cd GeographicLib-@PROJECT_VERSION@ \endverbatim - Edit \verbatim include/GeographicLib/Config.h \endverbatim If your C++ compiler does not recognize the long double type (unlikely), insert \code #undef GEOGRAPHICLIB_HAVE_LONG_DOUBLE \endcode If your machine using big endian ordering, then insert \code #define GEOGRAPHICLIB_WORDS_BIGENDIAN 1 \endcode - Build and install the software: \verbatim make # compile the library and the tools 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. For documentation, open share/doc/GeographicLib/html/index.html in a web browser. \section binaryinst Using a binary installer Binary installers are available for some platforms \subsection binaryinstwin Windows Use this method if you only need to use the GeographicLib utilities. The header files and static and shared versions of library are also provided; these can only be used by Visual Studio 14 2015 or later (2017 or 2019) (in either release or debug mode). However, if you plan to use the library, it may be advisable to build it with the compiler you are using for your own code using \ref cmake. Download and run GeographicLib-@PROJECT_VERSION@-win32.exe or GeographicLib-@PROJECT_VERSION@-win64.exe: - read the MIT/X11 License agreement, - select whether you want your PATH modified, - select the installation folder, by default C:\\Program Files\\GeographicLib-@PROJECT_VERSION@ or C:\\Program Files (x86)\\GeographicLib-@PROJECT_VERSION@, - 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:/Program Files{, (x86)}/GeographicLib-@PROJECT_VERSION@/bin where the utilities are installed. The headers and library are installed in the include/GeographicLib and lib folders. The libraries were built using using Visual Studio 14 2015 in release and debug modes. The utilities were linked against the release-mode shared library. NETGeographicLib library dlls (release and debug) are included with the binary installers; these are linked against the shared library for GeographicLib. Also included are the Python, JavaScript, and MATLAB interfaces. \subsection binaryinstosx MacOSX You can install using Homebrew. Follow the directions on https://brew.sh/ for installing this package manager. Then type \verbatim brew install geographiclib \endverbatim Now links to GeographicLib are installed under /usr/local. \subsection binaryinstlin Linux Some Linux distributions, Fedora, Debian, and Ubuntu, offer GeographicLib as a standard package. Typically these will be one or two versions behind the latest. \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 c:/QtSDK/mingw/bin`:$PATH" mkdir BUILD cd BUILD cmake -G "MinGW Makefiles" -D CMAKE_INSTALL_PREFIX="C:/Program Files/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:/Program Files/GeographicLib" .. \endverbatim \section maintainer Maintainer tasks Check the code out of git with \verbatim git clone -b master git://git.code.sourceforge.net/p/geographiclib/code geographiclib \endverbatim Here the "master" branch is checked out. There are three branches in the git repository: - master: the main branch for code maintenance. Releases are tagged on this branch as, e.g., v@PROJECT_VERSION@. - devel: the development branch; changes made here are merged into master. - release: the release branch created by unpacking the source releases (git is \e not used to merge changes from the other branches into this branch). This is the \e default branch of the repository (the branch you get if cloning the repository without specifying a branch). This differs from the master branch in that some administrative files are excluded while some intermediate files are included (in order to aid building on as many platforms as possible). Releases are tagged on this branch as, e.g., r@PROJECT_VERSION@. . The autoconf configuration script and the formatted man pages are not checked into master branch of the repository. 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 or configure. In the case of cmake, you then run \verbatim make dist \endverbatim which will copy the man pages from the build directory back into the source tree and package the resulting source tree for distribution as \verbatim GeographicLib-@PROJECT_VERSION@.tar.gz GeographicLib-@PROJECT_VERSION@.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. On Windows, you should configure GeographicLib with PACKAGE_DEBUG_LIBS=ON, build both Release and Debug versions of the library and finally build PACKAGE in Release mode. This will get the release and debug versions of the library included in the package. For example, the 64-bit binary installer is created with \verbatim cmake -G "Visual Studio 14" -A x64 \ -D GEOGRAPHICLIB_LIB_TYPE=BOTH \ -D PACKAGE_DEBUG_LIBS=ON \ -D BUILD_NETGEOGRAPHICLIB=ON \ .. cmake --build . --config Debug --target ALL_BUILD cmake --build . --config Release --target ALL_BUILD cmake --build . --config Release --target matlabinterface cmake --build . --config Release --target PACKAGE \endverbatim With configure, run \verbatim make dist-gzip \endverbatim which will create the additional files and packages the results ready for distribution as \verbatim geographiclib-@PROJECT_VERSION@.tar.gz \endverbatim Prior to making a release, the script tests/test-distribution.sh is run on a Fedora system. This checked that the library compiles correctly is multiple configurations. In addition it creates a directory and scripts for checking the compilation on Windows. The following Fedora packages are required by tests/test-distribution.sh - cmake - automake - autoconf-archive - libtool - gcc-c++ - gcc-gfortran - ccache - doxygen - boost-devel - mpfr-devel - octave - python2 - python3-sphinx - nodejs - maven . The following npm packages need to be installed (jshint is just for syntax checking) \verbatim npm install -g mocha jsdoc jshint \endverbatim The following Fedora package is also useful for syntax checking python - pylint . Installing the python package requires the following \verbatim python3 -m pip install --user --upgrade setuptools wheel twine \endverbatim mpreal.h, version 3.6.8 or later, needs to be downloaded from https://github.com/advanpix/mpreal and installed in the include/ directory. (Version 3.6.8 requires also the fixes given in pull requests #8 and #10.) For all the tests to be run, the following datasets need to be installed - geoid models: egm96-5 - magnetic models: wmm2010 emm2015 - gravity models: egm2008 grs80
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. - Finally compile and link your code. You have two options here. - Use cmake to build your package. If you are familiar with cmake this typically will be far the simplest option. - Set the include paths and linking options "manually". - Building your code with cmake. In brief, the necessary steps are: - include in your CMakeLists.txt files \verbatim find_package (GeographicLib REQUIRED) add_executable (program source1.cpp source2.cpp) target_link_libraries (program ${GeographicLib_LIBRARIES}) \endverbatim - configure your package, e.g., with \verbatim mkdir BUILD cd BUILD cmake -G "Visual Studio 14" -A x64 \ -D CMAKE_PREFIX_PATH="C:/Program Files" \ -D CMAKE_INSTALL_PREFIX="C:/Program Files/testgeog" \ .. \endverbatim Note that you almost always want to configure and build your code somewhere other than the source directory (in this case, we use the BUILD subdirectory). Also, on Windows, make sure that the version of Visual Studio (14 in the example above) architecture (x64 in the example above) is compatible with that used to build GeographicLib. In this example, it's not necessary to specify CMAKE_PREFIX_PATH, because C:/Program Files is one of the system paths which is searched automatically. - build your package. On Linux and MacOS this usually involves just running make. On Windows, you can load the solution file created by cmake into Visual Studio; alternatively, you can get cmake to run build your code with \verbatim cmake --build . --config Release --target ALL_BUILD \endverbatim You might also want to install your package (using "make install" or build the "INSTALL" target with the command above). - With cmake 3.13 and later, cmake can create the build directory for you. This allows you to configure and run the build on Windows with \verbatim cmake -G "Visual Studio 14" -A x64 \ -D CMAKE_PREFIX_PATH="C:/Program Files" \ -D CMAKE_INSTALL_PREFIX="C:/Program Files/testgeog" \ -S . -B BUILD cmake --build BUILD --config Release --target ALL_BUILD \endverbatim or on Linux with \verbatim cmake -D CMAKE_INSTALL_PREFIX="/tmp/testgeog" \ -S . -B BUILD make -C BUILD -j4 \endverbatim . The most import step is the find_package command. The cmake documentation describes the locations searched by find_package (the appropriate rule for GeographicLib are those for "Config" mode lookups). In brief, the locations that are searched are (from least specific to most specific, i.e., in reverse order) are - under the system paths, i.e., locations such as C:/Program Files and /usr/local); - frequently, it's necessary to search within a "package directory" (or set of directories) for external dependencies; this is given by a (semicolon separated) list of directories specified by the cmake variable CMAKE_PREFIX_PATH (illustrated above); - the package directory for GeographicLib can be overridden with the environment variable GeographicLib_DIR (which is the directory under which GeographicLib is installed); - finally, if you need to point to a particular build of GeographicLib, define the cmake variable GeographicLib_DIR, which specifies the absolute path of the directory containing the configuration file geographiclib-config.cmake (for debugging this may be the top-level build directory, as opposed to installation directory, for GeographicLib). . Typically, specifying nothing or CMAKE_PREFIX_PATH suffices. However the two GeographicLib_DIR variables allow for a specific version to be chosen. On Windows systems (with Visual Studio), find_package will only find versions of GeographicLib built with the right version of the compiler. (If you used a non-cmake 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.) If GeographicLib is not found, check the values of GeographicLib_CONSIDERED_CONFIGS and GeographicLib_CONSIDERED_VERSIONS; these list the configuration files and corresponding versions which were considered by find_package. If GeographicLib is found, then the following cmake variables are set: - GeographicLib_FOUND = 1 - GeographicLib_VERSION = @PROJECT_VERSION@ - GeographicLib_INCLUDE_DIRS - GeographicLib_LIBRARIES = one of the following two: - GeographicLib_SHARED_LIBRARIES = GeographicLib::GeographicLib_SHARED - GeographicLib_STATIC_LIBRARIES = GeographicLib::GeographicLib_STATIC - GeographicLib_LIBRARY_DIRS - GeographicLib_BINARY_DIRS - GEOGRAPHICLIB_DATA = value of this compile-time parameter . Either of GeographicLib_SHARED_LIBRARIES or GeographicLib_STATIC_LIBRARIES may be empty, if that version of the library is unavailable. If you require a specific version, SHARED or STATIC, of the library, add a COMPONENTS clause to find_package, e.g., \verbatim find_package (GeographicLib 1.34 REQUIRED COMPONENTS SHARED) \endverbatim causes only packages which include the shared library to be found. If the package includes both versions of the library, then GeographicLib_LIBRARIES is set to the shared version, unless you include \verbatim set (GeographicLib_USE_STATIC_LIBS ON) \endverbatim before the find_package command. You can check whether GeographicLib_LIBRARIES refers to the shared or static library with \verbatim get_target_property(_LIBTYPE ${GeographicLib_LIBRARIES} TYPE) \endverbatim which results in _LIBTYPE being set to SHARED_LIBRARY or STATIC_LIBRARY. On Windows, cmake takes care of linking to the release or debug version of the library as appropriate. (This assumes that the Release and Debug versions of the libraries were built and installed. This is true for the Windows binary installer for GeographicLib version 1.34 and later.) - Here are the steps to compile and link your code using GeographicLib "manually". - 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-vc14-x64\GeographicLib\include \endverbatim - If using the shared (or static) library with Visual Studio, define the macro GEOGRAPHICLIB_SHARED_LIB=1 (or 0), e.g., \verbatim C/C++ -> Preprocessor -> Preprocessor Definitions = GEOGRAPHICLIB_SHARED_LIB=1 \endverbatim This is only needed for Windows systems when both shared and static libraries have been installed. (If you configure your package with cmake, this definition is added automatically.) - 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-i.lib (for shared library) Linker -> Input -> Additional Dependencies = Geographic.lib (for static library) Linker -> General -> Additional Library Directories = C:\pkg-vc14-x64\Geographic\lib \endverbatim Note that the library name is Geographic and not GeographicLib. For the Debug version of your program on Windows add "_d" to the library, e.g., Geographic_d-i.lib or Geographic_d.lib. - Tell the runtime environment where to find the shared library (assuming you compiled %Geographic 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 or Geographic_d.dll is in the same directory as your executable or else include the directory containing the dll in your PATH. - You can also use the pkg-config utility to specify compile and link flags. This requires that pkg-config be installed and that it's configured to search, e.g., /usr/local/lib/pgkconfig; if not, define the environment variable PKG_CONFIG_PATH to include this directory. The compile and link steps under Linux would typically be \verbatim g++ -c -g -O3 `pkg-config --cflags geographiclib` testprogram.cpp g++ -g -o testprogram testprogram.o `pkg-config --libs geographiclib` \endverbatim Here is a very simple test code, which uses the 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 Here is a complete CMakeList.txt files you can use to build this test code using the installed library: \verbatim project (geodesictest) cmake_minimum_required (VERSION 3.1.0) find_package (GeographicLib REQUIRED) if (NOT MSVC) set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) endif () add_executable (${PROJECT_NAME} example-Geodesic-small.cpp) target_link_libraries (${PROJECT_NAME} ${GeographicLib_LIBRARIES}) if (MSVC) get_target_property (_LIBTYPE ${GeographicLib_LIBRARIES} TYPE) if (_LIBTYPE STREQUAL "SHARED_LIBRARY") # On Windows systems, copy the shared library to build directory add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CFG_INTDIR} COMMENT "Copying shared library for GeographicLib") endif () endif () \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 GeoCoords. See \ref GeoConvert.cpp. - GeodSolve: perform geodesic calculations using Geodesic and GeodesicLine. See \ref GeodSolve.cpp. - Planimeter: compute the area of geodesic polygons using PolygonAreaT. See \ref Planimeter.cpp. - TransverseMercatorProj: convert between geographic and transverse Mercator. This is for testing TransverseMercatorExact and TransverseMercator. See \ref TransverseMercatorProj.cpp. - CartConvert: convert geodetic coordinates to geocentric or local cartesian using Geocentric and LocalCartesian. See \ref CartConvert.cpp. - GeodesicProj: perform projections based on geodesics using AzimuthalEquidistant, Gnomonic, and CassiniSoldner. See \ref GeodesicProj.cpp. - ConicProj: perform conic projections using LambertConformalConic and AlbersEqualArea. See \ref ConicProj.cpp. - GeoidEval: look up geoid heights using Geoid. See \ref GeoidEval.cpp. - Gravity: compute the earth's gravitational field using GravityModel and GravityCircle. See \ref Gravity.cpp. - MagneticField: compute the earth's magnetic field using MagneticModel and MagneticCircle. See \ref MagneticField.cpp. - RhumbSolve: perform rhumb line calculations using Rhumb and RhumbLine. See \ref RhumbSolve.cpp. . 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 four of these utilities are provided: - GeoConvert - GeodSolve - Planimeter - GeoidEval - RhumbSolve
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. TransverseMercator, PolarStereographic, LambertConformalConic, and 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). TransverseMercator::UTM and 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 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). AlbersEqualArea::CylindricalEqualArea, AzimuthalEqualAreaNorth, and AzimuthalEqualAreaSouth, likewise provide special cases of the equal area projection. 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. 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. 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. 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. Geodesic and GeodesicLine perform geodesic calculations. The constructor for Geodesic specifies the ellipsoid and the direct and inverse calculations are implemented as const member functions. 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 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. GeodSolve is a simple command line utility to perform geodesic calculations. PolygonAreaT is a class which compute the area of geodesic polygons using the Geodesic class and Planimeter is a command line utility for the same purpose. AzimuthalEquidistant, CassiniSoldner, and Gnomonic are projections based on the Geodesic class. GeodesicProj is a command line utility to exercise these projections. GeodesicExact and GeodesicLineExact are drop in replacements for Geodesic and GeodesicLine in which the solution is given in terms of elliptic integrals (computed by EllipticFunction). These classes should be used if the absolute value of the flattening exceeds 0.02. The -E option to GeodSolve uses these classes. NearestNeighbor is a header-only class for efficiently \ref nearest of a collection of points where the distance function obeys the triangle inequality. The geodesic distance obeys this condition. Geocentric and 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. 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. 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. Ellipsoid is a class which performs latitude conversions and returns various properties of the ellipsoid. 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 GravityModel::Circle to return a 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. NormalGravity computes the gravity of the so-called level ellipsoid. 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 MagneticModel::Circle to return a 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. Constants, Math, Utility, DMS, are general utility class which are used internally by the library; in addition EllipticFunction is used by TransverseMercatorExact, Ellipsoid, and GeodesicExact, and GeodesicLineExact; Accumulator is used by PolygonAreaT, and SphericalEngine, CircularEngine, SphericalHarmonic, SphericalHarmonic1, and SphericalHarmonic2 facilitate the summation of spherical harmonic series which is needed by and MagneticModel and MagneticCircle. One important definition is 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. GeographicLib uniformly represents all angle-like variables (latitude, longitude, azimuth) in terms of degrees. To convert from degrees to radians, multiple the quantity by Math::degree(). To convert from radians to degrees , divide the quantity by Math::degree(). In general, the constructors for the classes in GeographicLib check their arguments and throw 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 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 (and similarly for GARS, Geohash, and Georef strings). 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 - 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. - Geoid, GravityModel, and 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. - 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 GEOGRAPHICLIB_WORDS_BIGENDIAN macro (which sets the compile-time constant Math::bigendian). An attempt is made to maintain backward compatibility with GeographicLib (especially at the level of your source code). Sometimes it's necessary to take actions that depend on what version of GeographicLib is being used; for example, you may want to use a new feature of GeographicLib, but want your code still to work with older versions. In that case, you can test the values of the macros GEOGRAPHICLIB_VERSION_MAJOR, GEOGRAPHICLIB_VERSION_MINOR, and GEOGRAPHICLIB_VERSION_PATCH; these expand to numbers (and the last one is usually 0); these macros appeared starting in version 1.31. There's also a macro GEOGRAPHICLIB_VERSION_STRING which expands to, e.g., "@PROJECT_VERSION@"; this macro has been defined since version 1.9. Since version 1.37, there's also been a macro GEOGRAPHICLIB_VERSION which encodes the version as a single number, e.g, 1003900. Do not rely on this particular packing; instead use the macro GEOGRAPHICLIB_VERSION_NUM(a,b,c) which allows you to compare versions with, e.g., \code #if GEOGRAPHICLIB_VERSION >= GEOGRAPHICLIB_VERSION_NUM(1,37,0) ... #endif \endcode
Back to \ref utilities. Forward to \ref other. Up to \ref contents.
**********************************************************************/ /** \page other Implementations in other languages
Back to \ref organization. Forward to \ref geoid. Up to \ref contents.
Various subsets of GeographicLib have been implemented in other languages. In some cases, these are available as independent packages. Here is a summary: - C (geodesic routines): documentation, also included with recent versions of PROJ; - Fortran (geodesic routines): documentation; - Java (geodesic routines): Maven Central package, documentation; - JavaScript (geodesic routines): npm package, documentation; - Python (geodesic routines): PyPI package, documentation; - MATLAB/Octave (geodesic and some other routines): MATLAB Central package, documentation; - C# (.NET wrapper for C++ library): documentation. Some more details are available in the following sections - \ref c-fortran - \ref java. - \ref javascript. - \ref python. - \ref matlab. - \ref dotnet. - \ref maxima. - \ref excel. \section c-fortran C and Fortran implementation This includes the geodesic capabilities of GeographicLib. The source code is in the directories legacy/C and legacy/Fortran. These are intended for use in old codes written in these languages and should work any reasonably modern compiler. These implementations are entirely self-contained and do not depend on the rest of GeographicLib. Sample main programs to solve the direct and inverse geodesic problems and to compute polygonal areas are provided. The C library is also included as part of PROJ starting with version 4.9.0, where it is used as the computational backend for geod(1). For documentation, see - C library for geodesics, - Fortran library for geodesics. It is also possible to call the C++ version of GeographicLib directly from C and the directory wrapper/C contains a small example, which converts heights above the geoid to heights above the ellipsoid. \section java Java implementation This includes the geodesic capabilities of GeographicLib. The source code is in the directory java. This implementation is entirely self-contained and does not depend on the rest of GeographicLib. Sample main programs to solve the direct and inverse geodesic problems and to compute polygonal areas are provided. This package is available on Maven Central; so if you're using Apache Maven as your build system, you can use this package by including the dependency \verbatim net.sf.geographiclib GeographicLib-Java @PROJECT_VERSION@ \endverbatim in your pom.xml. For documentation, see - Java library for geodesics. \section javascript JavaScript implementation This includes the geodesic capabilities of GeographicLib. The source code is in the directory js. This implementation is entirely self-contained and does not depend on the rest of GeographicLib. The library is available as an npm package. To install this package, use \verbatim npm install geographiclib \endverbatim For documentation, see - JavaScript library for geodesics. 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. \section python Python implementation This includes the geodesic capabilities of GeographicLib. The source code is in the directory python. This implementation is entirely self-contained and does not depend on the rest of GeographicLib. The library is available as an PyPI package. To install this package, use \verbatim pip install geographiclib \endverbatim For documentation, see - Python library for geodesics. It is also possible to call the C++ version of GeographicLib directly from Python and the directory wrapper/python contains a small example, which converts heights above the geoid to heights above the ellipsoid. \section matlab MATLAB and Octave implementations The includes the geodesic capabilities of GeographicLib and implementations of the TransverseMercator, PolarStereographic, AzimuthalEquidistant, CassiniSoldner, Gnomonic, UTMUPS, MGRS, Geocentric, and LocalCartesian classes. In addition, it includes solutions of the direct, inverse, and area problems for \ref greatellipse. Because these functions are all vectorized, their performance is comparable to the C++ routines. The minimum version numbers required are - MATLAB, version 7.9, 2009b, - Octave, version 3.4, Feb. 2011. . In addition, in order to use the geoid routines, Octave needs to have been built with a version of GraphicsMagick which supports 16-bit images. The source code is in the directory matlab/geographiclib. This implementation is entirely self-contained and does not depend on the rest of GeographicLib. The library is available as an MATLAB Central package, GeographicLib toolbox, documentation. A summary of the routines is obtained by \verbatim help geographiclib \endverbatim Prior to version 1.42, GeographicLib was distributed with some MATLAB functionality offered via compiled interface code. This has now been replaced by native MATLAB wrapper functions in matlab/geographiclib-legacy; these depend on the GeographicLib toolbox. A summary of the routines is obtained by \verbatim help geographiclib-legacy \endverbatim It is also possible to call the C++ version of GeographicLib directly from MATLAB or Octave and the directory wrapper/matlab contains a small example, which solves the inverse geodesic problem for ellipsoids with arbitrary flattening. (This example is taken from the MATLAB interface code which was provided prior to version 1.42.) \section dotnet .NET wrapper This is a comprehensive wrapper library, written and maintained by Scott Heiman, which exposes all of the functionality of GeographicLib to the .NET family of languages. For documentation, see - NETGeographicLib .NET wrapper library. \section maxima Maxima routines Maxima is a free computer algebra system which can be downloaded from http://maxima.sourceforge.net. Maxima was used to generate the series used by TransverseMercator ( tmseries.mac), Geodesic ( geod.mac), Rhumb ( rhumbarea.mac), \ref gearea ( gearea.mac), the relation between \ref auxlat ( auxlat.mac), and to generate accurate data for testing ( tm.mac and geodesic.mac). The latter uses Maxima's bigfloat arithmetic together with series extended to high order or solutions in terms of elliptic integrals ( ellint.mac). These files contain brief instructions on how to use them. \section excel Excel wrapper There is no implementation of the functionality GeographicLib in Visual Basic which would be callable from Excel. However, it is possible to call the C++ library from Visual Basic. The directory wrapper/Excel contains an illustration which allows geodesics and rhumb lines to be computed in Excel. At present this works only on Windows systems.
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 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: https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm84 - EGM96: https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm96 - EGM2008: https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm2008 . 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.) The height of the geoid above the ellipsoid, \e N, is sometimes called the geoid undulation. It can be used to convert a height above the ellipsoid, \e h, to the corresponding height above the geoid (the orthometric height, roughly the height above mean sea level), \e H, using the relations    \e h = \e N + \e H;   \e H = −\e N + \e h. 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 GravityModel class calculates geoid heights using the underlying gravity model. This is slower then 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 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 \verbatim 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 uses 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. Geoid and GeoidEval uses a compile time default to locate the datasets. This is - /usr/local/share/GeographicLib/geoids, for non-Windows systems - C:/ProgramData/GeographicLib/geoids, for Windows systems . consistent with the examples above. This may be overridden at run-time by defining the GEOGRAPHICLIB_GEOID_PATH or the GEOGRAPHICLIB_DATA environment variables; see Geoid::DefaultGeoidPath() for details. Finally, the path may be set using the optional second argument to the 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 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 https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm96 # 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 Geoid::Description, Geoid::DateTime, Geoid::MaxError, and 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 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 \ –a_offset -108 -a_scale 0.003 \ egmyy-g.pgm egmyy-g.tif \endverbatim (The -a_offset and -a_scale options were introduced in gdal_translate version 2.3.) 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. The Geoid class only handles world-wide geoid models. The pgm provides geoid height postings on grid of points with uniform spacing in latitude (row) and longitude (column). If the dimensions of the pgm file are \e h × \e w, then latitude (resp. longitude) spacing is −180°/(\e h − 1) (resp. 360°/\e w), with the (0,0) pixel given the value at φ = 90°, λ = 0°. Models covering a limited area will need to be "inserted" into a world-wide grid before being accessible to the Geoid class. \section geoidinterp Interpolating the geoid data Geoid evaluates the geoid height using bilinear or cubic interpolation. 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 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 Geoid uses are quantized to 3 mm. If, instead, 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 Geoid::CacheArea or the entire dataset with 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. - 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 μm) - EGM96 height (meters, accurate to 1 μm) - EGM2008 height (meters, accurate to 1 μm) . 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 normalgravity. Up to \ref contents.
GeographicLib can compute the earth's gravitational field with an earth gravity model using the GravityModel and 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. Underlying all these models is normal gravity which is the exact solution for an idealized rotating ellipsoidal body. This is implemented with the NormalGravity class and some notes on are provided in section \ref normalgravity Go to - \ref gravityinst - \ref gravityformat - \ref gravitynga - \ref gravitygeoid - \ref gravityatmos - \ref gravityparallel - \ref normalgravity (now on its own page) 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. See also Pavlis et al. (2012) - wgs84, the WGS84 Reference Ellipsoid. This is just reproduces the normal gravitational field for the reference ellipsoid. This includes the zonal coefficients up to order 20. Usually NormalGravity::WGS84() should be used instead. - grs80, the GRS80 Reference Ellipsoid. This is just reproduces the normal gravitational field for the GRS80 ellipsoid. This includes the zonal coefficients up to order 20. Usually NormalGravity::GRS80() 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. \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 \verbatim 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 uses 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. GravityModel and Gravity uses a compile time default to locate the datasets. This is - /usr/local/share/GeographicLib/gravity, for non-Windows systems - C:/ProgramData/GeographicLib/gravity, for Windows systems . consistent with the examples above. This may be overridden at run-time by defining the GEOGRAPHICLIB_GRAVITY_PATH or the GEOGRAPHICLIB_DATA environment variables; see GravityModel::DefaultGravityPath() for details. Finally, the path may be set using the optional second argument to the 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 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. 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 equatorial 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 ω 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 equatorial 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. - Cnm, 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. - Snm, 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 # https://geographiclib.sourceforge.io/html/gravity.html#gravityformat Name egm2008 Publisher National Geospatial Intelligence Agency Description Earth Gravity Model 2008 URL https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_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 The code to produce the coefficient files for the wgs84 and grs80 models is \include make-egmcof.cpp \section gravitynga Comments on the NGA harmonic synthesis code 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 β incorrectly. This leads to small errors in the deflection of the vertical, ξ and η, when the height above the ellipsoid, \e h, is non-zero (about 10−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 → ± 90°. . 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 GravityModel corrects issues 3--5. On issue 2, GravityModel neglects the 1/\e r term in \e T in GravityModel::GeoidHeight and GravityModel::SphericalAnomaly in order to produce results which match NGA's for these quantities. On the other hand, GravityModel::Disturbance and 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 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., 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 360°/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). 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 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. . NormalGravity computes the normal gravity accurately and avoids issue 3 of \ref gravitynga. Thus while 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 - ω = 7292115 × 10−11 rad s−1 - \e GM = 3986004.418 × 108 m3 s−2. . 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 g = (4πG/\e g) \e A = 8.552 × 10−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 g = 8.7 × 10−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 GravityCircle to compute the geoid height at several points on a circle of latitude. This reduces the cost per point to about 92 μs (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 3.0 GHz machine using OpenMP (-DHAVE_OPENMP=1), it takes about 10 minutes of elapsed time to compute the geoid height for EGM2008 on a 1' grid. (Without these optimizations, the computation would have taken about 50 days!) \include GeoidToGTX.cpp cmake will add in support for OpenMP for examples/GeoidToGTX.cpp, if it is available.
Back to \ref geoid. Forward to \ref normalgravity. Up to \ref contents.
**********************************************************************/ /** \page normalgravity Normal gravity
Back to \ref gravity. Forward to \ref magnetic. Up to \ref contents.
The NormalGravity class computes "normal gravity" which refers to the exact (classical) solution of an idealised system consisting of an ellipsoid of revolution with the following properties: - \e M the mass interior to the ellipsoid, - \e a the equatorial radius, - \e b the polar semi-axis, - ω the rotation rate about the polar axis. . (N.B. The mass always appears in the combination \e GM, with units m3/s2, where \e G is the gravtitational constant.) The distribution of the mass \e M within the ellipsoid is such that the surface of the ellipsoid is at a constant normal potential where the normal potential is the sum of the gravitational potential (due to the gravitational attraction) and the centrifugal potential (due to the rotation). The resulting field exterior to the ellipsoid is called normal gravity and was found by Somigliana (1929). Because the potential is constant on the ellipsoid it is sometimes referred to as the level ellipsoid. Go to - \ref normalgravcoords - \ref normalgravpot - \ref normalgravmass - \ref normalgravsurf - \ref normalgravmean - \ref normalgravj2 References: - C. Somigliana, Teoria generale del campo gravitazionale dell'ellissoide di rotazione, Mem. Soc. Astron. Ital, 4, 541--599 (1929). - 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). - B. Hofmann-Wellenhof, H. Moritz, Physical Geodesy (Second edition, Springer, 2006). https://doi.org/10.1007/978-3-211-33545-1 - H. Moritz, Geodetic Reference System 1980, J. Geodesy 54(3), 395--405 (1980). https://doi.org/10.1007/BF02521480 - H. Moritz, The Figure of the Earth (Wichmann, 1990). - M. Chasles, Solution nouvelle du problème de l’attraction d’un ellipsoïde hétérogène sur un point exterieur, Jour. Liouville 5, 465--488 (1840), Note 2. http://sites.mathdoc.fr/JMPA/PDF/JMPA_1840_1_5_A41_0.pdf \section normalgravcoords Ellipsoidal coordinates Two set of formulas are presented: those of Heiskanen and Moritz (1967) which are applicable to an oblate ellipsoid and a second set where the variables are distinguished with primes which apply to a prolate ellipsoid. The primes are omitted from those variables which are the same in the two cases. In the text, the parenthetical "alt." clauses apply to prolate ellipsoids. Cylindrical coordinates \f$ R,Z \f$ are expressed in terms of ellipsoidal coordinates \f[ \begin{align} R &= \sqrt{u^2 + E^2} \cos\beta = u' \cos\beta,\\ Z &= u \sin\beta = \sqrt{u'^2 + E'^2} \sin\beta, \end{align} \f] where \f[ \begin{align} E^2 = a^2 - b^2,&{} \qquad u^2 = u'^2 + E'^2,\\ E'^2 = b^2 - a^2,&{} \qquad u'^2 = u^2 + E^2. \end{align} \f] Surfaces of constant \f$ u \f$ (or \f$ u' \f$) are confocal ellipsoids. The surface \f$ u = 0 \f$ (alt. \f$ u' = 0 \f$) corresponds to the focal disc of diameter \f$ 2E \f$ (alt. focal rod of length \f$ 2E' \f$). The level ellipsoid is given by \f$ u = b \f$ (alt. \f$ u' = a \f$). On the level ellipsoid, \f$ \beta \f$ is the familiar parametric latitude. In writing the potential and the gravity, it is useful to introduce the functions \f[ \begin{align} Q(z) &= \frac1{2z^3} \biggl[\biggl(1 + \frac3{z^2}\biggr)\tan^{-1}z - \frac3z\biggr],\\ Q'(z') &= \frac{(1+z'^2)^{3/2}}{2z'^3} \biggl[\biggl(2 + \frac3{z'^2}\biggr)\sinh^{-1}z' - \frac{3\sqrt{1+z'^2}}{z'}\biggr],\\ H(z) &= \biggl(3Q(z)+z\frac{dQ(z)}{dz}\biggr)(1+z^2)\\ &= \frac1{z^4}\biggl[3(1+z^2) \biggl(1-\frac{\tan^{-1}z}z\biggr)-z^2\biggr],\\ H'(z') &= \frac{3Q'(z')}{1+z'^2}+z'\frac{dQ'(z')}{dz'}\\ &= \frac{1+z'^2}{z'^4} \biggl[3\biggl(1-\frac{\sqrt{1+z'^2}\sinh^{-1}z'}{z'}\biggr) +z'^2\biggr]. \end{align} \f] The function arguments are \f$ z = E/u \f$ (alt. \f$ z' = E'/u' \f$) and the unprimed and primed quantities are related by \f[ \begin{align} Q'(z') = Q(z),&{} \qquad H'(z') = H(z),\\ z'^2 = -\frac{z^2}{1 + z^2},&{} \qquad z^2 = -\frac{z'^2}{1 + z'^2}. \end{align} \f] The functions \f$ q(u) \f$ and \f$ q'(u) \f$ used by Heiskanen and Moritz are given by \f[ q(u) = \frac{E^3}{u^3}Q\biggl(\frac Eu\biggr),\qquad q'(u) = \frac{E^2}{u^2}H\biggl(\frac Eu\biggr). \f] The functions \f$ Q(z) \f$, \f$ Q'(z') \f$, \f$ H(z) \f$, and \f$ H'(z') \f$ are more convenient for use in numerical codes because they are finite in the spherical limit \f$ E \rightarrow 0 \f$, i.e., \f$ Q(0) = Q'(0) = \frac2{15} \f$, and \f$ H(0) = H'(0) = \frac25 \f$. \section normalgravpot The normal potential The normal potential is the sum of three components, a mass term, a quadrupole term and a centrifugal term, \f[ U = U_m + U_q + U_r. \f] The mass term is \f[ U_m = \frac {GM}E \tan^{-1}\frac Eu = \frac {GM}{E'} \sinh^{-1}\frac{E'}{u'}; \f] the quadrupole term is \f[ \begin{align} U_q &= \frac{\omega^2}2 \frac{a^2 b^3}{u^3} \frac{Q(E/u)}{Q(E/b)} \biggl(\sin^2\beta-\frac13\biggr)\\ &= \frac{\omega^2}2 \frac{a^2 b^3}{(u'^2+E'^2)^{3/2}} \frac{Q'(E'/u')}{Q'(E'/a)} \biggl(\sin^2\beta-\frac13\biggr); \end{align} \f] finally, the rotational term is \f[ U_r = \frac{\omega^2}2 R^2 = \frac{\omega^2}2 (u^2 + E^2) \cos^2\beta = \frac{\omega^2}2 u'^2 \cos^2\beta. \f] \f$ U_m \f$ and \f$ U_q \f$ are both gravitational potentials (due to mass within the ellipsoid). The total mass contributing to \f$ U_m \f$ is \f$ M \f$; the total mass contributing to \f$ U_q \f$ vanishes (far from the ellipsoid, the \f$ U_q \f$ decays inversely as the cube of the distance). \f$ U_m \f$ and \f$ U_q + U_r \f$ are separately both constant on the level ellipsoid. \f$ U_m \f$ is the normal potential for a massive non-rotating ellipsoid. \f$ U_q + U_r \f$ is the potential for a massless rotating ellipsoid. Combining all the terms, \f$ U \f$ is the normal potential for a massive rotating ellipsoid. The figure shows normal gravity for the case \f$ GM = 1 \f$, \f$ a = 1 \f$, \f$ b = 0.8 \f$, \f$ \omega = 0.3 \f$. The level ellipsoid is shown in red. Contours of constant gravity potential are shown in blue; the contour spacing is constant outside the ellipsoid and equal to 1/20 of the difference between the potentials on the ellipsoid and at the geostationary point (\f$ R = 2.2536 \f$, \f$ Z = 0 \f$); inside the ellipsoid the contour spacing is 5 times greater. The green lines are stream lines for the gravity; these are spaced at intervals of 10° in parametric latitude on the surface of the ellipsoid. The normal gravity is continued into the level ellipsoid under the assumption that the mass is concentrated on the focal disc, shown in black. \image html normal-gravity-potential-1.svg "Normal gravity" \section normalgravmass The mass distribution Typically, the normal potential, \f$ U \f$, is only of interest for outside the ellipsoid \f$ u \ge b \f$ (alt. \f$ u' \ge a \f$). In planetary applications, an open problem is finding a mass distribution which is in hydrostatic equilibrium (the mass density is non-negative and a non-decreasing function of the potential interior to the ellipsoid). However it is possible to give singular mass distributions consistent with the normal potential. For a non-rotating body, the potential \f$ U = U_m \f$ is generated by a sandwiching the mass \f$ M \f$ uniformly between the level ellipsoid with semi-axes \f$ a \f$ and \f$ b \f$ and a close similar ellipsoid with semi-axes \f$ (1-\epsilon)a \f$ and \f$ (1-\epsilon)b \f$. Chasles (1840) extends a theorem of Newton to show that the field interior to such an ellipsoidal shell vanishes. Thus the potential on the ellipsoid is constant, i.e., it is indeed a level ellipsoid. This result also holds for a non-rotating triaxial ellipsoid. Observing that \f$ U_m \f$ and \f$ U_q \f$ as defined above obey \f$ \nabla^2 U_m = \nabla^2 U_q = 0 \f$ everywhere for \f$ u > 0 \f$ (alt. \f$ u' > 0 \f$), we see that these potentials correspond to masses concentrated at \f$ u = 0 \f$ (alt. \f$ u' = 0 \f$). In the oblate case, \f$ U_m \f$ is generated by a massive disc at \f$ Z = 0 \f$, \f$ R < E \f$, with mass density (mass per unit area) \f$ \rho_m \f$ and moments of inertia about the equatorial (resp. polar) axis of \f$ A_m \f$ (resp. \f$ C_m \f$) given by \f[ \begin{align} \rho_m &= \frac M{2\pi E\sqrt{E^2 - R^2}},\\ A_m &= \frac {ME^2}3, \\ C_m &= \frac {2ME^2}3, \\ C_m-A_m &= \frac {ME^2}3. \end{align} \f] This mass distribution is the same as that produced by projecting a uniform spheric shell of mass \f$ M \f$ and radius \f$ E \f$ onto the equatorial plane. In the prolate case, \f$ U_m \f$ is generated by a massive rod at \f$ R = 0 \f$, \f$ Z < E' \f$ and now the mass density \f$ \rho'_m \f$ has units mass per unit length, \f[ \begin{align} \rho'_m &= \frac M{2E'},\\ A_m &= \frac {ME'^2}3, \\ C_m &= 0, \\ C_m-A_m &= -\frac {ME'^2}3. \end{align} \f] This mass distribution is the same as that produced by projecting a uniform spheric shell of mass \f$ M \f$ and radius \f$ E' \f$ onto the polar axis. Similarly, \f$ U_q \f$ is generated in the oblate case by \f[ \begin{align} \rho_q &= \frac{a^2 b^3 \omega^2}G \frac{2E^2 - 3R^2}{6\pi E^5 \sqrt{E^2 - R^2} Q(E/b)}, \\ A_q &= -\frac{a^2 b^3 \omega^2}G \frac2{45\,Q(E/b)}, \\ C_q &= -\frac{a^2 b^3 \omega^2}G \frac4{45\,Q(E/b)}, \\ C_q-A_q &= -\frac{a^2 b^3 \omega^2}G \frac2{45\,Q(E/b)}. \end{align} \f] The corresponding results for a prolate ellipsoid are \f[ \begin{align} \rho_q' &= \frac{a^2 b^3 \omega^2}G \frac{3Z^2 - E'^2}{12\,E'^5 Q'(E'/a)}, \\ A_q &= \frac{a^2 b^3 \omega^2}G \frac2{45\,Q'(E'/a)}, \\ C_q &= 0, \\ C_q-A_q &= -\frac{a^2 b^3 \omega^2}G \frac2{45\,Q'(E'/a)}. \end{align} \f] Summing up the mass and quadrupole terms, we have \f[ \begin{align} A &= A_m + A_q, \\ C &= C_m + C_q, \\ J_2 & = \frac{C - A}{Ma^2}, \end{align} \f] where \f$ J_2 \f$ is the dynamical form factor. \section normalgravsurf The surface gravity Each term in the potential contributes to the gravity on the surface of the ellipsoid \f[ \gamma = \gamma_m + \gamma_q + \gamma_r; \f] These are the components of gravity normal to the ellipsoid and, by convention, \f$ \gamma \f$ is positive downwards. The tangential components of the total gravity and that due to \f$ U_m \f$ vanish. Those tangential components of the gravity due to \f$ U_q \f$ and \f$ U_r \f$ cancel one another. The gravity \f$ \gamma \f$ has the following dependence on latitude \f[ \begin{align} \gamma &= \frac{b\gamma_a\cos^2\beta + a\gamma_b\sin^2\beta} {\sqrt{b^2\cos^2\beta + a^2\sin^2\beta}}\\ &= \frac{a\gamma_a\cos^2\phi + b\gamma_b\sin^2\phi} {\sqrt{a^2\cos^2\phi + b^2\sin^2\phi}}, \end{align} \f] and the individual components, \f$ \gamma_m \f$, \f$ \gamma_q \f$, and \f$ \gamma_r \f$, have the same dependence on latitude. The equatorial and polar gravities are \f[ \begin{align} \gamma_a &= \gamma_{ma} + \gamma_{qa} + \gamma_{ra},\\ \gamma_b &= \gamma_{mb} + \gamma_{qb} + \gamma_{rb}, \end{align} \f] where \f[ \begin{align} \gamma_{ma} &= \frac{GM}{ab},\qquad \gamma_{mb} = \frac{GM}{a^2},\\ \gamma_{qa} &= -\frac{\omega^2 a}6 \frac{H(E/b)}{Q(E/b)} = -\frac{\omega^2 a}6 \frac{H'(E'/a)}{Q'(E'/a)},\\ \gamma_{qb} &= -\frac{\omega^2 b}3 \frac{H(E/b)}{Q(E/b)} = -\frac{\omega^2 b}3 \frac{H'(E'/a)}{Q'(E'/a)},\\ \gamma_{ra} &= -\omega^2 a,\qquad \gamma_{rb} = 0. \end{align} \f] \section normalgravmean The mean gravity Performing an average of the surface gravity over the area of the ellipsoid gives \f[ \langle \gamma \rangle = \frac {4\pi a^2 b}A \biggl(\frac{2\gamma_a}{3a} + \frac{\gamma_b}{3b}\biggr), \f] where \f$ A \f$ is the area of the ellipsoid \f[ \begin{align} A &= 2\pi\biggl( a^2 + ab\frac{\sinh^{-1}(E/b)}{E/b} \biggr)\\ &= 2\pi\biggl( a^2 + b^2\frac{\tan^{-1}(E'/a)}{E'/a} \biggr). \end{align} \f] The contributions to the mean gravity are \f[ \begin{align} \langle \gamma_m \rangle &= \frac{4\pi}A GM, \\ \langle \gamma_q \rangle &= 0 \quad \text{(as expected)}, \\ \langle \gamma_r \rangle &= -\frac{4\pi}A \frac{2\omega^2 a^2b}3,\\ \end{align} \f] resulting in \f[ \langle \gamma \rangle = \frac{4\pi}A \biggl(GM - \frac{2\omega^2 a^2b}3\biggr). \f] \section normalgravj2 Possible values of the dynamical form factor The solution for the normal gravity is well defined for arbitrary \f$ M \f$, \f$ \omega \f$, \f$ a > 0\f$, and \f$ f < 1 \f$. (Note that arbitrary oblate and prolate ellipsoids are possible, although hydrostatic equilibrium would not result in a prolate ellipsoid.) However, it is much easier to measure the dynamical form factor \f$ J_2 \f$ (from the motion of artificial satellites) than the flattening \f$ f \f$. (Note too that \f$ GM \f$ is typically measured from from satellite or astronomical observations and so it includes the mass of the atmosphere.) So a question for the software developer is: given values of \f$ M > 0\f$, \f$ \omega \f$, and \f$ a > 0 \f$, what are the allowed values of \f$ J_2 \f$? We restrict the question to \f$ M > 0 \f$. The (unphysical) case \f$ M = 0 \f$ is problematic because \f$ M \f$ appears in the denominator in the definition of \f$ J_2 \f$. In the (also unphysical) case \f$ M < 0 \f$, a given \f$ J_2 \f$ can result from two distinct values of \f$ f \f$. Holding \f$ M > 0\f$, \f$ \omega \f$, and \f$ a > 0 \f$ fixed and varying \f$ f \f$ from \f$ -\infty \f$ to \f$ 1 \f$, we find that \f$ J_2 \f$ monotonically increases from \f$ -\infty \f$ to \f[ \frac13 - \frac8{45\pi} \frac{\omega^2 a^3}{GM}. \f] Thus any value of \f$ J_2 \f$ less that this value is permissible (but some of these values may be unphysical). In obtaining this limiting value, we used the result \f$ Q(z \rightarrow \infty) \rightarrow \pi/(4 z^3) \f$. The value \f[ J_2 = -\frac13 \frac{\omega^2 a^3}{GM} \f] results in a sphere (\f$ f = 0 \f$).
Back to \ref gravity. Forward to \ref magnetic. Up to \ref contents.
**********************************************************************/ /** \page magnetic Magnetic models
Back to \ref normalgravity. Forward to \ref geodesic. Up to \ref contents.
GeographicLib can compute the earth's magnetic field by a magnetic model using the MagneticModel and 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 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. - wmm2015v2, the World Magnetic Model 2015, which approximates the main magnetic field for the period 2015--2020. - wmm2015, a deprecated version of wmm2015v2. - wmm2020, the World Magnetic Model 2020, which approximates the main magnetic field for the period 2020--2025. - igrf11, the International Geomagnetic Reference Field (11th generation), which approximates the main magnetic field for the period 1900--2015. - igrf12, the International Geomagnetic Reference Field (12th generation), which approximates the main magnetic field for the period 1900--2020. - igrf13, the International Geomagnetic Reference Field (13th generation), which approximates the main magnetic field for the period 1900--2025. - emm2010, the Enhanced Magnetic Model 2010, which approximates the main and crustal magnetic fields for the period 2010--2015. - emm2015, the Enhanced Magnetic Model 2015, which approximates the main and crustal magnetic fields for the period 2000--2020. - emm2017, the Enhanced Magnetic Model 2017, which approximates the main and crustal magnetic fields for the period 2000--2022. 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)
wmm2015
12
2015--2020
3
link (2)
link (300)
link (2)
wmm2015v2
12
2015--2020
3
link (2)
link (300)
link (2)
wmm2020
12
2020--2025
3
link (2)
link (1390)
link (2)
igrf11
13
1900--2015
25
link (7)
link (310)
link (8)
igrf12
13
1900--2020
26
link (7)
link (310)
link (8)
igrf13
13
1900--2025
28
link (7)
link (1420)
link (8)
emm2010
739
2010--2015
4400
link (3700)
link (3000)
link (4100)
emm2015
729
2000--2020
4300
link (660)
link (990)
link (1030)
emm2017
790
2000--2022
5050
link (1740)
link (1700)
link (2750)
The "size" column is the size of the uncompressed data. N.B., the wmm2015 model is deprecated; use wmm2015v2 instead. 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 # install all available models 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 \verbatim 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 uses 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 wmm2020.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. MagneticModel and MagneticField uses a compile time default to locate the datasets. This is - /usr/local/share/GeographicLib/magnetic, for non-Windows systems - C:/ProgramData/GeographicLib/magnetic, for Windows systems . consistent with the examples above. This may be overridden at run-time by defining the GEOGRAPHICLIB_MAGNETIC_PATH or the GEOGRAPHIC_DATA environment variables; see MagneticModel::DefaultMagneticPath() for details. Finally, the path may be set using the optional second argument to the 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 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 "2"). 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. 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. WMM2020 consists of a single model giving the magnetic field and its time variation at 2020. IGRF12 consists of 24 models for 1900 thru 2015 at 5 year intervals. The time variation is given only for the last model to allow extrapolation beyond 2015. For dates prior to 2015, linear interpolation is used. - NumConstants (default 0), the number of time-independent terms; this can be 0 or 1. This keyword was introduced in format version 2 (GeographicLib version 1.43) to support the EMM2015 and later models. This model includes long wavelength time-varying components of degree 15. This is supplemented by a short wavelength time-independent component with much higher degree. - 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. . 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. - Cnm, 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. - Snm, 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 # https://geographiclib.sourceforge.io/html/magnetic.html#magneticformat Name igrf11 Description International Geomagnetic Reference Field 11th Generation URL https://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 normalgravity. Forward to \ref geodesic. Up to \ref contents.
**********************************************************************/ /** \page geodesic Geodesics on an ellipsoid of revolution
Back to \ref magnetic. Forward to \ref nearest. Up to \ref contents.
Geodesic and GeodesicLine provide accurate solutions to the direct and inverse geodesic problems. The GeodSolve utility provides an interface to these classes. AzimuthalEquidistant implements the azimuthal equidistant projection in terms of geodesics. CassiniSoldner implements a transverse cylindrical equidistant projection in terms of geodesics. The GeodesicProj utility provides an interface to these projections. The algorithms used by Geodesic and GeodesicLine are based on a Taylor expansion of the geodesic integrals valid when the flattening \e f is small. GeodesicExact and GeodesicLineExact evaluate the integrals exactly (in terms of incomplete elliptic integrals). For the WGS84 ellipsoid, the series solutions are about 2--3 times faster and 2--3 times more accurate (because it's easier to control round-off errors with series solutions); thus Geodesic and GeodesicLine are recommended for most geodetic applications. However, in applications where the absolute value of \e f is greater than about 0.02, the exact classes should be used. Go to - \ref testgeod - \ref geodseries - \ref geodellip - \ref meridian - \ref geodshort . For some background information on geodesics on triaxial ellipsoids, see \ref triaxial. 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). DOI: 10.1179/003962689791474267 - C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43--55 (2013); DOI: 10.1007/s00190-012-0578-z; addenda: geod-addenda.html; resource page: geod.html. - A collection of some papers on geodesics is available at https://geographiclib.sourceforge.io/geodesic-papers/biblio.html - The wikipedia page, Geodesics on an ellipsoid. \section testgeod Test data for geodesics A test set a geodesics is available at - GeodTest.dat.gz - C. F. F. Karney, Test set for geodesics (2010),
DOI: 10.5281/zenodo.32156. . 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 at point 1, \e lat1 (degrees, exact) - longitude at point 1, \e lon1 (degrees, always 0) - azimuth at point 1, \e azi1 (clockwise from north in degrees, exact) - latitude at point 2, \e lat2 (degrees, accurate to 10−18 deg) - longitude at point 2, \e lon2 (degrees, accurate to 10−18 deg) - azimuth at 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 ≤ 180°, 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 [0°, 90°], \e lon1 is taken to be zero, \e azi1 is chosen in [0°, 180°]. Furthermore, \e lat1 and \e azi1 are taken to be multiples of 10−12 deg and \e s12 is a multiple of 0.1 μm in [0 m, 20003931.4586254 m]. This results in \e lon2 in [0°, 180°] and \e azi2 in [0°, 180°]. 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 = 90°) - 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 GeodSolve utility as follows - Direct from point 1: \verbatim gunzip -c GeodTest.dat.gz | cut -d' ' -f1,2,3,7 | ./GeodSolve \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/" | ./GeodSolve \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 | ./GeodSolve -i \endverbatim This should yield columns 3, 6, 7, and 9 of the test set. . Add, e.g., "-p 6", to the call to GeodSolve to change the precision of the output. Adding "-f" causes GeodSolve 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. Code for computing arbitrarily accurate geodesics in maxima is available in geodesic.mac (this depends on ellint.mac and uses the series computed by geod.mac). This solve both the direct and inverse geodesic problems and offers the ability to solve the problems either using series expansions (similar to Geodesic) or in terms of elliptic integrals (similar to GeodesicExact). \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 GEOGRAPHICLIB_GEODESIC_ORDER can be used to select an order from 3 thru 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 = f3) 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 - \f$ \alpha \f$ is the azimuth - \f$ \alpha_0 \f$ is the azimuth at the equator crossing - \f$ \lambda \f$ is the longitude measured from the equator crossing - \f$ \sigma \f$ is the spherical arc length - \f$ \omega = \tan^{-1}(\sin\alpha_0\tan\sigma) \f$ is the spherical longitude - \f$ a \f$ is the equatorial radius - \f$ b \f$ is the polar semi-axis - \f$ f \f$ is the flattening - \f$ e^2 = f(2 - f) \f$ - \f$ e'^2 = e^2/(1-e^2) \f$ - \f$ k^2 = e'^2 \cos^2\alpha_0 = 4 \epsilon / (1 - \epsilon)^2 \f$ - \f$ n = f / (2 - f) \f$ - \f$ c^2 = a^2/2 + b^2/2 (\tanh^{-1}e)/e \f$ - \e ep2 = \f$ e'^2 \f$ - \e k2 = \f$ k^2 \f$ - \e eps = \f$ \epsilon = k^2 / (\sqrt{1 + k^2} + 1)^2\f$ The formula for distance is \f[ \frac sb = I_1(\sigma) \f] where \f[ \begin{align} I_1(\sigma) &= A_1\bigl(\sigma + B_1(\sigma)\bigr) \\ B_1(\sigma) &= \sum_{j=1} C_{1j} \sin 2j\sigma \end{align} \f] 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 \f$ \tau(\sigma) = s/(b A_1) = \sigma + B_1(\sigma) \f$ may be inverted by series reversion giving \f[ \sigma(\tau) = \tau + \sum_{j=1} C'_{1j} \sin 2j\sigma \f] 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 \f[ \begin{align} \frac mb &= \sqrt{1 + k^2 \sin^2\sigma_2} \cos\sigma_1 \sin\sigma_2 \\ &\quad {}-\sqrt{1 + k^2 \sin^2\sigma_1} \sin\sigma_1 \cos\sigma_2 \\ &\quad {}-\cos\sigma_1 \cos\sigma_2 \bigl(J(\sigma_2) - J(\sigma_1)\bigr) \end{align} \f] where \f[ \begin{align} J(\sigma) &= I_1(\sigma) - I_2(\sigma) \\ I_2(\sigma) &= A_2\bigl(\sigma + B_2(\sigma)\bigr) \\ B_2(\sigma) &= \sum_{j=1} C_{2j} \sin 2j\sigma \end{align} \f] \verbatim A2 = (1 - 3/4 * eps^2 - 7/64 * eps^4 - 11/256 * eps^6 - 375/16384 * eps^8 - 931/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 \f[ \lambda = \omega - f \sin\alpha_0 I_3(\sigma) \f] where \f[ \begin{align} I_3(\sigma) &= A_3\bigl(\sigma + B_3(\sigma)\bigr) \\ B_3(\sigma) &= \sum_{j=1} C_{3j} \sin 2j\sigma \end{align} \f] 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. 6 of Algorithms for geodesics in terms of \e S, \f[ S = c^2 \alpha + e^2 a^2 \cos\alpha_0 \sin\alpha_0 I_4(\sigma) \f] where \f[ I_4(\sigma) = \sum_{j=0} C_{4j} \cos(2j+1)\sigma \f] In the paper, this was expanded in \f$ e'^2 \f$ and \f$ k^2 \f$. However, the series converges faster for eccentric ellipsoids if the expansion is in \f$ n \f$ and \f$ \epsilon \f$. The series to order \f$ f^{10} \f$ becomes \verbatim C4[0] = + (2/3 - 4/15*n + 8/105*n^2 + 4/315*n^3 + 16/3465*n^4 + 20/9009*n^5 + 8/6435*n^6 + 28/36465*n^7 + 32/62985*n^8 + 4/11305*n^9) - (1/5 - 16/35*n + 32/105*n^2 - 16/385*n^3 - 64/15015*n^4 - 16/15015*n^5 - 32/85085*n^6 - 112/692835*n^7 - 128/1616615*n^8) * eps - (2/105 + 32/315*n - 1088/3465*n^2 + 1184/5005*n^3 - 128/3465*n^4 - 3232/765765*n^5 - 1856/1616615*n^6 - 6304/14549535*n^7) * eps^2 + (11/315 - 368/3465*n - 32/6435*n^2 + 976/4095*n^3 - 154048/765765*n^4 + 368/11115*n^5 + 5216/1322685*n^6) * eps^3 + (4/1155 + 1088/45045*n - 128/1287*n^2 + 64/3927*n^3 + 2877184/14549535*n^4 - 370112/2078505*n^5) * eps^4 + (97/15015 - 464/45045*n + 4192/153153*n^2 - 88240/969969*n^3 + 31168/1322685*n^4) * eps^5 + (10/9009 + 4192/765765*n - 188096/14549535*n^2 + 23392/855855*n^3) * eps^6 + (193/85085 - 6832/2078505*n + 106976/14549535*n^2) * eps^7 + (632/1322685 + 3456/1616615*n) * eps^8 + 107/101745 * eps^9; C4[1] = + (1/45 - 16/315*n + 32/945*n^2 - 16/3465*n^3 - 64/135135*n^4 - 16/135135*n^5 - 32/765765*n^6 - 112/6235515*n^7 - 128/14549535*n^8) * eps - (2/105 - 64/945*n + 128/1485*n^2 - 1984/45045*n^3 + 256/45045*n^4 + 64/109395*n^5 + 128/855855*n^6 + 2368/43648605*n^7) * eps^2 - (1/105 - 16/2079*n - 5792/135135*n^2 + 3568/45045*n^3 - 103744/2297295*n^4 + 264464/43648605*n^5 + 544/855855*n^6) * eps^3 + (4/1155 - 2944/135135*n + 256/9009*n^2 + 17536/765765*n^3 - 3053056/43648605*n^4 + 1923968/43648605*n^5) * eps^4 + (1/9009 + 16/19305*n - 2656/153153*n^2 + 65072/2078505*n^3 + 526912/43648605*n^4) * eps^5 + (10/9009 - 1472/459459*n + 106112/43648605*n^2 - 204352/14549535*n^3) * eps^6 + (349/2297295 + 28144/43648605*n - 32288/8729721*n^2) * eps^7 + (632/1322685 - 44288/43648605*n) * eps^8 + 43/479655 * eps^9; C4[2] = + (4/525 - 32/1575*n + 64/3465*n^2 - 32/5005*n^3 + 128/225225*n^4 + 32/765765*n^5 + 64/8083075*n^6 + 32/14549535*n^7) * eps^2 - (8/1575 - 128/5775*n + 256/6825*n^2 - 6784/225225*n^3 + 4608/425425*n^4 - 128/124355*n^5 - 5888/72747675*n^6) * eps^3 - (8/1925 - 1856/225225*n - 128/17325*n^2 + 42176/1276275*n^3 - 2434816/72747675*n^4 + 195136/14549535*n^5) * eps^4 + (8/10725 - 128/17325*n + 64256/3828825*n^2 - 128/25935*n^3 - 266752/10392525*n^4) * eps^5 - (4/25025 + 928/3828825*n + 292288/72747675*n^2 - 106528/6613425*n^3) * eps^6 + (464/1276275 - 17152/10392525*n + 83456/72747675*n^2) * eps^7 + (1168/72747675 + 128/1865325*n) * eps^8 + 208/1119195 * eps^9; C4[3] = + (8/2205 - 256/24255*n + 512/45045*n^2 - 256/45045*n^3 + 1024/765765*n^4 - 256/2909907*n^5 - 512/101846745*n^6) * eps^3 - (16/8085 - 1024/105105*n + 2048/105105*n^2 - 1024/51051*n^3 + 4096/373065*n^4 - 1024/357357*n^5) * eps^4 - (136/63063 - 256/45045*n + 512/1072071*n^2 + 494336/33948915*n^3 - 44032/1996995*n^4) * eps^5 + (64/315315 - 16384/5360355*n + 966656/101846745*n^2 - 868352/101846745*n^3) * eps^6 - (16/97461 + 14848/101846745*n + 74752/101846745*n^2) * eps^7 + (5024/33948915 - 96256/101846745*n) * eps^8 - 1744/101846745 * eps^9; C4[4] = + (64/31185 - 512/81081*n + 1024/135135*n^2 - 512/109395*n^3 + 2048/1247103*n^4 - 2560/8729721*n^5) * eps^4 - (128/135135 - 2048/405405*n + 77824/6891885*n^2 - 198656/14549535*n^3 + 8192/855855*n^4) * eps^5 - (512/405405 - 2048/530145*n + 299008/130945815*n^2 + 280576/43648605*n^3) * eps^6 + (128/2297295 - 2048/1438965*n + 241664/43648605*n^2) * eps^7 - (17536/130945815 + 1024/43648605*n) * eps^8 + 2944/43648605 * eps^9; C4[5] = + (128/99099 - 2048/495495*n + 4096/765765*n^2 - 6144/1616615*n^3 + 8192/4849845*n^4) * eps^5 - (256/495495 - 8192/2807805*n + 376832/53348295*n^2 - 8192/855855*n^3) * eps^6 - (6784/8423415 - 432128/160044885*n + 397312/160044885*n^2) * eps^7 + (512/53348295 - 16384/22863555*n) * eps^8 - 16768/160044885 * eps^9; C4[6] = + (512/585585 - 4096/1422135*n + 8192/2078505*n^2 - 4096/1322685*n^3) * eps^6 - (1024/3318315 - 16384/9006855*n + 98304/21015995*n^2) * eps^7 - (103424/189143955 - 8192/4203199*n) * eps^8 - 1024/189143955 * eps^9; C4[7] = + (1024/1640925 - 65536/31177575*n + 131072/43648605*n^2) * eps^7 - (2048/10392525 - 262144/218243025*n) * eps^8 - 84992/218243025 * eps^9; C4[8] = + (16384/35334585 - 131072/82447365*n) * eps^8 - 32768/247342095 * eps^9; C4[9] = + 32768/92147055 * eps^9; \endverbatim \section geodellip Geodesics in terms of elliptic integrals GeodesicExact and GeodesicLineExact solve the geodesic problem using elliptic integrals. The formulation of geodesic in terms of incomplete elliptic integrals is given in - C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint arxiv:1102.1215v1. . It is most convenient to use the form derived for a prolate ellipsoid in Appendix D. For an oblate ellipsoid this results in elliptic integrals with an imaginary modulus. However, the integrals themselves are real and the algorithms used to compute the elliptic integrals handles the case of an imaginary modulus using real arithmetic. The key relations used by GeographicLib are \f[ \begin{align} \frac sb &= E(\sigma, ik), \\ \lambda &= (1 - f) \sin\alpha_0 G(\sigma, \cos^2\alpha_0, ik) \\ &= \chi - \frac{e'^2}{\sqrt{1+e'^2}}\sin\alpha_0 H(\sigma, -e'^2, ik), \\ J(\sigma) &= k^2 D(\sigma, ik), \end{align} \f] where \f$ \chi \f$ is a modified spherical longitude given by \f[ \tan\chi = \sqrt{\frac{1+e'^2}{1+k^2\sin^2\sigma}}\tan\omega, \f] and \f[ \begin{align} D(\phi,k) &= \int_0^\phi \frac{\sin^2\theta}{\sqrt{1 - k^2\sin^2\theta}}\,d\theta\\ &=\frac{F(\phi, k) - E(\phi, k)}{k^2},\\ G(\phi,\alpha^2,k) &= \int_0^\phi \frac{\sqrt{1 - k^2\sin^2\theta}}{1 - \alpha^2\sin^2\theta}\,d\theta\\ &=\frac{k^2}{\alpha^2}F(\phi, k) +\biggl(1-\frac{k^2}{\alpha^2}\biggr)\Pi(\phi, \alpha^2, k),\\ H(\phi, \alpha^2, k) &= \int_0^\phi \frac{\cos^2\theta}{(1-\alpha^2\sin^2\theta)\sqrt{1-k^2\sin^2\theta}} \,d\theta \\ &= \frac1{\alpha^2} F(\phi, k) + \biggl(1 - \frac1{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k), \end{align} \f] and \f$F(\phi, k)\f$, \f$E(\phi, k)\f$, \f$D(\phi, k)\f$, and \f$\Pi(\phi, \alpha^2, k)\f$, are incomplete elliptic integrals (see https://dlmf.nist.gov/19.2.ii). The formula for \f$ s \f$ and the first expression for \f$ \lambda \f$ are given by Legendre (1811) and are the most common representation of geodesics in terms of elliptic integrals. The second (equivalent) expression for \f$ \lambda \f$, which was given by Cayley (1870), is useful in that the elliptic integral is relegated to a small correction term. This form allows the longitude to be computed more accurately and is used in GeographicLib. (The equivalence of the two expressions for \f$ \lambda \f$ follows from https://dlmf.nist.gov/19.7.E8.) Nominally, GeodesicExact and GeodesicLineExact will give "exact" results for any value of the flattening. However, the geographic latitude is a distorted measure of distance from the equator with very eccentric ellipsoids and this introducing an irreducible representational error in the algorithms in this case. It is therefore recommended to restrict the use of these classes to b/\e a ∈ [0.01, 100] or \e f ∈ [−99, 0.99]. Note that GeodesicExact still uses a series expansion for the area \e S12. However the series is taken out to 30th order and gives accurate results for b/\e a ∈ [1/2, 2]; the accuracy is about 8 decimal digits for b/\e a ∈ [1/4, 4]. Additional work planned for this aspect of the geodesic problem: - formulate the area integral \e S12 in terms of elliptic integrals; - generate accurate test geodesics for highly eccentric ellipsoids so that the roundoff errors can be quantified. Thomas (1952) and Rollins (2010) use a different independent variable for geodesics, \f$\theta\f$ instead of \f$\sigma\f$, where \f$ \tan\theta = \sqrt{1 + k^2} \tan\sigma \f$. The corresponding expressions for \f$ s \f$ and \f$ \lambda \f$ are given here for completeness: \f[ \begin{align} \frac sb &= \sqrt{1-k'^2} \Pi(\theta, k'^2, k'), \\ \lambda &= (1-f) \sqrt{1-k'^2} \sin\alpha_0 \Pi(\theta, k'^2/e^2, k'), \end{align} \f] where \f$ k' = k/\sqrt{1 + k^2} \f$. The expression for \f$ s \f$ can be written in terms of elliptic integrals of the second kind and Cayley's technique can be used to subtract out the leading order behavior of \f$ \lambda \f$ to give \f[ \begin{align} \frac sb &=\frac1{\sqrt{1-k'^2}} \biggl( E(\theta, k') - \frac{k'^2 \sin\theta \cos\theta}{\sqrt{1-k'^2\sin^2\theta}} \biggr), \\ \lambda &= \psi + (1-f) \sqrt{1-k'^2} \sin\alpha_0 \bigl( F(\theta, k') - \Pi(\theta, e^2, k') \bigr), \end{align} \f] where \f[ \begin{align} \tan\psi &= \sqrt{\frac{1+k^2\sin^2\sigma}{1+e'^2}}\tan\omega \\ &= \sqrt{\frac{1-e^2}{1+k^2\cos^2\theta}}\sin\alpha_0\tan\theta. \end{align} \f] The tangents of the three "longitude-like" angles are in geometric progression, \f$ \tan\chi/\tan\omega = \tan\omega/\tan\psi \f$. \section meridian Parameters for the meridian The formulas for \f$ s \f$ given in the previous section are the same as those for the distance along a meridian for an ellipsoid with equatorial radius \f$ a \sqrt{1 - e^2 \sin^2\alpha_0} \f$ and polar semi-axis \f$ b \f$. Here is a list of possible ways of expressing the meridian distance in terms of elliptic integrals using the notation: - \f$ a \f$, equatorial axis, - \f$ b \f$, polar axis, - \f$ e = \sqrt{(a^2 - b^2)/a^2} \f$, eccentricity, - \f$ e' = \sqrt{(a^2 - b^2)/b^2} \f$, second eccentricity, - \f$ \phi = \mathrm{am}(u, e) \f$, the geographic latitude, - \f$ \phi' = \mathrm{am}(v', ie') = \pi/2 - \phi \f$, the geographic colatitude, - \f$ \beta = \mathrm{am}(v, ie') \f$, the parametric latitude (\f$ \tan^2\beta = (1 - e^2) \tan^2\phi \f$), - \f$ \beta' = \mathrm{am}(u', e) = \pi/2 - \beta \f$, the parametric colatitude, - \f$ M \f$, the length of a quarter meridian (equator to pole), - \f$ y \f$, the distance along the meridian (measured from the equator). - \f$ y' = M -y \f$, the distance along the meridian (measured from the pole). . The eccentricities \f$ (e, e') \f$ are real (resp. imaginary) for oblate (resp. prolate) ellipsoids. The elliptic variables \f$(u, u')\f$ and \f$(v, v')\f$ are defined by - \f$ u = F(\phi, e) ,\quad u' = F(\beta', e) \f$ - \f$ v = F(\beta, ie') ,\quad v' = F(\phi', ie') \f$, . and are linearly related by - \f$ u + u' = K(e) ,\quad v + v' = K(ie') \f$ - \f$ v = \sqrt{1-e^2} u ,\quad u = \sqrt{1+e'^2} v \f$. . The cartesian coordinates for the meridian \f$ (x, z) \f$ are given by \f[ \begin{align} x &= a \cos\beta = a \cos\phi / \sqrt{1 - e^2 \sin^2\phi} \\ &= a \sin\beta' = (a^2/b) \sin\phi' / \sqrt{1 + e'^2 \sin^2\phi'} \\ &= a \,\mathrm{cn}(v, ie) = a \,\mathrm{cd}(u, e) \\ &= a \,\mathrm{sn}(u', e) = (a^2/b) \,\mathrm{sd}(v', ie'), \end{align} \f] \f[ \begin{align} z &= b \sin\beta = (b^2/a) \sin\phi / \sqrt{1 - e^2 \sin^2\phi} \\ &= b \cos\beta' = b \cos\phi' / \sqrt{1 + e'^2 \sin^2\phi'} \\ &= b \,\mathrm{sn}(v, ie) = (b^2/a) \,\mathrm{sd}(u, e) \\ &= b \,\mathrm{cn}(u', e) = b \,\mathrm{cd}(v', ie'). \end{align} \f] The distance along the meridian can be expressed variously as \f[ \begin{align} y &= b \int \sqrt{1 + e'^2 \sin^2\beta}\, d\beta = b E(\beta, ie') \\ &= \frac{b^2}a \int \frac1{(1 - e^2 \sin^2\phi)^{3/2}}\, d\phi = \frac{b^2}a \Pi(\phi, e^2, e) \\ &= a \biggl(E(\phi, e) - \frac{e^2\sin\phi \cos\phi}{\sqrt{1 - e^2\sin^2\phi}}\biggr) \\ &= b \int \mathrm{dn}^2(v, ie')\, dv = \frac{b^2}a \int \mathrm{nd}^2(u, e)\, du = \cal E(v, ie'), \end{align} \f] \f[ \begin{align} y' &= a \int \sqrt{1 - e^2 \sin^2\beta'}\, d\beta' = a E(\beta', e) \\ &= \frac{a^2}b \int \frac1{(1 + e'^2 \sin^2\phi')^{3/2}}\, d\phi' = \frac{a^2}b \Pi(\phi', -e'^2, ie') \\ &= b \biggl(E(\phi', ie') + \frac{e'^2\sin\phi' \cos\phi'}{\sqrt{1 + e'^2\sin^2\phi'}}\biggr) \\ &= a \int \mathrm{dn}^2(u', e)\, du' = \frac{a^2}b \int \mathrm{nd}^2(v', ie')\, dv' = \cal E(u', e), \end{align} \f] with the quarter meridian distance given by \f[ M = aE(e) = bE(ie') = (b^2/a)\Pi(e^2,e) = (a^2/b)\Pi(-e'^2,ie'). \f] (Here \f$ E, F, \Pi \f$ are elliptic integrals defined in https://dlmf.nist.gov/19.2.ii. \f$ \cal E, \mathrm{am}, \mathrm{sn}, \mathrm{cn}, \mathrm{sd}, \mathrm{cd}, \mathrm{dn}, \mathrm{nd} \f$ are Jacobi elliptic functions defined in https://dlmf.nist.gov/22.2 and https://dlmf.nist.gov/22.16.) There are several considerations in the choice of independent variable for evaluate the meridian distance - The use of an imaginary modulus (namely, \f$ ie' \f$, above) is of no practical concern. The integrals are real in this case and modern methods (GeographicLib uses the method given in https://dlmf.nist.gov/19.36.i) for computing integrals handles this case using just real arithmetic. - If the "natural" origin is the equator, choose one of \f$ \phi, \beta, u, v \f$ (this might be preferred in geodesy). If it's the pole, choose one of the complementary quantities \f$ \phi', \beta', u', v' \f$ (this might be preferred by mathematicians). - Applying these formulas to the geodesic problems, \f$ \beta \f$ becomes the arc length, \f$ \sigma \f$, on the auxiliary sphere. This is the traditional method of solution used by Legendre (1806), Oriani (1806), Bessel (1825), Helmert (1880), Rainsford (1955), Thomas (1970), Vincenty (1975), Rapp (1993), and so on. Many of the solutions in terms of elliptic functions use one of the elliptic variables (\f$ u \f$ or \f$ v \f$), see, for example, Jacobi (1855), Halphen (1888), Forsyth (1896). In the context of geodesics \f$ \phi \f$ becomes Thomas' variable \f$ \theta \f$; this is used by Thomas (1952) and Rollins (2010) in their formulation of the geodesic problem (see the previous section). - For highly eccentric ellipsoids the variation of the meridian with respect to \f$ \beta \f$ is considerably "better behaved" than other choices (see the figure below). The choice of \f$ \phi \f$ is probably a poor one in this case. . GeographicLib uses the geodesic generalization of \f$ y = b E(\beta, ie') \f$, namely \f$ s = b E(\sigma, ik) \f$. See \ref geodellip. \image html meridian-measures.png "Comparison of meridian measures" \section geodshort Short geodesics Here we describe Bowring's method for solving the inverse geodesic problem in the limit of short geodesics and contrast it with the great circle solution using Bessel's auxiliary sphere. References: - B. R. Bowring, The Direct and Inverse Problems for Short Geodesic Lines on the Ellipsoid, Surveying and Mapping 41(2), 135--141 (1981). - R. H. Rapp, Geometric Geodesy, Part I, Ohio State Univ. (1991), Sec. 6.5. Bowring considers the conformal mapping of the ellipsoid to a sphere of radius \f$ R \f$ such that circles of latitude and meridians are preserved (and hence the azimuth of a line is preserved). Let \f$ (\phi, \lambda) \f$ and \f$ (\phi', \lambda') \f$ be the latitude and longitude on the ellipsoid and sphere respectively. Define isometric latitudes for the sphere and the ellipsoid as \f[ \begin{align} \psi' &= \sinh^{-1} \tan \phi', \\ \psi &= \sinh^{-1} \tan \phi - e \tanh^{-1}(e \sin\phi). \end{align} \f] The most general conformal mapping satisfying Bowring's conditions is \f[ \psi' = A \psi + K, \quad \lambda' = A \lambda, \f] where \f$ A \f$ and \f$ K \f$ are constants. (In fact a constant can be added to the equation for \f$ \lambda' \f$, but this does affect the analysis.) The scale of this mapping is \f[ m(\phi) = \frac{AR}{\nu}\frac{\cos\phi'}{\cos\phi}, \f] where \f$ \nu = a/\sqrt{1 - e^2\sin^2\phi} \f$ is the transverse radius of curvature. (Note that in Bowring's Eq. (10), \f$ \phi \f$ should be replaced by \f$ \phi' \f$.) The mapping from the ellipsoid to the sphere depends on three parameters \f$ R, A, K \f$. These will be selected to satisfy certain conditions at some representative latitude \f$ \phi_0 \f$. Two possible choices are given below. \subsection bowring Bowring's method Bowring (1981) requires that \f[ m(\phi_0) = 1,\quad \left.\frac{dm(\phi)}{d\phi}\right|_{\phi=\phi_0} = 0,\quad \left.\frac{d^2m(\phi)}{d\phi^2}\right|_{\phi=\phi_0} = 0, \f] i.e, \f$m\approx 1\f$ in the vicinity of \f$\phi = \phi_0\f$. This gives \f[ \begin{align} R &= \frac{\sqrt{1 + e'^2}}{B^2} a, \\ A &= \sqrt{1 + e'^2 \cos^4\phi_0}, \\ \tan\phi'_0 &= \frac1B \tan\phi_0, \end{align} \f] where \f$ e' = e/\sqrt{1-e^2} \f$ is the second eccentricity, \f$ B = \sqrt{1+e'^2\cos^2\phi_0} \f$, and \f$ K \f$ is defined implicitly by the equation for \f$\phi'_0\f$. The radius \f$ R \f$ is the (Gaussian) mean radius of curvature of the ellipsoid at \f$\phi_0\f$ (so near \f$\phi_0\f$ the ellipsoid can be deformed to fit the sphere snugly). The third derivative of \f$ m \f$ is given by \f[ \left.\frac{d^3m(\phi)}{d\phi^3}\right|_{\phi=\phi_0} = \frac{-2e'^2\sin2\phi_0}{B^4}. \f] The method for solving the inverse problem between two nearby points \f$ (\phi_1, \lambda_1) \f$ and \f$ (\phi_2, \lambda_2) \f$ is as follows: Set \f$\phi_0 = (\phi_1 + \phi_2)/2\f$. Compute \f$ R, A, \phi'_0 \f$, and hence find \f$ (\phi'_1, \lambda'_1) \f$ and \f$ (\phi'_2, \lambda'_2) \f$. Finally, solve for the great circle on a sphere of radius \f$ R \f$; the resulting distance and azimuths are good approximations for the corresponding quantities for the ellipsoidal geodesic. Consistent with the accuracy of this method, we can compute \f$\phi'_1\f$ and \f$\phi'_2\f$ using a Taylor expansion about \f$\phi_0\f$. This also avoids numerical errors that arise from subtracting nearly equal quantities when using the equation for \f$\phi'\f$ directly. Write \f$\Delta \phi = \phi - \phi_0\f$ and \f$\Delta \phi' = \phi' - \phi'_0\f$; then we have \f[ \Delta\phi' \approx \frac{\Delta\phi}B \biggl[1 + \frac{\Delta\phi}{B^2}\frac{e'^2}2 \biggl(3\sin\phi_0\cos\phi_0 + \frac{\Delta\phi}{B^2} \bigl(B^2 - \sin^2\phi_0(2 - 3 e'^2 \cos^2\phi_0)\bigr)\biggr)\biggr], \f] where the error is \f$O(f\Delta\phi^4)\f$. This is essentially Bowring's method. Significant differences between this result, "Bowring (improved)", compared to Bowring's paper, "Bowring (original)", are: - Bowring elects to use \f$\phi_0 = \phi_1\f$. This simplifies the calculations somewhat but increases the error by about a factor of 4. - Bowring's expression for \f$ \Delta\phi' \f$ is only accurate in the limit \f$ e' \rightarrow 0 \f$. . In fact, arguably, the highest order \f$O(f\Delta\phi^3)\f$ terms should be dropped altogether. Their inclusion does result in a better estimate for the distance. However, if your goal is to generate both accurate distances \e and accurate azimuths, then \f$\Delta\phi\f$ needs to be restricted sufficiently to allow these terms to be dropped to give the "Bowring (truncated)" method. With highly eccentric ellipsoids, the parametric latitude \f$ \beta \f$ is a better behaved independent variable to use. In this case, \f$ \phi_0 \f$ is naturally defined using \f$\beta_0 = (\beta_1 + \beta_2)/2\f$ and in terms of \f$\Delta\beta = \beta - \beta_0\f$, we have \f[ \Delta\phi' \approx \frac{\Delta\beta}{B'} \biggl[1 + \frac{\Delta\beta}{B'^2}\frac{e'^2}2 \biggl(\sin\beta_0\cos\beta_0 + \frac{\Delta\beta}{3B'^2} \bigl( \cos^2\beta_0 - \sin^2\beta_0 B'^2\bigr) \biggr)\biggr], \f] where \f$B' = \sqrt{1+e'^2\sin^2\beta_0} = \sqrt{1+e'^2}/B\f$, and the error once again is \f$O(f\Delta\phi^4)\f$. This is the "Bowring (using \f$\beta\f$)" method. \subsection auxsphere Bessel's auxiliary sphere GeographicLib's uses the auxiliary sphere method of Legendre, Bessel, and Helmert. For short geodesics, this is equivalent to picking \f$ R, A, K \f$ so that \f[ m(\phi_0) = 1,\quad \left.\frac{dm(\phi)}{d\phi}\right|_{\phi=\phi_0} = 0,\quad \tan\phi'_0 = (1 - f) \tan\phi_0. \f] Bowring's requirement that the second derivative of \f$m\f$ vanish has been replaced by the last relation which states that \f$\phi'_0 = \beta_0\f$, the parametric latitude corresponding to \f$\phi_0\f$. This gives \f[ \begin{align} R &= B'(1-f)a, \\ A &= \frac1{B'(1-f)}, \\ \left.\frac{d^2m(\phi)}{d\phi^2}\right|_{\phi=\phi_0} &= -e^2B'^2\sin^2\phi_0. \end{align} \f] Similar to Bowring's method, we can compute \f$\phi'_1\f$ and \f$\phi'_2\f$ using a Taylor expansion about \f$\beta_0\f$. This results in the simple expression \f[ \Delta\phi' \approx \Delta\beta, \f] where the error is \f$O(f\Delta\beta^2)\f$. \subsection shorterr Estimating the accuracy In assessing the accuracy of these methods we use two metrics: - The absolute error in the distance. - The consistency of the predicted azimuths. Imagine starting ellipsoidal geodesics at \f$ (\phi_1, \lambda_1) \f$ and \f$ (\phi_2, \lambda_2) \f$ with the predicted azimuths. What is the distance between them when they are extended a distance \f$ a \f$ beyond the second point? . (The second metric is much more stringent.) We may now compare the methods by asking for a bound to the length of a geodesic which ensures that the one or other of the errors fall below 1 mm (an "engineering" definition of accurate) or 1 nm (1 nanometer, about the round-off limit).
Maximum distance that can be used in various methods for computing short geodesics while keeping the errors within prescribed bounds
method
distance metric
azimuth metric
1 mm error 1 nm error 1 mm error 1 nm error
Bowring (original)
87 km
870 m
35 km
350 m
Bowring (improved)
180 km
1.8 km
58 km
580 m
Bowring (truncated)
52 km
520 m
52 km
520 m
Bowring (using \f$\beta\f$)
380 km
24 km
60 km
600 m
Bessel's aux. sphere
42 km
420 m
1.7 km
1.7 m
For example, if you're only interested in measuring distances and an accuracy of 1 mm is sufficient, then Bowring's improved method can be used for distances up to 180 km. On the other hand, GeographicLib uses Bessel's auxiliary sphere and we require both the distance and the azimuth to be accurate, so the great circle approximation can only be used for distances less than 1.7 m. The reason that GeographicLib does not use Bowring's method is that the information necessary for auxiliary sphere method is already available as part of the general solution and, as much as possible, we allow all geodesics to be computed by the general method.
Back to \ref magnetic. Forward to \ref nearest. Up to \ref contents.
**********************************************************************/ /** \page nearest Finding nearest neighbors
Back to \ref geodesic. Forward to \ref triaxial. Up to \ref contents.
The problem of finding the maritime boundary defined by the "median line" is discussed in Section 14 of - C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011; preprint arxiv:1102.1215v1. . Figure 14 shows the median line which is equidistant from Britain and mainland Europe. Determining the median line involves finding, for any given \e P, the closest points on the coast of Britain and on the coast of mainland Europe. The operation of finding the closest in a set of points is usually referred to as the nearest neighbor problem and the NearestNeighbor class implements an efficient algorithm for solving it. The NearestNeighbor class implements nearest-neighbor calculations using the vantage-point tree described by - J. K. Uhlmann, Satisfying general proximity/similarity queries with metric trees, Information Processing Letters 40 175--179 (1991). - P. N. Yianilos, Data structures and algorithms for nearest neighbor search in general metric spaces, Proc. 4th ACM-SIAM Symposium on Discrete Algorithms, (SIAM, 1993). pp. 311--321. Given a set of points \e x, \e y, \e z, …, in some space and a distance function \e d satisfying the metric conditions, \f[ \begin{align} d(x,y) &\ge 0,\\ d(x,y) &= 0, \ \text{iff $x = y$},\\ d(x,y) &= d(y,x),\\ d(x,z) &\le d(x,y) + d(y,z), \end{align} \f] the vantage-point (VP) tree provides an efficient way of determining nearest neighbors. The geodesic distance (implemented by the Geodesic class) satisfies these metric conditions, while the great ellipse distance and the rhumb line distance do not (they do not satisfy the last condition, the triangle inequality). Typically the cost of constructing a VP tree of \e N points is \e N log \e N, while the cost of a query is log \e N. Thus a VP tree should be used in situations where \e N is large and at least log \e N queries are to be made. The condition, \e N is large, means that \f$ N \gg 2^D \f$, where \e D is the dimensionality of the space. - This implementation includes Yianilos' upper and lower bounds for the inside and outside sets. This helps limit the number of searches (compared to just using the median distance). - Rather than do a depth-first or breath-first search on the tree, the nodes to be processed are put on a priority queue with the nodes most likely to contain close points processed first. Frequently, this allows nodes lower down on the priority queue to be skipped. - This technique also allows non-exhaustive searchs to be performed (to answer questions such as "are there any points within 1km of the query point?). - When building the tree, the first vantage point is (arbitrarily) chosen as the middle element of the set. Thereafter, the points furthest from the parent vantage point in both the inside and outside sets are selected as the children's vantage points. This information is already available from the computation of the upper and lower bounds of the children. This choice seems to lead to a reasonably optimized tree. - The leaf nodes can contain a bucket of points (instead of just a vantage point). - Coincident points are allowed in the set; these are treated as distinct points. The figure below shows the construction of the VP tree for the points making up the coastlines of Britain and Ireland (about 5000 points shown in blue). The set of points is recursively split into 2 equal "inside" and "outside" subsets based on the distance from a "vantage point". The boundaries between the inside and outside sets are shown as green circular arcs (arcs of geodesic circles). At each stage, the newly added vantage points are shown as red dots and the vantage points for the next stage are shown as red plus signs. The data is shown in the Cassini-Soldner projection with a central meridian of 5°W. \image html vptree.gif "Vantage-point tree"
Back to \ref geodesic. Forward to \ref triaxial. Up to \ref contents.
**********************************************************************/ /** \page triaxial Geodesics on a triaxial ellipsoid
Back to \ref nearest. Forward to \ref jacobi. Up to \ref contents.
Jacobi (1839) showed that the problem of geodesics on a triaxial ellipsoid (with 3 unequal axes) can be reduced to quadrature. Despite this, the detailed behavior of the geodesics is not very well known. In this section, I briefly give Jacobi's solution and illustrate the behavior of the geodesics and outline an algorithm for the solution of the inverse problem. See also - The wikipedia page, Geodesics on a triaxial ellipsoid. Go to - \ref triaxial-coords - \ref triaxial-jacobi - \ref triaxial-survey - \ref triaxial-stab - \ref triaxial-inverse NOTES -# A triaxial ellipsoid approximates the earth only slightly better than an ellipsoid of revolution. If you are really considering measuring distances on the earth using a triaxial ellipsoid, you should also be worrying about the shape of the geoid, which essentially makes the geodesic problem a hopeless mess; see, for example, Waters (2011). -# There is nothing new in this section. It is just an exercise in exploring Jacobi's solution. My interest here is in generating long geodesics with the correct long-time behavior. Arnold gives a nice qualitative description of the solution in Mathematical Methods of Classical Mechanics (2nd edition, Springer, 1989), pp. 264--266. -# Possible reasons this problem might, nevertheless, be of interest are: - It is the first example of a dynamical system which has a non-trivial constant of motion. As such, Jacobi's paper generated a lot of excitement and was followed by many papers elaborating his solution. In particular, the unstable behavior of one of the closed geodesics of the ellipsoid, is an early example of a system with a positive Lyapunov exponent (one of the essential ingredients for chaotic behavior in dynamical systems). - Knowledge of ellipsoidal coordinates (used by Jacobi) might be useful in other areas of geodesy. - Geodesics which pass through the pole on an ellipsoid of revolution represent a degenerate class (they are all closed and all pass through the opposite pole). It is of interest to see how this degeneracy is broken with a surface with a more general shape. - Similarly, it is of interest to see how the Mercator projection of the ellipsoid generalizes; this is another problem addressed by Jacobi. -# My interest in this problem was piqued by Jean-Marc Baillard. I put him onto Jacobi's solution without having looked at it in detail myself; and he quickly implemented the solution for an HP-41 calculator(!) which is posted here. -# I do not give full citations of the papers here. You can find these in the Geodesic Bibliography; this includes links to online versions of the papers. -# An alternative to exploring geodesics using Jacobi's solution is to integrate the equations for the geodesics directly. This is the approach taken by Oliver Knill and Michael Teodorescu. However it is difficult to ensure that the long time behavior is correctly modeled with such an approach. -# At this point, I have no plans to add the solution of triaxial geodesic problem to GeographicLib. -# If you only want to learn about geodesics on a biaxial ellipsoid (an ellipsoid of revolution), then see \ref geodesic or the paper - C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43--55 (2013); DOI: 10.1007/s00190-012-0578-z; addenda: geod-addenda.html. \section triaxial-coords Triaxial coordinate systems Consider the ellipsoid defined by \f[ f = \frac{X^2}{a^2} + \frac{Y^2}{b^2} + \frac{Z^2}{c^2} = 1, \f] where, without loss of generality, \f$ a \ge b \ge c \gt 0\f$. A point on the surface is specified by a latitude and longitude. The \e geographical latitude and longitude \f$(\phi, \lambda)\f$ are defined by \f[ \frac{\nabla f}{\left| \nabla f\right|} = \left( \begin{array}{c} \cos\phi \cos\lambda \\ \cos\phi \sin\lambda \\ \sin\phi \end{array}\right). \f] The \e parametric latitude and longitude \f$(\phi', \lambda')\f$ are defined by \f[ \begin{align} X &= a \cos\phi' \cos\lambda', \\ Y &= b \cos\phi' \sin\lambda', \\ Z &= c \sin\phi'. \end{align} \f] Jacobi employed the \e ellipsoidal latitude and longitude \f$(\beta, \omega)\f$ defined by \f[ \begin{align} X &= a \cos\omega \frac{\sqrt{a^2 - b^2\sin^2\beta - c^2\cos^2\beta}} {\sqrt{a^2 - c^2}}, \\ Y &= b \cos\beta \sin\omega, \\ Z &= c \sin\beta \frac{\sqrt{a^2\sin^2\omega + b^2\cos^2\omega - c^2}} {\sqrt{a^2 - c^2}}. \end{align} \f] Grid lines of constant \f$\beta\f$ and \f$\omega\f$ are given in Fig. 1.
Geodesic grid on a triaxial ellipsoid Fig. 1
\n Fig. 1: The ellipsoidal grid. The blue (resp. green) lines are lines of constant \f$\beta\f$ (resp. \f$\omega\f$); the grid spacing is 10°. Also shown in red are two of the principal sections of the ellipsoid, defined by \f$x = 0\f$ and \f$z = 0\f$. The third principal section, \f$y = 0\f$, is covered by the lines \f$\beta = \pm 90^\circ\f$ and \f$\omega = 90^\circ \pm 90^\circ\f$. These lines meet at four umbilical points (two of which are visible in this figure) where the principal radii of curvature are equal. The parameters of the ellipsoid are \f$a = 1.01\f$, \f$b = 1\f$, \f$c = 0.8\f$, and it is viewed in an orthographic projection from a point above \f$\phi = 40^\circ\f$, \f$\lambda = 30^\circ\f$. These parameters were chosen to accentuate the ellipsoidal effects on geodesics (relative to those on the earth) while still allowing the connection to an ellipsoid of revolution to be made. The grid lines of the ellipsoid coordinates are "lines of curvature" on the ellipsoid, i.e., they are parallel to the direction of principal curvature (Monge, 1796). They are also intersections of the ellipsoid with confocal systems of hyperboloids of one and two sheets (Dupin, 1813). Finally they are geodesic ellipses and hyperbolas defined using two adjacent umbilical points. For example, the lines of constant \f$\beta\f$ in Fig. 1 can be generated with the familiar string construction for ellipses with the ends of the string pinned to the two umbilical points. The element of length on the ellipsoid in ellipsoidal coordinates is given by \f[ \begin{align} \frac{ds^2}{(a^2-b^2)\sin^2\omega+(b^2-c^2)\cos^2\beta} &= \frac{b^2\sin^2\beta+c^2\cos^2\beta} {a^2-b^2\sin^2\beta-c^2\cos^2\beta} d\beta^2 \\ &\qquad+ \frac{a^2\sin^2\omega+b^2\cos^2\omega} {a^2\sin^2\omega+b^2\cos^2\omega-c^2} d\omega^2. \end{align} \f] The torus \f$(\omega, \beta) \in [-\pi,\pi] \times [-\pi,\pi]\f$ covers the ellipsoid twice. In order to facilitate passing to the limit of an oblate ellipsoid, we may regard as the principal sheet \f$[-\pi,\pi] \times [-\frac12\pi,\frac12\pi]\f$ and insert branch cuts at \f$\beta=\pm\frac12\pi\f$. The rule for switching sheets is \f[ \begin{align} \omega & \rightarrow -\omega,\\ \beta & \rightarrow \pi-\beta,\\ \alpha & \rightarrow \pi+\alpha, \end{align} \f] where \f$\alpha\f$ is the heading of a path, relative to a line of constant \f$\omega\f$. In the limit \f$b\rightarrow a\f$ (resp. \f$b\rightarrow c\f$), the umbilic points converge on the \f$z\f$ (resp. \f$x\f$) axis and an oblate (resp. prolate) ellipsoid is obtained with \f$\beta\f$ (resp. \f$\omega\f$) becoming the standard parametric latitude and \f$\omega\f$ (resp. \f$\beta\f$) becoming the standard longitude. The sphere is a non-uniform limit, with the position of the umbilic points depending on the ratio \f$(a-b)/(b-c)\f$. Inter-conversions between the three different latitudes and longitudes and the cartesian coordinates are simple algebraic exercises. \section triaxial-jacobi Jacobi's solution Solving the geodesic problem for an ellipsoid of revolution is, from the mathematical point of view, trivial; because of symmetry, geodesics have a constant of the motion (analogous to the angular momentum) which was found by Clairaut (1733). By 1806 (with the work of Legendre, Oriani, et al.), there was a complete understanding of the qualitative behavior of geodesics on an ellipsoid of revolution. On the other hand, geodesics on a triaxial ellipsoid have no obvious constant of the motion and thus represented a challenging "unsolved" problem in the first half of the nineteenth century. Jacobi discovered that the geodesic equations are separable if they are expressed in ellipsoidal coordinates. You can get an idea of the importance Jacobi attached to his discovery from the letter he wrote to his friend and neighbor Bessel:
The day before yesterday, I reduced to quadrature the problem of geodesic lines on an ellipsoid with three unequal axes. They are the simplest formulas in the world, Abelian integrals, which become the well known elliptic integrals if 2 axes are set equal.\n Königsberg, 28th Dec. '38.
On the same day he wrote a similar letter to the editor of Compte Rendus and his result was published in J. Crelle in (1839) with a French translation (from German) appearing in J. Liouville in (1841). Here is the solution, exactly as given by Jacobi here (with minor changes in notation): \f[ \begin{align} \delta &= \int \frac {\sqrt{b^2\sin^2\beta + c^2\cos^2\beta}\,d\beta} {\sqrt{a^2 - b^2\sin^2\beta - c^2\cos^2\beta} \sqrt{(b^2-c^2)\cos^2\beta - \gamma}}\\ &\quad - \int \frac {\sqrt{a^2\sin^2\omega + b^2\cos^2\omega}\,d\omega} {\sqrt{a^2\sin^2\omega + b^2\cos^2\omega - c^2} \sqrt{(a^2-b^2)\sin^2\omega + \gamma}} \end{align} \f] As Jacobi notes "a function of the angle \f$\beta\f$ equals a function of the angle \f$\omega\f$. These two functions are just Abelian integrals…" Two constants \f$\delta\f$ and \f$\gamma\f$ appear in the solution. Typically \f$\delta\f$ is zero if the lower limits of the integrals are taken to be the starting point of the geodesic and the direction of the geodesics is determined by \f$\gamma\f$. However for geodesics that start at an umbilical points, we have \f$\gamma = 0\f$ and \f$\delta\f$ determines the direction at the umbilical point. Incidentally the constant \f$\gamma\f$ may be expressed as \f[ \gamma = (b^2-c^2)\cos^2\beta\sin^2\alpha-(a^2-b^2)\sin^2\omega\cos^2\alpha \f] where \f$\alpha\f$ is the angle the geodesic makes with lines of constant \f$\omega\f$. In the limit \f$b\rightarrow a\f$, this reduces to \f$\cos\beta\sin\alpha = \text{const.}\f$, the familiar Clairaut relation. A nice derivation of Jacobi's result is given by Darboux (1894) §§583--584 where he gives the solution found by Liouville (1846) for general quadratic surfaces. In this formulation, the distance along the geodesic, \f$s\f$, is also found using \f[ \begin{align} \frac{ds}{(b^2-c^2)\cos^2\beta + (a^2-b^2)\sin^2\omega} &= \frac {\sqrt{b^2\sin^2\beta + c^2\cos^2\beta}\,d\beta} {\sqrt{a^2 - b^2\sin^2\beta - c^2\cos^2\beta} \sqrt{(b^2-c^2)\cos^2\beta - \gamma}}\\ &= \frac {\sqrt{a^2\sin^2\omega + b^2\cos^2\omega}\,d\omega} {\sqrt{a^2\sin^2\omega + b^2\cos^2\omega - c^2} \sqrt{(a^2-b^2)\sin^2\omega + \gamma}} \end{align} \f] An alternative expression for the distance is \f[ \begin{align} ds &= \frac {\sqrt{b^2\sin^2\beta + c^2\cos^2\beta} \sqrt{(b^2-c^2)\cos^2\beta - \gamma}\,d\beta} {\sqrt{a^2 - b^2\sin^2\beta - c^2\cos^2\beta}}\\ &\quad {}+ \frac {\sqrt{a^2\sin^2\omega + b^2\cos^2\omega} \sqrt{(a^2-b^2)\sin^2\omega + \gamma}\,d\omega} {\sqrt{a^2\sin^2\omega + b^2\cos^2\omega - c^2}} \end{align} \f] Jacobi's solution is a convenient way to compute geodesics on an ellipsoid. Care must be taken with the signs of the square roots (which are determined by the initial azimuth of the geodesic). Also if \f$\gamma \gt 0\f$ (resp. \f$\gamma \lt 0\f$), then the \f$\beta\f$ (resp. \f$\omega\f$) integrand diverges. The integrand can be transformed into a finite one by a change of variable, e.g., \f$\sin\beta = \sin\sigma \sqrt{1 - \gamma/(b^2-c^2)}\f$. The resulting integrals are periodic, so the behavior of an arbitrarily long geodesic is entirely captured by tabulating the integrals over a single period. The situation is more complicated if \f$\gamma = 0\f$ (corresponding to umbilical geodesics). Both integrands have simple poles at the umbilical points. However, this behavior may be subtracted from the integrands to yield (for example) the sum of a term involving \f$\tanh^{-1}\sin\beta\f$ and a finite integral. Since both integrals contain similar logarithmic singularities they can be equated (thus fixing the ratio \f$\cos\beta/\sin\omega\f$ at the umbilical point) and connection formulas can be found which allow the geodesic to be followed through the umbilical point. The study of umbilical geodesics was of special interest to a group of Irish mathematicians in the 1840's and 1850's, including Michael and William Roberts (twins!), Hart, Graves, and Salmon. \section triaxial-survey Survey of triaxial geodesics Before delving into the nature of geodesics on a triaxial geodesic, it is worth reviewing geodesics on an ellipsoid of revolution. There are two classes of simple closed geodesics (i.e., geodesics which close on themselves without intersection): the equator and all the meridians. All other geodesics oscillate between two equal and opposite circles of latitude; but after completing a full oscillation in latitude these fall slightly short (for an oblate ellipsoid) of completing a full circuit in longitude. Turning to the triaxial case, we find that there are only 3 simple closed geodesics, the three principal sections of the ellipsoid given by \f$x = 0\f$, \f$y = 0\f$, and \f$z = 0\f$. To survey the other geodesics, it is convenient to consider geodesics which intersect the middle principal section, \f$y = 0\f$, at right angles. Such geodesics are shown in Figs. 2--6, where I use the same ellipsoid parameters as in Fig. 1 and the same viewing direction. In addition, the three principal ellipses are shown in red in each of these figures. If the starting point is \f$\beta_1 \in (-90^\circ, 90^\circ)\f$, \f$\omega_1 = 0\f$, and \f$\alpha_1 = 90^\circ\f$, then the geodesic encircles the ellipsoid in a "circumpolar" sense. The geodesic oscillates north and south of the equator; on each oscillation it completes slightly less that a full circuit around the ellipsoid resulting in the geodesic filling the area bounded by the two latitude lines \f$\beta = \pm \beta_1\f$. Two examples are given in Figs. 2 and 3. Figure 2 shows practically the same behavior as for an oblate ellipsoid of revolution (because \f$a \approx b\f$). However, if the starting point is at a higher latitude (Fig. 3) the distortions resulting from \f$a \ne b\f$ are evident.
Example of a circumpolar geodesic on a
triaxial ellipsoid Fig. 2
\n Fig. 2: Example of a circumpolar geodesic on a triaxial ellipsoid. The starting point of this geodesic is \f$\beta_1 = 45.1^\circ\f$, \f$\omega_1 = 0^\circ\f$, and \f$\alpha_1 = 90^\circ\f$.
Another example of a circumpolar geodesic on a
triaxial ellipsoid Fig. 3
\n Fig. 3: Another example of a circumpolar geodesic on a triaxial ellipsoid. The starting point of this geodesic is \f$\beta_1 = 87.48^\circ\f$, \f$\omega_1 = 0^\circ\f$, and \f$\alpha_1 = 90^\circ\f$. If the starting point is \f$\beta_1 = 90^\circ\f$, \f$\omega_1 \in (0^\circ, 180^\circ)\f$, and \f$\alpha_1 = 180^\circ\f$, then the geodesic encircles the ellipsoid in a "transpolar" sense. The geodesic oscillates east and west of the ellipse \f$x = 0\f$; on each oscillation it completes slightly more that a full circuit around the ellipsoid resulting in the geodesic filling the area bounded by the two longitude lines \f$\omega = \omega_1\f$ and \f$\omega = 180^\circ - \omega_1\f$. If \f$a = b\f$, all meridians are geodesics; the effect of \f$a \ne b\f$ causes such geodesics to oscillate east and west. Two examples are given in Figs. 4 and 5.
Example of a transpolar geodesic on a
triaxial ellipsoid Fig. 4
\n Fig. 4: Example of a transpolar geodesic on a triaxial ellipsoid. The starting point of this geodesic is \f$\beta_1 = 90^\circ\f$, \f$\omega_1 = 39.9^\circ\f$, and \f$\alpha_1 = 180^\circ\f$.
Another example of a transpolar geodesic on a
triaxial ellipsoid Fig. 5
\n Fig. 5: Another example of a transpolar geodesic on a triaxial ellipsoid. The starting point of this geodesic is \f$\beta_1 = 90^\circ\f$, \f$\omega_1 = 9.966^\circ\f$, and \f$\alpha_1 = 180^\circ\f$. If the starting point is \f$\beta_1 = 90^\circ\f$, \f$\omega_1 = 0^\circ\f$ (an umbilical point), and \f$\alpha_1 = 135^\circ\f$ (the geodesic leaves the ellipse \f$y = 0\f$ at right angles), then the geodesic repeatedly intersects the opposite umbilical point and returns to its starting point. However on each circuit the angle at which it intersects \f$y = 0\f$ becomes closer to \f$0^\circ\f$ or \f$180^\circ\f$ so that asymptotically the geodesic lies on the ellipse \f$y = 0\f$. This is shown in Fig. 6. Note that a single geodesic does not fill an area on the ellipsoid.
Example of an umbilical geodesic on a
triaxial ellipsoid Fig. 6
\n Fig. 6: Example of an umbilical geodesic on a triaxial ellipsoid. The starting point of this geodesic is \f$\beta_1 = 90^\circ\f$, \f$\omega_1 = 0^\circ\f$, and \f$\alpha_1 = 135^\circ\f$ and the geodesics is followed forwards and backwards until it lies close to the plane \f$y = 0\f$ in both directions. Umbilical geodesics enjoy several interesting properties. - Through any point on the ellipsoid, there are two umbilical geodesics. - The geodesic distance between opposite umbilical points is the same regardless of the initial direction of the geodesic. - Whereas the closed geodesics on the ellipses \f$x = 0\f$ and \f$z = 0\f$ are stable (an geodesic initially close to and nearly parallel to the ellipse remains close to the ellipse), the closed geodesic on the ellipse \f$y = 0\f$, which goes through all 4 umbilical points, is \e unstable. If it is perturbed, it will swing out of the plane \f$y = 0\f$ and flip around before returning to close to the plane. (This behavior may repeat depending on the nature of the initial perturbation.). \section triaxial-stab The stability of closed geodesics The stability of the three simple closed geodesics can be determined by examining the properties of Jacobi's solution. In particular the unstable behavior of umbilical geodesics was shown by Hart (1849). However an alternative approach is to use the equations that Gauss (1828) gives for a perturbed geodesic \f[ \frac {d^2m}{ds^2} + Km = 0 \f] where \f$m\f$ is the distance of perturbed geodesic from a reference geodesic and \f$K\f$ is the Gaussian curvature of the surface. If the reference geodesic is closed, then this is a linear homogeneous differential equation with periodic coefficients. In fact it's a special case of Hill's equation which can be treated using Floquet theory, see DLMF, §28.29. Using the notation of §3 of Algorithms for geodesics, the stability is determined by computing the reduced length \f$m_{12}\f$ and the geodesic scales \f$M_{12}, M_{21}\f$ over half the perimeter of the ellipse and determining the eigenvalues \f$\lambda_{1,2}\f$ of \f[ {\cal M} = \left(\begin{array}{cc} M_{12} & m_{12}\\ -\frac{1 - M_{12}M_{21}}{m_{12}} & M_{21} \end{array}\right). \f] Because \f$\mathrm{det}\,{\cal M} = 1\f$, the eigenvalues are determined by \f$\mathrm{tr}\,{\cal M}\f$. In particular if \f$\left|\mathrm{tr}\,{\cal M}\right| < 2\f$, we have \f$\left|\lambda_{1,2}\right| = 1\f$ and the solution is stable; if \f$\left|\mathrm{tr}\,{\cal M}\right| > 2\f$, one of \f$\left|\lambda_{1,2}\right|\f$ is larger than unity and the solution is (exponentially) unstable. In the transition case, \f$\left|\mathrm{tr}\,{\cal M}\right| = 2\f$, the solution is stable provided that the off-diagonal elements of \f${\cal M}\f$ are zero; otherwise the solution is linearly unstable. The exponential instability of the geodesic on the ellipse \f$y = 0\f$ is confirmed by this analysis and results from the resonance between the natural frequency of the equation for \f$m\f$ and the driving frequency when \f$b\f$ lies in \f$(c, a)\f$. If \f$b\f$ is equal to either of the other axes (and the triaxial ellipsoid degenerates to an ellipsoid of revolution), then the solution is linearly unstable. (For example, a geodesic is which is close to a meridian on an oblate ellipsoid, slowly moves away from that meridian.) \section triaxial-inverse The inverse problem In order to solve the inverse geodesic problem, it helps to have an understanding of the properties of all the geodesics emanating from a single point \f$(\beta_1, \omega_1)\f$. - If the point is an umbilical point, all the lines meet at the opposite umbilical point. - Otherwise, the first envelope of the geodesics is a 4-pointed astroid. The cusps of the astroid lie on either \f$\beta = - \beta_1\f$ or \f$\omega = \omega_1 + \pi\f$; see Sinclair (2003). - All geodesics intersect (or, in the case of \f$\alpha_1 = 0\f$ or \f$\pi\f$, touch) the line \f$\omega = \omega_1 + \pi\f$. - All geodesics intersect (or, in the case of \f$\alpha_1 = \pm\pi/2\f$, touch) the line \f$\beta = -\beta_1\f$. - Two geodesics with azimuths \f$\pm\alpha_1\f$ first intersect on \f$\omega = \omega_1 + \pi\f$ and their lengths to the point of intersection are equal. - Two geodesics with azimuths \f$\alpha_1\f$ and \f$\pi-\alpha_1\f$ first intersect on \f$\beta = -\beta_1\f$ and their lengths to the point of intersection are equal. . (These assertions follow directly from the equations for the geodesics; some of them are somewhat surprising given the asymmetries of the ellipsoid.) Consider now terminating the geodesics from \f$(\beta_1, \omega_1)\f$ at the point where they first intersect (or touch) the line \f$\beta = -\beta_1\f$. To focus the discussion, take \f$\beta_1 \le 0\f$. - The geodesics completely fill the portion of the ellipsoid satisfying \f$\beta \le -\beta_1\f$. - None of geodesics intersect any other geodesics. - Any initial portion of these geodesics is a shortest path. - Each geodesic intersects the line \f$\beta = \beta_2\f$, where \f$\beta_1 < \beta_2 < -\beta_1\f$, exactly once. - For a given \f$\beta_2\f$, this defines a continuous monotonic mapping of the circle of azimuths \f$\alpha_1\f$ to the circle of longitudes \f$\omega_2\f$. - If \f$\beta_2 = \pm \beta_1\f$, then the previous two assertions need to be modified similarly to the case for an ellipsoid of revolution. These properties show that the inverse problem can be solved using techniques similar to those employed for an ellipsoid of revolution (see §4 of Algorithms for geodesics). - If the points are opposite umbilical points, an arbitrary \f$\alpha_1\f$ may be chosen. - If the points are neighboring umbilical points, the shortest path lies on the ellipse \f$y = 0\f$. - If only one point is an umbilicial point, the azimuth at the non-umbilical point is found using the generalization of Clairaut's equation (given above) with \f$\gamma = 0\f$. - Treat the cases where the geodesic might follow a line of constant \f$\beta\f$. There are two such cases: (a) the points lie on the ellipse \f$z = 0\f$ on a general ellipsoid and (b) the points lie on an ellipse whose major axis is the \f$x\f$ axis on a prolate ellipsoid (\f$a = b > c\f$). Determine the reduced length \f$m_{12}\f$ for the geodesic which is the shorter path along the ellipse. If \f$m_{12} \ge 0\f$, then this is the shortest path on the ellipsoid; otherwise proceed to the general case (next). - Swap the points, if necessary, so that the first point is the one closest to a pole. Estimate \f$\alpha_1\f$ (by some means) and solve the \e hybrid problem, i.e., determine the longitude \f$\omega_2\f$ corresponding to the first intersection of the geodesic with \f$\beta = \beta_2\f$. Adjust \f$\alpha_1\f$ so that the value of \f$\omega_2\f$ matches the given \f$\omega_2\f$ (there is a single root). If a sufficiently close solution can be found, Newton's method can be employed since the necessary derivative can be expressed in terms of the reduced length \f$m_{12}\f$. The shortest path found by this method is unique unless: - The length of the geodesic vanishes \f$s_{12}=0\f$, in which case any constant can be added to the azimuths. - The points are opposite umbilical points. In this case, \f$\alpha_1\f$ can take on any value and \f$\alpha_2\f$ needs to be adjusted to maintain the value of \f$\tan\alpha_1 / \tan\alpha_2\f$. Note that \f$\alpha\f$ increases by \f$\pm 90^\circ\f$ as the geodesic passes through an umbilical point, depending on whether the geodesic is considered as passing to the right or left of the point. Here \f$\alpha_2\f$ is the \e forward azimuth at the second umbilical point, i.e., its azimuth immediately \e after passage through the umbilical point. - \f$\beta_1 + \beta_2 = 0\f$ and \f$\cos\alpha_1\f$ and \f$\cos\alpha_2\f$ have opposite signs. In this case, there another shortest geodesic with azimuths \f$\pi - \alpha_1\f$ and \f$\pi - \alpha_2\f$. \section triaxial-conformal Jacobi's conformal projection This material is now on its own page; see \ref jacobi.
Back to \ref nearest. Forward to \ref jacobi. Up to \ref contents.
**********************************************************************/ /** \page jacobi Jacobi's conformal projection
Back to \ref triaxial. Forward to \ref rhumb. Up to \ref contents.
In addition to solving the geodesic problem for the triaxial ellipsoid, Jacobi (1839) briefly mentions the problem of the conformal projection of ellipsoid. He covers this in greater detail in Vorlesungen über Dynamik, §28, which is now available in an English translation: Lectures on Dynamics ( errata). \section jacobi-conformal Conformal projection It is convenient to rotate Jacobi's ellipsoidal coordinate system so that \f$(X,Y,Z)\f$ are respectively the middle, large, and small axes of the ellipsoid. The longitude \f$\omega\f$ is shifted so that \f$(\beta=0,\omega=0)\f$ is the point \f$(b,0,0)\f$. The coordinates are thus defined by \f[ \begin{align} X &= b \cos\beta \cos\omega, \\ Y &= a \sin\omega \frac{\sqrt{a^2 - b^2\sin^2\beta - c^2\cos^2\beta}} {\sqrt{a^2 - c^2}}, \\ Z &= c \sin\beta \frac{\sqrt{a^2\cos^2\omega + b^2\sin^2\omega - c^2}} {\sqrt{a^2 - c^2}}. \end{align} \f] After this change, the large principal ellipse is the equator, \f$\beta=0\f$, while the small principal ellipse is the prime meridian, \f$\omega=0\f$. The four umbilic points, \f$\left|\omega\right| = \left|\beta\right| = \frac12\pi\f$, lie on middle principal ellipse in the plane \f$X=0\f$. Jacobi gives the following conformal mapping of the triaxial ellipsoid onto a plane \f[ \begin{align} x &= \frac{\sqrt{a^2-c^2}}b \int \frac {\sqrt{a^2 \cos^2\omega + b^2 \sin^2\omega}} {\sqrt{a^2 \cos^2\omega + b^2 \sin^2\omega - c^2}}\, d\omega, \\ y &= \frac{\sqrt{a^2-c^2}}b \int \frac {\sqrt{b^2 \sin^2\beta + c^2 \cos^2\beta}} {\sqrt{a^2 - b^2 \sin^2\beta - c^2 \cos^2\beta}}\, d\beta. \end{align} \f] The scale of the projection is \f[ k = \frac{\sqrt{a^2-c^2}} {b\sqrt{a^2 \cos^2\omega + b^2 (\sin^2\omega-\sin^2\beta) - c^2 \cos^2\beta}}. \f] I have scaled the Jacobi's projection by a constant factor, \f[ \frac{\sqrt{a^2-c^2}}{2b}, \f] so that it reduces to the familiar formulas in the case of an oblate ellipsoid. \section jacobi-elliptic The projection in terms of elliptic integrals The projection may be expressed in terms of elliptic integrals, \f[ \begin{align} x&=(1+e_a^2)\,\Pi(\omega',-e_a^2, \cos\nu),\\ y&=(1-e_c^2)\,\Pi(\beta' , e_c^2, \sin\nu),\\ k&=\frac{\sqrt{e_a^2+e_c^2}}{b\sqrt{e_a^2\cos^2\omega+e_c^2\cos^2\beta}}, \end{align} \f] where \f[ \begin{align} e_a &= \frac{\sqrt{a^2-b^2}}b, \qquad e_c = \frac{\sqrt{b^2-c^2}}b, \\ \tan\omega' &= \frac ba \tan\omega = \frac 1{\sqrt{1+e_a^2}} \tan\omega, \\ \tan\beta' &= \frac bc \tan\beta = \frac 1{\sqrt{1-e_c^2}} \tan\beta, \\ \tan\nu &= \frac ac \frac{\sqrt{b^2-c^2}}{\sqrt{a^2-b^2}} =\frac{e_c}{e_a}\frac{\sqrt{1+e_a^2}}{\sqrt{1-e_c^2}}, \end{align} \f] \f$\nu\f$ is the geographic latitude of the umbilic point at \f$\beta = \omega = \frac12\pi\f$ (the angle a normal at the umbilic point makes with the equatorial plane), and \f$\Pi(\phi,\alpha^2,k)\f$ is the elliptic integral of the third kind, https://dlmf.nist.gov/19.2.E7. This allows the projection to be numerically computed using EllipticFunction::Pi(real phi) const. Nyrtsov, et al., - M. V. Nyrtsov, M. E. Flies, M. M. Borisov, P. J. Stooke, Jacobi conformal projection of the triaxial ellipsoid: new projection for mapping of small celestial bodies, in Cartography from Pole to Pole (Springer, 2014), pp. 235--246. . also expressed the projection in terms of elliptic integrals. However, their expressions don't allow the limits of ellipsoids of revolution to be readily recovered. The relations https://dlmf.nist.gov/19.7.E5 can be used to put their results in the form given here. \section jacobi-properties Properties of the projection \f$x\f$ (resp. \f$y\f$) depends on \f$\omega\f$ (resp. \f$\beta\f$) alone, so that latitude-longitude grid maps to straight lines in the projection. In this sense, the Jacobi projection is the natural generalization of the Mercator projection for the triaxial ellipsoid. (See below for the limit \f$a\rightarrow b\f$, which makes this connection explicit.) In the general case (all the axes are different), the scale diverges only at the umbilic points. The behavior of these singularities is illustrated by the complex function \f[ f(z;e) = \cosh^{-1}(z/e) - \log(2/e). \f] For \f$e > 0\f$, this function has two square root singularities at \f$\pm e\f$, corresponding to the two northern umbilic points. Plotting contours of its real (resp. imaginary) part gives the behavior of the lines of constant latitude (resp. longitude) near the north pole in Fig. 1. If we pass to the limit \f$e\rightarrow 0\f$, then \f$ f(z;e)\rightarrow\log z\f$, and the two branch points merge yielding a stronger (logarithmic) singularity at \f$z = 0\f$, concentric circles of latitude, and radial lines of longitude. Again in the general case, the extents of \f$x\f$ and \f$y\f$ are finite, \f[ \begin{align} x\bigl(\tfrac12\pi\bigr) &=(1+e_a^2)\,\Pi(-e_a^2, \cos\nu),\\ y\bigl(\tfrac12\pi\bigr) &=(1-e_c^2)\,\Pi(e_c^2, \sin\nu), \end{align} \f] where \f$\Pi(\alpha^2,k)\f$ is the complete elliptic integral of the third kind, https://dlmf.nist.gov/19.2.E8. In particular, if we substitute values appropriate for the earth, \f[ \begin{align} a&=(6378137+35)\,\mathrm m,\\ b&=(6378137-35)\,\mathrm m,\\ c&=6356752\,\mathrm m,\\ \end{align} \f] we have \f[ \begin{align} x\bigl({\textstyle\frac12}\pi\bigr) &= 1.5720928 = \hphantom{0}90.07428^\circ,\\ y\bigl({\textstyle\frac12}\pi\bigr) &= 4.2465810 = 243.31117^\circ.\\ \end{align} \f] The projection may be inverted (to give \f$\omega\f$ in terms of \f$x\f$ and \f$\beta\f$ in terms of \f$y\f$) by using Newton's method to find the root of, for example, \f$x(\omega) - x_0 = 0\f$. The derivative of the elliptic integral is, of course, just given by its defining relation. If rhumb lines are defined as curves with a constant bearing relative to the ellipsoid coordinates, then these are straight lines in the Jacobi projection. A rhumb line which passes over an umbilic point immediately retraces its path. A rhumb line which crosses the line joining the two northerly umbilic points starts traveling south with a reversed heading (e.g., a NE heading becomes a SW heading). This behavior is preserved in the limit \f$a\rightarrow b\f$ (although the longitude becomes indeterminate in this limit). \section jacobi-limiting Limiting cases Oblate ellipsoid, \f$a\rightarrow b\f$. The coordinate system is \f[ \begin{align} X &= b \cos\beta \cos\omega, \\ Y &= b \cos\beta \sin\omega, \\ Z &= c \sin\beta. \end{align} \f] Thus \f$\beta\f$ (resp. \f$\beta'\f$) is the parametric (resp. geographic) latitude and \f$\omega=\omega'\f$ is the longitude; the quantity \f$e_c\f$ is the eccentricity of the ellipsoid. Using https://dlmf.nist.gov/19.6.E12 and https://dlmf.nist.gov/19.2.E19 the projection reduces to the normal Mercator projection for an oblate ellipsoid, \f[ \begin{align} x &= \omega,\\ y &= \sinh^{-1}\tan\beta' - e_c \tanh^{-1}(e_c\sin\beta'),\\ k &= \frac1{b\cos\beta}. \end{align} \f] Prolate ellipsoid, \f$c\rightarrow b\f$. The coordinate system is \f[ \begin{align} X &= b \cos\omega \cos\beta, \\ Y &= a \sin\omega, \\ Z &= b \cos\omega \sin\beta. \end{align} \f] Thus \f$\omega\f$ (resp. \f$\omega'\f$) now plays the role of the parametric (resp. geographic) latitude and while \f$\beta=\beta'\f$ is the longitude. Using https://dlmf.nist.gov/19.6.E12 https://dlmf.nist.gov/19.2.E19 and https://dlmf.nist.gov/19.2.E18 the projection reduces to similar expressions with the roles of \f$\beta\f$ and \f$\omega\f$ switched, \f[ \begin{align} x &= \sinh^{-1}\tan\omega' + e_a \tan^{-1}(e_a\sin\omega'),\\ y &= \beta,\\ k &= \frac1{b\cos\omega}. \end{align} \f] Sphere, \f$a\rightarrow b\f$ and \f$c\rightarrow b\f$. This is a non-uniform limit depending on the parameter \f$\nu\f$, \f[ \begin{align} X &= b \cos\omega \cos\beta, \\ Y &= b \sin\omega \sqrt{1 - \sin^2\nu\sin^2\beta}, \\ Z &= b \sin\beta \sqrt{1 - \cos^2\nu\sin^2\omega}. \end{align} \f] Using https://dlmf.nist.gov/19.6.E13 the projection can be put in terms of the elliptic integral of the first kind, https://dlmf.nist.gov/19.2.E4 \f[ \begin{align} x &= F(\omega, \cos\nu), \\ y &= F(\beta, \sin\nu), \\ k &= \frac1{b \sqrt{\cos^2\nu\cos^2\omega + \sin^2\nu\cos^2\beta}}, \end{align} \f] Obtaining the limit of a sphere via an oblate (resp. prolate) ellipsoid corresponds to setting \f$\nu = \frac12\pi\f$ (resp. \f$\nu =0\f$). In these limits, the elliptic integral reduces to elementary functions https://dlmf.nist.gov/19.6.E7 and https://dlmf.nist.gov/19.6.E8 \f[ \begin{align} F(\phi, 0) &= \phi, \\ F(\phi, 1) &= \mathop{\mathrm{gd}}\nolimits^{-1}\phi = \sinh^{-1}\tan\phi. \end{align} \f] The spherical limit gives the projection found by É. Guyou in - Sur un nouveau système de projection de la sphère, Comptes Rendus 102(6), 308--310 (1886). - Nouveau système de projection de la sphère: généralisation de la projection de Mercator, Annales Hydrographiques (2nd series) 9, 16--35 (1887). . who apparently derived it without realizing that it is just a special case of the projection Jacobi had given some 40 years earlier. Guyou's name is usually associated with the particular choice, \f$\nu=\frac14\pi\f$, in which case the hemisphere \f$\left|\omega\right|\le\frac12\pi\f$ is mapped into a square. However, by varying \f$\nu\in[0,\frac12\pi]\f$ the hemisphere can be mapped into a rectangle with any aspect ratio, \f$K(\cos\nu) : K(\sin\nu)\f$, where \f$K(k)\f$ is the complete elliptic integral of the first find, https://dlmf.nist.gov/19.2.E8. \section jacobi-sphere Conformal mapping of an ellipsoid to a sphere An essential tool in deriving conformal projections of an ellipsoid of revolution is the conformal mapping of the ellipsoid onto a sphere. This allows conformal projections of the sphere to be generalized to the case of an ellipsoid of revolution. This conformal mapping is obtained by using the ellipsoidal Mercator projection to map the ellipsoid to the plane and then using the spherical Mercator projection to map the plane onto the sphere. A similar construction is possible for a triaxial ellipsoid. Map each octant of the ellipsoid onto a rectangle using the Jacobi projection. The aspect ratio of this rectangle is \f[ (1+e_a^2)\,\Pi(-e_a^2, \cos\nu) : (1-e_c^2)\,\Pi( e_c^2, \sin\nu). \f] Find the value of \f$\nu'\f$ such that this ratio equals \f[ K(\cos\nu') : K(\sin\nu'). \f] Map the rectangle onto the equivalent octant of the sphere using Guyou's projection with parameter \f$\nu = \nu'\f$. This reduces to the standard construction in the limit of an ellipsoid of revolution. \section jacobi-implementation An implementation of the projection The JacobiConformal class provides an implementation of the Jacobi conformal projection is given here. NOTE: This is just sample code. It is not part of GeographicLib itself.
Back to \ref triaxial. Forward to \ref rhumb. Up to \ref contents.
**********************************************************************/ /** \page rhumb Rhumb lines
Back to \ref jacobi. Forward to \ref greatellipse. Up to \ref contents.
The Rhumb and RhumbLine classes together with the RhumbSolve utility perform rhumb line calculations. A rhumb line (also called a loxodrome) is a line of constant azimuth on the surface of the ellipsoid. It is important for historical reasons because sailing with a constant compass heading is simpler than sailing the shorter geodesic course; see Osborne (2013). The formulation of the problem on an ellipsoid is covered by Smart (1946) and Carlton-Wippern (1992). Computational approaches are given by Williams (1950) and Bennett (1996). My interest in this problem was piqued by Botnev and Ustinov (2014) who discuss various techniques to improve the accuracy of rhumb line calculations. The items of interest here are: - Review of accurate formulas for the auxiliary latitudes. - The calculation of the area under a rhumb line. - Using divided differences to compute \f$\mu_{12}/\psi_{12}\f$ maintaining full accuracy. Two cases are treated: - If \f$f\f$ is small, Krüger's series for the transverse Mercator projection relate \f$\chi\f$ and \f$\mu\f$. - For arbitrary \f$f\f$, the divided difference formula for incomplete elliptic integrals of the second relates \f$\beta\f$ and \f$\mu\f$. . - Extending Clenshaw summation to compute the divided difference of a trigonometric sum. Go to - \ref rhumbform - \ref rhumblat - \ref rhumbarea - \ref divideddiffs - \ref dividedclenshaw References: - G. G. Bennett, Practical Rhumb Line Calculations on the Spheroid J. Navigation 49(1), 112--119 (1996). - 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. - V.A. Botnev, S.M. Ustinov, Metody resheniya pryamoy i obratnoy geodezicheskikh zadach s vysokoy tochnost'yu (Methods for direct and inverse geodesic problems solving with high precision), St. Petersburg State Polytechnical University Journal 3(198), 49--58 (2014). - K. C. Carlton-Wippern On Loxodromic Navigation, J. Navigation 45(2), 292--297 (1992). - K. E. Engsager and K. Poder, A highly accurate world wide algorithm for the transverse Mercator mapping (almost), Proc. XXIII Intl. Cartographic Conf. (ICC2007), Moscow (2007). - F. R. Helmert, Mathematical and Physical Theories of Higher Geodesy, Part 1 (1880), Aeronautical Chart and Information Center (St. Louis, 1964), Chaps. 5--7. - W. M. Kahan and R. J. Fateman, Symbolic computation of divided differences, SIGSAM Bull. 33(3), 7--28 (1999) DOI: 10.1145/334714.334716. - C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475--485 (Aug. 2011); addenda: tm-addenda.html; preprint: arXiv:1002.1417; resource page: tm.html. - C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43--55 (2013); DOI: 10.1007/s00190-012-0578-z; addenda: geod-addenda.html; resource page: geod.html. - 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). - P. Osborne, The Mercator Projections (2013), §2.5 and §6.5; DOI: 10.5281/zenodo.35392. - W. M. Smart On a Problem in Navigation MNRAS 106(2), 124--127 (1946). - J. E. D. Williams Loxodromic Distances on the Terrestrial Spheroid Journal, J. Navigation 3(2), 133--140 (1950) \section rhumbform Formulation of the rhumb line problem The rhumb line can formulated in terms of three types of latitude, the isometric latitude \f$\psi\f$ (this serves to define the course of rhumb lines), the rectifying latitude \f$\mu\f$ (needed for computing distances along rhumb lines), and the parametric latitude \f$\beta\f$ (needed for dealing with rhumb lines that run along a parallel). These are defined in terms of the geographical latitude \f$\phi\f$ by \f[ \begin{align} \frac{d\psi}{d\phi} &= \frac{\rho}R, \\ \frac{d\mu}{d\phi} &= \frac{\pi}{2M}\rho, \\ \end{align} \f] where \f$\rho\f$ is the meridional radius of curvature, \f$R = a\cos\beta\f$ is the radius of a circle of latitude, and \f$M\f$ is the length of a quarter meridian (from the equator to the pole). Rhumb lines are straight in the Mercator projection, which maps a point with geographical coordinates \f$ (\phi,\lambda) \f$ on the ellipsoid to a point \f$ (\psi,\lambda) \f$. The azimuth \f$\alpha_{12}\f$ of a rhumb line from \f$ (\phi_1,\lambda_1) \f$ to \f$ (\phi_2,\lambda_2) \f$ is thus given by \f[ \tan\alpha_{12} = \frac{\lambda_{12}}{\psi_{12}}, \f] where the quadrant of \f$\alpha_{12}\f$ is determined by the signs of the numerator and denominator of the right-hand side, \f$\lambda_{12} = \lambda_2 - \lambda_1\f$, \f$\psi_{12} = \psi_2 - \psi_1\f$, and, typically, \f$\lambda_{12}\f$ is reduced to the range \f$[-\pi,\pi]\f$ (thus giving the course of the shortest rhumb line). The distance is given by \f[ \begin{align} s_{12} &= \frac {2M}{\pi} \mu_{12} \sec\alpha_{12} \\ &= \frac {2M}{\pi} \frac{\mu_{12}}{\psi_{12}} \sqrt{\lambda_{12}^2 + \psi_{12}^2}, \end{align} \f] where \f$\mu_{12} = \mu_2 - \mu_1\f$. This relation is indeterminate if \f$\phi_1 = \phi_2\f$, so we take the limits \f$\psi_{12}\rightarrow0\f$ and \f$\mu_{12}\rightarrow0\f$ and apply L'Hôpital's rule to yield \f[ \begin{align} s_{12} &= \frac {2M}{\pi} \frac{d\mu}{d\psi} \left|\lambda_{12}\right|\\ &=a \cos\beta \left|\lambda_{12}\right|, \end{align} \f] where the last relation is given by the defining equations for \f$\psi\f$ and \f$\mu\f$. This provides a complete solution for rhumb lines. This formulation entirely encapsulates the ellipsoidal shape of the earth via the \ref auxlat; thus in the Rhumb class, the ellipsoidal generalization is handled by the Ellipsoid class where the auxiliary latitudes are defined. \section rhumblat Determining the auxiliary latitudes Here we brief develop the necessary formulas for the \ref auxlat. Isometric latitude: The equation for \f$\psi\f$ can be integrated to give \f[ \psi = \sinh^{-1}\tan\phi - e\tanh^{-1}(e \sin\phi), \f] where \f$e = \sqrt{f(2-f)}\f$ is the eccentricity of the ellipsoid. To invert this equation (to give \f$\phi\f$ in terms of \f$\psi\f$), it is convenient to introduce the variables \f$\tau=\tan\phi\f$ and \f$\tau' = \tan\chi = \sinh\psi\f$ (\f$\chi\f$ is the conformal latitude) which are related by (Karney, 2011) \f[ \begin{align} \tau' &= \tau \sqrt{1 + \sigma^2} - \sigma \sqrt{1 + \tau^2}, \\ \sigma &= \sinh\bigl(e \tanh^{-1}(e \tau/\sqrt{1 + \tau^2}) \bigr). \end{align} \f] The equation for \f$\tau'\f$ can be inverted to give \f$\tau\f$ in terms of \f$\tau'\f$ using Newton's method with \f$\tau_0 = \tau'/(1-e^2)\f$ as a starting guess; and, of course, \f$\phi\f$ and \f$\psi\f$ are then given by \f[ \begin{align} \phi &= \tan^{-1}\tau,\\ \psi &= \sinh^{-1}\tau'. \end{align} \f] This allows conversions to and from \f$\psi\f$ to be carried out for any value of the flattening \f$f\f$; these conversions are implemented by Ellipsoid::IsometricLatitude and Ellipsoid::InverseIsometricLatitude. (For prolate ellipsoids, \f$f\f$ is negative and \f$e\f$ is imaginary, and the equation for \f$\sigma\f$ needs to be recast in terms of the tangent function.) For small values of \f$f\f$, Engsager and Poder (2007) express \f$\chi\f$ as a trigonometric series in \f$\phi\f$. This series can be reverted to give a series for \f$\phi\f$ in terms of \f$\chi\f$. Both series can be efficiently evaluated using Clenshaw summation and this provides a fast non-iterative way of making the conversions. Parametric latitude: This is given by \f[ \tan\beta = (1-f)\tan\phi, \f] which allows rapid and accurate conversions; these conversions are implemented by Ellipsoid::ParametricLatitude and Ellipsoid::InverseParametricLatitude. Rectifying latitude: Solving for distances on the meridian is naturally carried out in terms of the parametric latitude instead of the geographical latitude. This leads to a simpler elliptic integral which is easier to evaluate and to invert. Helmert (1880, §5.11) notes that the series for meridian distance in terms of \f$\beta\f$ converge faster than the corresponding ones in terms of \f$\phi\f$. In terms of \f$\beta\f$, the rectifying latitude is given by \f[ \mu = \frac{\pi}{2E(ie')} E(\beta,ie'), \f] where \f$e'=e/\sqrt{1-e^2}\f$ is the second eccentricity and \f$E(k)\f$ and \f$E(\phi,k)\f$ are the complete and incomplete elliptic integrals of the second kind; see https://dlmf.nist.gov/19.2.ii. These can be evaluated accurately for arbitrary flattening using the method given in https://dlmf.nist.gov/19.36.i. To find \f$\beta\f$ in terms of \f$\mu\f$, Newton's method can be used (noting that \f$dE(\phi,k)/d\phi = \sqrt{1 - k^2\sin^2\phi}\f$); for a starting guess use \f$\beta_0 = \mu\f$ (or use the first terms in the reverted series; see below). These conversions are implemented by Ellipsoid::RectifyingLatitude and Ellipsoid::InverseRectifyingLatitude. If the flattening is small, \f$\mu\f$ can be expressed as a series in various ways. The most economical series is in terms of the third flattening \f$ n = f/(2-f)\f$ and was found by Bessel (1825); see Eq. 5.5.7 of Helmert (1880). Helmert (1880, Eq. 5.6.8) also gives the reverted series (finding \f$\beta\f$ given \f$\mu\f$). These series are used by the Geodesic class where the coefficients are \f$C_{1j}\f$ and \f$C_{1j}'\f$; see Eqs. (18) and (21) of Karney (2013) and \ref geodseries. (Make the replacements, \f$\sigma\rightarrow\beta\f$, \f$\tau\rightarrow\mu\f$, \f$\epsilon\rightarrow n\f$, to convert the notation of the geodesic problem to the problem at hand.) The series are evaluated by Clenshaw summation. These relations allow inter-conversions between the various latitudes \f$\phi\f$, \f$\psi\f$, \f$\chi\f$, \f$\beta\f$, \f$\mu\f$ to be carried out simply and accurately. The approaches using series apply only if \f$f\f$ is small. The others apply for arbitrary values of \f$f\f$. \section rhumbarea The area under a rhumb line The area between a rhumb line and the equator is given by \f[ S_{12} = \int_{\lambda_1}^{\lambda_2} c^2 \sin\xi \,d\lambda, \f] where \f$c\f$ is the authalic radius and \f$\xi\f$ is the authalic latitude. Express \f$\sin\xi\f$ in terms of the conformal latitude \f$\chi\f$ and expand as a series in the third flattening \f$n\f$. This can be expressed in terms of powers of \f$\sin\chi\f$. Substitute \f$\sin\chi=\tanh\psi\f$, where \f$\psi\f$ is the isometric latitude. For a rhumb line we have \f[ \begin{align} \psi &= m(\lambda-\lambda_0),\\ m &= \frac{\psi_2 - \psi_1}{\lambda_2 - \lambda_1}. \end{align} \f] Performing the integral over \f$\lambda\f$ gives \f[ S_{12} = c^2 \lambda_{12} \left<\sin\xi\right>_{12}, \f] where \f$\left<\sin\xi\right>_{12}\f$ is the mean value of \f$\sin\xi\f$ given by \f[ \begin{align} \left<\sin\xi\right>_{12} &= \frac{S(\chi_2) - S(\chi_1)}{\psi_2 - \psi_1},\\ S(\chi) &= \log\sec\chi + \sum_{l=1} R_l\cos(2l\chi), \end{align} \f] \f$\log\f$ is the natural logarithm, and \f$R_l = O(n^l)\f$ is given as a series in \f$n\f$ below. In the spherical limit, the sum vanishes. Note the simple way that longitude enters into the expression for the area. In the limit \f$\chi_2 \rightarrow \chi_1\f$, we can apply l'Hôpital's rule \f[ \left<\sin\xi\right>_{12} \rightarrow \frac{dS(\chi_1)/d\chi_1}{\sec\chi_1} =\sin\xi_1, \f] as expected. In order to maintain accuracy, particularly for rhumb lines which nearly follow a parallel, evaluate \f$\left<\sin\xi\right>_{12}\f$ using divided differences (see the \ref divideddiffs "next section") and use Clenshaw summation to evaluate the sum (see the \ref dividedclenshaw "last section"). Here is the series expansion accurate to 10th order, found by the Maxima script rhumbarea.mac: \verbatim R[1] = - 1/3 * n + 22/45 * n^2 - 356/945 * n^3 + 1772/14175 * n^4 + 41662/467775 * n^5 - 114456994/638512875 * n^6 + 258618446/1915538625 * n^7 - 1053168268/37574026875 * n^8 - 9127715873002/194896477400625 * n^9 + 33380126058386/656284056553125 * n^10; R[2] = - 2/15 * n^2 + 106/315 * n^3 - 1747/4725 * n^4 + 18118/155925 * n^5 + 51304574/212837625 * n^6 - 248174686/638512875 * n^7 + 2800191349/14801889375 * n^8 + 10890707749202/64965492466875 * n^9 - 3594078400868794/10719306257034375 * n^10; R[3] = - 31/315 * n^3 + 104/315 * n^4 - 23011/51975 * n^5 + 1554472/14189175 * n^6 + 114450437/212837625 * n^7 - 8934064508/10854718875 * n^8 + 4913033737121/21655164155625 * n^9 + 591251098891888/714620417135625 * n^10; R[4] = - 41/420 * n^4 + 274/693 * n^5 - 1228489/2027025 * n^6 + 3861434/42567525 * n^7 + 1788295991/1550674125 * n^8 - 215233237178/123743795175 * n^9 + 95577582133463/714620417135625 * n^10; R[5] = - 668/5775 * n^5 + 1092376/2027025 * n^6 - 3966679/4343625 * n^7 + 359094172/10854718875 * n^8 + 7597613999411/3093594879375 * n^9 - 378396252233936/102088631019375 * n^10; R[6] = - 313076/2027025 * n^6 + 4892722/6081075 * n^7 - 1234918799/834978375 * n^8 - 74958999806/618718975875 * n^9 + 48696857431916/9280784638125 * n^10; R[7] = - 3189007/14189175 * n^7 + 930092876/723647925 * n^8 - 522477774212/206239658625 * n^9 - 2163049830386/4331032831125 * n^10; R[8] = - 673429061/1929727800 * n^8 + 16523158892/7638505875 * n^9 - 85076917909/18749059875 * n^10; R[9] = - 39191022457/68746552875 * n^9 + 260863656866/68746552875 * n^10; R[10] = - 22228737368/22915517625 * n^10; \endverbatim \section divideddiffs Use of divided differences Despite our ability to compute latitudes accurately, the way that distances enter into the solution involves the ratio \f$\mu_{12}/\psi_{12}\f$; the numerical calculation of this term is subject to catastrophic round-off errors when \f$\phi_1\f$ and \f$\phi_2\f$ are close. A simple solution, suggested by Bennett (1996), is to extend the treatment of rhumb lines along parallels to this case, i.e., to replace the ratio by the derivative evaluated at the midpoint. However this is not entirely satisfactory: you have to pick the transition point where the derivative takes over from the ratio of differences; and, near this transition point, many bits of accuracy will be lost (I estimate that about 1/3 of bits are lost, leading to errors on the order of 0.1 mm for double precision). Note too that this problem crops up even in the spherical limit. It turns out that we can do substantially better than this and maintain full double precision accuracy. Indeed Botnev and Ustinov provide formulas which allow \f$\mu_{12}/\psi_{12}\f$ to be computed accurately (but the formula for \f$\mu_{12}\f$ applies only for small flattening). Here I give a more systematic treatment using the algebra of divided differences. Many readers will be already using this technique, e.g., when writing, for example, \f[ \frac{\sin(2x) - \sin(2y)}{x-y} = 2\frac{\sin(x-y)}{x-y}\cos(x+y). \f] However, Kahan and Fateman (1999) provide an extensive set of rules which allow the technique to be applied to a wide range of problems. (The classes LambertConformalConic and AlbersEqualArea use this technique to improve the accuracy.) To illustrate the technique, consider the relation between \f$\psi\f$ and \f$\chi\f$, \f[ \psi = \sinh^{-1}\tan\chi. \f] The divided difference operator is defined by \f[ \Delta[f](x,y) = \begin{cases} df(x)/dx, & \text{if $x=y$,} \\ \displaystyle\frac{f(x)-f(y)}{x-y}, & \text{otherwise.} \end{cases} \f] Many of the rules for differentiation apply to divided differences; in particular, we can use the chain rule to write \f[ \frac{\psi_1 - \psi_2}{\chi_1 - \chi_2} = \Delta[\sinh^{-1}](\tan\chi_1,\tan\chi_2) \times \Delta[\tan](\chi_1,\chi_2). \f] Kahan and Fateman catalog the divided difference formulas for all the elementary functions. In this case, we need \f[ \begin{align} \Delta[\tan](x,y) &= \frac{\tan(x-y)}{x-y} (1 + \tan x\tan y),\\ \Delta[\sinh^{-1}](x,y) &= \frac1{x-y} \sinh^{-1}\biggl(\frac{(x-y)(x+y)}{x\sqrt{1+y^2}+y\sqrt{1+x^2}}\biggr). \end{align} \f] The crucial point in these formulas is that the right hand sides can be evaluated accurately even if \f$x-y\f$ is small. (I've only included the basic results here; Kahan and Fateman supplement these with the derivatives if \f$x-y\f$ vanishes or the direct ratios if \f$x-y\f$ is not small.) To complete the computation of \f$\mu_{12}/\psi_{12}\f$, we now need \f$(\mu_1 - \mu_2)/(\chi_1 - \chi_2)\f$, i.e., we need the divided difference of the function that converts the conformal latitude to rectifying latitude. We could go through the chain of relations between these quantities. However, we can take a short cut and recognize that this function was given as a trigonometric series by Krüger (1912) in his development of the transverse Mercator projection. This is also given by Eqs. (5) and (35) of Karney (2011) with the replacements \f$\zeta \rightarrow \mu\f$ and \f$\zeta' \rightarrow \chi\f$. The coefficients appearing in this series and the reverted series Eqs. (6) and (36) are already computed by the TransverseMercator class. The series can be readily converted to divided difference form (see the example at the beginning of this section) and Clenshaw summation can be used to evaluate it (see below). The approach of using the series for the transverse Mercator projection limits the applicability of the method to \f$\left|f\right|\lt 0.01\f$. If we want to extend the method to arbitrary flattening we need to compute \f$\Delta[E](x,y;k)\f$. The necessary relation is the "addition theorem" for the incomplete elliptic integral of the second kind given in https://dlmf.nist.gov/19.11.E2. This can be converted in the following divided difference formula \f[ \Delta[E](x,y;k) =\begin{cases} \sqrt{1 - k^2\sin^2x}, & \text{if $x=y$,} \\ \displaystyle \frac{E(x,k)-E(y,k)}{x-y}, & \text{if $xy \le0$,}\\ \displaystyle \biggl(\frac{E(z,k)}{\sin z} - k^2 \sin x \sin y\biggr)\frac{\sin z}{x-y}, &\text{otherwise,} \end{cases} \f] where the angle \f$z\f$ is given by \f[ \begin{align} \sin z &= \frac{2t}{1 + t^2},\quad\cos z = \frac{(1-t)(1+t)}{1 + t^2},\\ t &= \frac{(x-y)\Delta[\sin](x,y)} {\sin x\sqrt{1 - k^2\sin^2y} + \sin y\sqrt{1 - k^2\sin^2x}} \frac{\sin x + \sin y}{\cos x + \cos y}. \end{align} \f] We also need to apply the divided difference formulas to the conversions from \f$\phi\f$ to \f$\beta\f$ and \f$\phi\f$ to \f$\psi\f$; but these all involve elementary functions and the techniques given in Kahan and Fateman can be used. The end result is that the Rhumb class allows the computation of all rhumb lines for any flattening with full double precision accuracy (the maximum error is about 10 nanometers). I've kept the implementation simple, which results in rather a lot of repeated evaluations of quantities. However, in this case, the need for clarity trumps the desire for speed. \section dividedclenshaw Clenshaw evaluation of differenced sums The use of Clenshaw summation for summing series of the form, \f[ g(x) = \sum_{k=1}^N c_k \sin kx, \f] is well established. However when computing divided differences, we are interested in evaluating \f[ g(x)-g(y) = \sum_{k=1}^N 2 c_k \sin\bigl({\textstyle\frac12}k(x-y)\bigr) \cos\bigl({\textstyle\frac12}k(x+y)\bigr). \f] Clenshaw summation can be used in this case if we simultaneously compute \f$g(x)+g(y)\f$ and perform a matrix summation, \f[ \mathsf G(x,y) = \begin{bmatrix} (g(x) + g(y)) / 2\\ (g(x) - g(y)) / (x - y) \end{bmatrix} = \sum_{k=1}^N c_k \mathsf F_k(x,y), \f] where \f[ \mathsf F_k(x,y)= \begin{bmatrix} \cos kd \sin kp\\ {\displaystyle\frac{\sin kd}d} \cos kp \end{bmatrix}, \f] \f$d=\frac12(x-y)\f$, \f$p=\frac12(x+y)\f$, and, in the limit \f$d\rightarrow0\f$, \f$(\sin kd)/d \rightarrow k\f$. The first element of \f$\mathsf G(x,y)\f$ is the average value of \f$g\f$ and the second element, the divided difference, is the average slope. \f$\mathsf F_k(x,y)\f$ satisfies the recurrence relation \f[ \mathsf F_{k+1}(x,y) = \mathsf A(x,y) \mathsf F_k(x,y) - \mathsf F_{k-1}(x,y), \f] where \f[ \mathsf A(x,y) = 2\begin{bmatrix} \cos d \cos p & -d\sin d \sin p \\ - {\displaystyle\frac{\sin d}d} \sin p & \cos d \cos p \end{bmatrix}, \f] and \f$\lim_{d\rightarrow0}(\sin d)/d = 1\f$. The standard Clenshaw algorithm can now be applied to yield \f[ \begin{align} \mathsf B_{N+1} &= \mathsf B_{N+2} = \mathsf 0, \\ \mathsf B_k &= \mathsf A \mathsf B_{k+1} - \mathsf B_{k+2} + c_k \mathsf I, \qquad\text{for $N\ge k \ge 1$},\\ \mathsf G(x,y) &= \mathsf B_1 \mathsf F_1(x,y), \end{align} \f] where \f$\mathsf B_k\f$ are \f$2\times2\f$ matrices. The divided difference \f$\Delta[g](x,y)\f$ is given by the second element of \f$\mathsf G(x,y)\f$. The same basic recursion applies to the more general case, \f[ g(x) = \sum_{k=0}^N c_k \sin\bigl( (k+k_0)x + x_0\bigr). \f] For example, the sum area arising in the computation of geodesic areas, \f[ \sum_{k=0}^N c_k\cos\bigl((2k+1)\sigma) \f] is given by \f$x=2\sigma\f$, \f$x_0=\frac12\pi\f$, \f$k_0=\frac12\f$. Again we consider the matrix sum, \f[ \mathsf G(x,y) = \begin{bmatrix} (g(x) + g(y)) / 2\\ (g(x) - g(y)) / (x - y) \end{bmatrix} = \sum_{k=0}^N c_k \mathsf F_k(x,y), \f] where \f[ \mathsf F_k(x,y)= \begin{bmatrix} \cos\bigl( (k+k_0)d \bigr) \sin \bigl( (k+k_0)p + x_0 \bigr)\\ {\displaystyle\frac{\sin\bigl( (k+k_0)d \bigr)}d} \cos \bigl( (k+k_0)p + x_0 \bigr) \end{bmatrix}. \f] The recursion for \f$\mathsf B_k\f$ is identical to the previous case; in particular, the expression for \f$\mathsf A(x,y)\f$ remains unchanged. The result for the sum is \f[ \mathsf G(x,y) = (c_0\mathsf I - \mathsf B_2) \mathsf F_0(x,y) + \mathsf B_1 \mathsf F_1(x,y). \f]
Back to \ref jacobi. Forward to \ref greatellipse. Up to \ref contents.
**********************************************************************/ /** \page greatellipse Great Ellipses
Back to \ref rhumb. Forward to \ref transversemercator. Up to \ref contents.
Great ellipses are sometimes proposed (Williams, 1996; Pallikaris & Latsas, 2009) as alternatives to geodesics for the purposes of navigation. This is predicated on the assumption that solving the geodesic problems is complex and costly. These assumptions are no longer true, and geodesics should normally be used in place of great ellipses. This is discussed in more detail in \ref gevsgeodesic. Solutions of the great ellipse problems implemented for MATLAB and Octave are provided by - gedoc: briefly describe the routines - gereckon: solve the direct great ellipse problem - gedistance: solve the inverse great ellipse problem . At this time, there is C++ support in GeographicLib for great ellipses. References: - P. D. Thomas, Mathematical Models for Navigation Systems, TR-182 (U.S. Naval Oceanographic Office, 1965). - B. R. Bowring, The direct and inverse solutions for the great elliptic line on the reference ellipsoid, Bull. Geod. 58, 101--108 (1984). - M. A. Earle, A vector solution for navigation on a great ellipse, J. Navigation 53(3), 473--481 (2000). - M. A. Earle, Vector solutions for azimuth, J. Navigation 61(3), 537--545 (2008). - C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43--55 (2013); addenda: geod-addenda.html. - A. Pallikaris & G. Latsas, New algorithm for great elliptic sailing (GES), J. Navigation 62(3), 493--507 (2009). - A. Pallikaris, L. Tsoulos, & D. Paradissis, New meridian arc formulas for sailing calculations in navigational GIS, International Hydrographic Review, 24--34 (May 2009). - L. E. Sjöberg, Solutions to the direct and inverse navigation problems on the great ellipse, J. Geodetic Science 2(3), 200--205 (2012). - R. Williams, The Great Ellipse on the Surface of the Spheroid, J. Navigation 49(2), 229--234 (1996). - T. Vincenty, Direct and Inverse Solutions of Geodesics on the Ellipsoid with Application of Nested Equations, Survey Review 23(176), 88--93 (1975). - Wikipedia page, Great ellipse. Go to - \ref geformulation - \ref gearea - \ref gevsgeodesic \section geformulation Solution of great ellipse problems Adopt the usual notation for the ellipsoid: equatorial semi-axis \f$a\f$, polar semi-axis \f$b\f$, flattening \f$f = (a-b)/a\f$, eccentricity \f$e = \sqrt{f(2-f)}\f$, second eccentricity \f$e' = e/(1-f)\f$, and third flattening \f$n=(a-b)/(a+b)=f/(2-f)\f$. There are several ways in which an ellipsoid can be mapped into a sphere converting the great ellipse into a great circle. The simplest ones entail scaling the ellipsoid in the \f$\hat z\f$ direction, the direction of the axis of rotation, scaling the ellipsoid radially, or a combination of the two. One such combination (scaling by \f$a^2/b\f$ in the \f$\hat z\f$ direction, following by a radial scaling to the sphere) preserves the geographical latitude \f$\phi\f$. This enables a great ellipse to be plotted on a chart merely by determining way points on the corresponding great circle and transferring them directly on the chart. In this exercise the flattening of the ellipsoid can be ignored! Bowring (1984), Williams (1996), Earle (2000, 2008) and Pallikaris & Latsas (2009), scale the ellipsoid radially onto a sphere preserving the geocentric latitude \f$\theta\f$. More convenient than this is to scale the ellipsoid along \f$\hat z\f$ onto the sphere, as is done by Thomas (1965) and Sjöberg (2012), thus preserving the parametric latitude \f$\beta\f$. The advantage of this "parametric" mapping is that Bessel's rapidly converging series for meridian arc in terms of parametric latitude can be used (a possibility that is overlooked by Sjöberg). The full parametric mapping is: - The geographic latitude \f$\phi\f$ on the ellipsoid maps to the parametric latitude \f$\beta\f$ on the sphere, where \f[a\tan\beta = b\tan\phi.\f] - The longitude \f$\lambda\f$ is unchanged. - The azimuth \f$\alpha\f$ on the ellipsoid maps to an azimuth \f$\gamma\f$ on the sphere where \f[ \begin{align} \tan\alpha &= \frac{\tan\gamma}{\sqrt{1-e^2\cos^2\beta}}, \\ \tan\gamma &= \frac{\tan\alpha}{\sqrt{1+e'^2\cos^2\phi}}, \end{align} \f] and the quadrants of \f$\alpha\f$ and \f$\gamma\f$ are the same. - Positions on the great circle of radius \f$a\f$ are parametrized by arc length \f$\sigma\f$ measured from the northward crossing of the equator. The great ellipse has semi-axes \f$a\f$ and \f$b'=a\sqrt{1-e^2\cos^2\gamma_0}\f$, where \f$\gamma_0\f$ is the great-circle azimuth at the northward equator crossing, and \f$\sigma\f$ is the parametric angle on the ellipse. [In contrast, the ellipse giving distances on a geodesic has semi-axes \f$b\sqrt{1+e'^2\cos^2\alpha_0}\f$ and \f$b\f$.] . To determine the distance along the ellipse in terms of \f$\sigma\f$ and vice versa, the series for distance \f$s\f$ and for \f$\tau\f$ given in \ref geodseries can be used. The direct and inverse great ellipse problems are now simply solved by mapping the problem to the sphere, solving the resulting great circle problem, and mapping this back onto the ellipsoid. \section gearea The area under a great ellipse The area between the segment of a great ellipse and the equator can be found by very similar methods to those used for geodesic areas; see Danielsen (1989). The notation here is similar to that employed by Karney (2013). \f[ \begin{align} S_{12} &= S(\sigma_2) - S(\sigma_1) \\ S(\sigma) &= c^2\gamma + e^2 a^2 \cos\gamma_0 \sin\gamma_0 I_4(\sigma)\\ c^2 &= {\textstyle\frac12}\bigl(a^2 + b^2 (\tanh^{-1}e)/e\bigr) \end{align} \f] \f[ I_4(\sigma) = - \sqrt{1+e'^2}\int \frac{r(e'^2) - r(k^2\sin^2\sigma)}{e'^2 - k^2\sin^2\sigma} \frac{\sin\sigma}2 \,d\sigma \f] \f[ \begin{align} k &= e' \cos\gamma_0,\\ r(x) &= \sqrt{1+x} + (\sinh^{-1}\sqrt x)/\sqrt x. \end{align} \f] Expand in terms of the third flattening of the ellipsoid, \f$n\f$, and the third flattening of the great ellipse, \f$\epsilon=(a-b')/(a+b')\f$, by substituting \f[ \begin{align} e'&=\frac{2\sqrt n}{1-n},\\ k&=\frac{1+n}{1-n} \frac{2\sqrt{\epsilon}}{1+\epsilon}, \end{align} \f] to give \f[ I_4(\sigma) = \sum_{l = 0}^\infty G_{4l}\cos \bigl((2l+1)\sigma\bigr). \f] Compared to the area under a geodesic, we have - \f$\gamma\f$ and \f$\gamma_0\f$ instead of \f$\alpha\f$ and \f$\alpha_0\f$. In both cases, these are azimuths on the auxiliary sphere; however, for the geodesic, they are also the azimuths on the ellipsoid. - \f$r(x) = \bigl(1+t(x)\bigr)/\sqrt{1+x}\f$ instead of \f$t(x)\f$ with a balancing factor of \f$\sqrt{1+e'^2}\f$ appearing in front of the integral. These changes are because expressing \f$\sin\phi\,d\lambda\f$ in terms of \f$\sigma\f$ is a little more complicated with great ellipses. (Don't worry about the addition of \f$1\f$ to \f$t(x)\f$; that's immaterial.) - the factors involving \f$n\f$ in the expression for \f$k\f$ in terms of \f$\epsilon\f$. This is because \f$k\f$ is defined in terms of \f$e'\f$, whereas it is \f$e\cos\gamma_0\f$ that plays the role of the eccentricity for the great ellipse. Here is the series expansion accurate to 10th order, found by gearea.mac: \verbatim G4[0] = + (1/6 + 7/30 * n + 8/105 * n^2 + 4/315 * n^3 + 16/3465 * n^4 + 20/9009 * n^5 + 8/6435 * n^6 + 28/36465 * n^7 + 32/62985 * n^8 + 4/11305 * n^9) - (3/40 + 12/35 * n + 589/840 * n^2 + 1063/1155 * n^3 + 14743/15015 * n^4 + 14899/15015 * n^5 + 254207/255255 * n^6 + 691127/692835 * n^7 + 1614023/1616615 * n^8) * eps + (67/280 + 7081/5040 * n + 5519/1320 * n^2 + 6417449/720720 * n^3 + 708713/45045 * n^4 + 2700154/109395 * n^5 + 519037063/14549535 * n^6 + 78681626/1616615 * n^7) * eps^2 - (29597/40320 + 30013/5280 * n + 33759497/1441440 * n^2 + 100611307/1441440 * n^3 + 16639623457/98017920 * n^4 + 3789780779/10581480 * n^5 + 1027832503/1511640 * n^6) * eps^3 + (357407/147840 + 19833349/823680 * n + 61890679/480480 * n^2 + 97030756063/196035840 * n^3 + 2853930388817/1862340480 * n^4 + 15123282583393/3724680960 * n^5) * eps^4 - (13200233/1537536 + 306285589/2882880 * n + 26279482199/37340160 * n^2 + 3091446335399/931170240 * n^3 + 93089556575647/7449361920 * n^4) * eps^5 + (107042267/3294720 + 253176989449/522762240 * n + 57210830762263/14898723840 * n^2 + 641067300459403/29797447680 * n^3) * eps^6 - (51544067373/398295040 + 38586720036247/17027112960 * n + 104152290127363/4966241280 * n^2) * eps^7 + (369575321823/687964160 + 1721481081751393/158919720960 * n) * eps^8 - 10251814360817/4445306880 * eps^9; G4[1] = + (1/120 + 4/105 * n + 589/7560 * n^2 + 1063/10395 * n^3 + 14743/135135 * n^4 + 14899/135135 * n^5 + 254207/2297295 * n^6 + 691127/6235515 * n^7 + 1614023/14549535 * n^8) * eps - (53/1680 + 847/4320 * n + 102941/166320 * n^2 + 1991747/1441440 * n^3 + 226409/90090 * n^4 + 3065752/765765 * n^5 + 24256057/4157010 * n^6 + 349229428/43648605 * n^7) * eps^2 + (4633/40320 + 315851/332640 * n + 5948333/1441440 * n^2 + 11046565/864864 * n^3 + 9366910279/294053760 * n^4 + 23863367599/349188840 * n^5 + 45824943037/349188840 * n^6) * eps^3 - (8021/18480 + 39452953/8648640 * n + 3433618/135135 * n^2 + 29548772933/294053760 * n^3 + 44355142973/139675536 * n^4 + 4771229132843/5587021440 * n^5) * eps^4 + (2625577/1537536 + 5439457/247104 * n + 353552588953/2352430080 * n^2 + 405002114215/558702144 * n^3 + 61996934629789/22348085760 * n^4) * eps^5 - (91909777/13178880 + 2017395395921/18819440640 * n + 51831652526149/59594895360 * n^2 + 1773086701957889/357569372160 * n^3) * eps^6 + (35166639971/1194885120 + 26948019211109/51081338880 * n + 7934238355871/1596291840 * n^2) * eps^7 - (131854991623/1031946240 + 312710596037369/119189790720 * n) * eps^8 + 842282436291/1481768960 * eps^9; G4[2] = + (1/560 + 29/2016 * n + 1027/18480 * n^2 + 203633/1441440 * n^3 + 124051/450450 * n^4 + 1738138/3828825 * n^5 + 98011493/145495350 * n^6 + 4527382/4849845 * n^7) * eps^2 - (533/40320 + 14269/110880 * n + 908669/1441440 * n^2 + 15253627/7207200 * n^3 + 910103119/163363200 * n^4 + 2403810527/193993800 * n^5 + 746888717/30630600 * n^6) * eps^3 + (2669/36960 + 2443153/2882880 * n + 1024791/200200 * n^2 + 10517570057/490089600 * n^3 + 164668999127/2327925600 * n^4 + 1826633124599/9311702400 * n^5) * eps^4 - (5512967/15375360 + 28823749/5765760 * n + 31539382001/871270400 * n^2 + 1699098121381/9311702400 * n^3 + 287618085731/398361600 * n^4) * eps^5 + (22684703/13178880 + 25126873327/896163840 * n + 10124249914577/42567782400 * n^2 + 836412216748957/595948953600 * n^3) * eps^6 - (3259030001/398295040 + 2610375232847/17027112960 * n + 2121882247763/1418926080 * n^2) * eps^7 + (13387413913/343982080 + 939097138279/1135140864 * n) * eps^8 - 82722916855/444530688 * eps^9; G4[3] = + (5/8064 + 23/3168 * n + 1715/41184 * n^2 + 76061/480480 * n^3 + 812779/1782144 * n^4 + 9661921/8953560 * n^5 + 40072069/18106088 * n^6) * eps^3 - (409/59136 + 10211/109824 * n + 46381/73920 * n^2 + 124922951/43563520 * n^3 + 12524132449/1241560320 * n^4 + 30022391821/1022461440 * n^5) * eps^4 + (22397/439296 + 302399/384384 * n + 461624513/74680320 * n^2 + 1375058687/41385344 * n^3 + 4805085120841/34763688960 * n^4) * eps^5 - (14650421/46126080 + 17533571183/3136573440 * n + 1503945368767/29797447680 * n^2 + 43536234862451/139054755840 * n^3) * eps^6 + (5074867067/2788065280 + 479752611137/13243310080 * n + 1228808683449/3310827520 * n^2) * eps^7 - (12004715823/1203937280 + 17671119291563/79459860480 * n) * eps^8 + 118372499107/2222653440 * eps^9; G4[4] = + (7/25344 + 469/109824 * n + 13439/411840 * n^2 + 9282863/56010240 * n^3 + 37558503/59121920 * n^4 + 44204289461/22348085760 * n^5) * eps^4 - (5453/1317888 + 58753/823680 * n + 138158857/224040960 * n^2 + 191056103/53209728 * n^3 + 712704605341/44696171520 * n^4) * eps^5 + (28213/732160 + 331920271/448081920 * n + 2046013913/283785216 * n^2 + 11489035343/241274880 * n^3) * eps^6 - (346326947/1194885120 + 11716182499/1891901440 * n + 860494893431/12770334720 * n^2) * eps^7 + (750128501/386979840 + 425425087409/9287516160 * n) * eps^8 - 80510858479/6667960320 * eps^9; G4[5] = + (21/146432 + 23/8320 * n + 59859/2263040 * n^2 + 452691/2687360 * n^3 + 21458911/26557440 * n^4) * eps^5 - (3959/1464320 + 516077/9052160 * n + 51814927/85995520 * n^2 + 15444083489/3611811840 * n^3) * eps^6 + (1103391/36208640 + 120920041/171991040 * n + 18522863/2263040 * n^2) * eps^7 - (92526613/343982080 + 24477436759/3611811840 * n) * eps^8 + 1526273559/740884480 * eps^9; G4[6] = + (11/133120 + 1331/696320 * n + 145541/6615040 * n^2 + 46863487/277831680 * n^3) * eps^6 - (68079/36208640 + 621093/13230080 * n + 399883/680960 * n^2) * eps^7 + (658669/26460160 + 186416197/277831680 * n) * eps^8 - 748030679/2963537920 * eps^9; G4[7] = + (143/2785280 + 11011/7938048 * n + 972829/52093440 * n^2) * eps^7 - (434863/317521920 + 263678129/6667960320 * n) * eps^8 + 185257501/8890613760 * eps^9; G4[8] = + (715/21168128 + 27313/26148864 * n) * eps^8 - 1838551/1778122752 * eps^9; G4[9] = + 2431/104595456 * eps^9; \endverbatim \section gevsgeodesic Great ellipses vs geodesics Some papers advocating the use of great ellipses for navigation exhibit a prejudice against the use of geodesics. These excerpts from Pallikaris, Tsoulos, & Paradissis (2009) give the flavor - … it is required to adopt realistic accuracy standards in order not only to eliminate the significant errors of the spherical model but also to avoid the exaggerated and unrealistic requirements of sub meter accuracy. - Calculation of shortest sailings paths on the ellipsoid by a geodetic inverse method involve formulas that are much too complex. - Despite the fact that contemporary computers are fast enough to handle more complete geodetic formulas of sub meter accuracy, a basic principle for the design of navigational systems is the avoidance of unnecessary consumption of computing power. . This prejudice was probably due to the fact that the most well-known algorithms for geodesics, by Vincenty (1975), come with some "asterisks": - no derivation was given (although they follow in a straightforward fashion from classic 19th century methods); - the accuracy is "only" 0.5 mm or so, surely good enough for most applications, but still a reason for a user to worry and a spur to numerous studies "validating" the algorithms; - no indication is given for how to extend the series to improve the accuracy; - there was a belief in some quarters (erroneous!) that the Vincenty algorithms could not be used to compute waypoints; - the algorithm for the inverse problem fails to converge for some inputs. . These problems meant that users were reluctant to bundle the algorithms into a library and treat them as a part of the software infrastructure (much as you might regard the computation of \f$\sin x\f$ as a given). In particular, I regard the last issue, lack of convergence of the inverse solution, as fatal. Even though the problem only arises for nearly antipodal points, it means all users of the library must have some way to handle this problem. For these reasons, substitution of a great ellipse for the geodesic makes some sense. The solution of the great ellipse is, in principle, no more difficult than solving for the great circle and, for paths of less then 10000 km, the error in the distance is less than 13.5 m. Now (2014), however, the situation has reversed. The algorithms given by Karney (2013)—and used in GeographicLib since 2009—explicitly resolve the issues with Vincenty's algorithm. The geodesic problem is conveniently bundled into a library. Users can call this with an assurance of an accurate result much as they would when evaluating \f$\sin x\f$. On the other hand, great ellipses come with their own set of asterisks: - To the extent that they are regarded as approximations to geodesics, the errors need to be quantified, the limits of allowable use documented, etc. - The user is now left with decisions on when to trust the results and to find alternative solutions if necessary. - Even though the great ellipse is no more that 13.5 m longer than a 10000 km geodesic, the path of the great ellipse can deviate from the geodesic by as much as 8.3 km. This disqualifies great ellipses from use in congested air corridors where the strategic lateral offset procedure is in effect and in any situation which demands coordination in the routes of vessels. - Because geodesics obey the triangle inequality, while great ellipses do not, the solutions for realistic navigational problems, e.g., determining the time of closest approach of two vessels, are often simpler in terms of geodesics. To address some other of the objections in the quotes from Pallikaris et al. given above: - "exaggerated and unrealistic requirements of sub meter accuracy": The geodesic algorithms allow full double precision accuracy at essentially no cost. This is because Clenshaw summation allows additional terms to be added to the series without the need for addition trigonometric evaluations. Full accuracy is important to maintain because it allows the results to be used reliably in more complex problems (e.g., in the determination of maritime boundaries). - "unnecessary consumption of computing power": The solution of the inverse geodesic problem takes 2.3 μs; multiple points on a geodesic can be computed at a rate of one point per 0.4 μs. The actual power consumed in these calculations is minuscule compared to the power needed to drive the display of a navigational computer. - "formulas that are much too complex": There's no question that the solution of the geodesic problem is more complex than for great ellipses. However this complexity is only an issue when implementing the algorithms. For the end user, navigational software employing geodesics is less complex compared with that employing great ellipses. Here is what the user needs to know about the geodesic solution:
"The shortest path is found."
And here is the corresponding documentation for great ellipses:
"A path which closely approximates the shortest path is found. Provided that the distance is less than 10000 km, the error in distance is no more than 14 m and the deviation the route from that of the shortest path is no more than 9 km. These bounds apply to the WGS84 ellipsoid. The deviation of the path means that it should be used with caution when planning routes. In addition, great ellipses do not obey the triangle inequality; this disqualifies them from use in some applications."
Having all the geodesic functions bundled up into a reliable "black box" enables users to concentrate on how to solve problems using geodesics (instead of figuring out how to solve for the geodesics). A wide range of problems (intersection of paths, the path for an interception, the time of closest approach, median lines, tri-points, etc.) are all amenable to simple and fast solutions in terms of geodesics.
Back to \ref rhumb. Forward to \ref transversemercator. Up to \ref contents.
**********************************************************************/ /** \page transversemercator Transverse Mercator projection
Back to \ref greatellipse. Forward to \ref geocentric. Up to \ref contents.
TransverseMercator and TransverseMercatorExact provide accurate implementations of the transverse Mercator projection. The TransverseMercatorProj utility provides an interface to these classes. Go to - \ref testmerc - \ref tmseries - \ref tmfigures 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); addenda: tm-addenda.html; preprint: arXiv:1002.1417; resource page: tm.html. . The algorithm for TransverseMercator is based on Krüger (1912); that for 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 - C. F. F. Karney, Test data for the transverse Mercator projection (2009),
DOI: 10.5281/zenodo.32470. . 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 0°, 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 (1 − \e e) 90°. 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, was 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 = (1 − \e e) 90° with lat ≥ 0°; - 25000 entries randomly distributed in lat in [−89°, 0°], lon in [(1 − \e e) 90°, 90°]; - 1000 entries randomly distributed on lat in [−89°, 0°], lon = 90°; - 1000 entries randomly distributed on lat in [−89°, 0°], lon = (1 − \e e) 90°; - 1000 entries close to lat = 0°, lon = 90° (lat < 0°, lon ≤ 90°); - 1000 entries close to lat = 0°, lon = (1 − \e e) 90° (lat < 0°, lon ≤ (1 − \e e) 90°); . (a total of 287000 entries). The entries for lat < 0° and lon in [(1 − \e e) 90°, 90°] use the "extended" domain for the transverse Mercator projection explained in Sec. 5 of Karney (2011). The first 258000 entries have lat ≥ 0° 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, TransverseMercator uses the 6th-order approximation. The preprocessor macro GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER 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 \e n. Some of the integers here are not representable as 32-bit integers and will need to be included as 64-bit integers. \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 γ 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 β 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 α and β 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. \section tmfigures Figures from paper on transverse Mercator projection This section gives color versions of the figures in - C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475--485 (Aug. 2011); addenda: tm-addenda.html; preprint: arXiv:1002.1417; resource page: tm.html. \b NOTE: The numbering of the figures matches that in the paper cited above. The figures in this section are relatively small in order to allow them to be displayed quickly. Vector versions of these figures are available in tm-figs.pdf. This allows you to magnify the figures to show the details more clearly. \image html gauss-schreiber-graticule-a.png "Fig. 1(a)" Fig. 1(a): The graticule for the spherical transverse Mercator projection. The equator lies on \e y = 0. Compare this with Lee, Fig. 1 (right), which shows the graticule for half a sphere, but note that in his notation \e x and \e y have switched meanings. The graticule for the ellipsoid differs from that for a sphere only in that the latitude lines have shifted slightly. (The conformal transformation from an ellipsoid to a sphere merely relabels the lines of latitude.) This projection places the point latitude = 0°, longitude = 90° at infinity. \image html gauss-krueger-graticule-a.png "Fig. 1(b)" Fig. 1(b): The graticule for the Gauss-Krüger transverse Mercator projection. The equator lies on \e y = 0 for longitude < 81°; beyond this, it arcs up to meet \e y = 1. Compare this with Lee, Fig. 45 (upper), which shows the graticule for the International Ellipsoid. Lee, Fig. 46, shows the graticule for the entire ellipsoid. This projection (like the Thompson projection) projects the ellipsoid to a finite area. \image html thompson-tm-graticule-a.png "Fig. 1(c)" Fig. 1(c): The graticule for the Thompson transverse Mercator projection. The equator lies on \e y = 0 for longitude < 81°; at longitude = 81°, it turns by 120° and heads for \e y = 1. Compare this with Lee, Fig. 43, which shows the graticule for the International Ellipsoid. Lee, Fig. 44, shows the graticule for the entire ellipsoid. This projection (like the Gauss-Krüger projection) projects the ellipsoid to a finite area. \image html gauss-krueger-error.png "Fig. 2" Fig. 2: The truncation error for the series for the Gauss-Krüger transverse Mercator projection. The blue curves show the truncation error for the order of the series \e J = 2 (top) thru \e J = 12 (bottom). The red curves show the combined truncation and round-off errors for - float and \e J = 4 (top) - double and \e J = 6 (middle) - long double and \e J = 8 (bottom) \image html gauss-krueger-graticule.png "Fig. 3(a)" Fig. 3(a): The graticule for the extended domain. The blue lines show latitude and longitude at multiples of 10°. The green lines show 1° intervals for longitude in [80°, 90°] and latitude in [−5°, 10°]. \image html gauss-krueger-convergence-scale.png "Fig. 3(b)" Fig. 3(b): The convergence and scale for the Gauss-Krüger transverse Mercator projection in the extended domain. The blue lines emanating from the top left corner (the north pole) are lines of constant convergence. Convergence = 0° is given by the dog-legged line joining the points (0,1), (0,0), (1.71,0), (1.71,−∞). Convergence = 90° is given by the line y = 1. The other lines show multiples of 10° between 0° and 90°. The other blue, the green and the black lines show scale = 1 thru 2 at intervals of 0.1, 2 thru 15 at intervals of 1, and 15 thru 35 at intervals of 5. Multiples of 5 are shown in black, multiples of 1 are shown in blue, and the rest are shown in green. Scale = 1 is given by the line segment (0,0) to (0,1). The red line shows the equator between lon = 81° and 90°. The scale and convergence at the branch point are 1/\e e = 10 and 0°, respectively. \image html thompson-tm-graticule.png "Fig. 3(c)" Fig. 3(c): The graticule for the Thompson transverse Mercator projection for the extended domain. The range of the projection is the rectangular region shown - 0 ≤ \e u ≤ K(e2), 0 ≤ \e v ≤ K(1 − e2) . The coloring of the lines is the same as Fig. 3(a), except that latitude lines extended down to −10° and a red line has been added showing the line \e y = 0 for \e x > 1.71 in the Gauss-Krüger projection (Fig. 3(a)). The extended Thompson projection figure has reflection symmetry on all the four sides of Fig. 3(c).
Back to \ref greatellipse. Forward to \ref geocentric. Up to \ref contents.
**********************************************************************/ /** \page geocentric Geocentric coordinates
Back to \ref transversemercator. Forward to \ref auxlat. Up to \ref contents.
The implementation of 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. . Vermeille similarly updated his method in - H. Vermeille, An analytical method to transform geocentric into geodetic coordinates, J. Geodesy 85, 105--117 (2011). 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 |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 |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 − 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 may 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 (1999). 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 auxlat. Up to \ref contents.
**********************************************************************/ /** \page auxlat Auxiliary latitudes
Back to \ref geocentric. Forward to \ref highprec. Up to \ref contents.
Go to - \ref auxlatformula - \ref auxlattable - \ref auxlaterror Six latitudes are used by GeographicLib: - φ, the (geographic) latitude; - β, the parametric latitude; - θ, the geocentric latitude; - μ, the rectifying latitude; - χ, the conformal latitude; - ξ, the authalic latitude. . The last five of these are called auxiliary latitudes. These quantities are all defined in the Wikipedia article on latitudes. The Ellipsoid class contains methods for converting all of these and the geographic latitude. In addition there's the isometric latitude, ψ, defined by ψ = gd−1χ = sinh−1 tanχ and χ = gdψ = tan−1 sinhψ. This is not an angle-like variable (for example, it diverges at the poles) and so we don't treat it further here. However conversions between ψ and any of the auxiliary latitudes is easily accomplished via an intermediate conversion to χ. The relations between φ, β, and θ are all simple elementary functions. The latitudes χ and ξ can be expressed as elementary functions of φ; however, these functions can only be inverted iteratively. The rectifying latitude μ as a function of φ (or β) involves the incomplete elliptic integral of the second kind (which is not an elementary function) and this needs to be inverted iteratively. The Ellipsoid class evaluates all the auxiliary latitudes (and the corresponding inverse relations) in terms of their basic definitions. An alternative method of evaluating these auxiliary latitudes is in terms of trigonometric series. This offers some advantages: - these series give a uniform way of expressing any latitude in terms of any other latitude; - the evaluation may be faster, particularly if Clenshaw summation is used; - provided that the flattening is sufficiently small, the result may be more accurate (because the round-off errors are smaller). Here we give the complete matrix of relations between all six latitudes; there are 30 (= 6 × 5) such relations. These expansions complement the work of - O. S. Adams, Latitude developments connected with geodesy and cartography, Spec. Pub. 67 (US Coast and Geodetic Survey, 1921). - P. Osborne, The Mercator Projections (2013), Chap. 5. - S. Orihuela, Funciones de Latitud (2013). . Here, the expansions are in terms of the third flattening n = (a − b)/(a + b). This choice of expansion parameter results in expansions in which half the coefficients vanish for all relations between φ, β, θ, and μ. In addition, the expansions converge for |n| < 1 or b/a ∈ (0, ∞). These expansions were obtained with the the maxima code, auxlat.mac. Adams (1921) uses the eccentricity squared e2 as the expansion parameter, but the resulting series only converge for |e2| < 1 or b/a ∈ (0, √2). In addition, it is shown in \ref auxlaterror, that the errors when the series are truncated are much worse than for the corresponding series in \e n. \b NOTE: The assertions about convergence above are too optimistic. Some of the series do indeed converge for |n| < 1. However others have a smaller radius of convergence. More on this later… \section auxlatformula Series approximations for conversions Here are the relations between φ, β, θ, and μ carried out to 4th order in n: \f[ \begin{align} \beta-\phi&=\textstyle{} -n\sin 2\phi +\frac{1}{2}n^{2}\sin 4\phi -\frac{1}{3}n^{3}\sin 6\phi +\frac{1}{4}n^{4}\sin 8\phi -\ldots\\ \phi-\beta&=\textstyle{} +n\sin 2\beta +\frac{1}{2}n^{2}\sin 4\beta +\frac{1}{3}n^{3}\sin 6\beta +\frac{1}{4}n^{4}\sin 8\beta +\ldots\\ \theta-\phi&=\textstyle{} -\bigl(2n-2n^{3}\bigr)\sin 2\phi +\bigl(2n^{2}-4n^{4}\bigr)\sin 4\phi -\frac{8}{3}n^{3}\sin 6\phi +4n^{4}\sin 8\phi -\ldots\\ \phi-\theta&=\textstyle{} +\bigl(2n-2n^{3}\bigr)\sin 2\theta +\bigl(2n^{2}-4n^{4}\bigr)\sin 4\theta +\frac{8}{3}n^{3}\sin 6\theta +4n^{4}\sin 8\theta +\ldots\\ \theta-\beta&=\textstyle{} -n\sin 2\beta +\frac{1}{2}n^{2}\sin 4\beta -\frac{1}{3}n^{3}\sin 6\beta +\frac{1}{4}n^{4}\sin 8\beta -\ldots\\ \beta-\theta&=\textstyle{} +n\sin 2\theta +\frac{1}{2}n^{2}\sin 4\theta +\frac{1}{3}n^{3}\sin 6\theta +\frac{1}{4}n^{4}\sin 8\theta +\ldots\\ \mu-\phi&=\textstyle{} -\bigl(\frac{3}{2}n-\frac{9}{16}n^{3}\bigr)\sin 2\phi +\bigl(\frac{15}{16}n^{2}-\frac{15}{32}n^{4}\bigr)\sin 4\phi -\frac{35}{48}n^{3}\sin 6\phi +\frac{315}{512}n^{4}\sin 8\phi -\ldots\\ \phi-\mu&=\textstyle{} +\bigl(\frac{3}{2}n-\frac{27}{32}n^{3}\bigr)\sin 2\mu +\bigl(\frac{21}{16}n^{2}-\frac{55}{32}n^{4}\bigr)\sin 4\mu +\frac{151}{96}n^{3}\sin 6\mu +\frac{1097}{512}n^{4}\sin 8\mu +\ldots\\ \mu-\beta&=\textstyle{} -\bigl(\frac{1}{2}n-\frac{3}{16}n^{3}\bigr)\sin 2\beta -\bigl(\frac{1}{16}n^{2}-\frac{1}{32}n^{4}\bigr)\sin 4\beta -\frac{1}{48}n^{3}\sin 6\beta -\frac{5}{512}n^{4}\sin 8\beta -\ldots\\ \beta-\mu&=\textstyle{} +\bigl(\frac{1}{2}n-\frac{9}{32}n^{3}\bigr)\sin 2\mu +\bigl(\frac{5}{16}n^{2}-\frac{37}{96}n^{4}\bigr)\sin 4\mu +\frac{29}{96}n^{3}\sin 6\mu +\frac{539}{1536}n^{4}\sin 8\mu +\ldots\\ \mu-\theta&=\textstyle{} +\bigl(\frac{1}{2}n+\frac{13}{16}n^{3}\bigr)\sin 2\theta -\bigl(\frac{1}{16}n^{2}-\frac{33}{32}n^{4}\bigr)\sin 4\theta -\frac{5}{16}n^{3}\sin 6\theta -\frac{261}{512}n^{4}\sin 8\theta -\ldots\\ \theta-\mu&=\textstyle{} -\bigl(\frac{1}{2}n+\frac{23}{32}n^{3}\bigr)\sin 2\mu +\bigl(\frac{5}{16}n^{2}-\frac{5}{96}n^{4}\bigr)\sin 4\mu +\frac{1}{32}n^{3}\sin 6\mu +\frac{283}{1536}n^{4}\sin 8\mu +\ldots\\ \end{align} \f] Here are the remaining relations (including χ and ξ) carried out to 3rd order in n: \f[ \begin{align} \chi-\phi&=\textstyle{} -\bigl(2n-\frac{2}{3}n^{2}-\frac{4}{3}n^{3}\bigr)\sin 2\phi +\bigl(\frac{5}{3}n^{2}-\frac{16}{15}n^{3}\bigr)\sin 4\phi -\frac{26}{15}n^{3}\sin 6\phi +\ldots\\ \phi-\chi&=\textstyle{} +\bigl(2n-\frac{2}{3}n^{2}-2n^{3}\bigr)\sin 2\chi +\bigl(\frac{7}{3}n^{2}-\frac{8}{5}n^{3}\bigr)\sin 4\chi +\frac{56}{15}n^{3}\sin 6\chi +\ldots\\ \chi-\beta&=\textstyle{} -\bigl(n-\frac{2}{3}n^{2}\bigr)\sin 2\beta +\bigl(\frac{1}{6}n^{2}-\frac{2}{5}n^{3}\bigr)\sin 4\beta -\frac{1}{15}n^{3}\sin 6\beta +\ldots\\ \beta-\chi&=\textstyle{} +\bigl(n-\frac{2}{3}n^{2}-\frac{1}{3}n^{3}\bigr)\sin 2\chi +\bigl(\frac{5}{6}n^{2}-\frac{14}{15}n^{3}\bigr)\sin 4\chi +\frac{16}{15}n^{3}\sin 6\chi +\ldots\\ \chi-\theta&=\textstyle{} +\bigl(\frac{2}{3}n^{2}+\frac{2}{3}n^{3}\bigr)\sin 2\theta -\bigl(\frac{1}{3}n^{2}-\frac{4}{15}n^{3}\bigr)\sin 4\theta -\frac{2}{5}n^{3}\sin 6\theta -\ldots\\ \theta-\chi&=\textstyle{} -\bigl(\frac{2}{3}n^{2}+\frac{2}{3}n^{3}\bigr)\sin 2\chi +\bigl(\frac{1}{3}n^{2}-\frac{4}{15}n^{3}\bigr)\sin 4\chi +\frac{2}{5}n^{3}\sin 6\chi +\ldots\\ \chi-\mu&=\textstyle{} -\bigl(\frac{1}{2}n-\frac{2}{3}n^{2}+\frac{37}{96}n^{3}\bigr)\sin 2\mu -\bigl(\frac{1}{48}n^{2}+\frac{1}{15}n^{3}\bigr)\sin 4\mu -\frac{17}{480}n^{3}\sin 6\mu -\ldots\\ \mu-\chi&=\textstyle{} +\bigl(\frac{1}{2}n-\frac{2}{3}n^{2}+\frac{5}{16}n^{3}\bigr)\sin 2\chi +\bigl(\frac{13}{48}n^{2}-\frac{3}{5}n^{3}\bigr)\sin 4\chi +\frac{61}{240}n^{3}\sin 6\chi +\ldots\\ \xi-\phi&=\textstyle{} -\bigl(\frac{4}{3}n+\frac{4}{45}n^{2}-\frac{88}{315}n^{3}\bigr)\sin 2\phi +\bigl(\frac{34}{45}n^{2}+\frac{8}{105}n^{3}\bigr)\sin 4\phi -\frac{1532}{2835}n^{3}\sin 6\phi +\ldots\\ \phi-\xi&=\textstyle{} +\bigl(\frac{4}{3}n+\frac{4}{45}n^{2}-\frac{16}{35}n^{3}\bigr)\sin 2\xi +\bigl(\frac{46}{45}n^{2}+\frac{152}{945}n^{3}\bigr)\sin 4\xi +\frac{3044}{2835}n^{3}\sin 6\xi +\ldots\\ \xi-\beta&=\textstyle{} -\bigl(\frac{1}{3}n+\frac{4}{45}n^{2}-\frac{32}{315}n^{3}\bigr)\sin 2\beta -\bigl(\frac{7}{90}n^{2}+\frac{4}{315}n^{3}\bigr)\sin 4\beta -\frac{83}{2835}n^{3}\sin 6\beta -\ldots\\ \beta-\xi&=\textstyle{} +\bigl(\frac{1}{3}n+\frac{4}{45}n^{2}-\frac{46}{315}n^{3}\bigr)\sin 2\xi +\bigl(\frac{17}{90}n^{2}+\frac{68}{945}n^{3}\bigr)\sin 4\xi +\frac{461}{2835}n^{3}\sin 6\xi +\ldots\\ \xi-\theta&=\textstyle{} +\bigl(\frac{2}{3}n-\frac{4}{45}n^{2}+\frac{62}{105}n^{3}\bigr)\sin 2\theta +\bigl(\frac{4}{45}n^{2}-\frac{32}{315}n^{3}\bigr)\sin 4\theta -\frac{524}{2835}n^{3}\sin 6\theta -\ldots\\ \theta-\xi&=\textstyle{} -\bigl(\frac{2}{3}n-\frac{4}{45}n^{2}+\frac{158}{315}n^{3}\bigr)\sin 2\xi +\bigl(\frac{16}{45}n^{2}-\frac{16}{945}n^{3}\bigr)\sin 4\xi -\frac{232}{2835}n^{3}\sin 6\xi +\ldots\\ \xi-\mu&=\textstyle{} +\bigl(\frac{1}{6}n-\frac{4}{45}n^{2}-\frac{817}{10080}n^{3}\bigr)\sin 2\mu +\bigl(\frac{49}{720}n^{2}-\frac{2}{35}n^{3}\bigr)\sin 4\mu +\frac{4463}{90720}n^{3}\sin 6\mu +\ldots\\ \mu-\xi&=\textstyle{} -\bigl(\frac{1}{6}n-\frac{4}{45}n^{2}-\frac{121}{1680}n^{3}\bigr)\sin 2\xi -\bigl(\frac{29}{720}n^{2}-\frac{26}{945}n^{3}\bigr)\sin 4\xi -\frac{1003}{45360}n^{3}\sin 6\xi -\ldots\\ \xi-\chi&=\textstyle{} +\bigl(\frac{2}{3}n-\frac{34}{45}n^{2}+\frac{46}{315}n^{3}\bigr)\sin 2\chi +\bigl(\frac{19}{45}n^{2}-\frac{256}{315}n^{3}\bigr)\sin 4\chi +\frac{248}{567}n^{3}\sin 6\chi +\ldots\\ \chi-\xi&=\textstyle{} -\bigl(\frac{2}{3}n-\frac{34}{45}n^{2}+\frac{88}{315}n^{3}\bigr)\sin 2\xi +\bigl(\frac{1}{45}n^{2}-\frac{184}{945}n^{3}\bigr)\sin 4\xi -\frac{106}{2835}n^{3}\sin 6\xi -\ldots\\ \end{align} \f] \section auxlattable Series approximations in tabular form Finally, this is a listing of all the coefficients for the expansions carried out to 8th order in n. Here's how to interpret this data: the 5th line for φ − θ is [32/5, 0, -32, 0]; this means that the coefficient of sin(10θ) is [(32/5)n5 − 32n7 + O(n9)].

β − φ:
   [-1, 0, 0, 0, 0, 0, 0, 0]
   [1/2, 0, 0, 0, 0, 0, 0]
   [-1/3, 0, 0, 0, 0, 0]
   [1/4, 0, 0, 0, 0]
   [-1/5, 0, 0, 0]
   [1/6, 0, 0]
   [-1/7, 0]
   [1/8]

φ − β:
   [1, 0, 0, 0, 0, 0, 0, 0]
   [1/2, 0, 0, 0, 0, 0, 0]
   [1/3, 0, 0, 0, 0, 0]
   [1/4, 0, 0, 0, 0]
   [1/5, 0, 0, 0]
   [1/6, 0, 0]
   [1/7, 0]
   [1/8]

θ − φ:
   [-2, 0, 2, 0, -2, 0, 2, 0]
   [2, 0, -4, 0, 6, 0, -8]
   [-8/3, 0, 8, 0, -16, 0]
   [4, 0, -16, 0, 40]
   [-32/5, 0, 32, 0]
   [32/3, 0, -64]
   [-128/7, 0]
   [32]

φ − θ:
   [2, 0, -2, 0, 2, 0, -2, 0]
   [2, 0, -4, 0, 6, 0, -8]
   [8/3, 0, -8, 0, 16, 0]
   [4, 0, -16, 0, 40]
   [32/5, 0, -32, 0]
   [32/3, 0, -64]
   [128/7, 0]
   [32]

θ − β:
   [-1, 0, 0, 0, 0, 0, 0, 0]
   [1/2, 0, 0, 0, 0, 0, 0]
   [-1/3, 0, 0, 0, 0, 0]
   [1/4, 0, 0, 0, 0]
   [-1/5, 0, 0, 0]
   [1/6, 0, 0]
   [-1/7, 0]
   [1/8]

β − θ:
   [1, 0, 0, 0, 0, 0, 0, 0]
   [1/2, 0, 0, 0, 0, 0, 0]
   [1/3, 0, 0, 0, 0, 0]
   [1/4, 0, 0, 0, 0]
   [1/5, 0, 0, 0]
   [1/6, 0, 0]
   [1/7, 0]
   [1/8]

μ − φ:
   [-3/2, 0, 9/16, 0, -3/32, 0, 57/2048, 0]
   [15/16, 0, -15/32, 0, 135/2048, 0, -105/4096]
   [-35/48, 0, 105/256, 0, -105/2048, 0]
   [315/512, 0, -189/512, 0, 693/16384]
   [-693/1280, 0, 693/2048, 0]
   [1001/2048, 0, -1287/4096]
   [-6435/14336, 0]
   [109395/262144]

φ − μ:
   [3/2, 0, -27/32, 0, 269/512, 0, -6607/24576, 0]
   [21/16, 0, -55/32, 0, 6759/4096, 0, -155113/122880]
   [151/96, 0, -417/128, 0, 87963/20480, 0]
   [1097/512, 0, -15543/2560, 0, 2514467/245760]
   [8011/2560, 0, -69119/6144, 0]
   [293393/61440, 0, -5962461/286720]
   [6459601/860160, 0]
   [332287993/27525120]

μ − β:
   [-1/2, 0, 3/16, 0, -1/32, 0, 19/2048, 0]
   [-1/16, 0, 1/32, 0, -9/2048, 0, 7/4096]
   [-1/48, 0, 3/256, 0, -3/2048, 0]
   [-5/512, 0, 3/512, 0, -11/16384]
   [-7/1280, 0, 7/2048, 0]
   [-7/2048, 0, 9/4096]
   [-33/14336, 0]
   [-429/262144]

β − μ:
   [1/2, 0, -9/32, 0, 205/1536, 0, -4879/73728, 0]
   [5/16, 0, -37/96, 0, 1335/4096, 0, -86171/368640]
   [29/96, 0, -75/128, 0, 2901/4096, 0]
   [539/1536, 0, -2391/2560, 0, 1082857/737280]
   [3467/7680, 0, -28223/18432, 0]
   [38081/61440, 0, -733437/286720]
   [459485/516096, 0]
   [109167851/82575360]

μ − θ:
   [1/2, 0, 13/16, 0, -15/32, 0, 509/2048, 0]
   [-1/16, 0, 33/32, 0, -1673/2048, 0, 2599/4096]
   [-5/16, 0, 349/256, 0, -2989/2048, 0]
   [-261/512, 0, 963/512, 0, -43531/16384]
   [-921/1280, 0, 5545/2048, 0]
   [-6037/6144, 0, 16617/4096]
   [-19279/14336, 0]
   [-490925/262144]

θ − μ:
   [-1/2, 0, -23/32, 0, 499/1536, 0, -14321/73728, 0]
   [5/16, 0, -5/96, 0, 6565/12288, 0, -201467/368640]
   [1/32, 0, -77/128, 0, 2939/4096, 0]
   [283/1536, 0, -4037/7680, 0, 1155049/737280]
   [1301/7680, 0, -19465/18432, 0]
   [17089/61440, 0, -442269/286720]
   [198115/516096, 0]
   [48689387/82575360]

χ − φ:
   [-2, 2/3, 4/3, -82/45, 32/45, 4642/4725, -8384/4725, 1514/1323]
   [5/3, -16/15, -13/9, 904/315, -1522/945, -2288/1575, 142607/42525]
   [-26/15, 34/21, 8/5, -12686/2835, 44644/14175, 120202/51975]
   [1237/630, -12/5, -24832/14175, 1077964/155925, -1097407/187110]
   [-734/315, 109598/31185, 1040/567, -12870194/1216215]
   [444337/155925, -941912/184275, -126463/72765]
   [-2405834/675675, 3463678/467775]
   [256663081/56756700]

φ − χ:
   [2, -2/3, -2, 116/45, 26/45, -2854/675, 16822/4725, 189416/99225]
   [7/3, -8/5, -227/45, 2704/315, 2323/945, -31256/1575, 141514/8505]
   [56/15, -136/35, -1262/105, 73814/2835, 98738/14175, -2363828/31185]
   [4279/630, -332/35, -399572/14175, 11763988/155925, 14416399/935550]
   [4174/315, -144838/6237, -2046082/31185, 258316372/1216215]
   [601676/22275, -115444544/2027025, -2155215124/14189175]
   [38341552/675675, -170079376/1216215]
   [1383243703/11351340]

χ − β:
   [-1, 2/3, 0, -16/45, 2/5, -998/4725, -34/4725, 1384/11025]
   [1/6, -2/5, 19/45, -22/105, -2/27, 1268/4725, -12616/42525]
   [-1/15, 16/105, -22/105, 116/567, -1858/14175, 1724/51975]
   [17/1260, -8/105, 2123/14175, -26836/155925, 115249/935550]
   [-1/105, 128/4455, -424/6237, 140836/1216215]
   [149/311850, -31232/2027025, 210152/4729725]
   [-499/225225, 30208/6081075]
   [-68251/113513400]

β − χ:
   [1, -2/3, -1/3, 38/45, -1/3, -3118/4725, 4769/4725, -25666/99225]
   [5/6, -14/15, -7/9, 50/21, -247/270, -14404/4725, 193931/42525]
   [16/15, -34/21, -5/3, 17564/2835, -36521/14175, -1709614/155925]
   [2069/1260, -28/9, -49877/14175, 2454416/155925, -637699/85050]
   [883/315, -28244/4455, -20989/2835, 48124558/1216215]
   [797222/155925, -2471888/184275, -16969807/1091475]
   [2199332/225225, -1238578/42525]
   [87600385/4540536]

χ − θ:
   [0, 2/3, 2/3, -2/9, -14/45, 1042/4725, 18/175, -1738/11025]
   [-1/3, 4/15, 43/45, -4/45, -712/945, 332/945, 23159/42525]
   [-2/5, 2/105, 124/105, 274/2835, -1352/945, 13102/31185]
   [-55/126, -16/105, 21068/14175, 1528/4725, -2414843/935550]
   [-22/45, -9202/31185, 20704/10395, 60334/93555]
   [-90263/155925, -299444/675675, 40458083/14189175]
   [-8962/12285, -3818498/6081075]
   [-4259027/4365900]

θ − χ:
   [0, -2/3, -2/3, 4/9, 2/9, -3658/4725, 76/225, 64424/99225]
   [1/3, -4/15, -23/45, 68/45, 61/135, -2728/945, 2146/1215]
   [2/5, -24/35, -46/35, 9446/2835, 428/945, -95948/10395]
   [83/126, -80/63, -34712/14175, 4472/525, 29741/85050]
   [52/45, -2362/891, -17432/3465, 280108/13365]
   [335882/155925, -548752/96525, -48965632/4729725]
   [51368/12285, -197456/15795]
   [1461335/174636]

χ − μ:
   [-1/2, 2/3, -37/96, 1/360, 81/512, -96199/604800, 5406467/38707200, -7944359/67737600]
   [-1/48, -1/15, 437/1440, -46/105, 1118711/3870720, -51841/1209600, -24749483/348364800]
   [-17/480, 37/840, 209/4480, -5569/90720, -9261899/58060800, 6457463/17740800]
   [-4397/161280, 11/504, 830251/7257600, -466511/2494800, -324154477/7664025600]
   [-4583/161280, 108847/3991680, 8005831/63866880, -22894433/124540416]
   [-20648693/638668800, 16363163/518918400, 2204645983/12915302400]
   [-219941297/5535129600, 497323811/12454041600]
   [-191773887257/3719607091200]

μ − χ:
   [1/2, -2/3, 5/16, 41/180, -127/288, 7891/37800, 72161/387072, -18975107/50803200]
   [13/48, -3/5, 557/1440, 281/630, -1983433/1935360, 13769/28800, 148003883/174182400]
   [61/240, -103/140, 15061/26880, 167603/181440, -67102379/29030400, 79682431/79833600]
   [49561/161280, -179/168, 6601661/7257600, 97445/49896, -40176129013/7664025600]
   [34729/80640, -3418889/1995840, 14644087/9123840, 2605413599/622702080]
   [212378941/319334400, -30705481/10378368, 175214326799/58118860800]
   [1522256789/1383782400, -16759934899/3113510400]
   [1424729850961/743921418240]

ξ − φ:
   [-4/3, -4/45, 88/315, 538/4725, 20824/467775, -44732/2837835, -86728/16372125, -88002076/13956067125]
   [34/45, 8/105, -2482/14175, -37192/467775, -12467764/212837625, -895712/147349125, -2641983469/488462349375]
   [-1532/2835, -898/14175, 54968/467775, 100320856/1915538625, 240616/4209975, 8457703444/488462349375]
   [6007/14175, 24496/467775, -5884124/70945875, -4832848/147349125, -4910552477/97692469875]
   [-23356/66825, -839792/19348875, 816824/13395375, 9393713176/488462349375]
   [570284222/1915538625, 1980656/54729675, -4532926649/97692469875]
   [-496894276/1915538625, -14848113968/488462349375]
   [224557742191/976924698750]

φ − ξ:
   [4/3, 4/45, -16/35, -2582/14175, 60136/467775, 28112932/212837625, 22947844/1915538625, -1683291094/37574026875]
   [46/45, 152/945, -11966/14175, -21016/51975, 251310128/638512875, 1228352/3007125, -14351220203/488462349375]
   [3044/2835, 3802/14175, -94388/66825, -8797648/10945935, 138128272/147349125, 505559334506/488462349375]
   [6059/4725, 41072/93555, -1472637812/638512875, -45079184/29469825, 973080708361/488462349375]
   [768272/467775, 455935736/638512875, -550000184/147349125, -1385645336626/488462349375]
   [4210684958/1915538625, 443810768/383107725, -2939205114427/488462349375]
   [387227992/127702575, 101885255158/54273594375]
   [1392441148867/325641566250]

ξ − β:
   [-1/3, -4/45, 32/315, 34/675, 2476/467775, -70496/8513505, -18484/4343625, 29232878/97692469875]
   [-7/90, -4/315, 74/2025, 3992/467775, 53836/212837625, -4160804/1915538625, -324943819/488462349375]
   [-83/2835, 2/14175, 7052/467775, -661844/1915538625, 237052/383107725, -168643106/488462349375]
   [-797/56700, 934/467775, 1425778/212837625, -2915326/1915538625, 113042383/97692469875]
   [-3673/467775, 390088/212837625, 6064888/1915538625, -558526274/488462349375]
   [-18623681/3831077250, 41288/29469825, 155665021/97692469875]
   [-6205669/1915538625, 504234982/488462349375]
   [-8913001661/3907698795000]

β − ξ:
   [1/3, 4/45, -46/315, -1082/14175, 11824/467775, 7947332/212837625, 9708931/1915538625, -5946082372/488462349375]
   [17/90, 68/945, -338/2025, -16672/155925, 39946703/638512875, 164328266/1915538625, 190673521/69780335625]
   [461/2835, 1102/14175, -101069/467775, -255454/1563705, 236067184/1915538625, 86402898356/488462349375]
   [3161/18900, 1786/18711, -189032762/638512875, -98401826/383107725, 110123070361/488462349375]
   [88868/467775, 80274086/638512875, -802887278/1915538625, -200020620676/488462349375]
   [880980241/3831077250, 66263486/383107725, -296107325077/488462349375]
   [37151038/127702575, 4433064236/18091198125]
   [495248998393/1302566265000]

ξ − θ:
   [2/3, -4/45, 62/105, 778/4725, -193082/467775, -4286228/42567525, 53702182/212837625, 182466964/8881133625]
   [4/45, -32/315, 12338/14175, 92696/467775, -61623938/70945875, -32500616/273648375, 367082779691/488462349375]
   [-524/2835, -1618/14175, 612536/467775, 427003576/1915538625, -663111728/383107725, -42668482796/488462349375]
   [-5933/14175, -8324/66825, 427770788/212837625, 421877252/1915538625, -327791986997/97692469875]
   [-320044/467775, -9153184/70945875, 6024982024/1915538625, 74612072536/488462349375]
   [-1978771378/1915538625, -46140784/383107725, 489898512247/97692469875]
   [-2926201612/1915538625, -42056042768/488462349375]
   [-2209250801969/976924698750]

θ − ξ:
   [-2/3, 4/45, -158/315, -2102/14175, 109042/467775, 216932/2627625, -189115382/1915538625, -230886326/6343666875]
   [16/45, -16/945, 934/14175, -7256/155925, 117952358/638512875, 288456008/1915538625, -11696145869/69780335625]
   [-232/2835, 922/14175, -25286/66825, -7391576/54729675, 478700902/1915538625, 91546732346/488462349375]
   [719/4725, 268/18711, -67048172/638512875, -67330724/383107725, 218929662961/488462349375]
   [14354/467775, 46774256/638512875, -117954842/273648375, -129039188386/488462349375]
   [253129538/1915538625, 2114368/34827975, -178084928947/488462349375]
   [13805944/127702575, 6489189398/54273594375]
   [59983985827/325641566250]

ξ − μ:
   [1/6, -4/45, -817/10080, 1297/18900, 7764059/239500800, -9292991/302702400, -25359310709/1743565824000, 39534358147/2858202547200]
   [49/720, -2/35, -29609/453600, 35474/467775, 36019108271/871782912000, -14814966289/245188944000, -13216941177599/571640509440000]
   [4463/90720, -2917/56700, -4306823/59875200, 3026004511/30648618000, 99871724539/1569209241600, -27782109847927/250092722880000]
   [331799/7257600, -102293/1871100, -368661577/4036032000, 2123926699/15324309000, 168979300892599/1600593426432000]
   [11744233/239500800, -875457073/13621608000, -493031379277/3923023104000, 1959350112697/9618950880000]
   [453002260127/7846046208000, -793693009/9807557760, -145659994071373/800296713216000]
   [103558761539/1426553856000, -53583096419057/500185445760000]
   [12272105438887727/128047474114560000]

μ − ξ:
   [-1/6, 4/45, 121/1680, -1609/28350, -384229/14968800, 12674323/851350500, 7183403063/560431872000, -375027460897/125046361440000]
   [-29/720, 26/945, 16463/453600, -431/17325, -31621753811/1307674368000, 1117820213/122594472000, 30410873385097/2000741783040000]
   [-1003/45360, 449/28350, 3746047/119750400, -32844781/1751349600, -116359346641/3923023104000, 151567502183/17863765920000]
   [-40457/2419200, 629/53460, 10650637121/326918592000, -13060303/766215450, -317251099510901/8002967132160000]
   [-1800439/119750400, 205072597/20432412000, 146875240637/3923023104000, -2105440822861/125046361440000]
   [-59109051671/3923023104000, 228253559/24518894400, 91496147778023/2000741783040000]
   [-4255034947/261534873600, 126430355893/13894040160000]
   [-791820407649841/42682491371520000]

ξ − χ:
   [2/3, -34/45, 46/315, 2458/4725, -55222/93555, 2706758/42567525, 16676974/30405375, -64724382148/97692469875]
   [19/45, -256/315, 3413/14175, 516944/467775, -340492279/212837625, 158999572/1915538625, 85904355287/37574026875]
   [248/567, -15958/14175, 206834/467775, 4430783356/1915538625, -7597644214/1915538625, 2986003168/37574026875]
   [16049/28350, -832976/467775, 62016436/70945875, 851209552/174139875, -375566203/39037950]
   [15602/18711, -651151712/212837625, 3475643362/1915538625, 5106181018156/488462349375]
   [2561772812/1915538625, -10656173804/1915538625, 34581190223/8881133625]
   [873037408/383107725, -5150169424688/488462349375]
   [7939103697617/1953849397500]

χ − ξ:
   [-2/3, 34/45, -88/315, -2312/14175, 27128/93555, -55271278/212837625, 308365186/1915538625, -17451293242/488462349375]
   [1/45, -184/945, 6079/14175, -65864/155925, 106691108/638512875, 149984636/1915538625, -101520127208/488462349375]
   [-106/2835, 772/14175, -14246/467775, 5921152/54729675, -99534832/383107725, 10010741462/37574026875]
   [-167/9450, -5312/467775, 75594328/638512875, -35573728/273648375, 1615002539/75148053750]
   [-248/13365, 2837636/638512875, 130601488/1915538625, -3358119706/488462349375]
   [-34761247/1915538625, -3196/3553875, 46771947158/488462349375]
   [-2530364/127702575, -18696014/18091198125]
   [-14744861191/651283132500]
\section auxlaterror Truncation errors There are two sources of error when using these series. The truncation error arises from retaing terms up to a certain order in \e n; it is the absolute difference between the value of the truncated series compared with the exact latitude (evaluated with exact arithmetic). In addition, using standard double-precision arithmetic entails accumulating round-off errors so that at the end of a complex calculation a few of the trailing bits of the result are wrong. Here's a table of the truncation errors. The errors are given in "units in the last place (ulp)" where 1 ulp = 2−53 radian = 6.4 × 10−15 degree = 2.3 × 10−11 arcsecond which is a measure of the round-off error for double precision. Here is some rough guidance on how to interpret these errors: - if the truncation error is less than 1 ulp, then round-off errors dominate; - if the truncation error is greater than 8 ulp, then truncation errors dominate; - otherwise, round-off and truncation errors are comparable. . The truncation errors are given accurate to 2 significant figures.

Auxiliary latitude truncation errors (ulp)
expression [f = 1/150, order = 6] [f = 1/297, order = 5]
n series e2 series n series e2 series
β − φ
0.0060 
28   
 0.035 
 41   
φ − β
0.0060 
28   
 0.035 
 41   
θ − φ
2.9    
82   
 6.0   
120   
φ − θ
2.9    
82   
 6.0   
120   
θ − β
0.0060 
28   
 0.035 
 41   
β − θ
0.0060 
28   
 0.035 
 41   
μ − φ
0.037  
41   
 0.18  
 60   
φ − μ
0.98   
59   
 2.3   
 84   
μ − β
0.00069
 5.8 
 0.0024
  9.6 
β − μ
0.13   
12   
 0.35  
 19   
μ − θ
0.24   
30   
 0.67  
 40   
θ − μ
0.099  
23   
 0.23  
 33   
χ − φ
0.78   
43   
 2.1   
 64   
φ − χ
9.0    
71   
17     
100   
χ − β
0.018  
 3.7 
 0.11  
  6.4 
β − χ
1.7    
16   
 3.4   
 24   
χ − θ
0.18   
31   
 0.56  
 43   
θ − χ
0.87   
23   
 1.9   
 32   
χ − μ
0.022  
 0.56
 0.11  
  0.91
μ − χ
0.31   
 1.2 
 0.86  
  2.0 
ξ − φ
0.015  
39   
 0.086 
 57   
φ − ξ
0.34   
53   
 1.1   
 75   
ξ − β
0.00042
 6.3 
 0.0039
 10   
β − ξ
0.040  
10   
 0.15  
 15   
ξ − θ
0.28   
28   
 0.75  
 38   
θ − ξ
0.040  
23   
 0.11  
 33   
ξ − μ
0.015  
 0.79
 0.058 
  1.5 
μ − ξ
0.0043 
 0.54
 0.018 
  1.1 
ξ − χ
0.60   
 1.9 
 1.5   
  3.6 
χ − ξ
0.023  
 0.53
 0.079 
  0.92
\if SKIP 0 beta phi ,0.0060!,28!!!,!0.035!,!41!!! 1 phi beta ,0.0060!,28!!!,!0.035!,!41!!! 2 theta phi ,2.9!!!!,82!!!,!6.0!!!,120!!! 3 phi theta,2.9!!!!,82!!!,!6.0!!!,120!!! 4 theta beta ,0.0060!,28!!!,!0.035!,!41!!! 5 beta theta,0.0060!,28!!!,!0.035!,!41!!! 6 mu phi ,0.037!!,41!!!,!0.18!!,!60!!! 7 phi mu ,0.98!!!,59!!!,!2.3!!!,!84!!! 8 mu beta ,0.00069,!5.8!,!0.0024,!!9.6! 9 beta mu ,0.13!!!,12!!!,!0.35!!,!19!!! 10 mu theta,0.24!!!,30!!!,!0.67!!,!40!!! 11 theta mu ,0.099!!,23!!!,!0.23!!,!33!!! 12 chi phi ,0.78!!!,43!!!,!2.1!!!,!64!!! 13 phi chi ,9.0!!!!,71!!!,17!!!!!,100!!! 14 chi beta ,0.018!!,!3.7!,!0.11!!,!!6.4! 15 beta chi ,1.7!!!!,16!!!,!3.4!!!,!24!!! 16 chi theta,0.18!!!,31!!!,!0.56!!,!43!!! 17 theta chi ,0.87!!!,23!!!,!1.9!!!,!32!!! 18 chi mu ,0.022!!,!0.56,!0.11!!,!!0.91 19 mu chi ,0.31!!!,!1.2!,!0.86!!,!!2.0! 20 xi phi ,0.015!!,39!!!,!0.086!,!57!!! 21 phi xi ,0.34!!!,53!!!,!1.1!!!,!75!!! 22 xi beta ,0.00042,!6.3!,!0.0039,!10!!! 23 beta xi ,0.040!!,10!!!,!0.15!!,!15!!! 24 xi theta,0.28!!!,28!!!,!0.75!!,!38!!! 25 theta xi ,0.040!!,23!!!,!0.11!!,!33!!! 26 xi mu ,0.015!!,!0.79,!0.058!,!!1.5! 27 mu xi ,0.0043!,!0.54,!0.018!,!!1.1! 28 xi chi ,0.60!!!,!1.9!,!1.5!!!,!!3.6! 29 chi xi ,0.023!!,!0.53,!0.079!,!!0.92 \endif The 2nd and 3rd columns show the results for the SRMmax ellipsoid, \e f = 1/150, retaining 6th order terms in the series expansion. The 4th and 5th columns show the results for the International ellipsoid, \e f = 1/297, retaining 5th order terms in the series expansion. The 2nd and 4th columns give the errors for the series expansions in terms of \e n given in this section (appropriately truncated). The 3rd and 5th columns give the errors when the series are reexpanded in terms of e2 = 4\e n/(1 + \e n)2 and truncated retaining the e12 and e10 terms respectively. Some observations: - For production use, the 6th order series in \e n are recommended. For \e f = 1/150, the resulting errors are close to the round-off limit. The errors in the 6th order series scale as f7; so the errors with \e f = 1/297 are about 120 times smaller. - It's inadvisable to use the 5th order series in \e n; this order is barely acceptable for \e f = 1/297 and the errors grow as f6 as \e f is increased. - In all cases, the expansions in terms of e2 are considerably less accurate than the corresponding series in \e n. - For every series converting between φ and any of θ, μ, χ, or ξ, the series where β is substituted for φ is more accurate. Considering that the transformation between φ and β is so simple, tanβ = (1 - \e f) tanφ, it sometimes makes sense to use β internally as the basic measure of latitude. (This is the case with geodesic calculations.)
Back to \ref geocentric. Forward to \ref highprec. Up to \ref contents.
**********************************************************************/ /** \page highprec Support for high precision arithmetic
Back to \ref auxlat. Forward to \ref changes. Up to \ref contents.
One of the goals with the algorithms in GeographicLib is to deliver accuracy close to the limits for double precision. In order to develop such algorithms it is very useful to be have accurate test data. For this purpose, I used Maxima's bfloat capability, which support arbitrary precision floating point arithmetic. As of version 1.37, such high-precision test data can be generated directly by GeographicLib by compiling it with GEOGRAPHICLIB_PRECISION equal to 4 or 5. Here's what you should know: - This is mainly for use for algorithm developers. It's not recommended for installation for all users on a system. - Configuring with -D GEOGRAPHICLIB_PRECISION=4 gives quad precision (113-bit precision) via boost::multiprecision::float128; this requires: - Boost, version 1.64 or later, - the quadmath library (the package names are libquadmath and libquadmath-devel), - the use of g++. - Configuring with -D GEOGRAPHICLIB_PRECISION=5 gives arbitrary precision via mpfr::mpreal; this requires: - MPFR, version 3.0 or later, - MPFR C++ (version 3.6.8, dated 2020-10-29, or later; version 3.6.8 also requires the fixes given in pull requests #8 and #10), - a compiler which supports the explicit cast operator (e.g., g++ 4.5 or later, Visual Studio 12 2013 or later). - MPFR, MPFR C++, and Boost all come with their own licenses. Be sure to respect these. - The indicated precision is used for all floating point arithmetic. Thus, you can't compare the results of different precisions within a single invocation of a program. Instead, you can create a file of accurate test data at a high precision and use this to test the algorithms at double precision. - With MPFR, the precision should be set (using Utility::set_digits) just once before any other GeographicLib routines are called. Calling this function after other GeographicLib routines will lead to inconsistent results (because the precision of some constants like Math::pi() is set when the functions are first called). - All the \ref utilities call Utility::set_digits() (with no arguments). This causes the precision (in bits) to be determined by the GEOGRAPHICLIB_DIGITS environment variable. If this is not defined the precision is set to 256 bits (about 77 decimal digits). - The accuracy of most calculations should increase as the precision increases (and typically only a few bits of accuracy should be lost). We can distinguish 4 sources of error: - Round-off errors; these are reliably reduced when the precision is increased. For the most part, the algorithms used by GeographicLib are carefully tuned to minimize round-off errors, so that only a few bits of accuracy are lost. - Convergence errors due to not iterating certain algorithms to convergence. However, all iterative methods used by GeographicLib converge quadratically (the number of correct digits doubles on each iteration) so that full convergence is obtained for "reasonable" precisions (no more than, say, 100 decimal digits or about 340 bits). An exception is thrown if the convergence criterion is not met when using high precision arithmetic. - Truncation errors. Some classes (namely, Geodesic and TransverseMercator) use series expansion to approximate the true solution. Additional terms in the series are used for high precision, however there's always a finite truncation error which varies as some power of the flattening. On the other hand, GeodesicExact and TransverseMercatorExact are somewhat slower classes offering the same functionality implemented with EllipticFunction. These classes provide arbitrary accuracy. (However, a caveat is that the evaluation of the area in GeodesicExact still uses a series (albeit of considerably higher order). So the area calculations are always have a finite truncation error.) - Quantization errors. Geoid, GravityModel, and MagneticModel all depend on external data files. The coefficient files for GravityModel and MagneticModel store the coefficients as IEEE doubles (and perhaps these coefficients can be regarded as exact). However, with Geoid, the data files for the geoid heights are quantized at 3mm leading to an irreducible ±1.5mm quantization error. On the other hand, all the physical constants used by GeographicLib, e.g., the flattening of the WGS84 ellipsoid, are evaluated as exact decimal numbers. - Where might high accuracy be important? - checking the truncation error of series approximations; - checking for excessive round-off errors (typically due to subtraction); - checking the round-off error in computing areas of many-sided polygons; - checking the summation of high order spherical harmonic expansions (where underflow and overflow may also be a problem). - Because only a tiny number of people will be interested in using this facility: - the cmake support for the required libraries is rudimentary; - however geographiclib-config.cmake does export GEOGRAPHICLIB_PRECISION and GEOGRAPHICLIB_HIGHPREC_LIBRARIES, the libraries providing the support for high-precision arithmetic; - support for the C++11 mathematical functions and the explicit cast operator is required; - quad precision is only available on Linux; - mpfr has been mostly tested on Linux (but it works on Windows with Visual Studio 12 and MacOS too). The following steps needed to be taken - Phase 1, make sure you can switch easily between double, float, and long double. - use \#include <cmath> instead of \#include <math.h>; - use, e.g., std::sqrt instead of sqrt in header files (similarly for sin, cos, atan2, etc.); - use using namespace std; and plain sqrt, etc., in code files; - express all convergence criteria in terms of\code numeric_limits::epsilon() \endcode etc., instead of using "magic constants", such as 1.0e-15; - use typedef double real; and replace all occurrences of double by real; - write all literals by, e.g., real(0.5). Some constants might need the L suffix, e.g., real f = 1/real(298.257223563L) (but see below); - Change the typedef of real to float or long double, compile, and test. In this way, the library can be run with any of the three basic floating point types. - If you want to run the library with multiple floating point types within a single executable, then make all your classes take a template parameter specifying the floating-point type and instantiate your classes with the floating-point types that you plan to use. I did not take this approach with GeographicLib because double precision is suitable for the vast majority of applications and turning all the classes into templates classes would end up needlessly complicating (and bloating) the library. - Phase 2, changes to support arbitrary, but fixed, precision - Use, e.g., \code typedef boost::multiprecision::float128 real; \endcode - Change std::sqrt(...), etc. to \code using std::sqrt; sqrt(...) \endcode (but note that std::max can stay). It's only necessary to do this in header files (code files already have using namespace std;). - In the case of boost's multiprecision numbers, the C++11 mathematical functions need special treatment, see Math.hpp. - If necessary, use series with additional terms to improve the accuracy. - Replace slowly converging root finding methods with rapidly converging methods. In particular, the simple iterative method to determine the flattening from the dynamical form factor in NormalGravity converged too slowly; this was replaced by Newton's method. - If necessary, increase the maximum allowed iteration count in root finding loops. Also throw an exception of the maximum iteration count is exceeded. - Write literal constants in a way that works for any precision, e.g., \code real f = 1/( real(298257223563LL) / 1000000000 ); \endcode [Note that \code real f = 1/( 298 + real(257223563) / 1000000000 ); \endcode and 1/real(298.257223563L) are susceptible to double rounding errors. We normally want to avoid such errors when real is a double.] - For arbitrary constants, you might have to resort to macros \code #if GEOGRAPHICLIB_PRECISION == 1 #define REAL(x) x##F #elif GEOGRAPHICLIB_PRECISION == 2 #define REAL(x) x #elif GEOGRAPHICLIB_PRECISION == 3 #define REAL(x) x##L #elif GEOGRAPHICLIB_PRECISION == 4 #define REAL(x) x##Q #else #define REAL(x) real(#x) #endif \endcode and then use \code real f = 1/REAL(298.257223563); \endcode - Perhaps use local static declarations to avoid the overhead of reevaluating constants, e.g., \code static inline real pi() { using std::atan2; // pi is computed just once static const real pi = atan2(real(0), real(-1)); return pi; } \endcode This is not necessary for built-in floating point types, since the atan2 function will be evaluated at compile time. - In Utility::readarray and Utility::writearray, arrays of reals were treated as plain old data. This assumption now no longer holds and these functions needed special treatment. - volatile declarations don't apply. - Phase 3, changes to support arbitrary precision which can be set at runtime. - The big change now is that the precision is not known at compile time. All static initializations which involve floating point numbers need to be eliminated. - Some static variables (e.g., tolerances which are expressed in terms of numeric_limits<double>\::epsilon()) were made member variables and so initialized when the constructor was called. - Some simple static real arrays (e.g., the interpolating stencils for Geoid) were changed into integer arrays. - Some static variables where converted to static functions similar to the definition of pi() above. - All the static instances of classes where converted as follows \code // declaration static const Geodesic WGS84; // definition const Geodesic Geodesic::WGS84(Constants::WGS84_a(), Constants::WGS84_f()); // use const Geodesic& geod = Geodesic::WGS84; \endcode becomes \code // declaration static const Geodesic& WGS84(); // definition const Geodesic& Geodesic::WGS84() { static const Geodesic wgs84(Constants::WGS84_a(), Constants::WGS84_f()); return wgs84; static const Geodesic& WGS84(); } // use const Geodesic& geod = Geodesic::WGS84(); \endcode This is the so-called "construct on first use idiom". This is the most disruptive of the changes since it requires a different calling convention in user code. However the old static initializations were invoked every time a code linking to GeographicLib was started, even if the objects were not subsequently used. The new method only initializes the static objects if they are used. . - numeric_limits<double>\::digits is no longer a compile-time constant. It becomes numeric_limits<double>\::digits(). - Depending on the precision cos(π/2) might be negative. Similarly atan(tan(π/2)) may evaluate to −π/2. GeographicLib already handled this, because this happens with long doubles (64 bits in the fraction). - The precision needs to be set in each thread in a multi-processing applications (for an example, see examples/GeoidToGTX.cpp). - Passing numbers to functions by value incurs a substantially higher overhead than with doubles. This could be avoided by passing such arguments by reference. This was not done here because it would junk up the code to benefit a narrow application. - The constants in GeodesicExact, e.g., 831281402884796906843926125, can't be specified as long doubles nor long longs (since they have more than 64 significant bits): - first tried macro which expanded to a string (see the macro REAL above); - now use inline function to combine two long long ints each with at most 52 significant bits; - also needed to simplify one routine in GeodesicExact which took inordinately long (15 minutes) to compile using g++; - but Visual Studio 12 then complained (with an internal compiler error presumably due to overly aggressive whole-file optimization); fixed by splitting one function into a separate file.
Back to \ref auxlat. Forward to \ref changes. Up to \ref contents.
**********************************************************************/ /** \page changes Change log
Back to \ref highprec. 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 https://sourceforge.net/projects/geographiclib/files/distrib/. Older versions are in https://sourceforge.net/projects/geographiclib/files/distrib/archive/. The corresponding documentation for these versions is obtained by clicking on the “Version m.nn” links below. Some of the links in the documentation of older versions may be out of date (in particular the links for the source code will not work if the code has been migrated to the archive subdirectory). All the releases are available as tags “rm.nn” in the the "release" branch of the git repository for GeographicLib. \if SKIP - TODO: Planned updates - Change templating in PolygonArea so that the AddPoint and AddEdge methods are templated instead of the class itself. This would allow a polygon to contain a mixture of geodesic and rhumb-line edges. - Generalize Geoid, UTMUPS, MGRS, GeoCoords to handle non-WGS84 ellipsoids. - Add GreatEllipse class. - Implement Geodesic + TM + PolarStereographic on Jets. - Template versions of Gnomonic and AzimuthalEquidistant so that they can use either Geodesic and GeodesicExact. Use typedefs so that Geodesic::Line points to GeodesicLine. - Split DMS stuff from main JavaScript package. - Add C++ tests not dependent on utility programs. - Add information on radius of convergence for aux latitude series. - Check Geocentric::Reverse for accuracy for extreme ellipsoids, \e e > 1/sqrt(2). - Check Visual Studo "code analysis" results (from Analize VS menu). Probably an awful lot of false positives. - Fix cmake files so that they play nice with vcpkg: - Allow only some components to be built. - Allow tools, cmake install directories, etc., to be set. - Compute relative paths from bin to lib directories. - Install dll in tools directory. - Use BUILD_SHARED_LIBS instead of GEOGRAPHICLIB_LIB_TYPE. - Maybe segregate more tasks into a MAINTAINER mode. - Add Math routine for Clenshaw summation; may AuxiliaryLatitude class for conversions via the series? \endif - Version 1.52 (released 2021-06-22) - Add MagneticModel::FieldGeocentric and MagneticCircle::FieldGeocentric to return the field in geocentric coordinates (thanks to Marcelo Banik de Padua). - Document realistic errors for PolygonAreaT and Planimeter. - Geodesic routines: be more aggressive in preventing negative \e s12 and \e m12 for short lines (all languages). - Fix bug in AlbersEqualArea for extreme prolate ellipsoids (plus general cleanup in the code). - Thanks to Thomas Warner, a sample of wrapping the C++ library, so it's accessible in Excel, is given in wrapper/Excel. - Minor changes - Work around inaccuracies in hypot routines in Visual Studio (win32), Python, and JavaScript. - Initialize reference argument to remquo (C++ and C). - Get ready to retire unused _exact in RhumbLine. - Declare RhumbLine copy constructor "= default". - Use C++11 "= delete" idiom to delete copy assignment and copy constructors in RhumbLine, Geoid, GravityModel, MagneticModel. - Fix MGRS::Forward to work around aggressive optimization leading to incorrect rounding. - Fix plain makefiles, Makefile.mk, so that PREFIX is handled properly. - Make cmake's GeographicLib_LIBRARIES point to namespace versions. - NOTE: In the next version (tentatively 2.0), I plan to split up the git repository and the packaging of GeographicLib into separate entities for each language. This will simplify development and deployment of the library. - WARNING: The .NET version of GeographicLib will not be supported in the next version. . - Version 1.51 (released 2020-11-22) - C++11 compiler required for C++ library. As a consequence: - The workaround implementations for C++11 routines (Math::hypot, Math::expm1, Math::log1p, Math::asinh, Math::atanh, Math::copysign, Math::cbrt, Math::remainder, Math::remquo, Math::round, Math::lround, Math::fma, Math::isfinite, and Math::isnan) are now deprecated. Just use the versions in the std:: namespace instead. - SphericalEngine class, fix the namespace for using streamoff. - Some templated functions, e.g., Math::degree(), now have default template parameters, T = Math::real. - C99 compiler required for C library. - Reduce memory footprint in Java implementation. - New form of Utility::ParseLine to allow the syntax "KEY = VAL". - Add International Geomagnetic Reference Field (13th generation), igrf13, which approximates the main magnetic field of the earth for the period 1900--2025. - More symbols allowed with DMS decoding in C++, JS, and cgi-bin packages; see DMS::Decode. - Fix bug in cgi-bin argument processing which causes "+" to be misinterpreted. - Required minium version of CMake is now 3.7.0 (released 2016-11-11). This is to work around a bug in find_package for cmake 3.4 and 3.5. . - Version 1.50.1 (released 2019-12-13) - Add the World Magnetic Model 2020, wmm2020, covering the period 2020--2025. This is now the model returned by MagneticModel::DefaultMagneticName and is default magnetic model for MagneticField (replacing wmm2015v2 which is only valid thru the end of 2019). - Include float instantiations of those templated Math functions which migrated to Math.cpp in version 1.50. - WARNING: The next version of GeographicLib will require a C++11 compliant compiler. This means that the minimum version of Visual Studio will be Visual Studio 14 2015. (This repeats the warning given with version 1.50. It didn't apply to this version because this is a minor update.) . - Version 1.50 (released 2019-09-24) - BUG fixes: - Java + JavaScript implementations of PolygonArea::TestEdge counted the pole encirclings wrong. - Fix typo in JavaScript implementation which affected unsigned areas. - Adding edges to a polygon counted pole encirclings inconsistent with the way the adding point counted them. This might have caused an incorrect result if a polygon vertex had longitude = 0. This affected all implementations except Fortran and MATLAB). - GARS::Forward: fix BUG in handling of longitude = ±180°. - Fix bug in Rhumb class and RhumbSolve(1) utiity which caused incorrect area to be reported if an endpoint is at a pole. Thanks to Natalia Sabourova for reporting this. - Fix bug in MATLAB routine mgrs_inv which resulted in incorrect results for UPS zones with prec = −1. - In geodreckon.m geoddistance.m, suppress (innocuous) "warning: division by zero" messages from Octave. - In python implementation, work around problems caused by sin(inf) and fmod(inf) raising exceptions. - Geoid class, fix the use of streamoff. - The PolygonArea class, the Planimeter utility, and their equivalents in C, Fortran, MATLAB, Java, JavaScript, Python, and Maxima can now handle arbitrarily complex polygons. In the case of self-intersecting polygons the area is accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. - Changes in gravity and magnetic model handling - SphericalEngine::coeff::readcoeffs takes new optional argument \e truncate. - The constructors for GravityModel and MagneticModel allow the maximum degree and order to be specified. The array of coefficients will then be truncated if necessary. - GravityModel::Degree(), GravityModel::Order(), MagneticModel::Degree(), MagneticModel::Order() return the maximum degree and order of all the components of a GravityModel or MagneticModel. - Gravity and MagneticField utilities accept -N and -M options to to allow the maximum degree and order to be specified. - The GeodSolve allows fractional distances to be entered as fractions (with the -F flag). - MajorRadius() methods are now called EquatorialRadius() for the C++, Java, and .NET libraries. "Equatorial" is more descriptive in the case of prolate ellipsoids. MajorRadius() is retained for backward compatibility for C++ and Java but is deprecated. - Minimum version updates: - CMake = 3.1.0, released 2014-12-15. - Minimum g++ version = 4.8.0, released 2013-03-22. - Visual Studio 10 2010 (haven't been able to check Visual Studio 2008 for a long time). - WARNING: The next version of GeographicLib will require a C++11 compliant compiler. This means that the minimum version of Visual Studio will be Visual Studio 14 2015. - Minimum boost version = 1.64 needed for GEOGRAPHICLIB_PRECISION = 4. - Java = 1.6; this allows the removal of epsilon, min, hypot, log1p, copysign, cbrt from GeoMath. - CMake updates: - Fine tune Visual Studio compatibility check in find_package(GeographicLib); this allows GeographicLib compiled with Visual Studio 14 2015 to be used with a project compiled with Visual Studio 15 2017 and 16 2019. - Suppress warnings with dotnet build. - Change CMake target names and add an interface library (thanks to Matthew Woehlke). - Remove pre-3.1.0 cruft and update the documentation to remove the need to call include_dirctories. - Add _d suffix to example and test programs. - Changer installation path for binary installer to the Windows default. - Add support for Intel compiler (for C++, C, Fortran). This entails supplying the -fp-model precise flag to prevent the compiler from incorrectly simplying (a + b) + c and 0.0 + x. - Add version 2 of the World Magnetic Model 2015, wmm2015v2. This is now the default magnetic model for MagneticField (replacing wmm2015 which is now deprecated). Coming in 2019-12: the wmm2020 model. - The -f flag in the scripts geographiclib-get-geoids, geographiclib-get-gravity, and geographiclib-get-magnetic, allows you to load new models (not yet in the set defined by "all"). This is in addition to its original role of allowing you to overwrite existing models. - Changes in math function support: - Move some of the functionality from Math.hpp to Math.cpp to make compilation of package which depend on GeographicLib less sensitive to the current compiler environment. - Add Math::remainder, Math::remquo, Math::round, and Math::lround. Also add implementations of remainder, remquo to C implementation. - Math::cbrt, Math::atanh, and Math::asinh now preserve the sign of −0. (Also: C, Java, JavaScript, Python, MATLAB. Not necessary: Fortran because sign is a built-in function.) - JavaScript: fall back to Math.hypot, Math.cbrt, Math.log1p, Math.atanh if they are available. - When parsing DMS strings ignore various non-breaking spaces (C++ and JavaScript). - Improve code coverage in the tests of geodesic algorithms (C++, C, Java, JavaScript, Python, MATLAB, Fortran). - Old deprecated NormalGravity::NormalGravity constructor removed. - Additions to the documentation: - add documentation links to ge{distance,reckon}.m; - clarify which solution is returned for Geocentric::Reverse. . - Version 1.49 (released 2017-10-05) - Add the Enhanced Magnetic Model 2017, emm2017. This is valid for 2000 thru the end of 2021. - Avoid potential problems with the order of initializations in DMS, GARS, Geohash, Georef, MGRS, OSGB, SphericalEngine; this only would have been an issue if GeographicLib objects were instantiated globally. Now no GeographicLib initialization code should be run prior to the entry of main(). - To support the previous fix, add an overload, Utility::lookup(const char* s, char c). - NearestNeighbor::Search throws an error if \e pts is the wrong size (instead of merely returning no results). - Use complex arithmetic for Clenshaw sums in TransverseMercator and tranmerc_{fwd,inv}.m. - Changes in cmake support: - fix compiler flags for GEOGRAPHICLIB_PRECISION = 4; - add CONVERT_WARNINGS_TO_ERRORS option (default OFF), if ON then compiler warnings are treated as errors. - Fix warnings about implicit conversions of doubles to bools in C++, C, and JavaScript packages. - Binary installers for Windows now use Visual Studio 14 2015. . - Version 1.48 (released 2017-04-09) - The "official" URL for GeographicLib is now https://geographiclib.sourceforge.io (instead of http://geographiclib.sourceforge.net). - The default range for longitude and azimuth is now (−180°, 180°], instead of [−180°, 180°). This was already the case for the C++ library; now the change has been made to the other implementations (C, Fortran, Java, JavaScript, Python, MATLAB, and Maxima). - Changes to NearestNeighbor: - fix BUG in reading a NearestNeighbor object from a stream which sometimes incorrectly caused a "Bad index" exception to be thrown; - add NearestNeighbor::operator<<, NearestNeighbor::operator>>, NearestNeighbor::swap, std::swap(GeographicLib::NearestNeighbor&, GeographicLib::NearestNeighbor&); - Additions to the documentation: - add documentation on \ref nearest; - \ref normalgravity documentation is now on its own page and now has an illustrative figure; - document the \ref auxlaterror in the series for auxiliary latitudes. - Fix BUGS in MATLAB function geodreckon with mixed scalar and array arguments. - Workaround bug in math.fmod for Python 2.7 on 32-bit Windows machines. - Changes in cmake support: - add USE_BOOST_FOR_EXAMPLES option (default OFF), if ON search for Boost libraries for building examples; - add APPLE_MULTIPLE_ARCHITECTURES option (default OFF), if ON build for both i386 and x86_64 on Mac OS X systems; - don't add flag for C++11 for g++ 6.0 (since it's not needed). - Fix compiler warnings with Visual Studio 2017 and for the C library. . - Version 1.47 (released 2017-02-15) - Add NearestNeighbor class. - Improve accuracy of area calculation (fixing a flaw introduced in version 1.46); fix applied in Geodesic, GeodesicExact, and the implementations in C, Fortran, Java, JavaScript, Python, MATLAB, and Maxima. - Generalize NormalGravity to allow oblate and prolate ellipsoids. As a consequence a new form of constructor, NormalGravity::NormalGravity, has been introduced and the old form is now deprecated (and because the signatures of the two constructors are similar, the compiler will warn about the use of the old one). - Changes in Math class: - Math::sincosd, Math::sind, Math::cosd only return −0 for the case sin(−0); - Math::atan2d and Math::AngNormalize return results in (−180°, 180°]; this may affect the longitudes and azimuth returned by several other functions. - Add Utility::trim() and Utility::val(); Utility::num() is now deprecated. - Changes in cmake support: - remove support of PACKAGE_PATH and INSTALL_PATH in cmake configuration; - fix to FindGeographicLib.cmake to make it work on Debian systems; - use $ (cmake version ≥ 3.1); - use NAMESPACE for exported targets; - geographiclib-config.cmake exports GEOGRAPHICLIB_DATA, GEOGRAPHICLIB_PRECISION, and GeographicLib_HIGHPREC_LIBRARIES. - Add pkg-config support for cmake and autoconf builds. - Minor fixes: - fix the order of declarations in C library, incorporating the patches in version 1.46.1; - fix the packaging of the Python library, incorporating the patches in version 1.46.3; - restrict junit dependency in the Java package to testing scope (thanks to Mick Killianey); - various behind-the-scenes fixes to EllipticFunction; - fix documentation and default install location for Windows binary installers; - fix clang compiler warnings in GeodesicExactC4 and TransverseMercator. . - Version 1.46 (released 2016-02-15) - The following BUGS have been fixed: - the -w flag to Planimeter(1) was being ignored; - in the Java package, the wrong longitude was being returned with direct geodesic calculation with a negative distance when starting point was at a pole (this bug was introduced in version 1.44); - in the JavaScript package, PolygonArea.TestEdge contained a misspelling of a variable name and other typos (problem found by threepointone). - INCOMPATIBLE CHANGES: - make the -w flag (to swap the default order of latitude and longitude) a toggle for all \ref utilities; - the -a option to GeodSolve(1) now toggles (instead of sets) arc mode; - swap order \e coslon and \e sinlon arguments in CircularEngine class. - Remove deprecated functionality: - remove gradient calculation from the Geoid class and GeoidEval(1) (this was inaccurate and of dubious utility); - remove reciprocal flattening functions, InverseFlattening in many classes and Constants::WGS84_r(); stop treating flattening > 1 as the reciprocal flattening in constructors; - remove DMS::Decode(string), DMS::DecodeFraction, EllipticFunction:m, EllipticFunction:m1, Math::extradigits, Math::AngNormalize2, PolygonArea::TestCompute; - stop treating LONG_NOWRAP as an alias for LONG_UNROLL in Geodesic (and related classes) and Rhumb; - stop treating full/schmidt as aliases for FULL/SCHMIDT in SphericalEngine (and related classes); - remove qmake project file src/GeographicLib.pro because QtCreator can handle cmake projects now; - remove deprecated Visual Studio 2005 project and solution files. - Changes to GeodesicLine and GeodesicLineExact classes; these changes (1) simplify the process of computing waypoints on a geodesic given two endpoints and (2) allow a GeodesicLine to be defined which is consistent with the solution of the inverse problem (in particular Geodesic::InverseLine the specification of south-going lines which pass the poles in a westerly direction by setting sin α1 = −0): - the class stores the distance \e s13 and arc length \e a13 to a reference point 3; by default these quantities are NaNs; - GeodesicLine::SetDistance (and GeodesicLine::SetArc) specify the distance (and arc length) to point 3; - GeodesicLine::Distance (and GeodesicLine::Arc) return the distance (and arc length) to point 3; - new methods Geodesic::InverseLine and Geodesic::DirectLine return a GeodesicLine with the reference point 3 defined as point 2 of the corresponding geodesic calculation; - these changes are also included in the C, Java, JavaScript, and Python packages. - Other changes to the geodesic routines: - more accurate solution of the inverse problem when longitude difference is close to 180° (also in C, Fortran, Java, JavaScript, Python, MATLAB, and Maxima packages); - more accurate calculation of lon2 in the inverse calculation with LONG_UNROLL (also in Java, JavaScript, Python packages). - Changes to GeodSolve(1) utility: - the -I and -D options now specify geodesic line calculation via the standard inverse or direct geodesic problems; - rename -l flag to -L to parallel the new -I and -D flags (-l is is retained for backward compatibility but is deprecated), and similarly for RhumbSolve(1); - the -F flag (in conjunction with the -I or -D flags) specifies that distances read on standard input are fractions of \e s13 or \e a13; - the -a option now toggles arc mode (noted above); - the -w option now toggles longitude first mode (noted above). - Changes to Math class: - Math::copysign added; - add overloaded version of Math::AngDiff which returns the error in the difference. This allows a more accurate treatment of inverse geodesic problem when \e lon12 is close to 180°; - Math::AngRound now converts tiny negative numbers to −0 (instead of +0), however −0 is still converted to +0. - Add -S and -T options to GeoConvert(1). - Add Sphinx documentation for Python package. - Samples of wrapping the C++ library, so it's accessible in other languages, are given in wrapper/C, wrapper/python, and wrapper/matlab. - Binary installers for Windows now use Visual Studio 12 2013. - Remove top-level pom.xml from release (it was specific to SRI). - A reminder: because of the JavaScript changes introduced in version 1.45, you should remove the following installation directories from your system: - Windows: ${CMAKE_INSTALL_PREFIX}/doc/scripts - Others: ${CMAKE_INSTALL_PREFIX}/share/doc/GeographicLib/scripts . - Version 1.45 (released 2015-09-30) - Fix BUG in solution of inverse geodesic caused by misbehavior of some versions of Visual Studio on Windows (fmod(−0.0, 360.0) returns +0.0 instead of −0.0) and Octave (sind(−0.0) returns +0.0 instead of −0.0). These bugs were exposed because max(−0.0, +0.0) returns −0.0 for some languages. - Geodesic::Inverse now correctly returns NaNs if one of the latitudes is a NaN. - Changes to JavaScript package: - thanks to help from Yurij Mikhalevich, it is a now a node package that can be installed with npm; - make install now installs the node package in lib/node_modules/geographiclib; - add unit tests using mocha; - add documentation via JSDoc; - fix bug Geodesic.GenInverse (this bug, introduced in version 1.44, resulted in the wrong azimuth being reported for points at the pole). - Changes to Java package: - add implementation of ellipsoidal Gnomonic projection (courtesy of Sebastian Mattheis); - add unit tests using JUnit; - Math.toRadians and Math.toDegrees are used instead of GeoMath.degree (which is now removed), as a result… - Java version 1.2 (released 1998-12) or later is now required. - Changes to Python package: - add unit tests using the unittest framework; - fixed bug in normalization of the area. - Changes to MATLAB package: - fix array size mismatch in geoddistance by avoiding calls to subfunctions with zero-length arrays; - fix tranmerc_{fwd,inv} so that they work with arrays and mixed array/scalar arguments; - work around Octave problem which causes mgrs_fwd to return garbage with prec = 10 or 11; - add geographiclib_test.m to run a test suite. - Behavior of substituting 1/\e f for \e f if \e f > 1 is now deprecated. This behavior has been removed from the JavaScript, C, and Python implementations (it was never documented). Maxima, MATLAB, and Fortran implementations never included this behavior. - Other changes: - fix bug, introduced in version 1.42, in the C++ implementation to the computation of area which causes NaNs to be returned in the case of a sphere; - fixed bug, introduced in version 1.44, in the detection of C++11 math functions in configure.ac; - throw error on non-convergence in Gnomonic::Reverse if GEOGRAPHICLIB_PRECISION > 3; - add geod_polygon_clear to C library; - turn illegal latitudes into NaNs for Fortran library; - add test suites for the C and Fortran libraries. . - Version 1.44 (released 2015-08-14) - Various changes to improve accuracy, e.g., by minimizing round-off errors: - Add Math::sincosd, Math::sind, Math::cosd which take their arguments in degrees. These functions do exact range reduction and thus they obey exactly the elementary properties of the trigonometric functions, e.g., sin 9° = cos 81° = − sin 123456789°. - Math::AngNormalize now works for any angles, instead of angles in the range [−540°, 540°); the function Math::AngNormalize2 is now deprecated. - This means that there is now no restriction on longitudes and azimuths; any values can be used. - Improve the accuracy of Math::atan2d. - DMS::Decode avoids unnecessary round-off errors; thus 7:33:36 and 7.56 result in identical values. DMS::Encode rounds ties to even. These changes have also been made to DMS.js. - More accurate rounding in MGRS::Reverse and mgrs_inv.m; this change only makes a difference at sub-meter precisions. - With MGRS::Forward and mgrs_fwd.m, ensure that digits in lower precision results match those at higher precision; as a result, strings of trailing 9s are less likely to be generated. This change only makes a difference at sub-meter precisions. - Replace the series for A2 in the Geodesic class with one with smaller truncation errors. - Geodesic::Inverse sets \e s12 to zero for coincident points at pole (instead of returning a tiny quantity). - Math::LatFix returns its argument if it is in [−90°, 90°]; if not, it returns NaN. - Using Math::LatFix, routines which don't check their arguments now interpret a latitude outside the legal range of [−90°, 90°] as a NaN; such routines will return NaNs instead of finite but incorrect results; caution: code that (dangerously) relied on the "reasonable" results being returned for values of the latitude outside the allowed range will now malfunction. - All the \ref utilities accept the -w option to swap the latitude-longitude order on input and output (and where appropriate on the command-line arguments). CartConvert now accepts the -p option to set the precision; now all of the utilities except GeoidEval accept -p. - Add classes for GARS, the Global Area Reference System, and for Georef, the World Geographic Reference System. - Changes to DMS::Decode and DMS.js: - tighten up the rules: - 30:70.0 and 30:60 are illegal (minutes and second must be strictly less than 60), however - 30:60.0 and 30:60. are legal (floating point 60 is OK, since it might have been generated by rounding 59.99…); - generalize a+b concept, introduced in version 1.42, to any number of pieces; thus 8+0:40-0:0:10 is interpreted as 8:39:50. - Documentation fixes: - update man pages to refer to GeoConvert(1) on handling of geographic coordinates; - document limitations of the series used for TransverseMercator; - hide the documentation of the computation of the gradient of the geoid height (now deprecated) in the Geoid class; - warn about the possible misinterpretation of 7.0E+1 by DMS::Decode; - \e swaplatlong optional argument of DMS::DecodeLatLon and various functions in the GeoCoords class is now called \e longfirst; - require Doxygen 1.8.7 or later. - More systematic treatment of version numbers: - Python: \__init\__.py defines \__version\__ and \__version_info\__; - JavaScript: - Math.js defines Constants.version and Constants.version_string; - version number included as comment in packed script geographiclib.js; - geod-calc.html and geod-google.html report the version number; - https://geographiclib.sourceforge.io/scripts/ gives access to earlier versions of geographiclib.js as geographiclib-m.nn.js; - Fortran: add geover subroutine to return version numbers; - Maxima: geodesic.mac defines geod_version; - CGI scripts: these report the version numbers of the utilities. - BUG FIXES: - NormalGravity now works properly for a sphere (\e omega = \e f = \e J2 = 0), instead of returning NaNs (problem found by htallon); - CassiniSoldner::Forward and cassini_fwd.m now returns the correct azimuth for points at the pole. - MATLAB-specific fixes: - mgrs_fwd now treats treats prec > 11 as prec = 11; - illegal letter combinations are now correctly detected by mgrs_inv; - fixed bug where mgrs_inv returned the wrong results for prec = 0 strings and center = 0; - mgrs_inv now decodes prec = 11 strings properly; - routines now return array results with the right shape; - routines now properly handle mixed scalar and array arguments. - Add Accumulator::operator*=(T y). - Geohash uses "invalid" instead of "nan" when the latitude or longitude is a nan. . - Version 1.43 (released 2015-05-23) - Add the Enhanced Magnetic Model 2015, emm2015. This is valid for 2000 thru the end of 2019. This required some changes in the MagneticModel and MagneticCircle classes; so this model cannot be used with versions of GeographicLib prior to 1.43. - Fix BLUNDER in PolarStereographic constructor introduced in version 1.42. This affected UTMUPS conversions for UPS which could be incorrect by up to 0.5 km. - Changes in the LONG_NOWRAP option (added in version 1.39) in the Geodesic and GeodesicLine classes: - The option is now called LONG_UNROLL (a less negative sounding term); the original name, LONG_NOWRAP, is retained for backwards compatibility. - There were two bad BUGS in the implementation of this capability: (a) it gave incorrect results for west-going geodesics; (b) the option was ignored if used directly via the GeodesicLine class. The first bug affected the implementations in all languages. The second affected the implementation in C++ (GeodesicLine and GeodesicLineExact), JavaScript, Java, C, Python. These bugs have now been FIXED. - The GeodSolve utility now accepts a -u option, which turns on the LONG_UNROLL treatment. With this option lon1 is reported as entered and lon2 is given such that lon2lon1 indicates how often and in what sense the geodesic has encircled the earth. (This option also affects the value of longitude reported when an inverse calculation is run with the -f option.) - The inverse calculation with the JavaScript and Python libraries similarly sets lon1 and lon2 in output dictionary respecting the LONG_UNROLL flag. - The online version of GeodSolve now offers an option to unroll the longitude. - To support these changes DMS::DecodeLatLon no longer reduces the longitude to the range [−180°, 180°) and Math::AngRound now coverts −0 to +0. - Add Math::polyval (also to C, Java, JavaScript, Fortran, Python versions of the library; this is a built-in function for MATLAB/Octave). This evaluates a polynomial using Horner's method. The Maxima-generated code fragments for the evaluation of series in the Geodesic, TransverseMercator, and Rhumb classes and MATLAB routines for great ellipses have been replaced by Maxima-generated arrays of polynomial coefficients which are used as input to Math::polyval. - Add MGRS::Check() to verify that \e a, \e f, kUTM, and kUPS are consistent with the assumptions in the UTMUPS and MGRS classes. This is invoked with GeoConvert \--version. (This function was added to document and check the assumptions used in the UTMUPS and MGRS classes in case they are extended to deal with ellipsoids other than WS84.) - MATLAB function mgrs_inv now takes an optional \e center argument and strips white space from both beginning and end of the string. - Minor internal changes: - GeodSolve sets the geodesic mask so that unnecessary calculations are avoided; - some routines have migrated into a math class for the Python, Java, and JavaScript libraries. - A reminder: because of changes in the installation directories for non-Windows systems introduced in version 1.42, you should remove the following directories from your system: - ${CMAKE_INSTALL_PREFIX}/share/cmake/GeographicLib* - ${CMAKE_INSTALL_PREFIX}/libexec/GeographicLib/matlab . - Version 1.42 (released 2015-04-28) - DMS::Decode allows a single addition or subtraction operation, e.g., 70W+0:0:15. This affects the GeoCoords class and the utilities (which use the DMS class for reading coordinates). - Add Math::norm, Math::AngRound, Math::tand, Math::atan2d, Math::eatanhe, Math::taupf, Math::tauf, Math::fma and remove duplicated (but private) functionality from other classes. - On non-Windows systems, the cmake config-style find_package files are now installed under ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} instead of ${CMAKE_INSTALL_PREFIX}/share, because the files are architecture-specific. This change will let 32-bit and 64-bit versions coexist on the same machine (in lib and lib64). You should remove the versions in the old "share" location. - MATLAB changes: - provide native MATLAB implementations for compiled interface functions, see \ref matlab; - the compiled MATLAB interface is now deprecated and so the MATLAB_COMPILER option in the cmake build has been removed; - reorganize directories, so that - matlab/geographiclib contains the native matlab code; - matlab/geographiclib-legacy contains wrapper functions to mimic the previous compiled functionality; - the installed MATLAB code mirrors this layout, but the parent installation directory on non-Windows systems is ${CMAKE_INSTALL_PREFIX}/share (instead of ${CMAKE_INSTALL_PREFIX}/libexec), because the files are now architecture independent; - matlab/geographiclib is now packaged and distributed as MATLAB File Exchange package 50605 (this supersedes three earlier MATLAB packages); - point fix for geodarea.m to correct bug in area of polygons which encircle a pole multiple times (released as version 1.41.1 of MATLAB File Exchange package 39108, 2014-04-22). - artifactId for Java package changed from GeographicLib to GeographicLib-Java and the package is now deployed to Maven Central (thanks to Chris Bennight for help on this). - Fix autoconf mismatch of version numbers (which were inconsistent in versions 1.40 and 1.41). - Mark the computation of the gradient of the geoid height in the Geoid class and the GeoidEval utility as deprecated. - Work around the boost-quadmath bug with setprecision(0). - Deprecate use of Visual Studio 2005 "-vc8" project files in the windows directory. . - Version 1.41 (released 2015-03-09) - Fix bug in Rhumb::Inverse (with \e exact = true) and related functions which causes the wrong distance to be reported if one of the end points is at a pole. Thanks to Thomas Murray for reporting this. - Add International Geomagnetic Reference Field (12th generation), igrf12, which approximates the main magnetic field of the earth for the period 1900--2020. - Split information about \ref jacobi to a separate section and include more material. . - Version 1.40 (released 2014-12-18) - Add the World Magnetic Model 2015, wmm2015. This is now the default magnetic model for MagneticField (replacing wmm2010 which is valid thru the end of 2014). - Geodesic::Inverse didn't return NaN if one of the longitudes was a NaN (bug introduced in version 1.25). Fixed in the C++, Java, JavaScript, C, Fortran, and Python implementations of the geodesic routines. This bug was not present in the MATLAB version. - Fix bug in Utility::readarray and Utility::writearray which caused an exception in debug mode with zero-sized arrays. - Fix BLUNDER in OSGB::GridReference (found by kalderami) where the wrong result was returned if the easting or northing was negative. - OSGB::GridReference now returns "INVALID" if either coordinate is NaN. Similarly a grid reference starting with "IN" results in NaNs for the coordinates. - Default constructor for GeoCoords corresponds to an undefined position (latitude and longitude = NaN), instead of the north pole. - Add an online version of RhumbSolve at https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve. - Additions to the documentation: - documentation on \ref triaxial-conformal; - a page on \ref auxlat (actually, this was added in version 1.39); - document the use of two single quotes to stand for a double quote in DMS (this feature was introduced in version 1.13). - The MATLAB function, geographiclibinterface, which compiles the wrapper routines for MATLAB now works with MATLAB on a Mac. . - Version 1.39 (released 2014-11-11) - GeographicLib usually normalizes longitudes to the range [−180°, 180°). However, when solving the direct geodesic and rhumb line problems, it is sometimes necessary to know how many lines the line encircled the earth by returning the longitude "unwrapped". So the following changes have been made: - add a LONG_NOWRAP flag to \e mask enums for the \e outmask arguments for Geodesic, GeodesicLine, Rhumb, and RhumbLine; - similar changes have been made to the Python, JavaScript, and Java implementations of the geodesic routines; - for the C, Fortran, and MATLAB implementations the \e arcmode argument to the routines was generalized to allow a combination of ARCMODE and LONG_NOWRAP bits; - the Maxima version now returns the longitude unwrapped. . These changes were necessary to fix the PolygonAreaT::AddEdge (see the next item). - Changes in area calculations: - fix BUG in PolygonAreaT::AddEdge (also in C, Java, JavaScript, and Python implementations) which sometimes causes the wrong area to be returned if the edge spanned more than 180°; - add area calculation to the Rhumb and RhumbLine classes and the RhumbSolve utility (see \ref rhumbarea); - add PolygonAreaRhumb typedef for PolygonAreaT; - add -R option to Planimeter to use PolygonAreaRhumb (and -G option for the default geodesic polygon); - fix BLUNDER in area calculation in MATLAB routine geodreckon; - add area calculation to MATLAB/Octave routines for great ellipses (see \ref gearea). - Fix bad BUG in Geohash::Reverse; this was introduced in version 1.37 and affected all platforms where unsigned longs are 32-bits. Thanks to Christian Csar for reporting and diagnosing this. - Binary installers for Windows are now built with Visual Studio 11 2012 (instead of Visual Studio 10 2010). Compiled MATLAB support still with version 2013a (64-bit). - Update GeographicLib.pro for builds with qmake to include all the source files. - Cmake updates: - include cross-compiling checks in cmake config file; - improve the way unsuitable versions are reported; - include_directories (${GeographicLib_INCLUDE_DIRS}) is no longer necessary with cmake 2.8.11 or later. - legacy/Fortran now includes drop-in replacements for the geodesic utilities from the NGS. - geographiclib-get-{geoids,gravity,magnetic} with no arguments now print the usage instead of loading the minimal sets. - Utility::date(const std::string&, int&, int&, int&) and hence the MagneticField utility accepts the string "now" as a legal time (meaning today). . - Version 1.38 (released 2014-10-02) - On MacOSX, the installed package is relocatable (for cmake version 2.8.12 and later). - On Mac OSX, GeographicLib can be installed using homebrew. - In cmake builds under Windows, set the output directories so that binaries and shared libraries are together. - Accept the minus sign as a synonym for - in DMS.{cpp,js}. - The cmake configuration file geographiclib-depends.cmake has been renamed to geographiclib-targets.cmake. - MATLAB/Octave routines for great ellipses added; see \ref greatellipse. - Provide man pages for geographiclib-get-{geoids,gravity,magnetic}. . - Version 1.37 (released 2014-08-08) - Add \ref highprec. - INCOMPATIBLE CHANGE: the static instantiations of various classes for the WGS84 ellipsoid have been changed to a "construct on first use idiom". This avoids a lot of wasteful initialization before the user's code starts. Unfortunately it means that existing source code that relies on any of the following static variables will need to be changed to a function call: - AlbersEqualArea::AzimuthalEqualAreaNorth - AlbersEqualArea::AzimuthalEqualAreaSouth - AlbersEqualArea::CylindricalEqualArea - Ellipsoid::WGS84 - Geocentric::WGS84 - Geodesic::WGS84 - GeodesicExact::WGS84 - LambertConformalConic::Mercator - NormalGravity::GRS80 - NormalGravity::WGS84 - PolarStereographic::UPS - TransverseMercator::UTM - TransverseMercatorExact::UTM . Thus, occurrences of, for example, \code const Geodesic& geod = Geodesic::WGS84; // version 1.36 and earlier \endcode need to be changed to \code const Geodesic& geod = Geodesic::WGS84(); // version 1.37 and later \endcode (note the parentheses!); alternatively use \code // works with all versions const Geodesic geod(Constants::WGS84_a(), Constants::WGS84_a()); \endcode - Incompatible change: the environment variables {GEOID,GRAVITY,MAGNETIC}_{NAME,PATH} are now prefixed with GEOGRAPHICLIB_. - Incompatible change for Windows XP: retire the Windows XP common data path. If you're still using Windows XP, then you might have to move the folder C:\\Documents and Settings\\All Users\\Application Data\\GeographicLib to C:\\ProgramData\\GeographicLib. - All macro names affecting the compilation now start with GEOGRAPHICLIB_; this applies to GEOID_DEFAULT_NAME, GRAVITY_DEFAULT_NAME, MAGNETIC_DEFAULT_NAME, PGM_PIXEL_WIDTH, HAVE_LONG_DOUBLE, STATIC_ASSERT, WORDS_BIGENDIAN. - Changes to PolygonArea: - introduce PolygonAreaT which takes a geodesic class as a parameter; - PolygonArea and PolygonAreaExact are typedef'ed to PolygonAreaT and PolygonAreaT; - add -E option to Planimeter to use PolygonAreaExact; - add -Q option to Planimeter to calculate the area on the authalic sphere. - Add -p option to Planimeter, ConicProj, GeodesicProj, TransverseMercatorProj. - Add Rhumb and RhumbLine classes and the RhumbSolve utility; see \ref rhumb for more information. - Minor changes to NormalGravity: - add NormalGravity::J2ToFlattening and NormalGravity::FlatteningToJ2; - use Newton's method to determine \e f from \e J2; - in constructor, allow \e omega = 0 (i.e., treat the spherical case). - Add grs80 GravityModel, see \ref gravity. - Make geographiclib-get-{geoids,gravity,magnetic} scripts work on MacOS. - Minor changes: - simplify cross-platform support for C++11 mathematical functions; - change way area coefficients are given in GeodesicExact to improve compile times; - enable searching the online documentation; - add macros GEOGRAPHICLIB_VERSION and GEOGRAPHICLIB_VERSION_NUM; - add solution and project files for Visual Studio Express 2010. . - Version 1.36 (released 2014-05-13) - Changes to comply with NGA's prohibition of the use of the upper-case letters N/S to designate the hemisphere when displaying UTM/UPS coordinates: - UTMUPS::DecodeZone allows north/south as hemisphere designators (in addition to n/s); - UTMUPS::EncodeZone now encodes the hemisphere in lower case (to distinguish this use from a grid zone designator); - UTMUPS::EncodeZone takes an optional parameter \e abbrev to indicate whether to use n/s or north/south as the hemisphere designator; - GeoCoords::UTMUPSRepresentation and GeoCoords::AltUTMUPSRepresentation similarly accept the \e abbrev parameter; - GeoConvert uses the flags -a and -l to govern whether UTM/UPS output uses n/s (the -a flag) or north/south (the -l flag) to denote the hemisphere; - Fixed a bug what allowed +3N to be accepted as an alternative UTM zone designation (instead of 3N). . WARNING: The use of lower case n/s for the hemisphere might cause compatibility problems. However DecodeZone has always accepted either case; so the issue will only arise with other software reading the zone information. To avoid possible misinterpretation of the zone designator, consider calling EncodeZone with \e abbrev = false and GeoConvert with -l, so that north/south are used to denote the hemisphere. - MGRS::Forward with \e prec = −1 will produce a grid zone designation. Similarly MGRS::Reverse will decode a grid zone designation (and return \e prec = −1). - Stop using the throw() declaration specification which is deprecated in C++11. - Add missing std:: qualifications to copy in LocalCartesion and Geocentric headers (bug found by Clemens). . - Version 1.35 (released 2014-03-13) - Fix blunder in UTMUPS::EncodeEPSG (found by Ben Adler). - MATLAB wrapper routines geodesic{direct,inverse,line} switch to "exact" routes if |f| > 0.02. - GeodSolve.cgi allows ellipsoid to be set (and uses the -E option for GeodSolve). - Set title in HTML versions of man pages for the \ref utilities. - Changes in cmake support: - add _d to names of executables in debug mode of Visual Studio; - add support for Android (cmake-only), thanks to Pullan Yu; - check CPACK version numbers supplied on command line; - configured version of project-config.cmake.in is project-config.cmake (instead of geographiclib-config.cmake), to prevent find_package incorrectly using this file; - fix tests with multi-line output; - this release includes a file, pom.xml, which is used by an experimental build system (based on maven) at SRI. . - Version 1.34 (released 2013-12-11) - Many changes in cmake support: - minimum version of cmake needed increased to 2.8.4 (which was released in 2011-02); - allow building both shared and static libraries with -D GEOGRAPHICLIB_LIB_TYPE=BOTH; - both shared and static libraries (Release plus Debug) included in binary installer; - find_package uses COMPONENTS and GeographicLib_USE_STATIC_LIBS to select the library to use; - find_package version checking allows nmake and Visual Studio generators to interoperate on Windows; - find_package (GeographicLib …) requires that GeographicLib be capitalized correctly; - on Unix/Linux, don't include the version number in directory for the cmake configuration files; - defaults for GEOGRAPHICLIB_DOCUMENTATION and BUILD_NETGEOGRAPHICLIB are now OFF; - the GEOGRAPHICLIB_EXAMPLES configuration parameter is no longer used; cmake always configures to build the examples, but they are not built by default (instead build targets: exampleprograms and netexamples); - matlab-all target renamed to matlabinterface; - the configuration parameters PACKAGE_PATH and INSTALL_PATH are now deprecated (use CMAKE_INSTALL_PREFIX instead); - on Linux, the installed package is relocatable; - on MacOSX, the installed utilities can find the shared library. - Use a more precise value for OSGB::CentralScale(). - Add Arc routines to Python interface. - The Geod utility has been removed; the same functionality lives on with GeodSolve (introduced in version 1.30). . - Version 1.33 (released 2013-10-08) - Add NETGeographic .NET wrapper library (courtesy of Scott Heiman). - Make inspector functions in Ellipsoid const. - Add Accumulator.cpp to instantiate Accumulator. - Defer some of the initialization of OSGB to when it is first called. - Fix bug in autoconf builds under MacOS. . - Version 1.32 (released 2013-07-12) - Generalize C interface for polygon areas to allow vertices to be specified incrementally. - Fix way flags for C++11 support are determined. . - Version 1.31 (released 2013-07-01) - Changes breaking binary compatibility (source compatibility is maintained): - overloaded versions of DMS::Encode, EllipticFunction::EllipticFunction, and GeoCoords::DMSRepresentation, have been eliminated by the use of optional arguments; - correct the declaration of first arg to UTMUPS::DecodeEPSG. - FIX BUG in GravityCircle constructor (found by Mathieu Peyréga) which caused bogus results for the gravity disturbance and gravity anomaly vectors. (This only affected calculations using GravityCircle. GravityModel calculations did not suffer from this bug.) - Improvements to the build: - add macros GEOGRAPHICLIB_VERSION_{MAJOR,MINOR,PATCH} to Config.h; - fix documentation for new version of perlpod; - improving setting of runtime path for Unix-like systems with cmake; - install PDB files when compiling with Visual Studio to aid debugging; - Windows binary release now uses MATLAB R2013a (64-bit) and uses the -largeArrayDims option. - fixes to the way the MATLAB interface routines are built (thanks to Phil Miller and Chris F.). - Changes to the geodesic routines: - add \ref java of the geodesic routines (thanks to Skip Breidbach for the maven support); - FIX BUG: avoid altering input args in Fortran implementation; - more systematic treatment of very short geodesic; - fixes to Python port so that they work with version 3.x, in addition to 2.x (courtesy of Amato); - accumulate the perimeter and area of polygons via a double-wide accumulator in Fortran, C, and MATLAB implementations (this is already included in the other implementations); - port PolygonArea::AddEdge and PolygonArea::TestEdge to JavaScript and Python interfaces; - include documentation on \ref geodshort. - Unix scripts for downloading datasets, geographiclib-get-{geoids,gravity,magnetic}, skip already download models by default, unless the -f flag is given. - FIX BUGS: meridian convergence and scale returned by TransverseMercatorExact was wrong at a pole. - Improve efficiency of MGRS::Forward by avoiding the calculation of the latitude if possible (adapting an idea of Craig Rollins). - Fixes to the way the MATLAB interface routines are built (thanks to Phil Miller and Chris F.). . - Version 1.30 (released 2013-02-27) - Changes to geodesic routines: - FIX BUG in fail-safe mechanisms in Geodesic::Inverse; - the command line utility Geod is now called GeodSolve; - allow addition of polygon edges in PolygonArea; - add full Maxima implementation of geodesic algorithms. . - Version 1.29 (released 2013-01-16) - Changes to allow compilation with libc++ (courtesy of Kal Conley). - Add description of \ref triaxial to documentation. - Update journal reference for "Algorithms for geodesics". . - Version 1.28 (released 2012-12-11) - Changes to geodesic routines: - compute longitude difference exactly; - hence FIX BUG in area calculations for polygons with vertices very close to the prime meridian; - FIX BUG is geoddistance.m where the value of m12 was wrong for meridional geodesics; - add MATLAB implementations of the geodesic projections; - remove unneeded special code for geodesics which start at a pole; - include polygon area routine in C and Fortran implementations; - add doxygen documentation for C and Fortran libraries. . - Version 1.27 (released 2012-11-29) - Changes to geodesic routines: - add native MATLAB implementations: geoddistance.m, geodreckon.m, geodarea.m; - add C and Fortran implementations; - improve the solution of the direct problem so that the series solution is accurate to round off for |f| < 1/50; - tighten up the convergence criteria for solution of the inverse problem; - no longer signal failures of convergence with NaNs (a slightly less accurate answer is returned instead). - Fix DMS::Decode double rounding BUG. - On MacOSX platforms with the cmake configuration, universal binaries are built. . - Version 1.26 (released 2012-10-22) - Replace the series used for geodesic areas by one with better convergence (this only makes an appreciable difference if |f| > 1/150). . - Version 1.25 (released 2012-10-16) - Changes to geodesic calculations: - restart Newton's method in Geodesic::Inverse when it goes awry; - back up Newton's method with the bisection method; - Geodesic::Inverse now converges for any value of \e f; - add GeodesicExact and GeodesicLineExact which are formulated in terms of elliptic integrals and thus yield accurate results even for very eccentric ellipsoids; - the -E option to Geod invokes these exact classes. - Add functionality to EllipticFunction: - add all the traditional elliptic integrals; - remove restrictions on argument range for incomplete elliptic integrals; - allow imaginary modulus for elliptic integrals and elliptic functions; - make interface to the symmetric elliptic integrals public. - Allow Ellipsoid to be copied. - Changes to the build tools: - cmake uses folders in Visual Studio to reduce clutter; - allow precision of reals to be set in cmake; - fail gracefully in the absence of pod documentation tools; - remove support for maintainer tasks in Makefile.mk; - upgrade to automake 1.11.6 to fix the "make distcheck" security vulnerability; see https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-3386 . - Version 1.24 (released 2012-09-22) - Allow the specification of the hemisphere in UTM coordinates in order to provide continuity across the equator: - add UTMUPS::Transfer; - add GeoCoords::UTMUPSRepresentation(bool, int) and GeoCoords::AltUTMUPSRepresentation(bool, int); - use the hemisphere letter in, e.g., GeoConvert -u -z 31n. - Add UTMUPS::DecodeEPSG and UTMUPS::EncodeEPSG. - cmake changes: - restore support for cmake 2.4.x; - explicitly check version of doxygen. - Fix building under cygwin. - Document restrictions on \e f in \ref intro. - Fix Python interface to work with version 2.6.x. . - Version 1.23 (released 2012-07-17) - Documentation changes: - remove html documentation from distribution and use web links if doxygen is not available; - use doxygen tags to document exceptions; - begin migrating the documentation to using Greek letters where appropriate (requires doxygen 1.8.1.2 or later). - Add Math::AngNormalize and Math::AngNormalize2; the allowed range for longitudes and azimuths widened to [−540°, 540°). - DMS::Decode understands more unicode symbols. - Geohash uses geohash code "nan" to stand for not a number. - Add Ellipsoid::NormalCurvatureRadius. - Various fixes in LambertConformalConic, TransverseMercator, PolarStereographic, and Ellipsoid to handle reverse projections of points near infinity. - Fix programming blunder in LambertConformalConic::Forward (incorrect results were returned if the tangent latitude was negative). . - Version 1.22 (released 2012-05-27) - Add Geohash and Ellipsoid classes. - FIX BUG in AlbersEqualArea for very prolate ellipsoids (b2 > 2 a2). - cmake changes: - optionally use PACKAGE_PATH and INSTALL_PATH to determine CMAKE_INSTALL_PREFIX; - use COMMON_INSTALL_PATH to determine layout of installation directories; - as a consequence, the installation paths for the documentation, and Python and MATLAB interfaces are shortened for Windows; - zip source distribution now uses DOS line endings; - the tests work in debug mode for Windows; - default setting of GEOGRAPHICLIB_DATA does not depend on CMAKE_INSTALL_PREFIX; - add a cmake configuration for build tree. . - Version 1.21 (released 2012-04-25) - 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 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 SphericalEngine to deal with aggressive iterator checking by Visual Studio. - Fix transcription BUG is Geodesic.js. . - Version 1.19 (released 2012-03-13) - 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 \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 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 documentation to the cmake configuration files. . - Version 1.16 (released 2011-12-07) - Add calculation of the earth's gravitational field: - add NormalGravity GravityModel and GravityCircle classes; - add command line utility Gravity; - add \ref gravity; - 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. . - Version 1.15 (released 2011-11-08) - Add calculation of the earth's magnetic field: - add MagneticModel and MagneticCircle classes; - add command line utility MagneticField; - add \ref magnetic; - add \ref magneticinst; - add \ref magneticformat; - 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. . - Version 1.14 (released 2011-09-30) - 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 https://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 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 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" 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 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 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 DMS. - Move Accumulator class from Planimeter.cpp to Constants.hpp. - Add 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 Geocentric and 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. - Geoid updates - Add Geoid::DefaultGeoidPath and Geoid::DefaultGeoidName; - GeoidEval uses environment variable GEOGRAPHICLIB_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 LambertConformalConic::Reverse. - Add 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 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 LambertConformalConic using divided differences. - FIX BUG in meridian convergence returned by LambertConformalConic::Forward. - Add optional threadsafe parameter to Geoid constructor. WARNING: This changes may break binary compatibility with previous versions of GeographicLib. However, the library is source compatible. - Add OSGB. - MATLAB and Octave interfaces to UTMUPS, MGRS, Geoid, Geodesic provided. - Minor changes - explicitly turn on optimization in Visual Studio 2008 projects; - add missing dependencies in some Makefiles; - move pi() and degree() from Constants to Math; - introduce Math::extended type to aid testing; - add Math::epi() and 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 Geodesic and 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 Gnomonic::Reverse. - Add 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 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 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 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 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 \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 LambertConformalConic class. - Add PolarStereographic::SetScale to allow the latitude of true scale to be specified. - Add solution and project files for Visual Studio 2008. - Add GeographicErr for exceptions. - Geoid changes: - BUG FIX: fix typo in 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 (released 2009-11-03) - Allow specification of "closest UTM zone" in UTMUPS and GeoConvert (via -t option). - Utilities now complain is there are too many tokens on input lines. - Include real-to-real versions of DMS::Decode and 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 MGRS::Forward. - Include more information in some error messages. - Improve accuracy of inverse hyperbolic functions. - Fix the way Math functions handle different precisions. . - Version 2009-10 (released 2009-10-18) - Change web site to https://geographiclib.sourceforge.io - 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 (released 2009-09-01) - Add Geoid and GeoidEval utility. . - Version 2009-08 (released 2009-08-14) - Add CassiniSoldner class and EquidistantTest utility. - Fix bug in 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 (released 2009-07-16) - Speed up the series inversion code in tmseries.mac and geod.mac. - Reference Borkowski in section on \ref geocentric. . - Version 2009-06 (released 2009-06-01) - Add routines to decode and encode zone+hemisphere to UTMUPS. - Clean up code in Geodesic. . - Version 2009-05 (released 2009-05-01) - Improvements to 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 Geocentric, TransverseMercator, and PolarStereographic classes work with prolate ellipsoids. - CartConvert checks its inputs more carefully. - Remove reference to defunct Constants.cpp from GeographicLib.vcproj. . - Version 2009-04 (released 2009-04-01) - Use compile-time constants to select the order of series in TransverseMercator. - 2x unroll of Clenshaw summation to avoid data shuffling. - Simplification of EllipticFunction::E. - Use STATIC_ASSERT for compile-time checking of constants. - Improvements to 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 (released 2009-03-01) - Add Geodesic and the Geod utility. - Declare when no exceptions are thrown by functions. - Minor changes to 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 ECEF to Geocentric, ECEFConvert to CartConvert. - Use inline functions to define constant doubles in Constants.hpp. . - Version 2009-02 (released 2009-01-30) - Fix documentation of constructors (flattening → inverse flattening). - Use std versions of math functions. - Add ECEF and LocalCartesian classes and the ECEFConvert utility. - Gather the documentation on the \ref utilities onto one page. . - Version 2009-01 (released 2009-01-12) - First proper release of library. - More robust 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 MGRS, UTMUPS, etc. . - Version 2008-09 - Ad hoc posting of information on the transverse Mercator projection.
Back to \ref highprec. Up to \ref contents.
**********************************************************************/ } GeographicLib-1.52/doc/Makefile.am0000644000771000077100000001152114064202371016616 0ustar ckarneyckarneyEXTRAFILES = $(srcdir)/tmseries30.html $(srcdir)/geodseries30.html FIGURES = \ $(srcdir)/gauss-krueger-graticule.png \ $(srcdir)/thompson-tm-graticule.png \ $(srcdir)/gauss-krueger-convergence-scale.png \ $(srcdir)/gauss-schreiber-graticule-a.png \ $(srcdir)/gauss-krueger-graticule-a.png \ $(srcdir)/thompson-tm-graticule-a.png \ $(srcdir)/gauss-krueger-error.png \ $(srcdir)/meridian-measures.png \ $(srcdir)/normal-gravity-potential-1.svg \ $(srcdir)/vptree.gif 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/Ellipsoid.hpp \ $(top_srcdir)/include/GeographicLib/EllipticFunction.hpp \ $(top_srcdir)/include/GeographicLib/GARS.hpp \ $(top_srcdir)/include/GeographicLib/GeoCoords.hpp \ $(top_srcdir)/include/GeographicLib/Geocentric.hpp \ $(top_srcdir)/include/GeographicLib/Geodesic.hpp \ $(top_srcdir)/include/GeographicLib/GeodesicExact.hpp \ $(top_srcdir)/include/GeographicLib/GeodesicLine.hpp \ $(top_srcdir)/include/GeographicLib/GeodesicLineExact.hpp \ $(top_srcdir)/include/GeographicLib/Geohash.hpp \ $(top_srcdir)/include/GeographicLib/Geoid.hpp \ $(top_srcdir)/include/GeographicLib/Georef.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/Ellipsoid.cpp \ $(top_srcdir)/src/EllipticFunction.cpp \ $(top_srcdir)/src/GARS.cpp \ $(top_srcdir)/src/GeoCoords.cpp \ $(top_srcdir)/src/Geocentric.cpp \ $(top_srcdir)/src/Geodesic.cpp \ $(top_srcdir)/src/GeodesicLine.cpp \ $(top_srcdir)/src/Geohash.cpp \ $(top_srcdir)/src/Geoid.cpp \ $(top_srcdir)/src/Georef.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/GeodSolve.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/GeodSolve.1.html \ ../man/GeoidEval.1.html \ ../man/Gravity.1.html \ ../man/MagneticField.1.html \ ../man/Planimeter.1.html \ ../man/RhumbSolve.1.html \ ../man/TransverseMercatorProj.1.html doc: html/index.html if HAVE_DOXYGEN manpages: $(MANPAGES) if test -d html; then rm -rf html/*; else mkdir html; fi cp $^ html/ touch $@ html/index.html: manpages doxyfile.in GeographicLib.dox.in \ $(HPPFILES) $(ALLSOURCES) $(EXTRAFILES) $(FIGURES) cp -p $(EXTRAFILES) $(top_srcdir)/maxima/*.mac \ $(top_srcdir)/LICENSE.txt html/ sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ $(srcdir)/GeographicLib.dox.in > GeographicLib.dox sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \ -e "s%@PROJECT_BINARY_DIR@%..%g" \ -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ $(srcdir)/doxyfile.in | $(DOXYGEN) - else html/index.html: index.html.in utilities.html.in if test -d html; then rm -rf html/*; else mkdir html; fi cp $(top_srcdir)/LICENSE.txt html/ sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ $(srcdir)/utilities.html.in > html/utilities.html sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ $(srcdir)/index.html.in > html/index.html endif maintainer-clean-local: rm -rf html manpages htmldir=$(DESTDIR)$(docdir)/html install-doc: html/index.html $(INSTALL) -d $(htmldir) $(INSTALL) -m 644 `dirname $<`/*.* $(htmldir) -test -f `dirname $<`/search/search.js && \ $(INSTALL) -d $(htmldir)/search && \ $(INSTALL) -m 644 `dirname $<`/search/*.* $(htmldir)/search || true GeographicLib-1.52/doc/Makefile.mk0000644000771000077100000000114514064202371016631 0ustar ckarneyckarneyVERSION:=$(shell grep '\bVERSION=' ../configure | cut -f2 -d\' | head -1) doc: html/index.html html/index.html: index.html.in utilities.html.in if test -d html; then rm -rf html/*; else mkdir html; fi cp ../LICENSE.txt html/ sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ utilities.html.in > html/utilities.html sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ index.html.in > html/index.html DEST = $(PREFIX)/share/doc/GeographicLib DOCDEST = $(DEST)/html INSTALL = install -b install: html/index.html test -d $(DOCDEST) || mkdir -p $(DOCDEST) $(INSTALL) -m 644 html/* $(DOCDEST)/ .PHONY: doc install clean GeographicLib-1.52/doc/NETGeographicLib.dox0000644000771000077100000002775314064202371020362 0ustar ckarneyckarney// -*- text -*- /** * \file NETGeographicLib.dox * \brief Documentation for NETGeographicLib * * Written by Scott Heiman and licensed under the * MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ /** \mainpage NETGeographicLib library \author Scott Heiman (mrmtdew2@outlook.com) \version 1.52 \date 2020-06-22 The documentation for other versions is available at https://geographiclib.sourceforge.io/m.nn/NET for versions numbers m.nn ≥ 1.33. \section abstract-net Abstract %NETGeographicLib is a .NET wrapper for GeographicLib. It allows .NET developers to access GeographicLib classes within C#, Visual Basic, Managed C++, and other Microsoft .NET languages. NETGeographicLib is written in Managed C++. It IS NOT a reimplementation of the GeographicLib software. It is a container that provides interfaces to the GeographicLib classes. GeographicLib and NETGeographicLib is an integrated product. The NETGeographic solutions and C++ projects are located in the \/GeographicLib-1.52/windows folder where \ is the directory where you unpacked the GeographicLib source distribution. The C# Projections projects are located in the \/GeographicLib-1.52/dotnet/Projections folder. Solution files have been provided for VS 2010 and VS 2013 NETGeographicLib is not available for older versions of Microsoft Visual Studio. NETGeographicLib has been tested with C#, Managed C++, and Visual Basic. Sample code snippets can be found in \/GeographicLib-1.52/dotnet/examples. \section differences Differences between NETGeographicLib and GeographicLib The NETGeographicLib class names are identical to the GeographicLib class names. All NETGeographicLib classes are in the NETGeographicLib namespace. NETGeographicLib exposes most of the GeographicLib classes. The exceptions are SphericalEngine, GeographicLib::Math, and most of GeographicLib::Utility. The SphericalEngine class is a template class which (according to the comments in the SphericalEngine.h file) is not usually accessible to developers. The GeographicLib::Math class contains several specialized functions required by GeographicLib classes. They have limited use outside GeographicLib. This class may be exposed in a future release if there is demand for it. The functions provided by GeographicLib::Utility duplicate functions provided by existing .NET controls (DateTime). The GeographicLib::Utility::fractionalyear function is available to .NET programmers by calling NETGeographicLib::Utility::FractionalYear. The SphericalCoefficients class replaces the SphericalEngine::coeff class. The NETGeographicLib class function interfaces are similar, and in many cases, identical to the GeographicLib interfaces. There are differences because of limitations in .NET and other differences that are discretionary. The comments in the header files contain a section labeled "INTERFACE DIFFERENCES" that detail the differences between the NETGeographicLib interfaces and the GeographicLib interfaces. The differences are summarized in the text that follows. Default values for function parameters are not supported in .NET. If the documentation refers to a default value for a parameter, it applies only to GeographicLib. However, such a "default" value often provides a reasonable choice for this parameter. Several GeographicLib class functions accept or return a "capabilities mask" as an unsigned integer. The NETGeographicLib classes accept and return the capabilities mask as an enumeration. The Geocentric and LocalCartesian classes have functions that return a rotation matrix. The NETGeographicLib versions return a two-dimensional, 3 × 3 array rather than a vector. A lot of GeographicLib classes have inspector functions (EquatorialRadius, Flattening, etc.). These inspector functions are implemented as properties in NETGeographicLib. NETGeographicLib classes do not implement constructors that create "uninitialized" objects. Many NETGeographicLib classes implement a default constructor that assumes WGS84 parameters. Several GeographicLib classes implement the () operator. NETGeographicLib classes replace the () operator with a specific function. Managed C++ allows developers to overload the () operator; however, the () operator is not 'elegantly' supported in other .NET languages. For example, if the () operator was implemented in the NETGeographicLib::Geoid class, then C# code would look like \code Geoid geoid = new Geoid(); double h = geoid.op_FuncCall(latitude,longitude); // if () operator was implemented. h = geoid.Height(latitude,longitude); // with () operator replaced with Height \endcode The author felt that the op_FuncCall syntax did not appropriately define the purpose of the function call. .NET does not allow developers to overload the assignment operators (=,+=,-=,*=). These operators have been replaced with functions in the NETGeographicLib::Accumulator class. \section library Using NETGeographicLib in a .NET Application If you have access to the NETGeographicLib and GeographicLib projects then -# Create a new solution. -# Create a new project using any .NET language. For this example, call it MyApp. -# Add the NETGeographic and Geographic projects to the solution. Verify that NETGeographicLib depends upon GeographicLib. -# Right-Click MyApp in the Solution View and select "Add Reference..." (C#/VB) or "References..." (Managed C++) in the pop-up menu. -# (Managed C++) Click the "Add New Reference..." button in the Properties dialog. \image html NETGeographicLib3.png -# Click the Projects Tab and select NETGeographic. \image html NETGeographicLib1.png -# Click OK. If you only have access to the NETGeographic.dll then -# Create a new solution. -# Create a new project using any .NET language. For this example, call it MyApp. -# Right-Click MyApp in the Solution View and select "Add Reference..." in the popup menu. -# Right-Click MyApp in the Solution View and select "Add Reference..." (C#/VB) or "References..." (Managed C++) in the pop-up menu. -# (Managed C++) Click the "Add New Reference..." button in the Properties dialog. \image html NETGeographicLib3.png -# Click the Browse Tab and navigate to the folder containing NETGeographic.dll. \image html NETGeographicLib2.png -# Select NETGeographic.dll and click OK. The MyApp project will have access to all public NETGeographicLib classes after the NETGeographic reference is added to MyApp. C# developers should add \code using NETGeographicLib; \endcode to any C# source file that uses NETGeographicLib. Managed C++ developers should add \code using namespace NETGeographicLib; \endcode to any C++ source that uses NETGeographicLib classes. Visual Basic developers should add \code Imports NETGeographicLib \endcode to any Visual Basic source that uses NETGeographicLib classes. \section sample C# Sample Application A C# sample application is provided that demonstrates NETGeographicLib classes. The source code for the sample application is located in \/GeographicLib-1.52/dotnet/Projections. The sample application creates a tabbed dialog. Each tab provides data entry fields that allow the user to exercise one or more NETGeographicLib classes. The following table lists the source code that demonstrates specific classes.
Source FileClasses
AccumPanel.csAccumulator
AlbersPanel.csAlbersEqualArea, LambertConformalConic, TransverseMercator, TransverseMercatorExact
EllipsoidPanel.csEllipsoid
EllipticPanel.csEllipticFunction
GeocentricPanel.csGeocentric
GeodesicPanel.csGeodesic, GeodesicLine, GeodesicExact, GeodesicLineExact
GeoidPanel.csGeoid
GravityPanel.csNormalGravity, GravityModel, GravityCircle
LocalCartesianPanel.csLocalCartesian
MagneticPanel.csMagneticModel, MagneticCircle
MiscPanel.csDMS, Geohash, GARS, Georef
PolarStereoPanel.csPolarStereographic
PolyPanel.csPolygonArea
ProjectionsPanel.csAzimuthalEquidistant, CassiniSoldner, Gnomonic
SphericalHarmonicsPanel.csSphericalHarmonic, SphericalHarmonic1, SphericalHarmonic2, CircularEngine, SphericalCoefficients
TypeIIIProjPanel.csUTMUPS, MGRS, OSGB
RhumbPanel.csRhumb, RhumbLine
\section netcmake Using cmake to build a Managed C++ Application The following assumes that you have installed %GeographicLib in one of two ways: - you have built and installed %GeographicLib using cmake with -D BUILD_NETGEOGRAPHICLIB=ON (see \ref cmake "Installation with cmake" in the %GeographicLib documentation). You can use any version of Visual Studio to build %GeographicLib and should use the same version to build your application. You can build %GeographicLib as a shared library using -D GEOGRAPHICLIB_LIB_TYPE=SHARED or BOTH. - you have installed %GeographicLib using one of the binary installers (see \ref binaryinstwin "Using a binary installer for Windows" in the %GeographicLib documentation). In this case, you are restricted to using Visual Studio 14. The minimum version of cmake for use with NETGeographicLib is 3.1.0 or later. In order to build an application that uses NETGeographicLib with cmake, ask for the NETGeographicLib "component" of %GeographicLib using \verbatim find_package(GeographicLib COMPONENTS NETGeographicLib) \endverbatim If NETGeographicLib is found, then GeographicLib_NETGeographicLib_FOUND will be set to true and GeographicLib_NETGeographicLib_LIBRARIES will be set to the NETGeographic shared library. This is the name of the cmake target from which the pathname of the dll can be obtained. Here is a very simple test code, which uses the NETGeographicLib::Geodesic class: \include example-Geodesic-small.cpp This example is dotnet/examples/ManagedCPP/example-Geodesic-small.cpp. Here is a complete CMakeList.txt files you can use to build this test code using the installed library: \verbatim project (geodesictest) cmake_minimum_required (VERSION 2.8.7) # required for VS_DOTNET_REFERENCES find_package (GeographicLib 1.35 REQUIRED COMPONENTS NETGeographicLib) add_executable (${PROJECT_NAME} example-Geodesic-small.cpp) set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/clr") string (REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string (REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # This is set up for Release builds only. Change RELEASE to DEBUG for # Debug builds. get_target_property (_LOC "${GeographicLib_NETGeographicLib_LIBRARIES}" IMPORTED_LOCATION_RELEASE) set_target_properties (${PROJECT_NAME} PROPERTIES VS_DOTNET_REFERENCES ${_LOC}) get_target_property (_LIB "${GeographicLib_NETGeographicLib_LIBRARIES}" IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE) get_target_property (_LIBTYPE ${_LIB} TYPE) if (_LIBTYPE STREQUAL "SHARED_LIBRARY") # On Windows systems, copy the shared library to build directory add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CFG_INTDIR} COMMENT "Copying shared library for GeographicLib") endif () \endverbatim The typical invocation of cmake is \verbatim mkdir BUILD cd BUILD cmake -G "Visual Studio 14" -A x64 -D CMAKE_PREFIX_PATH=C:/pkg-vc14 .. cmake --build . --config Release cmake --build . --config Release --target INSTALL \endverbatim The version of Visual Studio should match that used to build NETGeographicLib. Running the example with \verbatim Release\geodesictest.exe \endverbatim should give \verbatim 5551.75940031868 km \endverbatim **********************************************************************/ GeographicLib-1.52/doc/NETGeographicLib1.png0000644000771000077100000004151214064202371020422 0ustar ckarneyckarneyPNG  IHDRnsRGBgAMA a pHYsodBIDATx^ۯmU)ϑ"Ey Vj;N! B8v:5cGHtԨvqX__/G?_{?woxM_'_cз HQ[|tz^0eZ͢H7rww1o!7_KwKq F%G ~~Q L-~/]_گL^G_?{Ň~e?#o93:Wꕲ*yd3|!0= /vrM7v>jFMZG+2%o|Ͽ{zPw+_#_?7ot~d->M@ J~ fY|xyyPTܷ;DQ"]ܻZ[I|-fu^sXuĖS˫ծ0?#_w>ϟo< >`~u_<_;F h#UY`Բe7YhdZߤrcnR$·c˫ծ0xWAg_k=]?~M~-soykα! [#\i2]Å4wIؠ[^k0*Q LcMyS_}~'^{_3y|kCr;ǞFV@"gJ%؍KbvoqT;f2}ӣJ.jTi<[xG~]_~~[?OǾݎ޿e -S!BEpdV"!ro.{Dk0*Q cT98fF]hhT1-=3 <7=dGuJ&!Q=iGK"$`TryUecӃ2ALsppplzP98886=(iM4ǦeccR?+J1dBY4!l4!l4!l4!l4!l4!l4!l4!l4!l4!l|Z&\鵁|ML%VQ<]CsFs nZDʸ-md2A;Q<9q[6 9?NT7v-"eLqFf{+NTk]2ZƝd;2nbK؆6:!26؉` dZlڛo1v-"eLqFI>/>q rI.ŵB|Hnbt_؉`teZ7Y)c[+N9L${u~O*Cϋy/޾[]pJqN?v*Xӕ0x֭{ oVʫi03;͡*Sq\)c[GPw' mtBϕvrgOBCgJi{6m<~$kN`7sHvې؎؉2@n'uDCs/3T-k4 N?Ca` ՒG8W~ަ;N>SJ/ى6:!g2qNGey{2 ފHbApn;Q\fzqCձ[|1]yΗNҗÝ{D8/.}'Usǧs s6 9?k!OV ~l"ݑ+Fʸ-a脜3myDUpl"RMl F'Qw3ӽ`'g;2nbK؆6:!26؉ΡEi;(ӿ~UͳCH7%lCLg̠*ytyȴ>B&؄L5!4!l4!l4!l4!l4!l4!l4!l4!l4!l4!l4!l4!l$O=C7ird::B #:#dQẼNon49"Aez|~I&%ir&Ẽx?z?GZ2MĠyB~;_g_?\H2MĠyB&2MĠyB&2MĔ=:k@ȮdS2x7z|q>r?WXNIȄL_i$r24:%ٛLk[û8A@,3yl%2-9s[ 2]\ΞwR !#/՝C^]J}_I-)c~ ļ $7`-w߳-K2(bJ/Z/&dr܄3"Ae rYRo@64} hLOded&O| |Ҥ< !iBj!H 4P L3iR4!5ir& M*c@B&2MIx BnLIԀ4ACȍiB *c@B&P4! 4P !d=Tǀ!2M!< !;/{Kj<3T]ܺ,pwUZkn<K%ԡ=|ɋv9j*c@3u(2Na Vysyb=ԛwQ±#@.I"&Ѡ͒@rOz to1:U6SǎEwcNm7uwR:0 [ OW51 hٙLKiٗti)VOX)7lUR4# D -1Yca< [ OW51 hٙLy Ies̒e:6@Xdt4_c[z$U,?dfe r9N 49+Ų/ߙJ9sOϙޮ$s}ˠ< !{F K-4nCgcÂ/edUJ*c@B&P4! 4P !d=Tǀ!2M!< !iBY1 hLBzACeBCx B'@/c?ZH oe.!Y@EPfez΁g\νT]BgakQ 㪦< !;4O#'9G;7 ?dh&7" Y9?X/Wtz3 6){39UdpTǀ!dO2=Өa)$%amluifa"K\:QdEB-R< 9U&x&z]n&,Z.bvYd:ȜLCs'WaJ\-Wo2TLrDuk.-{(Ӑu@  R*jZF)|Ƴ(m>dY-ذaUe7)-$%l0K:{ - N'J_HIX2%l)6YN[8H[g:m ƜnptV5OayԛEp=<9O/W̃ղL'!VU,-ӱB0kxV8cw(.IemK5!+ѻhsr9s;ڲ76y[ ?D:xN/ey Q1l,$R\0h`Q(ybTKj҆zcc6B(HlYMrȓBr.ڬL‰)vRD*c@B>7MW7' ٧LQ4! 4P !d=Tǀ!2M!< !iBY1 hLBzACeBCx B(ӄ*c@??zt?~?2k(q3hVi7#,{^r㟝{:ւ yq5DS51 hٙLl)IK%-E<ڹi![Gs0?*a2m9"##P`XE?SL7`±0? 3/]YI Ax B$3"![\L2$iNllrf): y>jUdi og"Wf¢%)i-.&![zhKE&ɴ;[94wqA,$r\ 4+a76%v~2MK2ds {U\82siZKqYi`L% :-iLi!/aKY\6Kghi`lt:Y-W.'E*H勀$Q66'&ޝlTas[mlUSԱw]SMΪ)6OzH"4Q.tG`1 3y0CZ;Ī~9JРnirҟlRi$qUڻu_"_Ҽf1G[*3G-{c#MTb^s~VB2-'V 1qG"MqM0oK/NJU*.lYMrȓBr.ڬL‰)vRD [ OW51 hٙLyM>glysCI Y\-v*Ų/>5mTy*J2g *c@'i԰Ibq"`raE6k^N#x<a.7-II{lq1[G;\,2ldNʡ `I% 斫b]1KVuZqӘBL0V:;J|r&a*7 Som>d6oKY\6Kghi`lt:Y-W.'E*HYUUjh47I6Piڰ@WnZgU6Աw]SMΪ)6OzH"4Q.tG`1 3y0]|۹tw%ACȞd8Abiv@T.g2WG[&Oyk%jB&_h|)p:o\ʯ i^yE3-˙іSZ&*Љtsz1/ \pt9?dd!bG+8Fc)Ԧa\I!y %jP&s'y'8#>*]i)YS8̉xْ,v"[·J[< Bi촙sV{CqQDl3BqhUluLLUǀ!d2BA}4虑a/z*c@B KP(H62lQ8]Db; ͆a/ 4P !d=Tǀ!2M!< !iBY1 hLBzACeBCx B(ӄ*c@B&PɴУ~3á?[zp T[b6;v3¥1z ?K%ԡ=|ɋACd<%>gzei .EysC؆I Y,HӴ\.\ Ų/ =9{39UdpTǀ!dO2=Өa)L-o "ZE6TWa"MRY^,LLʻLX$%]$#?dKop VȄu9vg+N6.‚%$VnyUdcBapUMӈO'd)5,~Z^Mme(Od)JpY ,]Q³101d-fqڸxVGb/5Sҟrwd\ +H<1R&2EJ?]ڰ@Wm:U6SǎEwcNm7uwR:0e 4P !d=Tǀ!2M!< !iBY1 hLBzACeBCx B(ӄ*c@B&PɴXg?{=Gp,]fӛTz?L=K%ԡ=|ɋ?j*c@3.Onr3G;7 ?dh}dfGRłC:lV Kqlϑk͡zL29=Ty*J2g *c@'lPoU[aJ*c1㭋=7r\x+l&lSI]T^z<a.7-II{lq1[G;\,2ldNʡɺUҹ㿮82MKyu#7u.ܹo:7MjaQ.ui§n;hAftwF lX°2Ɣdťj YM@^LqKF~VyM͵,ت'zu[7rKXzL(9$@-6SǎEwcNm7uwR:0e6 M"O NpG|TZVS8?dk2'4G Be s &KKE5ȍ$5HA@x BiBEAqQDl3BqhUluLLUǀ!d2}NPv!hn6#`]s=C1 hL/K%ټC;A2(*c@B^cy h]SACeBCx B(ӄ*c@B&P4! 4P !d=Tǀ!2M!< !iBY1 hٕLoS~"?1u U"8pnk~8uT-_Uv3LWjK%ԡ=|ɋv9j*c@7_bҌ1 tt@N@C^I iQ)J*:tt@.=`Xu9S֛98fSs楷8+\2ACdZ>>#3Ż`ӟ#9ʷʥT%1rN[[8rM +k0&r}-uy03+r3aђwՃ`%FcC"ea< !;iwZw?\tּr<i*H2癜!9'- JL |rE<'J͸͇,x~ lX°2Ɣdťj YM@^LqKF[eR^V3*c@GG+gqi-^8k!+"9#S6,Lp%Xk T٪>pcG1\)USm&&ADh\>u>.bg(`l,,=(3kq*1anYԣH>ݺ8c/&n3.ׄ4n]:ʱBNX` =WFEB%"ݫ_`tzrWQ*c@+>Pf $A}4xm6cAuY Uǀ!2=JrxSl͋pdzQTǀ!2=Ox[irN׶)mx(}Tǀ!2M!< !iBY1 hمLŭ+AC.dqACȎMsppp\*c@w+ < !|7*c@wӟoh'R3~ݿs?>o嗿\Նm;Um8UQwh1FKP̈́q [wΝTrӰ:y{?P}ƹrUe䵽:ZEn9;>G\/|kaXsT';?*h1'#V]5c< 44**=Uʎ/^Kru>Udf3״ugSskR 3<}1 hݻi>Hw0S%/QgɏG2b֟m!{SR7|i[1m5dސ1U}:};-+wIrTTeeHTE/63y.]qKq;(_пλ±Hx+ڕ;Rթawv50p u !۶< e{w2]ܝP!;}7E]Ge_UZF{E:"fa2nԱWm`f3w/͗UZ?l~3Q1;t܀0i =>Vr[Ť"\1_c9%\]&hj3 y lU-ߝ|lT6c[0fizʂI;YOw,͊jg73թawUQ0YdOi%Yr@_Bs@%JL |H7 XfBGadZVFa5Ivh, m&kغv }T;Y{16ǟDuZ?yթawR㙯6|9t@Gcta.w@ujvFxT}[TAM:/;&^Fk6]dթaw+ :5 BvnO?O:5 Bv!ӄTAeBCujP !d=TAeBCujP !d=TAȮd-ほ/tM#tR4#~;2 nFp{.=ns/νT]BgakQac:5 B&zTkދyݻ9nn-dG57qbXG`$U,EOp݋"sK:5 Bv*n>RX^dq쁞rߖe:mC_ca<\JsTANM;Qj-ۣv21 6JHf-btR`rh63]49R9\m<iH<G(ܘ_]yXujPq:xg25$[mflP4ǟ &ϯ̺ƐN}Cũ92>fsBf$8}.ە$ŦP&s'y'8#>*]i)!i3R?̟j9O)R%ټYIVUk!Ps63:dUEmKgW9'bG1Cl^ ɗ@&xz w~тmHVUp]5F N ee!iBVh@jαAFv뚳N QA5 2MȖؼC;A2(S ZL o۔6ݜ0f2Guʡ h4!TɔFP !d=TAeBCujP !d=TAeBCujP !d=TAeBVBEuceZ/UG 5Lg!gF92Ԍ2"}P3tF;rf#@v'z"}n*.%K'Q;rf,PɴiBΌ>r7jc=8 BșGrRCn:D93PThnz)zxǧD93DTbh5ۗL=!jBΌ>r74@v'3hBΌ>rde:D93ȑfv!#GQ3A3jF&52M!7)7irdBveB6 eB6 eB6 eB6 eB6 eB6 eB6 eB6 eB6 eB6 eB6 eB6VdBiB4W,ӄByeBȂP !dP !dP !dP !dP !dP !dP !dP !dP !dP !dP !dP !dP Y}yCDS܎у2MLNi4!:;fFcP i=ʴ,iB:3#K(ӄlʴD eZb4!k3#K(ӄleJ򽿡`x+ozܬ("/?L!S{uůy]`Ay 32^뭇?WceX(ӄle:hU* 2YEWxYiBn.Щ?ZE"+(̝GZVp/[t;"A;;4!:^D`<I2#q:^=)iS*Y2MȆXUk6yLO}Y9 y,H&沞Lz IelM(yXCt:1;V|iBn.Щ?Xu_Hs JiXZ+Nj9t!]c) A&dC@~M y9^ȴz, OTKzhP=4-<4!bm2MȆLAP fLЩ1322MȆNi%iB6eZ21 e5NΎi%iB6eZ21 e5N|A@v,iB4iB4iB4iB4iB4iB4iB4iB4iB4iB4iB4G4ʣbI LsppplzP98886=(iM4Ǧ4F[)~a{IENDB`GeographicLib-1.52/doc/NETGeographicLib2.png0000644000771000077100000003533314064202371020427 0ustar ckarneyckarneyPNG  IHDR1YsRGBgAMA a pHYsod:pIDATx^ UyO{4ֶ>Mi>y*@hL4hbl$1Q bPTQT6"" "" _0k9g>awl@  #F D5Ǜ睗VEG#@ ˕֪(h"aZ@ *0Nְv kUp4`7kX\YaF qDXLyLVEG#JR;B>nGXEkpƥ3C.'p/?bĬK8^!c)Z ($-FTnȻ\YhH5K]* 8Qp$K1vˋ9Z^B[ D@TA8wvDMa"GwS ݏ|yxp}<4{F Q!ezTtщk 4 re!-v֪(b} ?6c_5S^7<{~vqL[;/õ=G:QE7@ѫh՛8^Fюv]a^X7n8.sjCל_-d*7_&Òo2 QaZE)^P{W_3wP\0nw_vK7 j#/<_P8s)F1gVhqG|߇Pmb! ,WvVXHh""J߄p<u8^YjQB[:MRfnWE$2˕֪(hn݀"G#DvF @  8@ p4@d7hn;zʀH9,S:s)G@v ]h.p4d8  G@v :I0ahPm(WX@)yPem=6a&©G73bX$ 7:Nǂ:$Y8u(=r@zCkc4~Ȣ4X6iȯ"Y[۝׌T&^5~|NPRhUq8i(=)uc<8A Z0a{ }MISo߂3vhZZІ$PIܺmtCmw©bv1l|-`NZR9zW(w2",ZLzyyC# O)}yS]-/x=gTc1 wZW_JQP-m4*IOl`c9vS^5󦇡oߩ΀6; ϓ3uZR9zg(N4l3YKTA{gS SJA⸸GDTSw\N.m 8#mƨ1NuhqŘƵ 2!\3Ĭ;u0'*l8#g*9"(=hg( xGY۠xՄ;D6=xW˖76޻=k>u7ptˎ\ @ v֭[g=?1 Ntߎy'Nzf{d __Wfl*,ZW%=]M8C}x[붻u莖voۃ;vd- VjJ@ɿ֭G?µ;nohiϸnWNO}7?>oOqeњE,xayr]N8iSnՄ;D{p(6Mo]Z|CNh;yʪ߸$}=.jqԸmN~wܱvw슯8tB VP C7Sp[>7!Gp/[>:yWwd|~+’ohI\;`خxWi}2o wc.sm>^Z||~Wn3~}xDLw;V^cݭL3޷ۑa?mYp4 C5;=GܕMU)_L x-j(]QbݡF?] gڎl_/ߞSiٵd=nZ7|kvm:|j4y9nQV[)@5}2ᑋ t=jGS>72 W~4_|ȧ{}Ps)|`J7ڄIL!'~s>6):1e;Vv{nWȟagC9zǫv,ffDhcRwp 9]17niz%VCO\Fv_U/ut 䶖U j1VyYI:z9+մ=z;ֺ/Ux/9ӯjFם۶ō O8GOȝk߾{(zKd\MҶbzq?H>?cO'\~!ڷSsh~ڦu3/h>Qe9ZTg%kX#EtOIAOǽ9˞ #K/ W2uޣluz7F59叔2a~%.}r=n7߽ggλ|Bà' OGM~|}[} pћ_ލm|~?ؖ qFsĭ*^B|f,E[^ag$hh)h腟|]&CUa-rD߬}/t_HvlyO59zBb,*ۺ/Č߿I2r * g]kݫ쑉_ɚ^yCnY_?:ܩn!^Wm^[Ʀۺ}߽o՟si84ɖٌukܶ.sPw> 9 }Nsf^w˨oܥ TFt+AoY}s%y_n\t9z}Zǐ)mH7;%o I"8`=M:z]?pwߝpɃ_qWn~Ǧn?aԯʈ'^tߍ۶s ֝+쏾q~ֿݻ֍7s?#&Y}o~׸:=Z]ٴ䜍sH,GI˷g}T8H˱Y=i٣9X p땠7|oL=瑝?ylhAo^pKw%k2W^$@%(h"IJ>B䒇gk'{{}_x/XgL}oqCy?Ϸ,Ub=/|7 A޳2F7Ox7WO9nZ>jD3fͦض?O!xsgfSL] G9 tUް3Nc,,̧pE\K6wމ o#ՓNzn /i:᙭'[1_߂ G/o|"ns#'F&ZB]کjjW^֑>kvd/4 }>˖K'o$ џR zы&@w~IspM-s4A~y_x\9R6m;[ڜ承?eт&HMk_WҰB KP$y㎀̛<ܠ Gw@G7k>k\f~5_t Iл6LRhɎ_Nw=I~ҼnRֽAÂ$Մ;D6Yl[x%7`6@u4(j"t"pt@Wp4 pt@Wp4 pt@W0  AAG@v ]h.6@2;#PJqYg Aqſ pt:Aw`IN8ڀ?" =}oom{jza1gA6~;j⹛[^g-[mi}6N8ڀ?" 8:hryK@c? w8ϋK6hlw"LғQtSx/uqtuKw ;;Z=IԞ#BLj|^,豳vNE]-CGW0ԎCwSGG4ೠ oH#Cg ͉[;*U/rD"Gk6ow>=SZ>v$6NV&oI&ZYg (G .цX=wvkʈB ʈv>S!ѼRt4 $k$m x-gT)03hΥ; #͈%z(+6j]6!x)bS|zY*|;UbAc& D==S 6!x)ѼdY*BNFI9ҋ4/ -v֞J>,aυU^>\ȪJk`%C$iSBg%m\-g(ݿhm@h jd碠gJ;s_C$iS,h@E Gpt:ve%b!yԈ>Xg Xthyf%b6N8ڀ?" 8:h:Q:K@9ZHu]y; i`,O?+M{X?qYg ѕVA:n;zcmǏM|9s漿u^@Tp; ю:Kߣ?ѣGXx̙ޖ& Ȁ 8@Hѯ#5=wܗh pt:G=z޼yG"M]7/g:$5ݸu릍MGtMv7y  5Jk-A]7M|ySiDj g/ʴΉ`wUޢ%MG}.>v[t@~^Ě?{d+Y׌4݋dh*cގr4}خoߣɿ7h2v||gs+MG8z$:PٻfXyqa-((":'ݡ{pJSvkmoФh<$pʨU>łŹ#-φyND@_|LϹv>XUVwTqOqi.})$nѴ& *}e&y%dQ~Q".qc (pk$"7&$CxoW5}E/P;>q\YHt={-xh5W׏ǜEź@ ӝ[ILwТwtڽd'lIyE7 k(vw{w]hKV_$t4? ~A]hHR'űxNjO;䠯[E5kց48oh&56I㶶Th׉- f^XҺ"!JcZ$`{I<"Y>-"JwRힱ !gڍQdӯE3^UQJ/FEie JSA^3V^kc/ʠMQTޮ*,˧Dy}.⸬*=linV>xz>zh-u.#d&yһ^X_/ X43t[Jf6QRc5*-ƛ-|j(q~kwU`)t'47#ơ#" EZ ۚEy?x[MuxgĉG}tsVi}WFk)wik/*ō"i/{Qoz[IƽQ]Q g@YĽ߱I găox.2&9֦ oW=IOj ,nOgg9o⸬{t}}}7s5_j<| ij <+vo!*;bޣ9foγ*so?Wn 4X] k;H΀ d=$zKgU K4Hpt:G|OO'#b/~g;3,$v4@]@+cG"rG<@p4 pls nr6-~HѠ6-~HW0hP G?=pرG>|---3jN6p_X_ߣ5@r]BezDD3N馌[MDFa yH "t ,T\QgyϹF9r z?={xR7_/s wΦ…u IXx.p i[2hu+#Wa*(C;+Dʻ45ZQr9-CC+w]GzmOC:K5T3?? ?zo߾SoljjMEBgՕ#GZR evj|P5mFm΋Ze六ܛdb(Cg`HPw-uHkMG.QhlBiChu0~to^f'<juvOC<3D=½{wi:ځ!*%q/tN +g'#U>D˄v%ˠl i1Nz @.{@}t13v*OV5x.E^sn͇@ h|єMtɬ?+\e]g8:E;#ȹ> =cfj}i٘5Xha,d)eѠT>GGuj(GǏW_C:߿CޱcǶmŴ4$W!=w@肂$a6i_o gE:xѠB(ѠB6-Xthyf%h*8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d 8:hN8@b6-Xt d /Pq9 @(7h~@GP 8PnTk\x[oR~@*tT(h>!goR~@Z:Jp4s7)U ? EXLt;AY*.hM9{4RT>!oR~@Z:&hBM:#|PReaA&p4U? ܀ a @U(7P]h.p4d8  G@v ]1mlQO{AO@EG7p4 ]T6蕣Ny:j%'yTT6Uh]rdtdG; S0Li&!2?u490-ui=r=ؔ["oPېoe }6YiQKm];({lf#_)N;EȌqv֠ њXEJnv67V?yeOտGOnFӻXWX2E؎Q_l-ѝY?yYG.V&|wxZ>WF ~G{QF[ev8UbZվ>.NCo/dCw{{$#Ѡ #R6wоŪwXBYZ#dڢh]e+eu!VbmŌy 5o?|;К ]r@y LXcMԋ.wLr-OL)H:ZHKUB-DңAT5^x] VFyvIX.uGW.!v-:^^jB3o|h }&(Owd0G;fTXy ѲIm˸#OrV+^ծr.1R-@(h.o횋GZ&Pcf; u[՜j.(cw0ڵb{oAWLG.o GgmQG7qZG8{4x  @eG7p4 ]C 'G@v ]h.p4d8  tZ ? 3GAPv .oh*8ӲPTW:_Nt&OJGMz\oJz}sȱQhSkjNU;| x1Cwt:R$O>ΟOY;&E'ВbSٟ>':F%msHMM \L8mHLM+JѥʨW&6ݣ5kBӲ˅e5)a ]Մbի5x˔"ՑsixXi >y]b$0 g]bÕ+\JY #H^d$0p7R3K5LItJӚer:Ʈ}5hԮŝGftL3!*}Vo,@еr$3ʨ< >vʀ\Sp4T™aM+SpiÛpZI:dMe×$L>6Yc BR)1jx3 +iT9q}J.nbFUX}IC_ ȣ¨eB5-~}N$m+_ydR4ؼ8&]0?rQ-Ƙ(F^FͰ9ƶG&6/^WVN}ȵ nw"'gOĄsіoLBUj2;ٖ{JhI ]d;\JGo+ Ku:l oO@ݡvEQdt\{zG7tZbżQ^Lu"A5P]W.oh@&:-[ ]T6ptyCPӞ8  G@v ]h.p4d8  G@v ]h.p40h.h4(8  G@v ]h.p4d8  G@v(9LWy0*OD$p4%'LRUByTd*&\Qd8O '"8CSD8+8G0DDGPrHRGsEUGv~9n#WpRd֊r~SFIhH'dTSjLK~\n,MmzTp4WYs}mPPGRt)Kb|%'Gh*ԮtX昊7$6b Ō?VD8+:Ngc3=SHN8;wp4Y$3uZ7$LRK8U"'[ǗygA H%sU/H8m +{9sQIa}';hπ; GPhl4&i/MBmGPv>\F׺K?n6"EA|VӇgCn1/c&: @V ImOIV>8d_mh[%\Q,O禺U`>il"eGvtHe @VD|""(9$mUL* $*&\Qd8O '"8CZD8+8G0DDGPrHRU|"LHRUHh.p4d8  G@v ]h.p4d8KaF Da"B݀"G#DvF @  h@d1HBIENDB`GeographicLib-1.52/doc/NETGeographicLib3.png0000644000771000077100000007540714064202371020436 0ustar ckarneyckarneyPNG  IHDRS]XsRGBgAMA a pHYsodzIDATx^߫muLbb籥FݯzC)DQ7A"y##h.c+519se8F %Ӗk0D@ߪFլV\ZtQ?f9kz~_}  gFAA,?Gլ\`~AA Ge` ̏  b lTTrAA,jV.0?  2QQGA'jFe` ̏  bWӨ lTTrAA k{#*3QGAk z|DTrĿߏ>_?]_o F٩_?\|7C^_\`Ts-̙ 6Ŷw{E꠨f#rrb~ZW~s؏bƏpyz1g~E1­<|@#o *ߌӵE5+A\O >܂I,o~rX:$4gp_`*9}BUuPTrx[_/oqm~n)|0_D~ŕ!()qdUiroc0s v؉)V._nگHW`?Dzݳ4_+r~$>_7%D5#+f/#0ȟ(yL;CD#*;(QGj~=[Dm~qԠ `84oGHѓTd2)YkܩN*RkB31% ¯30?(]Q1~y4GO#G+ ,^3Gvgh~a&8ݜ7㻾yqfozLTr~LdP]e~FҡvXF)3LGBu,A'i:E)7|"F־IU)?a+6 ֶ:1ѝtαt 4<C7 iCAp_A*9jV.0?Z+4)T5K"N̛x8&TB]&gFqFӸi8F0BM2{⣼ƃ\a𼈿 R$vjBKADe` ̏ 'D~sڼ1?NQ+"}p] gIn>Kw#7?{ϧ{m~;> OD\T6*YzB< XQO|<2?%oIS  &z?3-˪Bwq1LOf$r㹨IQݴ T 3´>~̜cōf"|DjsA42QQGsF/Oۻl|K?R0a2< xɧ̘_R&i~z-QG_` rč [Bǜyj3s61td}jަ,qt;IDOT6*YzBzXu+?zq==i;a|ՅhꐥXu<,fѳ_ڰyzZ'oGlw)2TYvpekUoC|^3w~f` |չ'FIJ®X)K_ɜ3َ/<5Ԏ~#qao~O"W )\FQbA6}9$Wzp,!$m]I&'͚Wjg(h2硟R>`˶pJ[&m9wv3Lo"c_ 5 5HW[K w8]`RhV.K T m(HvT~i7/1(hO24ƋrK ).}sKh_Qi|!e({u+ޛI)?]f5 pftvT~iR9M;m FhrT*#esK῍^H2߬y~&;]rS|5P؄*#WW+^63َ/e&X}IdV)"_?鞊6}羹%Lwlz>:Z5 {y+ýT=h$ KRH)ޣǭ.I:xR[v^ջLW&qHA2z<GK3e`slG}_,J2*-7=ĤZ=neZ-QE䧧nؘ\'<&ia=}ysND HW\{ˡB.3葀LYJ{*9'kǢ/ɀ;<}ey|ɗC]*,fѳVh݁Oĺ>B 6~ڨ2U1?%!\hnVnVnVnVn7<$Ega`~0 `~0/?Wƒ?׺f19llvҚ~żu=q:פ8vEJ?W>Iw`G}7>1-+PC8 (qǝlOՔ}uwiW`b~=nbqǝlOd5Dss|}:3Y>\k~=|I}s/=|O“;\nĉ,b~Xїo/{^x w2BQh}C8usb^b.'Xu3}%RW(FٿOޖ shU]|v~{TbfH\$Z\{Ga*_TV|dRR _`x> o]mi1e}%b P_[Td}63ϓ5 2PkI;vR xgJf4.6ih6eF84H0\ywX![U0)VKTHؠ~%]_e )kݑ"ɹ<jؘ a_8':h-U~ڬ̸#e:l|ۢ$'7DkPv5\!"0OK_L!~@!nD.Dc`~؇M݉|Y!Ke_s#1Muvi1sҺK}0M?Ӡ~%%Qvjdl9N?2w嗿+!A5l)c,U~dӕrym ٿXy|q™9LdJp2sKlxGl0˹? SLT+'W[QLѴjvRq)&cL))qb1']\FXґJ6Ky'ᨻLj$]!g"w+|uO!ư9e+kR](\oU~dRrnK\ǧR3 =A{9rB'+YOkLt#[aI1cҷ4m*OLz;,`~ߑ/#oi='A{:[=>ckS/x+ʚTW7]UeL46'}͑z0 lqiژɴ9@/iߧ>]WySbN5608LrEZmVӓ'/Xk"8ebYMq&ڷXџYMfI] Gե9flL*8Fm/sLd,ps ~ps/9KZ1wHҙ\yoG3z^㸃FꢍyMߨqd~P!̯83j0?300?300?3m1l0?3yM cp83=>\Ǿ}M_ nz Nj:Zqp r83Wf~{3_xs]u=>`~gcMG纔߁Ǚ®+ _xz uϼC.wG^[_vՒ()Gs6͍fq+BH4YjKgcƬ&&I#/ڜw9Up\eaLGFBI1H^%5s:'5ϑJCK3!w̳IŁE'Hb(L֤Z͹v¤K))o~EbGs北AUzq2[R)߸pPZ"R"w ,ė >m:R<02I%/^Pu/rUan7Ivz͘_Wdcly4W>rWJ6_5#M'B)miǐI=.1?%I6=,N\6wڙ~޹4vjyVr Ej"78wwʥJj;vU=>?'L`Kw+ljvJMU5y; %;GmԮkU$cp@S` d~Z@7?(ٶ   1?׆ ]g{ [X7k~=|I~niG?8ip +VSw,L"n_k1`}wO>L.T _D8+R^~_%ұLW GpG\ٟ.m淑 /Gq}%ݏhWo?9v_,P-|?(^hZR棨ӚTvSnw".-24?fLZiCf o}j`W]\0]o}<њ'A'ۗt?f~39P*Ob d&ISV斘f&آlZFOO>\f;Vg~"|s|#׮D: ̏ V/~T/kioo|p~bCg5ť8sIFƀ|{*\斘fU昱E3TL._f?~KU~[KqIy}Wiih}I#>AK.zDTelۑ'ߑۗt?-IF5_}3?G㿋;20?pG`~%N3?i0? /ܾCKv~0?Gq}%u>d`~A\_}Iٸda`~p4i~a]ÍEPC6.`  Aٸda`~p4\,Xu>d`~pi`Kv~0?F.@n.:]q8{X(~־.Kv~0?y̯:b?1@l+k=kZcXGJT ^oy:և URO6$t}%;X? ~|rWY9W(MonqOA?h"W:]qX~;+˿.->7g?I3Ɵ~)aVu#CRκ֮:VWnJ.+DךÖIO=+L,p1 &t}%;X? cs'[xO~?{;B)X-U1Ե[6 |ol^>IOE\Ʒ֗v_0]4?yJ(mr!``~0EsgS~߽>هG= o8ϡ@zxo~{-([D FY(M{8{]<|zɗ!紃r!``~0Ϲݯ?ʿkjk#槢>kg L&bLer?O kr=pPq`V\EC8m(t}%;X? 8sJ_?g3[}M/i_2? S}{:T7''dA\F+hV)-Eoh8⚩Ӿ6\4n3NgqPKv~0?q/?9sV'{>sᚹ?Sي)?[ڏi$j#0qd=duL>;i @QC6.`Ǚ_ wNA~;A`~U4+[ǙuI[6Y3L3Ӹ8K2?<,Xu>dx>.>QۣɫuU`u4b)Y}WՑqr*θ``Kv~0?R;g~>7d`-S3L&U:Nͅd>SCUǕԥ4n3Ngq#8%ܾNׇl\0c~.,qfj\,Xu>dq+>["bݎ8BnN EPC6.`1Jfno3?4Xt}%;X? 8;?#.$Na"!``~0S??Y6%mZk(S"iX ;LZԴ'i^BhrMFٸdaX{.0M_9P~qֳs=T;mvL^|d\n}Znu>dXV6?+Ps0kݍRYɟZ|d\nAٸda`~0uo*%DԤ1#g%|#C&{#q*hquooLu"7XJqȢAz\JmMBI.@ٸda`~0ͯyy|m9rFoKӡ<˔܅ҴYgGrsԴ,=M6߭4δ)@6RQN ) #ϡ<\7t}%;X? 󃱬n~7vw/p&)-ZT4m)2dDWhRBcUv:Bof8e<թ{k5IJk/( \7t}%;X? c)]=z?{N[y?eϺVݪ Ir W3Hu>Lz]a2AkvG1U䖾9·f2WR;3U;rH5Tcγ :]qXI?>'?я~<|bڸW[xeey9Yd ԗ Wnpk_%R.5<ў^vGAULjmɗ$c[VM|[;iVfR.tCq.UMұHt}%;X? c{}wgswLCɔr+dxJ֑[ab,Ԧ LIcN ;*u7t #]HͲ/L|Q]]K/a|MlGju>dq9{wy9|כvYq3P|R{bvcig+S'tT-ns_/n9_"/T`N[:]q8ҽ}}-ϡnQFbuL](LU̽kET*5Gzbj;WI[jxf8m(t}%;X? 8pzw?=z$hX\P>Wp&JC/aI}2$EPC6.`xmxhc^Tͼ.X\%t`AXt}%;X? c)ëb>thJr$ >c o GqJ}Iٸda8M3MEPC6.`/~[nNׇl\0|i0?X,:]qj~, Aٸda`~0O@HIOaݿ0f/ c 2#Nׇl\00?jWݙ)$BuhJ^39ߡK>}c׫`ǸKv~0?c9D=|O4/ڽ>f^!:q*/jݝ˅VÇ:14apukoL{ 3yIJqȢAi%9=ʀKI Tψ퓆bבL=Y#'R%5zf,Mn u>dX7Hk܅ɴkMU;v´5T.ցƀ3Pl`7o3T'4{ds[!,6\MNׇl\00?_qSj32 .)<ͤ(ۤ?籵r≙9%\j:jԃ\<S ɂPC6.`Kx믿~ݝMBȻwb;d~FUKZ~Iʟ㽯|žHfq{"f },uFlg~)R0iVe"vk;s&l䓘~號/]Ӥ8v9mƴs۽d™ 䩇Se墴[Dٸda,b~=r6l~ns=ةӢ:hRg.h~.GvP4;*+J97t &2)BQأՃTQ딢Iݥ4g59^G2YzA:/5vPC6.`Ǚsw}wޑ_}Ma~ac/WWyGig+S'tT?q7=O3<+[Kt7Nׇl\03?to?{8is}wKsżgXyq26S~rJ.-Czq"ARh&a0 _;PC6.`Ǚ;Yy>s皹AxT2ʥ͕*ƊFLٲ.'}nhK󃍡Nׇl\03 wN?~ѣGA3"NjjkRPfu4S-,  EPC6.`xmx(O^ԤSM*VsU 娐)gdZ6jaa0?X,:]qXʥ&7$5s4˶G4MZXi `n_Ru`K8JxAg/!``~0p:]qj~Tp:]qj~An_RC6.`e]/Q>_T W]:p|rgߪvS])uKb  /!``~0 rk &+ߨ4]&b'vŗ_9֝bp:]q`,Ǚ>T%aEʫ|V͋}۠1 #xRC8k}Iٸda`~0#7~_|p?CL> L'^*~V( ɘ_OaEi6=as}E̹=~ 2v^yu5Yy+)qS%u>dX5?ѾO~_ЩٛKea;JUbj[֟͟:pj#Wl̹= =Q6u{n;OO p:]q`,_ҾO}S7,l#II+0Bi~o}JgT4צfITsn,p)+㨞An_RC6.`Kx믿~ݝMBȿD#@yp,glהb3hZa]ؑmɷȉƥvdv':M󛝧\$An_RC6.`s>)?|G?~矏(|}+]귘{ou/9KzՠbM%QJJcQ7 ]kةZ06aAzNl#JT_c3s(ju&'皜ݏ@[M N /!``~0EѣGϦ=~Zνe:wL xuhBvIj3d1̷a`AXt}%;X? cna"!``~0`Kv~0?cY=C{_2Cu"nJ(9Zu1 ϣfؼ`c!``~0 rnÎUٕQ_L / FNׇl\00? 淓rdo1kzr& cPC6.`2P}C=.ڡ\NHEL/dm. TF73%ZsiV_unbo̹>^SwOLcl3sp;!``~0 2S7DM %E5'Uux2SR{!M܅PsZҵNJyOI'#tZ+3t 5av!kns Dٸda`~0旪KPD0ݑ2{(&`"wRG,uRv'G|,83_HT7:]q`,g~_CyM2|iEP4L氧Y,'6ξsU^ͦ& @O.L'W5Dٸda`~03?_v7T VcڧM]b36gek)0mfo&dG|IbزJʟdi2A\6N?\gpѨ!``~0 ƲezU*޳g f|*wG= >)ڧ!=csfqS }Sg=FdtBA:zӴMkKv~0?cY6lȪ:]q`,ӿyPC6.`ͯ`~ .DKv~0?cy%a"!``~0 Ƃ`Kv~0?cY N /!``~0 Ʋp`Kv~0?c`AXt}%;X? `~ ,Xu>dX0?X,:]q`,+߳'<}_{xmyi9k$Q-1gyf$Wd=lz:„I7'O]l.`6~ 52FgUpwt}%;X? 󃱬o~wۢS\rjs/Boz˹`f/7{Ō{N[Lǝ$1JW0O韛!/k`cps3О`fV-lġNׇl\00?̯/CsXk\ŕP.)8+,DߜPLͤr_}5Qʓ\pMmIp d4\N13Dl2Kj07 K\ҥyKv~0?ca~p?/ % L\^(6ZF˛Kጮ>U#˔r25`ƛ\&w?;ּ9*&ϏPkʾ=khOK5Wr㧡S8sdb.'Kv~0?c9]2"2/ 6Q찾٤ifv(lAPo]"8"N<m1;B('C=⹎dX7Dz?Ց_, H que-G03rwrπ7Y'C*V=JazL |v:R49dt\{ zOK" ;}z wOZ  *a2Uu9u>dX7GL|U+ 5HSfffbTN)@-n{Ӹk魳ԫ{jҩFŎ!h]-\~qr2a&`fVM&NƥKv~0?cl~_ڲoTfNҒ9;$Jl6!nB|'{oi?:u&cEly͌0Xȓ9yt[\G0'%k Nc1R(J+z(q_SUEٸda`~0'!%M\'VI|\dX0?X,:]q`,+ߓ^zL{tyK9bNșQ޵8wO.(nc{ Y0l u>dXg~#FĎ3ֲ$] d­ݣ t}%;X? `~-ʑkzpc~%Kv~0?cd~^UI"2 '16ɻ;EGM/dm. TFyf=L[块cl8ݟ?X=K\II5~1 t}%;X? 󃱌1?_ ٓ-_HWN-!'Uu8SR{!y<+j&ź$砾d(Ds&9r#EPNJ wy:VKv~0?cc~t)OٜCYǔyf~cgٜק$.-Pи?R/͹F<_BtBGFjb<^`C1 \?t}%;X? 󃱬o~)Y62QC6.`߉;K2#/Cٸda`~0[5?Vs!w`~pq!``~0 rEPC6.`a"!``~0 25?-Kt}.l 25?AęKt}%;X? `~A\T}Iٸda`~0̏ /!``~0 ƂqQ%u>dXV6o|6gߪv{/&UgBr; _a'k/!``~0 r{r;/^ {omp"c̏p:]q`,Ǚ>T%[Q^dX5?ѾO~򓇘b> yw\~j>8lQas}S(bˉBU>z/_OO b%u>dX2}ԧ1#+Gʟڈ$k04E'aҔ,.99EZ}rUۗKv~0?c7?}_4ð5vҖmD-S bed\3a5Ix}Iٸda`~0~{KRo^5h1?/Hļ!~lSRM57*i$/\d\S5p{IKt}%;X? Qa/Z]B}m&h44S鉚I"i20W]3*|:(M/!``~0 Ʋ^Xc#p:]q`,i%u>dX0#Kt}%;X? `~A\T}Iٸda`~0̏ /!``~0 ƂqQ%u>dX7?n,:]q`,, Aٸda`~0Nׇl\00?  EPC6.`<zi&+ʹ6 ckY1ƙPC6.`޲l{Ӿ̓xOJzvϰem u>dX`~^/jjythN {+Y6΄:]q`,_TB i"YL8dѠHz4QؤsѕvMq)7E_0K9c䃧OCޥ}x{Yc.t}%;X? 󃱬n~\][}(L|ib(KO4㛢4 [w(yٝUw)i2t9Z,1Iv3>f.t}%;X? 󃱬m~e^|3KzO;e<6s+tVeFIrcERҵ.np#QTzӀuQC6.`eesoʊH2nm&S׷3ӎ1ƭrr "]*3?Hw]sr`̽RS{TmqS7hOEٸda`~0uͯ~Q֯⭚]kjM|b;uLI)Ͳ+ R-p;q|FOKa7vMb%gcNNׇl\00?˪g_TPE|Ύ,BGQPq{DVFx\w%ݯ]ʙ*~#6h? ~b8t}%;X? 󃱬j~{}ߞwg}6:]q`,b~NPYiݺ?S1!``~0 r' JPC6.` Aٸda`~0Nׇl\00?GqJ}Iٸda`~0ODžNׇl\00?  EPC6.`a"!``~0 Ƃ`Kv~0?c9m׿?ƶyfa!``~0 ƲOPXNׇl\00?罯`a~gAٸda`~0uoVU-㇉ݒ P/PC6.`euKV0sea )kdXV7?󳅹I|7z:]q`,߬f-\& Kv~0?cY5~oP=-, Gٸda`~0a![[rsZ)ƷǎCi/QC6.`7 Aٸda`~0Nׇl\00?  EPC6.`a"!``~0 Ƃ`Kv~0?cY N /!``~0 Ʋp`Kv~0?c`AXt}%;X? `~ ,Xu>dX0?X,:]q`,+_k N[L1!``~0 Ʋ% x߫[V_8#p t}%;X? 󃱜378u>dXj~V|QD}<]aC6 )nfytPT{`3YǠNׇl\00? 3gQebEba/[1kh& Kv~0?c9C^g\!P\BVr]-& Kv~0?c9%j'_8RVr@m '0YǠNׇl\00?ϕ|rӳ%S+4-͌n}OK88u>dX7DU^"Nr(uii~#5hOlz3Nǩp$p t}%;X? 󃱬l~k]g_p!``~0 Ƃ}uNׇl\00?  r׉:]q`,7?,Xt}%;X? `~ ,Xu>dX7? SKt}%;X? ,n~:.$,Xu>dX0?X,:]q`,, Aٸda`~0Nׇl\00?^g>d8+{L GS]ԓxv߭5KrbѾg(y`-{LR֙=<u>dX6d~;GlR.m\}Q}8?l=}?އr-w\6f{x”}>~tTЦWM)2d|edz1}bӧkɳ>Bu;ԩVUB4jZ먙V挛L4 k) RC6.`e}˄׀yTQHU펮!X`EPh|VI0?<"2%S#ӳLsV s2vN}qLQL]rHJjگn'\H4͸y4K:CU8:]q`,_W$&ʰ:^`Ie tFEM\TֺiFqqzM\j`,+G.j4xzfhh|Kv~0?c`A,%7^:]q`,,Y~2mI'H˨!``~0 Ƃ`Kv~0?c`AXt}%;X? ,n~AۗKv~0?cYt\IXt}%;X? `~ ,Xu>dX0?X,:]q`,, Aٸda`~0Y+ .jԮXh;8rE\O=3Φ#Lt3}t<& Ͼo㇨[-sykdA{V ?ywNׇl\00?̯A `\@0>ԗbw=w-ΌPϘp+pJҐfµ4:ܜFxL'-h5tx 3q!``~0 Ƃ ~ ?''k3=*ٹ \/'c9ے0g;@i E7bgǯڍMfI fոa]K4:]q`,3?RBICv|{G(H5eӎt5Qҥ+J)Aqz t9j2x1st}%;X? 󃱜\t7{~(Mzf\ՆEP,>󋗿=Lo3q]mECbvQN*{s=xj7ibbO->Ȏ8$sJݠ{#j=IyCJdB{7{SyoROdܔ =Xp#9zLƯXݷ R3؁<O}s_bL>S*џܝ4⮇5UYKv~0?c9+1򺰻.kײIXQ =#qO<mG(3#TS|<ґG\pA_zVi#0wMN)ɘ5e|>}5#^VLUC6.`ee;~?)T<PC6.`J$D=9:]q`,7?6wXp!``~0 Ʋ} Nׇl\00?  EPC6.`eq#8%ܾNׇl\00?MEPC6.`a"!``~0 Ƃ`Kv~0?c`AXt}%;X? 󃱬l~=š7= !6d.Z9~VĞEx&Kv~0?c`AP ֳ!c"<t}%;X? `~ w t}%;X? 󃱜\JQ)ms]BiKw `fL|i|~߻oշ擺)iLEٸda`~0_$UB|!WlJƎCiPp) =IJ;>h]d螓s" kXc2d͐i!``~0 2‹8ƹ;oTk(0(-(Ec#QTzӀuQC6.`_j(@N@2c^=c8Nׇl\00?˹/%WJ.װI*t7@^`vR']SqZ]ry?d.t}%;X? 󃱬o~ oOpo> gߣGle%_pm<ط ؠs-.\%,8t}%;X? 󃱬l~p[㵭lu>dX0?XЭN7_G7ayKv~0?c`A]o u>dX0?X,:]q`,, Aٸda`~0͏ p:]q`, 7 Aٸda`~0Nׇl\00?  EPC6.`a"!``~0 Ʋ׮(U1O L!``~0 Ʋ=xP-ޝLJzv?Wb,XgBٸda`~03gO +\mwe0Q7l r{߾0sѕP41 6& `McΘ>1Ӹl"wij*\3jߪjLEn0?<*$lU|3b(}v_@0ŇIn3MS3M9;'ҀV8XnLEn0?\Yfɘf9x3j pA ?/cҵ.@^va#QTzӀuc9;vMV۸Uє >Ds,3?HBsr`̽RS{TmqS7hOEn0?'oLI)Ͳ+,\  dG`~%0?o-5k,m+^g9A!& t?-XF|XW)xSP(ZhGLyN,fyF& t?-Xf~ދhժT()榶Fh4vK.al,.?6'`BG6c\7p u`,_"\IZOjkՄ6SidMsg tql,cca~I]t:i,uΩ`ۄFru-bƭ:qs `DLIsioˮr[H#p̝it?*>[󃱬k~Op4˷Z#%mS DU2J$33-YK9P?]Ww;~ [󃱬l~+) νJcٴω`(g^p~ [l.r׏G`~%0?.,G`~%0?6na`~0 ҳ X0?A0?c`ZWf6na`~0 25?-lc``~%0? [-X0?:l Ƃ`K`~0Y^xZ -R^pɗI%v y`K`~0naǙ7byZm`,_Ca~c [f~VΌtJNjrYK]L! m/kK͖'kHal3F_{bpA`~%0?K%ge)YUhYӤʗVHH2Ch4\\  [tulJEɲr2U3^LU%'(LJWG5A(0?@˖97KLS&ۧ7gO`Sq}Һ][h~FL:H Ũ\BSd3֤q}:jsޑoU `K`~0nD9RWrBtHF{`ei Ame9;=-\ l a~56m0?`,lc٪D0?`,lc``~%0? [-X0?:l Ƃ`K`~0[`~u0?`,lc``~%0? [-X0?:l Ƃ`K`~0[`~u0?`,lc``~%0? [-X0?:l Ƃ`K`~0[`~u0?`,lc``~%0? [-X0?:l Ƃ`K`~0[`~u0?`,lc``~%0? [-X0?:l Ƃ`K`~0[bup(-Qw`m0?pf0?pf0?pf0?F ECDp.,7?-ٙ|9n`~0~0i00 0g0i00 0o`M:XaOy3=7U~Adc4;! O94Ov}Vg` w^G?ν|Z5MG?jٱg}cW݅p܁3g`~0ϋkߑ?5U`i2d޴4;cijoenY`~8 ͷ};Wq[{}5:fR oo'v O&fʡ\剤g>rU/%0m7MDn=wsTWH$ >{=3qףC|6>C8>h/~#_vYo}͗\$L&\mj6WE_r :B=}5Hcd(iךT6^\l'L;Fnazž;`QŹ\3~eLRfIj']Y`~8,>C8olzj|61EWI=`˴ZCRC8[}Z_Oͥ5[ķ df\S7(fd}׻V .sec(sSjSyڬ0u8t\ʁs396`~ {W7o{~\BJ5rvZzOH?A9`*OR+e?IBi.Dՙlw.N#'f-WNrϳsn{93PFf4?`qj~u}BAA67׉ l}lp@1D4 B;B`~`)0?X}l@!`~Be~{*G ͇|_:7     yz~z+C4OKnpΐ-z]6?mt]`~  w5`~ 3]#O]_h] _h o槍 /qӕx3E>w4;}>,nF,Z{s 77>`)0?Xܜ9X*S-.eߏћo>:N0? `T|*7 =eEoX`~3^oG>ڷ]!kODwIk CڰNޗ/*_~G_|{v63_Gm=\|&B+A4.](WRw P2YYsK撡8̯VMAn6Y|5^\^],OW^Y:}.dLBnu$a8Co-'5xrkvr߲ɲ6?mtrڕ¥kwc<`4?k޲%!ܓ*y4a8Cz #X~#)8O|U~Õج&2q+u99#tY8F8FɶT}bsxc#G$e*+zCh>UܜCYjFkُw$ Up+P2 ff:,p-?@!5uɧwS4?f pΐ5uww2a`~W pΐm~@j@gHz!]+z!]+z%    AAݨŬAAWAAĭGAq+AAJ`~AAAAĭAAq?d(c_M:IENDB`GeographicLib-1.52/doc/doxyfile-c.in0000644000771000077100000022343214064202371017163 0ustar ckarneyckarney# Doxyfile 1.8.2 # 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 sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "C library for Geodesics" # 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 = @PROJECT_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # 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, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. 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. Note that you specify absolute paths here, but also # relative paths, which will be relative from the directory where doxygen is # started. STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/legacy/C/ # 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@/legacy/C/ # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # 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 regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_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 = YES # 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 # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, # and language is one of the parsers supported by doxygen: IDL, Java, # Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, # C++. For instance to make doxygen treat .inc files as Fortran files (default # is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note # that for custom extensions you also need to set FILE_PATTERNS otherwise the # files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented classes, # or namespaces to their corresponding documentation. Such a link can be # prevented in individual cases by by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. AUTOLINK_SUPPORT = YES # 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 makes 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 # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter and setter methods for a property. Setting this option to YES (the default) will make doxygen replace the get and set methods by a property in the documentation. This will only work if the methods are indeed getting or setting a simple type. If this is not the case, or you want to show the methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # 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 # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # 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_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = 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 this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = 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 FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # 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_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = 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 # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = 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 macro 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 macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 0 # 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 # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = 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 = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # 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 # The WARN_NO_PARAMDOC option can be enabled 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@/legacy/C \ @PROJECT_SOURCE_DIR@/doc/geodesic-c.dox # 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++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.c \ *.h # 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 be # 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. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system 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@/legacy/C # 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 or if # non of the patterns match the file name, INPUT_FILTER is applied. 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 # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # 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, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES # 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 # 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 documentation. 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/C # 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. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! 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 left blank doxygen will # generate a default style sheet. Note that it is recommended to use # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this # tag will in the future become obsolete. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional # user-defined cascading style sheet that is included after the standard # style sheets created by doxygen. Using this option one can overrule # certain style aspects. This is preferred over using HTML_STYLESHEET # since it does not replace the standard style sheet and is therefor more # robust against future updates. Doxygen will copy the style sheet file to # the output directory. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely # identify the documentation publisher. This should be a reverse domain-name # style string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # 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 compiled 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 CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # 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 # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value 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 (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # 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 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = https://geographiclib.sourceforge.io/MathJax-2.7.2 # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # 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. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. 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, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # 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 = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # 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 # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # 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 style sheet 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 # 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 # pointed to by INCLUDE_PATH will be searched when 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 that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these 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. For each # tag file the location of the external documentation should be added. 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. 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 = html/GeographicLib.tag=.. # 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/C/GeographicLib-C.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 #--------------------------------------------------------------------------- # 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 also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # 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 # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # 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 # 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 the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # 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 options 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 generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH 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 svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # 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 MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The 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 if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. 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 GeographicLib-1.52/doc/doxyfile-for.in0000644000771000077100000022356514064202371017536 0ustar ckarneyckarney# Doxyfile 1.8.2 # 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 sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "Fortran library for Geodesics" # 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 = @PROJECT_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # 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, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. 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. Note that you specify absolute paths here, but also # relative paths, which will be relative from the directory where doxygen is # started. STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/legacy/Fortran/ # 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@/legacy/Fortran/ # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # 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 regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_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 # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = YES # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, # and language is one of the parsers supported by doxygen: IDL, Java, # Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, # C++. For instance to make doxygen treat .inc files as Fortran files (default # is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note # that for custom extensions you also need to set FILE_PATTERNS otherwise the # files are not read by doxygen. EXTENSION_MAPPING = inc=Fortran # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented classes, # or namespaces to their corresponding documentation. Such a link can be # prevented in individual cases by by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. AUTOLINK_SUPPORT = YES # 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 makes 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 # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter and setter methods for a property. Setting this option to YES (the default) will make doxygen replace the get and set methods by a property in the documentation. This will only work if the methods are indeed getting or setting a simple type. If this is not the case, or you want to show the methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # 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 # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # 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_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = 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 this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = 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 FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # 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_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = 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 # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = 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 macro 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 macros 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 # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = 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 = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # 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 # The WARN_NO_PARAMDOC option can be enabled 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@/legacy/Fortran \ @PROJECT_SOURCE_DIR@/doc/geodesic-for.dox # 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++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = geod*.for planimeter.for geodesic.inc # 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 be # 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. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system 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@/legacy/Fortran # 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 = "sed -e /@cond/,/@endcond/g" # 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 or if # non of the patterns match the file name, INPUT_FILTER is applied. 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 # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # 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, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES # 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 # 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 documentation. 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/Fortran # 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. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! 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 left blank doxygen will # generate a default style sheet. Note that it is recommended to use # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this # tag will in the future become obsolete. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional # user-defined cascading style sheet that is included after the standard # style sheets created by doxygen. Using this option one can overrule # certain style aspects. This is preferred over using HTML_STYLESHEET # since it does not replace the standard style sheet and is therefor more # robust against future updates. Doxygen will copy the style sheet file to # the output directory. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely # identify the documentation publisher. This should be a reverse domain-name # style string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # 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 compiled 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 CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # 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 # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value 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 (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # 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 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = https://geographiclib.sourceforge.io/MathJax-2.7.2 # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # 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. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. 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, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # 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 = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # 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 # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # 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 style sheet 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 # 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 # pointed to by INCLUDE_PATH will be searched when 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 that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these 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. For each # tag file the location of the external documentation should be added. 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. 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 = html/GeographicLib.tag=.. # 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/Fortran/GeographicLib-for.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 #--------------------------------------------------------------------------- # 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 also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # 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 # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # 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 # 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 the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # 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 options 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 generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH 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 svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # 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 MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The 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 if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. 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 GeographicLib-1.52/doc/doxyfile-net.in0000644000771000077100000022370314064202371017530 0ustar ckarneyckarney# Doxyfile 1.8.2 # 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 sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = NETGeographicLib # 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 = @PROJECT_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # 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, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. 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. Note that you specify absolute paths here, but also # relative paths, which will be relative from the directory where doxygen is # started. STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@/dotnet/ # 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@/dotnet/ # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # 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 regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_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 = 4 # 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 # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, # and language is one of the parsers supported by doxygen: IDL, Java, # Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, # C++. For instance to make doxygen treat .inc files as Fortran files (default # is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note # that for custom extensions you also need to set FILE_PATTERNS otherwise the # files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented classes, # or namespaces to their corresponding documentation. Such a link can be # prevented in individual cases by by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. AUTOLINK_SUPPORT = YES # 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 makes 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 = YES # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter and setter methods for a property. Setting this option to YES (the default) will make doxygen replace the get and set methods by a property in the documentation. This will only work if the methods are indeed getting or setting a simple type. If this is not the case, or you want to show the methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # 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 # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # 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_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = 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 this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = 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 FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # 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_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = 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 # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = 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 macro 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 macros 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 # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = 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 = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # 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 # The WARN_NO_PARAMDOC option can be enabled 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@/dotnet/NETGeographicLib \ @PROJECT_SOURCE_DIR@/doc/NETGeographicLib.dox # 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++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = [A-Za-z]*.h # 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 be # 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. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system 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@/dotnet/examples/CS \ @PROJECT_SOURCE_DIR@/dotnet/examples/ManagedCPP \ @PROJECT_SOURCE_DIR@/dotnet/examples/VB # 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 = @PROJECT_SOURCE_DIR@/doc # 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 or if # non of the patterns match the file name, INPUT_FILTER is applied. 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 # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # 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, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES # 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 # 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 documentation. 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/NET # 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. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! 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 left blank doxygen will # generate a default style sheet. Note that it is recommended to use # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this # tag will in the future become obsolete. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional # user-defined cascading style sheet that is included after the standard # style sheets created by doxygen. Using this option one can overrule # certain style aspects. This is preferred over using HTML_STYLESHEET # since it does not replace the standard style sheet and is therefor more # robust against future updates. Doxygen will copy the style sheet file to # the output directory. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely # identify the documentation publisher. This should be a reverse domain-name # style string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # 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 compiled 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 CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # 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 # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value 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 (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # 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 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = YES # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = https://geographiclib.sourceforge.io/MathJax-2.7.2 # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # 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. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. 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, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # 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 = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # 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 # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # 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 style sheet 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 # 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 # pointed to by INCLUDE_PATH will be searched when 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 that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these 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. For each # tag file the location of the external documentation should be added. 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. 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 = html/GeographicLib.tag=.. # 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/NET/NETGeographicLib.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 #--------------------------------------------------------------------------- # 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 also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # 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 # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # 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 # 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 the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # 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 options 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 generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH 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 svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # 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 MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The 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 if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. 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 GeographicLib-1.52/doc/doxyfile.in0000644000771000077100000022402314064202371016740 0ustar ckarneyckarney# Doxyfile 1.8.2 # 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 sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. 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 = @PROJECT_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # 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, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. 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. Note that you specify absolute paths here, but also # relative paths, which will be relative from the directory where doxygen is # started. 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/ \ @PROJECT_SOURCE_DIR@/examples/ # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # 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 regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_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 # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, # and language is one of the parsers supported by doxygen: IDL, Java, # Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, # C++. For instance to make doxygen treat .inc files as Fortran files (default # is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note # that for custom extensions you also need to set FILE_PATTERNS otherwise the # files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented classes, # or namespaces to their corresponding documentation. Such a link can be # prevented in individual cases by by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. AUTOLINK_SUPPORT = YES # 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 makes 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 # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter and setter methods for a property. Setting this option to YES (the default) will make doxygen replace the get and set methods by a property in the documentation. This will only work if the methods are indeed getting or setting a simple type. If this is not the case, or you want to show the methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # 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 # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # 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_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = 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 = NO # 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 this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = 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 FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # 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_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = 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 # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = 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 macro 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 macros 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 # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = 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 = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # 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 # The WARN_NO_PARAMDOC option can be enabled 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_BINARY_DIR@/doc/GeographicLib.dox \ @PROJECT_SOURCE_DIR@/examples/JacobiConformal.hpp # 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++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = [A-Za-z]*.cpp \ [A-Za-z]*.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 be # 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. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system 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 = @PROJECT_SOURCE_DIR@/doc # 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 or if # non of the patterns match the file name, INPUT_FILTER is applied. 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 # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # 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, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES # 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 # 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 documentation. 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. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! 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 left blank doxygen will # generate a default style sheet. Note that it is recommended to use # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this # tag will in the future become obsolete. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional # user-defined cascading style sheet that is included after the standard # style sheets created by doxygen. Using this option one can overrule # certain style aspects. This is preferred over using HTML_STYLESHEET # since it does not replace the standard style sheet and is therefor more # robust against future updates. Doxygen will copy the style sheet file to # the output directory. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely # identify the documentation publisher. This should be a reverse domain-name # style string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # 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 compiled 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 CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # 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 # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value 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 (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # 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 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = YES # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = https://geographiclib.sourceforge.io/MathJax-2.7.2 # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # 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. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. 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, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # 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 = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # 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 # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # 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 style sheet 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 # 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 # pointed to by INCLUDE_PATH will be searched when 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 that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these 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. For each # tag file the location of the external documentation should be added. 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. 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/GeographicLib.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 #--------------------------------------------------------------------------- # 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 also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # 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 # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # 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 # 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 the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # 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 options 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 generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH 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 svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # 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 MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The 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 if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. 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 GeographicLib-1.52/doc/gauss-krueger-convergence-scale.png0000644000771000077100000007607214064202371023451 0ustar ckarneyckarneyPNG  IHDRCJPLTEnОXXlleYYjjllmdd``__zzOKKff?A󅷷b[RR}}}YYEETQQ``LLggSSSSSIIInn@@EEEZZuu555TFFaaPvMMhhbbd^^`TToo}9[[vvbb}}NNruUU&#\\wwzzzHHcc~~k7[JJXؕOOjjffffVVqq\\\::]]II>>>;KI:PPkku((***noWWrrxx"""^^yyv͖eeQQll΃| IDATxy\TI/J{0St 8djDZ-(@疬rA|u"Fg(q j̽ 2~M3vi)%.UM'(L¥]j_'"N%3%3O{N`,˯ua`Kύ07 >k:Vm-[eY@:G?R#Pn}8-JCsI9Kkq0([Sa߃j55Q})W$pk*@,|ox 0׺ % AA{."Z hX;<<?={ߒ.AXKAJ[˜!^AV\þ'@' o"@$TVWhupB2KAReg7]2mMdR~Vعԟ٠{i:=d?Y|Gk̓_-h;m-g^?~bn:BRjZߡȼ##Zu"?p#k,`Q¾{u*Ly8շXYS2sڵ o=6tUL9&~/a*'Z5@ ?A5Sz@0 -VoVVd9Ȋ {3V\ӧm0!fe4oTqrN9ўZSu۱N˕m`4j= 3BGKGim'>TQk%y5ۺT"#زDx'vV[/ŲXhb2$Kin{^z_c荩b\cuKlqڵJqr+j2% p%i5*eY?>rPnMe.=BXMuS2P3JwKb\dpFy+hٸa%"PC#Nxw 0t鯙7~/6(JoS3D>Z6BiUo@~R&C:GAu ;p2I v#UpQ'윫ɒo:l")85A/RO/ $QVR_ދDŤOnò+~w͐|Ngc OB`V_U$*[yT8LF|m- k,@)f{}b2G2ݡ0SuL_X*H'lbo* Q^RSqȧ&Mf^nl`_.Q3{xR)dzp-uøӲ2FltH{s>僺Wyt=4ĦtnPn~ɊϏzH#9]˖Z{3yYMm1iKl[=XAH gW鱗U9p G2gyfk QQ@a$kAF?o$kmb-7T ͷFniaskr ʪs_Nz)FWljxK|b9V):ww`KM_ojh?*s̰᪻Y(cƹl鑭)H|.|}SKJ-4՝u}H:O)r7{0lT)Ȩ,lN^2/ -n}0H5b.i*JfOX׋wΨ[I&.GR8N:,^BKJ5XΖ™t搤,TL䢄Lv^ӯ"Yʘ5-I^nǦV[_LRN[hK=d lm m;Pa 2 EFpubcPPJZDX3s/!wT1)wcƱy ozqnezyp4 6Zbzъ%cc1 2Vi%nX5Zn݆β%vuieEZV:FoF0-.[janjڣwys8K;~#y%37 7 /h-Pn͆P&#ۚ Ȑ DžwIg͵QA H{:P dQ|u o~տ(9 w0kiMQ5Ƕ@%*h>#6[ R<<ԹY&8y#╌崓 g}ڟ#A 񑅎9_H6=1EC QL0}\3(bzǷ·$k6&x=q2O:O'[^&xEgA<=4Qf9LV- +s}hCaD {˘i,딙1[|c1A3;Q dd$$K[&2]=_+54"o,9MlN|C9tKC2 --͘x VO[4%y"?־"`ǖf'6⿗vSuU;τz/4~%mz48 {rsѱĆr`|bàQ [$b E;r|~4p5N4zSR<T͌N=q xzM?a:b D$^G2%\lp$a}X=jM S1lC)kKBB,j:U>%% )q ]3]pa󛲁ӻ'^/$Urɨv|ώr=_t]5R^K>[ZR#W[3LKQ$Ml0 u+d=KvҊ*A%nK :Nw6o;AW[$r5 " LE䣽DV'CECvϟQ %iݢ=2|S&  >SvީyrO*A*񺼬k7BCYDvYAH74KW~E>a(:ċ8k;pCa6>̓\n]P$ЁL7nfXH+rlÚ@CggLs0<`ґWDH\' tk'9a,WA+PPX4}%͠?$M>QqP \k}V##qE[DK7^4פc~FBq#|ngg\>FTDd"m‚diYPr%7B{$!F^r~zoHC&.H7vqfm>MҍqzJC~[W"(owJkD }tO~&ƸϑHHy_uiqrٌr^@7l(ljKh(/_)'W "$\u%XhNNG2>,/Y(C^G':O~Dz1PXKd7A ;/31SC7$Vih$H4By` 1jhݦ*M,%1O.$￴v l0,iqn5-ZC}yD1lYBL%Ϳ9HcugS0d< 47t#:(hШ3eslnE E;keɄ<2,߱hfx(yRz;Y.h4b,H``$lV%#7pkfV+et[RnXbJob\c;+~[z} z le"cRA=cPLBpb14 cp|툺2Rg?Z>?>{~ɾ~0IUrp, 2X2}g_?5O/`pZG+-C$ e""9t 39[J>tCEnIVx\\vr\&.¹#jNGY Ghf_5TCVYFt d5 Sj2Mn~R..eswֶ;%+r>%|9n8Ym5M!-J{D&D2vq3D]N} +f?f%&75 zvU-\Q )}4|N?qF9!MV?5ME塢3l*CKsȅ!fYJm[5f*nCzh'l"&YT> sπNXN&؁θI̤FUrEkE??2=>FrSx\i-Pw|? Ϯ3vWZVZ[n'bvkΊuzn>I?%\A<4t5 @+q0iqQXli8/*W1D骶2bCVb2I_߂GPQw;D1)ѳkZOcBsͥ,軬,=167$;K}Pqi@c! ϐZOKĚaSJmT@VaQhM6dَ(~㍿q@?^Xw/7M2y՗'hZ`6Pn=av1*jm#vd.G0GY+ Nd; T+oKDIn;6VVȌ>#&C|wEy;d Et"~^!sg9Ю'KF0\]S>OVL5U{o n?Q1D-U'L 7?W) !R(s$/ 1_ϙQ`l^ M6" fX:>uN#CPD5s>5\m>N;pd0%r ՙÂ?i= Q(~/xDIiD.Fm|]{]+u]8&Dq.ĭ%< = {e5f\ QTmC'R> E3Esc"hFZNv_Rfg9|oAfd#ubmCf!q/o \FDU$Di~Z!ʘs 7|[VN V?8x8JNʮ6QjB30/wf`7xȔQۯ 2`dY`XņN6õEc ?plF_^Ѭ, Ĥ~FIGS:UG9ҳr;C*[SjrV*2T,g;mT a"_ۇhWq|Npߛ uDݠ {oV TNB;(9!"Z6Q3~7l_kf>Sc%!?/ & !I.a JnD|o;nDH--NcMK1.2T%^bc7G)˩ od׆UGt lѱ0F8GD 皔vJBE웤12T?!/Z3nO:=uM~"8ˋXCz5%.a"aŊ$Ο>qw(%B]|LKմ Q|92 )I%Fl JA^םຐ(<.xo IDATzKhR?b* l?lYJ >̲ۈ(J#L3959IbK- cnw:1UҰڤڶQIGۍJ2#KTv/ۀdtMoPa [AAoG3"f5vV/-&2UTBl[(>ΦӔ/\&=ԭ`<.Mq9VG'*^E#zKt˄Diq9ID|K2|mW:m9_nY~ANy*)K0MDmYPy" .%suD+dB,&ۿ͌&"c.;DH9KSU#f*{Sݸl"3oHFbܪL:ZyYKϜZbC#sVz]$ ZW7]YOwW*x+lyPiyl)R!tuUQ3QD#:28『q@tr@_\/ 1NM =y5RpO']u{̵Q-GV0urgytv4؍:SXuiVuEfz ٺg60 .z8[oxt3{O&DI/Xn5%ՁM}_t3ffuYEѴZ[\Z\RsjS3XK{cV4.o[;h#N 3vu͝27(@?C>FY@cgyƙuL֖I;%vnLP M꟏PV0\2rl)h^ Qd[bdv̢Фͥ= f`#h T)ޠ(bWڰc$l5OQ\/F(6e›r,u~~>U*hW|fK}QgQvCP@?H| Ӿ#Do*+繐};#~VSL[NQ7j=qG?!23?Y)^_vƬ~[=Hr q&E/ito!"{ rSrW j@mJK1ˊ1t0t)~n-t˺hvܺ 8EYO @)@.\G~0[zdFƾ"r@ Ѝch35M u)I=*]M[P; }ɱ PHTЙa|g`Ο,Sn9Mrp.WPo*^p;qSː[@'Ћҹ-v|Lf9͝=tO]He Mƿ9ɿ<=sPn TB8AXJWЎBf eSOբE/^'= [hl+y1/Op蹙\upCޤ$0kߋaL_) TMeePN֋C!N*{,]a .XP[XmE<O/KgbӤvüwaO@{T򌂨U Эk3[gG8l?ZV\%vds̮%;„*78Ptj0R"@|s,a6BQCq&oIPmpSJmr&@5(3'ʴ.L#cŎ.;h=4s2)S;gLq?j$G )/aJ–n =MXWT&bL"y̒! mPO /cs9!3IɆURF%~EfXx`%嫓q0iQw/˵v!J—*/,'}9I{LU9; (݊\I\OXT(VүƯ\o7qk8[ cr.sŁ7-h]m5i‡8?MDߜ Y@CAӊ#  '@ ?FɁjW֮U:*49JJ/_@/XLyB1-?PЯ!@Y#¼š5,\ EW⹃ aq_کWl /m52>c!Pb6}359|i"=Ls[ߡ*]ʁ*rF{j(!ApZVYnqU8 Cv &VBCjJQxrqkcA"ͥ"'>Ze4%3^k]~o{@õ'ge~s ,'-Ċ-nb蘦HD<DŽ,l3Hah {.*:dM I9qX$mB%vj?[-iʪ)[.CfS%R Sj9pк M]܁\xg(!h 3INV\eo,~َ1{sSxhS ' / V2Se+G}庼Zwxˉ$"4ȠzCaOMfbJX]ء.*mU{)$ew~~ÓIP'b"(T2EEwXlb!kI߂mb U];hVi]0AIz PM)*?o6 ZRt;j]t((>3$1!,¨?.?=%@(9? t)h,&G~K6k0b"p@ l/bKCvo~MЪOX{6@MWw"~6xY;HmW#F@yEX]V3e4Wg@ȵAL<M||qa?:5Y#+0z-M2 yIL"$3R&UB~)^ _'٭P ŠMB ~DWB %wܞh[-$& S+b&J!'ǜ )E9 Gyf̀Nx 0NrB_P>*z] /ߑk$@E+}kوgzi5Hw9R_+x0| (uR@̑p{E%/@ϰ+!)+ͅ:Q@9 f!^aR<CYq[;;S[LJ""f Ll İ5%!:ih,\-#C!^eck PLp;#^纪!Ȭl=u~hԿD i2fdFЀDH!^ EmxY+*?W#4S[b^W{ƇC*'@5˧"^3dGFXr7RPF{@=.AxWDs@+݌b̿Sޒ~  8{7с:1wAѺk7:"BK> 7/FE9D@5;a E{ډ]N:'(J?oD @zʝ 48*$3J %Q,AU!|G2_Nc谏=&V6&)Lo?;Cu*RhXS +YCА T"йߪ'2 J+;t(g܆d U{=$EF,hӾ'|ϟ7d2On?7] ddų!,BmNw`o˲KPJawyf~=': a>m?W:~2PS) ni" !@: f,&{}d-fGjPAW[4idnݫp!eAr:_ `+QO7gݷ Ppx;PT,| 23J7 Gsǩz^8< k@2a"i/l`C C[L5 A%4߳Cbَbğw@0:ȏy@SLζL;k162` H- >,+@@CC <5tUa݁u3Tx6 $4.j2FfD׋@=պ|h褳g< tq́!a?DiǘgO49}ٸ=X 7"Br)H(h9Vz(,"'P(`LoMk&犞<Ej^ѥP C5tJ9YrRcbǛ@Qo&,ެsfՠxR4/Bp05.r5es(e5#JŰ[#N)xЎPR!tp H_/4&i2nHg"g0sFVI Oۏ$_Mc4( g9wgBŧK>&f>B!>Ue"0./P~=AZmDo39 #1P΂%gwȮ'?"[@^\e{C&$ ͥ/[-9qLR(2?}fwy6v?| ̏R֪A*o  ZE.^fA79ޝ"kS28xzR-+0ɋ дg U x &~w=&Sl7t;astI&V+ )b>{cK'u}{R)ʥ5 ܥf'~By!7PfQt עqM Qb t)TE< IDAT-  d@>.O EelK鞴`ɇu:Ɣ\ʛ(4Ehm] _ᘷP|~]~,_9^溽H(Q~3uDU^Be`~%H2+/!(oU=g[$Y=_>s<)0(yd(ˑTJ/F @%.smjgio(SHogIfdɀFB4 1~;&‚q$Gvpr?ʏ qIr-bشeDoR9nͰ-z1vD-員(Do+dotP1<2㗓bvՄv=vT8fj]"Nk@%V2RLf8nQ `A䕮%묷% kS@2ܓiC(o G׭ 38\B(i2!R h]]{l{!;ƿuDe׽sʄC(ZIH,s X [Lo gݗqo"䬼R Ōc& ݫ\>ˁFl!qRq۶˗- f4q0N[tmVqw pwѺ$5ƸuxVPSqq1Y<|fFA{ђe5.]2]폱.}iFsLC|5s nIho3)s7Z;uwGǶefFo.[*N\ڶqI;%r֥7ԭ.1uV~pWPk\\VdZ{wnkiڽ☇\3 f>`G}V{Z]>kݴIlZRkLiԹu)9hαM.1c?(Z}2=FۡnnmXtoOuvqf 0з,ٔ9Rݙ=2^t:ӳxye(k2ec 50pO_` {{qo~0/?Ixz'3'⡶ 9 v&:(-dad4'dn{,wtr{&/}mo7C3"6h } 2ܲ\oigc e7CkOg(]ˎ κr9p&et Ɔ1Qz! Dw^P&:0t}*uZHzyK%3* WP'Wj(3T_Jw>_8Dй00|Q.mK-h$%Tp#w{(C=cДzR3ѵW! $w#Q CoU1D:-L ha.%;;61^j}`j6GG50%j3f-Fe MbёV׀)}%'+_El}Z41$CC;>[޿zCe7|`;/gzgrՉ 5^MGa.n l`̲bί| 33c]>vЂ?ݖ,C:SGgٽUCB&Qe247JS=n؁l|l1P%YxNOw#a5 t%4(l*1?pCqkL۷} *AAAG#ª2tuE}JHx8Dh1t?\#9U| j&}p%zߍ2C2-[t0:)=2&yU@g[nϚT]'I;JYI1&O^[PҡN~,u5T@6YĊO/ {/~X츪*&6>#=_b^:g3 ɻTOR{J8%M2.KI <) k?} g15H~eˑ=m}^wkxh14BظaGl:g2T8QxՔЉ2f7 ^aW[NY{ |Ϝ3tW܆|axcc\biȭjKPuνTyZ~qabZdz }7M< ]dɔ)QG*K&Eu2hথs?Y-䕀 WiCY1jL ^]~uճ, TCJ( K *mu<Z2fÏ`iLkYΕ;s>=yI1FʾG i浰A%321nC㲿{7m*AƕGQ6&gEnb@?_2F!Z:G(ݜ'=GvлkWgr %G_oMC( k)Sx_M h`F֕8TI }.,4So8N,E(y kO5$Ӂ(Bw* gЎgOkrfv nIF2YCY'_ ur|k % a;ֺ“kRC' e].&>eJNB`lO d=n}2_ج6Xl_ yGk}Cwke(Q^6x|_[TC^^G8VxޭoȒoo{TV%nK::XrH٩CyNɇnF@Y/4 au@68p"AڽY(U̥҅2SUriDcI!s9c nYjzܼ%G09W.@(.}}@:QǍHʻJbm^4"nQtd4v_6Ƒ$/vua!ر?#\/zZlCØ1ԟ_`0{r!.ɺ0qU l;BʅB˻SOw"⚪^5P,ԁh=`gЍ.DYj :syf$*V] s;5q^NEڬkZu|Fɉ' |f~Jbɭ7|qG ę(7)8Ts.4assA[j`1]y+QC =+tezXC)h` Cy~6g]υ0&#Lg%fIZ[#uQ64ʖ jBa',Uj4T+t<> oK(']>9(q,P mV`$i>!Sx|jgQ6rZ&s6}NS1+M-FSr*s" :%趩ZEd!68X7|. odK֜]t{%,PqmO cOQj#( R-:mQ:tsk oǖ:HPNUt$kyԺ_ytZE2,=Ua] [|˴$JussY38,MTIgEqᓃHF$R@Po^"EGNm A]+8=`Igγ]q!DwOEWl`jGFTwL{*U َN\!|R)v)ݻӍ3 SȈBe6_L9t_X#q*d&N}PVV\>+2xBǰE.XvTL!0kl2CoP 5 k3=wo/b#zy~tx< kS>E#% Ar_Qg:n>';'4#ciWaO=XhZG`6dc36FPEy6jX2+3Щ# P^ [q uR9TU1C@hq X ȿ9 5#skx N^!>j Kw\fYzǼ$Cj eX{ n8_3%P\o#wUNȺ'I rTDZ&lBCUFҹ{'Z$4<9IDAT\tϕG+Фѐ {}TUy? a- e>v⋄I/6tҹ=8;B߄DX8ejd p'#t^ÃJni_Ql Ќ Q kJuZJ+ (2Ti"q&d)Ð'=}MWqׄΎHy+PÍD93)뿆_CJeP?HG3̘.a(l ]|#PUmm?&S?ooܳKꀣmAzǟ93p0=JC3FPu63~jdd35W^&5lQu oG1&#tv[!8)HȨ g$\ѡܵ .C'}A/TŦ$"ÜR|QYt 6˴۩hN** s{,eTIE%cD! q!h62<,sNA-iwtՎ^z$0߽4RG*П/+]I,Sdn;IЁ]ߩ-QFcl(qWG 4!|AQvGSA ɼ~ bGy E6 zg3Qށ{T'^ CQV9Ѱ6Pt.HM h>Sh֦fA6 JCÞ Z"],0֪lN|;doR{!+ %j лV)yy)LM xz78G~-J^ufp$:>>y]KCJ ,In8) Y zpmXB%ܐU h9oV%ApBϱq9N%[-!Ъ^(\8zΪUaEx# {]X( e2x]Mr-5ĵۧGhb螙$.25.>~ξ5,'_eeͯK z`Q]#أ.Y/ $LNΉA"f#mkmSez,fhPدV2xՕYzcr*~'ԁOt?ﷱʻ Yf"e쳄DTܦЊ? We7`KlB,T6A,OkԒ&5)b= Mu]&|XA(ᕐ#e을旜5JFb>e,HXOY7wNlҥóJb+q]QArg} 5C@k*_WƸ<:fyA;5r>cw 3Id èdSf8ESC'e}.9Ull\EPJ^X}oo~_꒡ƞbŽ{Դ&3ԇܡ6gUVCVWX7[8u?8d /ͷH^g+7\2 5lĆy"2WθWpҼ>^P$؍#[TDo/r/ѸĦ=;<@ w`ђp|@^Ɠ5Eq@'_w煲} 7G[5Kۭ̍>WD`@;d& Ц۠| 7"?hec-tvJ]J<ߐd˼wii-\eYvb=..jii4GOfKnAA.MqQly 6ͻVvoa%@=# o4S\(-<4INޕ(zEaaaoہɲɲfsRQ7@ۚCPا%hR3!6tp<8xVNwG+RQȿ?A}:(JC{-,FkCCOE_vM6z_٬wx_ͧ=MEנy"Cy\M<.ըsÚU.r[6J$;JiBҥ?}Nlۣ_R4'6_Z?v>1{E-N9ݟFzqVZ1N-waVřuq**(7P*" NI[/$6>{,!R'Yll_va#>ӝ tw>Crd ].T*ZI QN;*+5x P.'9v.#/ܭ;fp-$^+9\jsZvs뭯yAh j$?$N pBf2=;Kb Ɛ0,>c,|9gd,lE? M<`Id}n芹jcn('4$ Ym=_,z;V;mwfX\OP iS ]$3IYVM_hf (wBe@!!T:}t >sa]誺(n.8n6#]1wg`*.FRZhn'aO\3Ab!RtKvSP΄+J[nڈYWvI]&_AyeY-%VF>#Vi g OC62zpJ*&ʙP_޿qQ6va(rZGC{FF;u86_?0^SnR.zy'z6=x}YH( BryktV8_QxpW;eS,!5M0H']7wn8V! {sH(+PKw9VW5 r6  3?ݑۉ$Lc=YJl(!gg"@(R7; 5pIdy$nUm#sV T~~7Y9)zZ$4pVyt<[,o_knzAT_uZ*GAx]"A!+]aZ+rzuSho'syKtXRGT[=舠I,DBDhŢ:Nj_M%Tsuv<#T86gNo? LuKLN.e ABJEB;~~w=JsyOb2c@H &uUfT;E7ʫ?3>sj l[5Ŧc "!i(x&'0hS*y$ 0ɬsh92I+ius}H"[&{7s"9FAkVQWӹ_Zg\J8eWyp}zhz}1]}&nCSeZH菌Ђ{OI"/Hf*(WG~ŷz'T}ZR%ffPs8eXM1c҇|5@9Y.-J k!OΦQz9n"oн#i}v{ -5F%L~)|WNƵ½H_WyMe05L?oglK3>c0 d(PDDl#U3?Ĩ=lt6jt*kcb˅ 0q-lol j5JϭE$S52Hdu 5q>I3x'9NZۻ[Z$>:DK%/r| F Nd kǻ=N| J2RQ?ƍBgN>OޓEB3#2M3;6V۵ Onw˚.WgRjBRxt}o@|4ЍH9| Y;k\}}On^jm; V9"21r;KoՄO 82~! F _(5Tzz=Fm*4()w !Rjuyf+f^H5](nL^CV7X=-@!tqu#B5!@deE r^ ء (Xu@:|)[,b&C;dCج"D(qGm&F9{h"zģ.vw$*BA$ËtЀ!tlLضtP W*}[޽b~ ),4#"@脾cXx4yrX6jLccLt_|v@(nhOm.=APy+/ʬʬ̬ʂB3ڦr9y*qΉ' J}2 Bhj | }i'݃5?ו=?WEd*EŬ%=U`fz{ 70_R !R_.]#CzP;.EVEc!@E]z[naȷ{4D.`>H?:[= ґ.0t;MsS~J ^ʻ> QNJUIu W*u,(*fyr煒 i<ˍzJ)&J_qǵȇs!e R.|%K)~d0LdoIː}2E;F#oCR% Ts9H%_Ԟz2[H+m" 7fd2R%cI~=mH AEE*@l*mk]m;UNF:HK^i.R%SrS(Y(vv dw# Zc0ѵDM]=YWsgoUq{+qn,g Sd:/5Zh"Ӗ392[T䲧R&Uz(*J=njG-u!ƒ7Wz\iE=PҸW+94ׄJIuBاC'v7Zr saO_t< ,F.ކh`%W~Vi x3`SFK; )޶[|Ԥ??qushoϿુJwsJ5PAFr瑖JMUIn ZfV~1^[0wt fKT,~FGuPhyƘ)"yV:oV)xN_1N[cW醎b١ 4%Pȕ ^&R~H\{I+=$P6U3^yjeՙ#|zaZb-ޥ"iQSFULlJg-$3M]8iQb({)I:\ۿTQ٪|r YόJcԄdD5 JN˙z 0Ev6o SÉRwƟH/(TOI*l$I0):9I"#sJ?֢rI4U  'I"92#{"PqKo7tvQr3p(P'2l؈S3l'ψ,rHv${(+sŦER(p¿tyBq%1lzbB8[&7|gSϱ\ c…uGfiIu,>B3;6R4psCāy:[W oP[3g%1|'td٢f~>f*5UhN*Œ2,T)VPP^i,;Di .K\pêYg7*S*T*=XVIg9`$z\w]mv@4>-?hA cc'PZTf4 := }\gh;_RYeEȨD웋 CPI/|/]hih2;spǧZvUI'e$wo FPS%ǘQ2#B} i )VȏHZ=%e*LT7:QzLp*PF3OU ;)iN D<=gJCNk,}n7F\ud-Qga4OSVF &R}ωȀCJ9Έ+wC:i\Z¥3K)]GzDhG0,y#pO=#8)Yld`#,KN7Ll $*FR?sXVOBhq ҷR3t01@t5$ z19^ O^'RFϡ,{X4%Зc&eHR9/̶ךW/"EF A@W @ kq@1!E `-alALTŮs ;}ቶ(0%^߆?{QfaxQ%ؼWʨ0 <e;g4 1zU2{V3Z(AC +Oj1鈦;꘶2{`26uG A7+3Q|8*-btܔxnuEJ.{*qй쁚Q,ݫ M\CW{ Wg[vcWM `% yMF)/˝ 4~rj:!P3];.Z8i`{0kDgVra>){(u%yYVa#B%a XT'gQ܅q(z4&@g5>%h]9lb9aMі)-G3"-ŋut/Vg.Z_G[A~@-t0C>nh1QX'|@_̛aHRsCn%d:4٧M55m`D-#FPM&*OrQsܿK J5ͪKCDCН4薱S3+i%,DW5.c8Ft')]f!3HrhlҲ@ڎ{Y# ˚k"nEWU¦%T`46*[E]@qK%Yw_2B% ~>a:+ -8څ:t!C wOb( ƜNdAʦ#WQ1:Z(juQ}\9M3M(!2~\y݂Q̞Ҽ ԏ_,/ X~M0VǷ|_٪3cR,ۖ%tu݅Tgan:$'&%PʎWl>awxmBWw`^l‰¤/r D.TC^ ^2pC?`·fv~ٮ窘V=1#,o4Bt) wALAsnRvw'Nϑ4uSz_ Kf߽$ݔI2ړ_XKխ$6^؆ʎ30?|MClI%}PЕ%K`1]٫7ڭĆoǐTBlg?&N q$q ђdixk ʣPHv1ޅ2p-Bh5,ͶpAǘ%?WŪ:/b,˔Ni xIbP KqÐdXa9KE#>1lōB KIv(]mVH-KV.eħ&3M/-#V5)aT/WB:lMms I iU$i`S K@HmehxI}!*k `cl6cή L?`j1lfR]WWCč.L̉xSFTVPχ%#S*0zzԹ :5a}OI.\>`ɨAӤIDofe75H#M* x}L&ғ mKF*"Yb "1R},SOWKpyGnef2_NŘRU0|Q(ww )l\TpNp詁FUt>O\|Na[5{0F^`Crdz҇V2*^"O271n[et`Hk4g1q0 )y ԃh ם ZBdT(- ZE#EFG6'OQ̧OQ/S({ODX!޼-3Jt'v:$>]p}*=1)4uG <$Ɍ{B-o1vNs'[S^~|ui=_ǎ ;TH1\߿#/qzR(Ӣ6A K Qd(h# h[a/'O4!]&^VSTݓdg)J  %-0+ WEHh=t.P ^B:zE ]Ƈ!éx8;T`5zK({ A&D0/)tXйs#8<;!'hPm#81>Q_B) T$Y@J90,}Zm*+PJW@]t!#.Um8?.IS}iЯFsYy@9}[|Ŀx@$so,fd$%]GP5d~0qT%2z'jAgy@ƣ; No8؝QɣCdn XiHǺ`Ф]N+@.7J(67uΝ?ѮsY98t $S7n'V)9uoldQ76O4UWz2U*Ci| `v Ig݀6X4#Wme\l_FZcEH',2+N MM \So5޿4K!liΒ҄*eny !_Sg{'0pIJopEMESQd\=@͗f ׸ߵ\7aѹqoeUhIPљ3q ZlvFyER.^ʢ- ؕDC)cXJq.BM8t]?go^'3B]nӱ=?M1궣FӧL_(l|~zyG,Z?[Z@1I_t+лM{4yTڠV~[ϱ2MNnBP׀ܸ.ک$407A0J::l* .MT%Y #PJ"0uFkTmWSvӉI_O:!A  6X`(l#v|0*?Bn$WSIÿ>/a_ 7{TF=KC%D5Ve-@_l{2:{ЖVtYrnr#Ԯ+xOJM5 hNڼQ4?瑩΋N\WL$_աz4z{Ú)Dzu7U^܊U ,cˋz_2"znccBL>Sܝ0u $؄|4tJRs_,oJ;Wcʸ5^B$w'þ jW6@Gż?- R6V^pJ @#CTw5k]x7$K- wwޟИNú0nHE4Sdb(Nǀ~V}W $TG 3Xp-@-Gi]ז0_PYrV|lc }3Ê7F>9 ;]TOxMMyS>3QIv44@5C _Jrsn_rņ]*U|,&%UndgUe72i(}5VOD'כ͜:l5R IDATNg>&ٞocdu y<-r>g-:Z1"\+jB=Y.EK#aӎr9#i)3P/f[d;jKjUL Bpӄٳ{B{R̥SQF+f);<"gyʚB׫ HN2R _n'K2WɁPChSJDGqHU|w/{A b|ԔSw)LdH}u %3MOԕşFo&{%O|ocX$EK@_0ٯP R3q7-Oas蜚\ =8r؇_LfLfa _+ {{61R-4+@W/S_'dXrh׏Jzq$y>R@CL9+9L_Ody%F;c$N|8e{\$2U%4ǧi;xCg_ akFJp&Bry֖Nkko`r%Nr^p!h4#@m!j6ݬ" ;9<7HI] ]$; n 7_nG\`$R*>/1+дlq=)ϤО87-5*lr!"Qt fd7d,?NhXoZҞe !ToO{84cާRg˻=qC+FM4իt^BSYwSylugEMg{=Wk JwM%E{%@uoLVoLnƣCAI.L46 ƒfTejH;гdMU4q].|._ .c)F3@SƔs*LCx:9pATPHZ%dҽFcN@OA#@G(-P{bYoT]*Ka`>z@|PP PKtl 8fL4))yquQ1 :W]J<=9C_=F'3 l,P禐%5nLQeqVs49t{w>7aenX"Sd*pR#JhY }Dݭz0+N=)tȑv cBY63"vb+\V~tv Y$51T|F/a*̢$ɣ>f63@3?A`u5#F՚[KEc ngk~&g02Ze" ХxNe^B,h *MLf4c8T4Ytlz~K2[[Kxe QfCRo*h-1?rZb.\k@I]ck>"sdMͪD htAL%T~ F_1,փ/gk"av0J7Xx 8bX5MqJ̀6}AG =:uXkA&wE`2wxR|G90ȯ'ݧOqџKrE-|aɴ~g~9bSy a:eq`MwG^.ehӌ0gW ;]-LgBCX@\SGS[~\~MWz0 A\MQT3'h2WN! 2S{DCZe尠VwA4KyuA/!\A@[)f]B&((((O<<<mmErb"c=v>>}yK-Y$;b/~z ӡh)ۀqaaY?"=*XBͰǪ ||`K|B3n'D Sp=Vq/,Xԣ?M^ Ő bs+ 1 а1o;wƇxhW_TCk7D A;! _A"SЊZn @lOA/`s>x!l;ha) z%i) COAA rE ˃]!L@[!\ 8i>)\JoE <(ʓ&=| ZmW ڟaˌ>4ҽ [M 'Ʌy@;L=.6ƈ̈́?Cr3K]@yع6q//\PxY{JI Nd9&-93$-_U#Zt=F~`Y/~PRꏴwP9d93Qz.fl~8yT~: F3T4s B֢ۭWڟ4eI8]r5F4Gۏ Cnx(cr)es c^Å <dZC^%=:f5ң'Fat$13MZrϡ[*<ף!{ahE hK|섵yF=mB >2geppL}J8<1`)LBBpT"3\V\Cgp:=xB( iRݡFSWo!ݸlD,=F؏N(QS\l?QGD2:#=uXgm)g5To[>wIU@DFcص н| tEGйE9JBiFkM;`/<)xKo7.Lz-b`Oo)#&#zzͿ:3)%o' Sَ4sPy04260<_gΛu'0SBwP'Kډ?P( 'hn/-)o0TŜSӘ*VXˏqdžGO sV:jlbe6@As3jŋ!2g}z` p|Z"J:b#^, X%9j<:h7êOXM8i9Zh5}4dY+wQhۣm9J+Ɩich@/X;cV!n| w OEYe@1T@[VB}HZ'͇0 mh۷{p> T;S秏\&#T\f(X6d*5b pGU@! ,P[-stueJ /d4U"'a:ZHgF+99)QFIQR@8V)Qa>r.b"R 7!+wwn\B}H/! tqAH*.*\ct÷/B%v ݆9bON ÄB'*/м[AWϡDD;Pc3rŀ^3S٘*Ck脷=UzPu4#lu`"0S_pd.*:J>Bo5n\"l " h'Z;$ቶݣѡZ޼)'PYNLEXnW]3nꁶz@GTQuo |wIvɎ"m།BnɾK/>:>ƙiYrNH^Q/>(KkN>WF; Tݶ&uI>̰KxtnAjޛIfCHuzyiD8EJhq ]YK 7%ٹ澡XANȒVnX*1J4Ud<!+b!=ښ$kJ:\:,ag}eNY^h5v=f;}EfSg^`4kui{?з4}I3@w.0QKC=58h&EdWɂ%*2}g {tD/PUަW{ϴ2IG,[@m"X?WzLyJmW5$7#Hmܩ(*rP͐n E-聚l jNax?WD 0[@`t=zjh4^~\cxE} `O>9 2Pq]Sv-yiu*;;kCp/ѫ-,$֞=G,E8'ўImPFb&7R@VS[(GVOR@-zV(li.bJ&Ց\";&@sttuGM eVЀ\8q43ݥ0^G&ǍZ="1ϓ ~g,'N lmx~A9 tNVk@~c\!Sϡ$Y*DS5m^ݖQܙ(wg4Bg"5 ܪ(HP()i?nm{[e}}I<]=FY5Ng5$gQ(0'pI苕BTc&&zL,(M̔stT;b@)$Útↄ14>ymWO hDE z$J!)& $rB'5g0L$0teMw瀾ܜ8pSqPYA7`XԄ4yfbtK`5έߋQ*}#gy6opEF0YVq\L-@MBg ±l 4 2%)W5qwF ԑ/50wKK@Gh?%hG\eg\[[n{i怿!9Z(%x iفUv?CD *c< GeDף|;G;@SVa_B]5md4Wf٪9)\\n%=Nݿ.` bt A۟&03cN`:2 QZf QΤC<|>g}3(T ~zB ~s߯SwZ@#DKgfWSbd,NH!@=Vf#LG,%7ߑPD{/;jw ic'8*uZ&jEWb5E׺K~j4r03K yC7c]x"H|šWBI ,mS>a;x>vr2i.K%tgpVFf~h [Rݹ0grPC~*GtЎNx߬&q*ic臭Twv+mƱi a=.Lf pkgR('tP:8oQegQLyT >ɬЇfT4#˳<}mb( c' /M*=IT%ɥג<3<[Ef~cTlٕd" O2ivf}z85^TǾU8vpQKSsNc7yeo'QП~f.J"p6 7#L7T( ǛIcEq跀wޔ4_՝=4><g@?U~` 2&xF~Ag$4ˡrt06rw2+=hm)oƫ1(ȪZ脥P?N0F~"~T<)H}8{3KRVѱtZ_&3əb_87Ϟ IXeYf15-TI5!z|_(Lfh۷U~ah@͌l& Pi?Ap1/*1x`cv`Od|Œ >GSŌ|uBd% [3]B(y! (Cb& _q hbhnJMT_ qh7+q۟ JIKY% ۷JfΒ=咺"hcaPr$-Vetf*|: 'Mlv*Ǜ'8OV",%~eGA SIj^'Œ2-v@[_?qI"8(E43 v Eqe: 7!y2EY}ER. ȂnF5u|퀆A2(rT} '2\- N215m2vx^àŮ0)t@\!_3O#h hKǦb@TkpA @ bW6`{pCM<(((((O<O (O<O_TvZoZlX4*}dfx:0XpZߖCMOZ!t9Ԛ=뛪}3,Z7ma[}neӶ8Sr ڢ>ق qAEeQO\N%&JU!֝Yi2>1> ĠhN3;Qoq/:`':O\8 i[{o[;=/6'zm{"5>qlNL (OE\lAP0/}+_oݰKY? (O}LSbd s5׭`{P 2/;-A`]vì'y婏uc]uXZm5O?߼.ъ1؁@~?Sԋ;\'ydw:w'O^ޡr ZHo>H't@ ]n8yxIJUTýYإa1ֵɓyIsyH xNI#N9q[;:*'PU[jB#Bq;~x~^?v:r\^@y#>wOB_2Ӈ&K~j,'xvWwr^;nvdn7 ?԰QE_][O#K&9+o$@9r!,5zX~'tyjw֛r$B?I':NFw$}X{o6ĘZ^Zk=w\P{$7_I3ʠv}BT'2qO]~]:vﻣh6U.$Gx~asyvB1YS/͵jvG9̛:^ gOr.Eau'> jZS ~ Rg?obJΛKqz=~ji[C`\Xryn2o3f%guYqг9̙fJ^UcDi՛I xF+h7Ԓ`}7 ڢ8_'$WD뤄f, a 'oYsB CS3q<zT> LQP+xţms/’}"Ƈ<{,1)wmcރ##V/|Q**Ѯ+)ǜ~Dm9k4b liy|9ܥJqHf`sEuYM0V= &}쁥{NTTL-_|Jcμ\ޝCSd;.}YBޫ@ 2c30M#@ԱBaP$\}k]ʝs&݋.W%o투LQB*v6ȺOc-;޴/0#vÆ}ǎ] Y)kB1}x#C,+]7V Z]V$3viWz֊/NA4>t0ްaCŋ:::υscZY 9sfOhHc׷\ݼλb隩@PF>,jޥdNJo,#2EGkމD:fg59;z~Zo#:kȌod'^<b3Iw?c gzGY5 ɞ߼qDōHպOnI:L#Bgݍ ;Ao K/Uj*{D+)#"{M*v5Q:AN˷FHӭ[q3xj!`n*ŝ3)G?z~tlnG:f59+ie*Ddp1~BT<H٨ϳprШak: }| vq^IU`؄## ~qZ䩔o1dj1 u㯺÷ r_K/ ?w(A{"^eHdž޾" ¸ς@#SW/5aiԉ W/mk:֕u3 cf4vf…|¿bq!=R_Di4ҳ,D'5K'?}S4 txh OV4笧VU=*`:ȻPU'ZV\.Q@N^:~R?k x+ +L΁59Y)Z6bl5I;Q3_,;%כ%Mn4\{/*yU>7 VL9[;'^7ZՌV&bf]-Fbv ^JA6 FCp[rx>Z'=ۢ͜@0:r ePx.iLcP̚{f"=䭔Ј-幈`NQ_0QLM_֎,/1T?w,wQMd[e@@|@8(s LKB 㡨D`_d0TBp8ҡ>iQ؊  CURjI%U'U~uOVMJK(s ўSIcRM{wZ=п!$:rܻ՗J,!٫JwaY(;|Bm1io7<̃^y{=03 VM`%:f-L9nT: q2|pi_}wou}>^*`7gB$+RwLvdcKgn: F>u}^|{Kdb@+PdV^ӓyku5s0_vfe!)ϥϿ?P5,Cc\:NޟVMjjrUf˧= p6=̖\3v̞`?Y7s]'~nI捙hN  gt˘Ru&4}K],FVA羖B=%ČJK(X3E؂CZt4XeIu{yRBu휜lljI0 bDŽu<)WmİM?@QA %j霈Y_@>PfdKX^14A24D#+Ő\N7Q$I jY1,ѱ};r6QpkԈeX~Xߪ珕Ӵ[4.4h;w+vHTҪ02]cvλ(LZ 7)_c3Msִj^#)ŪD=ŏkORۋy9+9BcJQ~m+\|x1aQ %f@La$@9D?jsy5^m;ɿS$`y"_C%5_fi8IF(3' 8ιki^摠NR^S|Ja}?f3Umb,W陞Y:<}t'L@9QNQ6|R+S,@41[3'2 hJ&)B\C1(8CPC5m_ :PZ@)~~ g\gMaFܹC7iX*> 'LJq~t>&Bw5<ɭ?VfiTᱢy`j,SG ,~/G?Ǻ=j~mN^\tCb5C֊ٺ,36Yf k-$w]Rd쐠q&ñy.?kRPf{1p k]I ;_ *u&FNLQ|| sY_o`Pf9m$ۦ H5 *5qTq-ȷk%p^\OLvt'sbmHW1JޘhFn9`av*Ճ*] TyțN|Zfl;j$ M Y>>}qÌL][CG.=՜'2mec.;ֿQOJq{Hw ^MvW x:,6Yi'qm?ԣn.a@SY+/FV]qA߷G‹u0 h`@[/0>[ B!o X_)9%S)?a8<4++>Ph#t!s,=\D7L"P6]^0\>ZEtyޯkZq ۭuQ^\kӰqy4r,M?DZ~E d)v鲸(g_)<&sIC6Lj4]oIJ{Z6#<;v/Xaa11ÂCs_\,> פ&[D ݕn\5ـj_|..,%yˡ߾w}/|_-Dิmc{؛V;$?Âq.6r$IDwP|+wqa<T(kAtXr>W+h襫.̋~>Px{G؝|2UnrӋWm*(g(a%ylnNr gItυuz%YS3>QUETwgYН~JNoDL %:8!4k)銠 hyY&/lFI1ʱ1!ׄ72*t%;%V IeNmV&T=k-Ѓ&E LU닕hpQ#`B63+"(#BxT,8E9SYO 68l.x= Tdj'#DJ;ɿ\-LDkC j;O"( 5Scyf'&=* У'6^UL.Rv^AO3q~<)-X=@ҰZSP,A߀yQ?Zi h\(5p$ryo'k.[ցMWX&D= (zSQYF."['i|@D24Om/$>'@@-lbMdE/5H&w?Nbp1ze`tvO69 EN&:ɪ]Óv[y r 4Fjh(ԑ:bh?/xK) q&@2o+}%Q 9eƦr0+~`bvId)xφ)1& e^B~,Aq]A)C:&]9L]G{,XXNi*Oa~4$ sYxR`bYq7nFx}Ƙ!L3k nHK ;p[qGPWYn{|x>Mƴ7E _ANe/fh QH@'R9 .7eNx9;nkD5XHж(EtM]]`e !njO hpw %{VVf"LpSsOယB%o@$^"uQ@vw7G=`Ptr X_+:ھ[IL3 D+&D oS pH]ooO%PΓUM[HC(Ҭ@~ |U׋^>ZyAkjiytК5q52iv͏=9 8#q)Kr,YDAJVA]]e{m q{\UNRZ/u}ހ[O_CQzy !*`Qy>t%M"H`?|NW;ˮâuw%؂N0l5A)%n]cʌ)B1&fV @mZ:#! ho8aC{"t .p~J= &Y'\ < :,xOXTlu,:W8w),NDMjL S.:j9n'xyVZ{_͍?HK8 YܮցV nc޹TtSބm9}MOz1*2CdSU [" Kɫ^@dsnzk $3-g(= L2%%~MdkX)! C Y,pw~{TMmxhN_bEJ)tg;JW{3M vҷO^9e]R^%ßr'F;\hG?)(Bxh;J=H-\hꑭ' 34y':j KޥEIj([ )6>U#mRȍ9u蘍1*A?g *vp/g,Pd"W@oP:PQvٷ/[$E0"n3펂 R3N9H +F$QHO!)\k|EP,dwۙVrF"zgq@3Vr@ bŧ"}bɲAb\ʝ@3Cduv[lLsf̋0l%wI]2o#>s7PS:oU,(aTUtK#x 3ITs[vV-%)n)$G?I0n vԋ+kAɳUe@%T?ñi@o־-he:^An}eT^呂ZI@z`Gam&Yt&.TxS*݋YS1po~Oo(=Fpd6%~:%7=QRB/!h=KOdݥ>z#&E-ćgr9KZRFSvfM >Q5$]H*'}\2 ?bT.D([9k#dR=v!L$d/qH:zLv34 ObU*c_%N~O',&/)2ms/nX`i&&wsmK֋MOޫbK^2 $XS.+si.Rqk/aM㗷t f4Y=8eVC:Wښ?ZF FB}]>>oLs[^ ^sgEq"9'h}$o십"ٹ 3t|! U]f3[gr Oc]!.nf9SUѮtHz?dٺJqo~K8g4 'WM=xD̴]J`0x:Q- evN2S)>egG눻O*,.j+'F 1pI*̢'w6?=.IDAT.ɟP8 @%KR#?dUP8 @%8PjH̹$E-v˫SN 4P'lT p!>UEu1k|kD(*Imcr)=P2'Ƕj}iD(|&Vl(Y<zKt v#l"+Β44%tPDz4JhJ22!3PMOsh?Gf翴N,A* 8]5613-g XZIs]…D&93ecx2l]*]=&MI,5rm?ql?n$n2(\yL"qhUC6Z&tj~P"= 䗯wx5D+|%o'}b?7,MF`КZy8p/@opYOJBΦZ|uPMcQb>![Px/|/G#a4^k2cr@k9Z 1DNBjA4 Y4U]ք@"c+^z@5]Z2+Vt0?"D3t}$jE [b! .Q\"!,! }ce.f@6yTJ!#F( "{zzj%!JoB(!zN̥^\շ2^c{H!JtB̄i.MX$']󊁕 [oEFz׬H[ N껚:apxj 2(kwtq/`jpvY7h X 糹fZ##k]UPiZkk-"uد8VZV!m! \u#PYG]_ ]R]>J_j_,ӐOrzi_>B<i-*PA5Ѝ>Z{ⳁ(Sň'*qBӧhJG8DbT)PBX->,gp=«}4ZtӀP%Xy ןjǹ4jnӑPW=\4l< ?Uo׉)%xCw3St )(bamm75=mi\<4d@ܵoz" Vi'MM(oZYUJ"E T-OT`$-BO"WPGBOX-%;]epצrn: ='dA( ]V'[aNrΥ=?[ޠࡹ9 .+گsVPBUB/"TځWu|-WE2Cv?x-FIV}nұ7NF@Py^F(jshP:y{5O҂> G=vY7.`UG:se8Y}-[7gq'Aoq{` n 긨aWmwзQ#G_u#` >,Jy@BU.z[,ZZo`X %ZPBG LV #B@ !PB!%d[!7v)IENDB`GeographicLib-1.52/doc/gauss-krueger-graticule-a.png0000644000771000077100000007572614064202371022270 0ustar ckarneyckarneyPNG  IHDR1s$PLTE}}yywwttppnnXXssllffddbb__]]\\YY__WWVVUUTTSSRRQQPPNNMMLLKKJJIIHHGGFFEEffCCAARRmm$$qqqYY}~OP""``{{aaaLLSSGGGZZuu7HFF///aa%%%MMhhTTooHH[[:VGGbbWWiigUUww~~TdOOzCCVVqqTTTBB]]dd緷勸:::kk׼PWXyyJJeeQQn IDATx \NY?PBor<ΧR< Q!Sx#?dH6zºj"r f {&ܟwZku<]ڿ]wo5uI) Ma@_2CAb9ܐfe:?{fm$Un{@2tj'_~-d iWc @C0N>^]Λ䓆;[Kt9fq:zYw/R^NgO;xRL[#~ U 5^ēvb^=]+Z=tʾc . R+^_e;K>)3 gC y`TB|@>it}8q$bƾ.I`6X _ wl }ȦN?~x!I=B+1ҙr&NSDvug}ۻ!->M㋳>c%g\3z[7Vkw-i[9oޝ׬ nUs___~چ)C">ϡHgz3_9­v=ܿ;4K0B4IqYnoD/!" '7Q ?$Th1sIg$3CDϥot 4 C棔璵w}DGYdpX6&q?]npB=틥*޴}ڦxiE *@'&P\o؜ۗ[>:ֻ<l 6EqE훂˚o+&4AEoE'1tތt'1s"q DB1s>% 5]3tbXs#o>݅LŒ3[Ek)Mz?%¥ )K-y擘c.ff iGZWҐPr%[W8@Z(d#RL;y'n7pEOr2\\lHv4Q =1GmTu##gTqATO86sUxODy^/m > &WRL5M$ɺ?ywU+I2a}ߡLvy>Hɻ .#aFQӐ' YN\Hqډ!}#\|%*yȋ8{ElvI=Mb8 {!M& 7?2Byڝ~<.0kB ~8S:F9҃a,]q`GT牒-0:- ݈@J4gӗ3!ā})`s3"HeHCY%25CNuK&sKJPD:$~Ggc 0v~c5A+煯_H!Dg3,7)*|w(\( Gy9f$?SrF8KR5K_%RL9ӗm| shzD80 iV}5Y b>#=lW>ˀSxT9x=t^{p9&3"ǯΉ>g7 VG^3qw1oSԺDJ\|yDI4,`@Z*!|Aq: %|a4~@;@T\ !T;.<ڋjxWY3ZكcKhMi4fM'ƺ;QN!iSId ρ+^@P 58SuRbT~ltFxpo+`U?2O< S"վWhe\ȿ>4j?}e͋g{gF6eGAfQ&!7F&67_?e~jPTWv'ƁM%ƂeA~аMߔMMYN, 7Ys_%!\n<ՊvxM|h[5d.\%<#4Ow/mlQ:YWзö:'Ź((V,c]'?2~6` IT> #GG$4yѸVwvXڗQnv KIYdz9Q,M@wVq1ۜVi_9-<#YR3 y; i6Si>j,V-LɈ8OvSlI%)+&殥SԐ5ٌ(Vxz0}|Z?$JȜ!:¯e9:|0y" K$6xS>U<7Qmv?z OځEvee5VW$`罝r-@SCgN pnE/F~(Q40o& n v9)K |8K#Q.IKluw89g5W+{%)#f`d א#Gk 3C7$[7σ:wJX\U(w4Ls7)sux*%eG zhPQ gqLWBʤO9 @gn(5Wӄ-橼iqCQ NJ;80OVRzRuK|e΃[/C @Fh"@WqU=Bj>z?GMoL2JI(9#,TW̯\pt2i 5(bL,&9">Z<ܢW.L6u ZO9ahem4nYSY|@[P=myWk7qLMSĖ{F=D2 X's1g& jʢ]=|z<'.B+$繖5[&TYlFSA\,y{R\T*TG M#1fKx8j=Zp2 OĦY( S;VyVt] T/f0IZejmk\xy@~'R!؊(@uDx"K." Cz?ś42gk*O<RXaOC|nq$=ceH@ˊϚ0?o)" m; !哹aY2PHWyZFTyG31IÝ1rMTM-'O;lѠ! :hH>'$E] liw)pV^OͺxK'#}zBm?0Kh9&\)ဂm=3HnELp{̛jmVÞ$]c>Lvit+3y={FǑPW+RFgA|`q?':0QSp{pu lCKr?)q-_Gc߉\߉‘ڰۤk*t)5XK޻3@b?'(S <?AMV:Xqp˹~Vaxlφ~ q}+*HoS m ĴzAiQ, >H2~J6D8m23' M`S{V""@AԦ)ato 6M`oni~oAUzGgshh6'&|Joo=?Ou,g?5Ӊ^ ?i Zl`GVS[qGNeTY좘Lғ [_6 Sua@CCXEV׆E٠C9ܯO~[ ^_@jC$>7?P/+g1kSH-Ra7Siq&!_q.e^;0yO~WεG伞DA!AN@)~q~!̶.oDҕ4/nMw>UC6_As$}}q+0t]ݚ_S笨~s%?kɮˢ]1Űq@E)0> T)P^$W,~ 3i_tq`άOaك3UoP(1eXӘgr{!B],$d߳XY^ABt3M⧁ek`A-c<9&~Z@ϻ䔥F:ߧ⤷vuHg-?v8Yr^lLwԃHI ܬ3P3vMC6W- bV oS/`]H7-KϯHfWzK)2[9;-L*Y%wOOsZr{II|g_aW8?NSbi7UԒ 2†%G9},GUZ>gqi 9J?KQҠgSZmr9:,S'd+Nep΂b'4̦&#@H s!YTl5.ΩoSRq#Wӳ LJ"NLb 6荛¡ŒYy'5eh){G_وU޽_xTG.Stwr;΍_v"ZZ$"F#vSn?-]Ҹ4M 4KnH(/NВ=$R!rx⬅?USHI6'zմZNoD%1+Ii3~U[p@V㞃.zNE_8^?c9DZHvT/S^Z){M Zu>wF K~\.% 3$euUQA:`*ts{85۩x&F߯M^82:Ÿ]OeCnPN߃emzf岭SnrXG. T?g#1LLz3:y6.4LE; cܮpD*DK뤷V㚈螣Bo|Rk=޾SԔfDcղN43Jqz[P(f蝰IxYz)h0Fd!VuǦMed)|WL`}.k16uO} SLO6>1DvG8Ñ1B ׬Jt(eǛ9X*R"J&~}O\\""P5k>1Nq~4gE7Bd#3!r"AEAHDrRPy̽^ ~^YLx澋1w}iLl?l3RS.F|ǴyhDvzɚ<*nm%IЁswgeL[@ BxNqR/dL({~c}`AK/@0:+‡yy)ȅU(Pg:®>>](=Eb# W[C#^8t8T0a/& |^tӦBI5rH- !l'vp促vŷ p[M X;jt j5&CԤSGChF}E AQ ܀%MU-Nh31j.Pۨ*1zlDu_GP%P8XC3łM%'<ÖFi&](s$ };_ {g$>[w{n/h8hCS<5 4s5Ģg#vtQDG3ijnP'LBr '|h&"QK&@2RԥbB^h(j :t lF"<㧈Z8cEO V,"PcGWpn] Hom,V>`qmn "X9vфӴwK'<C8}wiȑؙ+ْh&E] r ZIc{ALq NXϕ:Mt~ߢ&7;`IRWo<{D{&+ Y^S,ϲ+~ztK7R N"I<7xڇɀQz9D5V:~qnl%7>Na*l< Oq9q[4=D*`8 *C\$&)a6|YB!]&hrK V IDAT| #Q._&x1gήthVb"M">޶ǠA'\th.lx&i[*Giʇ[ǯ9&~(p,;;i8zẊ y^v 9PT|Dg8Á`ݣNb-I&Mk`!'X@'°uȨVSVS ;"z?':qNSC wJKX+%-%/ I.`e3 NVS1@ -VknrAbq76h9-ܑV3qZ?Xe-BQ*f*A-|jd8IEhu*1Zc z Oоnڿ6H,nmcA jjqwʭpaA-><2Cc @fP8Y~O`Sl\M+[|堠,?4[rCe:mo8mbC0Z8 ͆ i6HSk,TDh6V%LL+T6=in߄Eٱ ybu_f4(4(zKy6q;e8i8FA nh!hCby MbEfg2 w- /'D bCC>lkB۰N70; 0 k+M46͋ڀMٓnbj(4L6 ro&Do&P,LH ѡBc/̂A`q`yPdh7GeXһ EE47왋BA/+߄ѡ˦c c&+BV)`lz4 b#d* t3\>ذ+HG[nG/Ɛ7 *+Sqe˖5W&Mۋc;J'Q`,`_H,jW'ff<%8SJseqi y$y3֊aT<]W` 6 KZGvOb?lX IS~gm;rȏ#$;Y-HTy:j!fp `[$zSP*Gj-id;L7 .JqgaE2q8g:N iuLe{5)`wUB7EեyQ<8QVZ>* kXe,?0]5 ]et}CM-ЁonL|YO6)J΢4IhJ׊HMUut{+lwaNPꐦ#g!sUҭ%`r| Pn|`VϿLq*MyGVI>[޴4}\7nɖqҔW=u I7muC,[C6Ɨ:^͐]ɡ7Cy͋Z!}a_I{%~drӌZ?bD)a0CnRqEyщzidɺ!dt,It; ZEjN7.ɨOx]z؟EJ/* ^/wt| PgpQ~~MsAJqTwn">|48'ft4rvP?_wq}|Db4$N1VV]jLiBoO⟀VD$}qyGu6dG[f$@#&:+P}Dϟ_l𙲔<ޖ$`^0,|u DFP[N]Ҝ)F1{M Cʅ0N*AЅ8$Ʋޕ0$ x?c35HiK\,Úo=P )0%czԗoJ-^7F",LV!q |ZzA cK-x5dV"*4%˸ &|Q# Gơ),&] BCp 7S$ljaBmփ}rMRWX0L*1RH4["(Q(gqivBi8nkJ{7SM42L)Hh{W|5i+/Z'6 %0wԚ+智K@ls ƥ=})[f ug 5!7- ys;?ޠ/|l!"t=yG$1?ƚYyjs6WPBLN68qid ҫ#ssrQtpI6<%O~"s:+8. h̗=UtkYbݥ}B1).W ltHs/:k3$<wj.DvM2Al#FiH'L:[yiKUyЭן|v۵I:mrVi6F4?Dd;'sS͚˟cJFL8Eo*qU"H_)HĘ_ /!E}$+kIӚ } rr9p | Z $FF]`WH`5W4s괜d M{1Kbݚ@B2"'ϕm4&d'Ml͑`Wy&y7R>yUWZH5ނhFR}8s_~]oKV֓#x*$dl…d#\ɐ4` _JbKtfe59T܎+_sP5iTrs(7Ɠ3&M$!z &g08~tҢMώtx:,ނEi3B|s; Q|fv&qa?! 9 ,Uw l[]= @7Z5%ýÀ4  ^v)z@IZfB9!kUjLܠ싲xʺbs2D[Ҭ;c}!=|Ҝn4xp:SB LTÏ ^'GPCpdyg3ֹBS2R/m-qg Z]\`$k#RюA+rm DGꞏ d8 {Y]$8+q/' )M&i> iT\ܧn*t}PS!\ۥEr49CBvƞ]Fahq&X1vEc4!v415s8C]QDOq3k/(|m=aR ~ ̃y yMڻ+4%5iB>ib×#8,:-3i;#d)Ġ1XO# P) YZ-P5ГF3?!5rMb}sT[ T/|g ܧ8%'>A H V'da@n8; 4C~?mnj'ga1[ade07t䄌Zr`uDZ 6s;.O\a$/ĸo`>:΀4zzʹج~l'ϣJx3+-Z 0a)A)OiyTz9r083 E|y1tqre<)8:ї|ktd NISNm@T&/)hO0e܄huOCd(]єO} y~/hL3G7]qpY!A*Y6A8BC4V磄4`-t!QD*̝!邁hi-CG2Dq&sX ,4L?$FNDzL.kk-mG)Xy'Cc_w;WgIdN}P4 6m)]9$V+o*j?>jևƅ蝯;b/y"q>yrH.pK:Cttp@̀U&Db 7-9ƦuS2q<;Qs2<4JJ΋ a{iڙ !H&;*pPx~5?kHx%;&Ł"}GM6}eh|3k%@0%"˜0)s]b#a8Ax# i'@lt*HNA766 M(1q̯R؂&‘ !hH8>@n"mYztfm4/˽{]ФM^d($M>EW2"rck"DQk!g K"/Ժj"w񘔄4Ff8ٙխ`(A^i~I e:OS5222_Mu&‹1F*.'oˎ@f&XW3+jdg#ٯ9j /MtyH–Dw|jU;K*:EOƻ*ES$@Xa{غs2)JiV 3τ)*8M&t ^2QcwӎȻ$K$HuT\[Joܻ`Ap闍g<|tRQz*'WqSW҃0 RZ ޼VK|4i$aMZ (g[*L*;1F5Z,Hyo~ $}'ckOG0Dc!M=s] ZC <]?= N-ѳT*LSI-M8=ky K?,Zxo׿DP  CazskĊS1QqU&D=fd9~وCXCOѐ s2ɩ\IqqB4.ŋRA\Xl%M!V4 V e*57S옠6 Qk('1a(#>O=xPyf"6GZ.ӧ'N$'9SV\ N(&E8iev~Hu&腰636oF25DaA=zfYnp%UPz\f1\[Aq!kLH7, ]3)5D5]*pǂH V@Z5Pr;&(J9M#OZQC&[,m2hrբ2j'pl$M]A[CYMdqx MjLhy<#s%U-,mqI> W=S7B8K5ylj LF6Sep,f ي$"Shz5bt›o8H. u pE | Oc[9Ҥ$EvڕJ3ʑD=*j8nrU6l&gs$SA4ͨ:>0>FrׁO?Y,ȈVҕ%% p>^q8|uІ<yJw,P(ҿ9w]QAcV(q|bʅ)<ɗo<(*8.ShbfD`ci&meE>~42)Ro\*,~(ɉEpvB6!OJڻO19dc֔5C׆jL>+B(\?\`( l"͛7Ĝ #9*$yn`8eIhSiqU)jE4D:ƧK;<~f4X DIKMÍyWujOR5C /ϛ H-o ,t2x=9%זwF`5Ҹ/fG$ ԓ4w(F=)dtn|lb_r#)%M̩+HpyDDhP$sp05M&]꣱py͐ qʼ5|՜Pg9tRiGѠ IDAT.vF4,2VHs/QY2C ub;h[ hq҄: y=ltuu-wt1yˆi4$AD _͂+ќ21)Gao90rS-4 ٶi;v ?~lh)^m%B>V5莅a-wG뇠n ,JsNB2{zE#_##WJH b'ݗ[Q:Hfh>fEV>sͺV}j5daN]Ȁ4wϏ k\"Ue*@ ԛ4_R @J4wZs:dϬVIR S6f5> T:?OuRKGٸA3K$amr-[ISڼKn iPX+*Fײ4!<#+>;I{ru&51훦nCv[[ISՍAMOzr7ȻU4l+i6m6)I=4$;eHP￈4!ՙڛ,pAsՑ>EA؟b~cgY|he ,*͆fC+ MCiR Ҵ]+]  i6i6l6ր͆ր͆ lFSMb&n}eLjDž2EjE~$e> U^I~i,h?{c~+XQeX9;% H fuH{o([濆 ]Mo(MﰂТȂ#Cgn ^4 -k[y,( |CqYELlZ[,498lMhw쯉oC@X6AAs+alۀ6A4PP˜!314)u72gϞo 'o|ئEEl ;.ַi AsocyX6m߂аM낰XAozћ>*а`6 ̣Abe1~iCd>m ؟y7eƛrN!let|oSo :AAMo_$>wx ̷sgdzـ[TavbtotqEZ ڗv/MnQ{v"wd2F/kf9, cL,/aMʃBck/`Lp& #)l` a~X|[^T'5/e]]Tbn2g< }! 2`s + uj~n lh 6HM( g[͏T6R+yکjg,{2XA)_yֵX ߮^+~PspbWnɛ $aT|^j݆1lfj`sKaUBllAYڀMؐm[<}-A  W\d61m1|C]xGA7lk6quh[q;\)_Y5ّs׉ޤA7aJqʓ#of^"FoΚYw\GRc.}J[-j*V%3aeUiMtEw4JI8ċ"G ]gi{=wįn9C25 I6>Uㄝ'7}Ͷ*ظ6.>yײmnnnv/\)GZ1J^iCs=w:ܿN9B !c+􉟿Q۰tn ʗ<;Zƕo=׶kѮ~5nŠ'*]|@ͪl<|;CInWp^Fr]N>f> ilkӬzfxtqFžiy蠮.vgkbxKZ/^Pb+`Qϝ֚l=x,iYa7&ݩJ\^T*ot6=Yz&vgP07@b&pMk/=!.и.zTP6ysmik[,(OwZIh&tF#?MRqy3{fb^O=>y۲s.\Jh G7N3: ^2" }׈Q셞_K㠌UNK񻵮4۞1ak~&vurgl~H#oӿQPaIA4e k:wֶ/zEӵnBn=6^~|ǑNKOnʉYpyLP㘬*{)4IYygcmH{{6nZryuwЪtdPqS]uq.z_4䵞;i5g:qd ޠgsk R!qyP5ikTɭ8B[Z8<-8LSbj&4#]?x5[g%"77dM\Yo#^oһteUK7榞[=e#ιε'{d#=QFnH|:~SulYӪɻ<~?AL1Iu(~v#G-Ӻ2xϛukY;GBi1@XV-%Q$l=id`s/>t>:4I!yW9z*'fBn[t,B<,ܾc77-nz~~]wA;J]N|ς"ë.U^p>%8ApwZMzݵks AYכ/v-(@廁}为\g+l{PM*oi$)__R_P EКEЇȤɗ;v#֡&cc}͗ijXһw.4%G&Ze5-ݺRyi6CZ&J hL hLM5,^ Ͽp:mBhjl]\y.Wá fw%^,7ުiFxo\^x<`56QK)+|]"f(EPK4M`]׫B'_[M֡fz&p&l M1ysTfnpռ֚agaur'OB֡fN}d&߷yYEKf{碑GgWqڝfsuR3б^I1MCԯ>E sQTBLez !5KJ'_iE~G]7[ lMIdMOἱkY $'pc П؋Gv~)Qڝ(&[ݓvc{ZlV*r4S6nㅧ:Sewۨf'~lClm\s2'"iG߆+P|8w)j N ,淪k:ӒhW 7=[0uS瞹ufܕr)d5=!}ƭ}qJAh;fcl>(6h+ Afв.|FR‘}Ut=XvZ3`ĢݧmW Hz߀fppxJb2(77]{qM}RoX"[`s\DNf[cqttal]]Y{? >3||Rl}X|e.P9sC9iQʕ7ږIYɫusIwRɘǏC>\gklKY`e2,yG<@~5g]TݮFx 2j~(u^LBVC1CT8eڋLQ,_̾={Kj>dYo`̉[ƅDlF~N`3> :!Noo׵Rv'˔/eig=#\W$t~XJ)l^289jgvߧZ>kB04C6\P?b\tEj6NVqu>MuBmOC(}zҥ}dyjF,uQ-Lt媁 Ѭ %|Y#dUiQ\k9G GXl{O`1=z<kBxЧҧyvm+SMWί lBUY,L~Y?vҤNM@zO)${>6so̬3uD]uu2zw=.G?"(ASzyHL&CY6mMZkzE) $*K1ށdG]JS͉k9FWh]#UӌopJ|DT(M"Wr/yQAO#hщNRҦ髵>pwr211=K1dJ;-`p< ({DVb 6 4ӆ!ok*Eڊ5i~֮^qR5UΌ7 S C[vVkѫԦ1<}%6S>i! b("94j%x~R^Qm8<݃SHZF͵94wSyc(!w#IbSj9ż.ne"εܢY=Vٶ׻(S,8d#lO p7Ua\lb-f>C/'my5WT@93rݗl-<jr{j 柫ܹFɌ/@aԧ{ Ǫ*toz=RV^`QHpw|8~ҫ%5bf1=q)L[\ђ54x2I_gYp{ˈ}ێ7=w/X}QsZbK7z>Ж̙3W%';ٜ7acp;#$uR@:M F4#YoMUz}]-gk+^A4>I+.K~TVR|NL|u+%M9Vzs2M@ #T"ЄZL늹2ofq{W]G}0 SK;L^Ai #mN>"2`(aLiՎQgŘMJfkvKb-G7xOU/ VvkBs6wǰgB/"/'Elv%?,Iz44ZDžpLNPLGxSJQtĮ; .z 髞bH{ݷ<zNMO$6w`a7úz)ñOJ<}3pg 5tVR~VQ:]խl۠l$r*A4QYgpȖPcB#ot[7env|OPbipe(!M,Zi{.1kuʯ: n;w/z8w`\:PQU%tc#ȳA析6 >gyOzAY!5Ds:f{-=sJ2qy* ǚViP~D~+()Kk&-bK)OpGU@;0𼮨Fu+й}*`H V!xW3YA?A${WrnWsp Y_NjELuTj(6ETj_c1ATҠ-ZC+^ =^8W?P\Kz 3yebV.1!<퇗f6}V0mY^"+l3TS;1kE#GkNlxZ9Dpnc`^b|՗+-a>͹d ĔgjCpEׇJrʲj)tJϝ[RvGY3y"DV!z_қ0>zpz~:<x ]sjph pẈWʉw= WjZ_ףRgKlSF)HnTD ʨlҜ'X^zp΄ &`c`P MߔB~Uz~7zz\Hc$l_pIDAT=} vT[kXYNS .8 Ul"MdoaykTA4Lvntzpa}w Mul6͌hEyXy&ڏ)"a䐴^񺃅yC~(uwGU)~AQrYva:Fɽ2پ4~rPd7 ^mPY}. y;ڔ^ PrtQ%\yo{^'~6& j.  qoEl2-67W'jS`yWD"R4"77.wE_Yrs!W|oAUs= <.#f۴U |м _u6ӚFAѳAXsVI&qfD-G8G\8U3iE{/LRem02Etc{g~en֤Aʩ^t~JUݥ RBpZd?wSV?JsYHٹU>aߪ;o*Bٔ5Gt/ &}i.+kΫ]kӞ#o+_cZ7vPP:Yﳳ16grOv 8S& Ҧ"719iPe8͊G}m+d.ݾOGi^N^w**foU!"teb 73d/y舽ouһ:GVk la}}{gcE¿LjDHb4/ӓ2>$M7E nd] dbɺ 2tcڝ%jT@(Ģ/Xs }`! 1 A9$^'^2]Ϫw3zNSym7/&xDbڎ`p2-OT-K}WJeۿb.]"ZqLedih!{J {0 ~ juD>võ16SLTq>X[ꤿ*Į{s2sB{dGL^bg-@ýn*}қ@L/젳8=Jjy\Іv#!6&~Hr6 dcP} *pgڼK ȼԂKJFT*SC.!/`iv_xH?d,hB|ӍTb lN g}AYts T\-&vFQS-(d"#G%&p%S+G2?W~idABm+"ٽbĎOUn/OK_y?Xkt';[cseMrBi3CV~v^ߧLe]m# snVRra%s]D`tg[%Q,4#]QIT'cP-s婤&#*L\S ڤ,hSR߄>NgȞ4drU >7P<k^^\ͺgEMrI/8%lXz)""(]NZlb9A69+H  5 A9JA(F(u9DJ"H =*Z*bv#JPFc~xaRMw}zpM`h#SAZCπWl5NgfW k}WaNY#:g65~+"O-d >?c@T!< j/6G9z1ք'{/1ms13K5:ҙJ|0 -6Hۣw,A ݸVGjW]=0o8a{}+ӽ?NZC+yIp /^ GMuVS/'f5„MQOn:$ވcA+P;IUJc]3۾L ;[BFwEe!h8DK-Q<(q|6b.!U9~ܳ;#g&8q$%aLJ"Y?'kcSyBZw`n .s٠ӠW&Ґ"/mL?6LEΝXS]θ=C+cU`6O`w>t^Խo6743.!S9?Ac¦;J<;ߝ$B4ˇa<}G3maDI\zqhN(HQĨQ7hS궚8+ζ Jz5ZKV,`0 =yL7EE/YZ9vy">SW^5 ߧ4C=;Uޘ@EgN[rV#ղnMW;ئ9 y)g2V/k]K]Vx(Yq^6AD+MT/eĥ>COÓ] kXfR(Fw#3";4y;\6ӻ3VIx8?@h<⺼;XǿdrMr/8Cge'd \'6W}z-H'՛mb;ykrcx/˓isz1>팍\n%#^o}61~e.oRi/>D3:Y2z zw]USuևƴci ω_.!7*c |MϗKtG(-z@Gŋ, pn4+۷>fѼF+[֌ i UZEm] b$lc‹L'XϹ]|ʘU~s!}Ae6A>!Z~A69gzSX@kX' !nA̻E~DG 8! 98 Yy/9+9l`N-הb)(~"QEy71Txow5a$87* E4!:رe&ˆg8QȰ.V>nϏI%\$:9qr]vJ-.*N~3݉Y>ϑu \ڃTIu8uÃ}elh_OFqo'Zaw( ت,klFkG!c=룕RmJgVY#}88Rab\h 8`%k'!ǖN}J9eDd9XǍYȰlo*(rA`wѼo8ӟ<+ XRO?KM,RQb0Xf-n̴.}w|0F*~SF۝ A4;&Ȇ1& mMkȫ`7RcL^qrn`' Gb,G?G7[B.xZ׎MZ85Vj{YY ^ i"? }RR.Y8M)o`*)G،w ,[nmN1ޭ!ƶu5ؔd~]cd|>RCCfYt0h XV6~2fNѵDjtN#.8cEoTL6?:DiĤ8zRb,ȯEaT1g]=r4#GMLk L&˭dQ^A ('[h8?D~!bӶIg 6/bnFmTŗ/hf0)W{4i@1kfPN=>\;Nlbu,6㩊 o 3ĿCIcIfp A()'y &Vys"|ؤFO CzPl, ]*A Vٌf3֗8O/B~iK{a{g&M_p 6!@iQx5=Tnf^$lC;^D 1J̣AjNHa,ta |C GRU^}:odxl2Ôx'+LXqtxX\VQw QKǹ˱zu14rD33Å+,$k3Ùyl^]gO?r X|O[Mh w2rGUԡlkZ5Eef%Kh1asU\E>*'[>%-˧E7\$}ľ.^kK_iȄ660ērOzp9/'!6UVXf \YlYr% N0Y3ROp@ól036# P}ݐH|KnYmxETur5H_\ m?< cP"5U"@ZT` r/?ó\z5_bj]u?un-<DX7ޥO،4rɗc .rRUa#ڑy'-O<6y&Znzc?sU>bc_^­xlc'xlMxl]K, IENDB`GeographicLib-1.52/doc/gauss-krueger-graticule.png0000644000771000077100000010067014064202371022035 0ustar ckarneyckarneyPNG  IHDRCJPLTE}}{{yywwvvttssqqoo^bXXssmmllkkiiggffddccaa``__^^]]\\[[ZZYYDD__XXWWVVUUTTSSRRQQPPOONNLLKKJJIIGGFFEEDDBBNaAAzz88CC=AmmXZGGYYaaa>>ggJJSSGGG999B||MMTT][[󴴴žbbpptzHH\\zzzimlllOOHe""VVVxᮮII쵵ס...WW¨ս$$$HU^^yyÞeeQQim IDATxyXɖ/*r"N#AE@B*ZFelASy>zԖ؀< T88A()e9rΈȈGT;wȕ+[+V4 њ}^7&.\>$:)0I G룆o^cb?j=]6y bٗ2~;8Ы5躇t ^lһ+-PGv҇v^&3/!? vL0U̿*_ D p4='|U~?{"R7Ǵ[=镹&pH?Ht(Whj Zb_żS: [ϕ뢿 /T^yAduah?lJ>wVS`RB"˖@_utdUz7}!LBbT?qrko%:{0bl,_r1b?T*NT*&fOβ $!Ñ^p'\^ZJ] }:3(zO$QxGW*Q1D-Yp^ jH>2[|۫ ~ }2ԫu^ ,ıKqjИ'_xC̀]N+Q6>a.[z^Gԕ\{*})SzmO}5 @( 泜07`L1w?my)(mn^`KS^cķوy^pz)#͆\er,һMfDkoN%0%WXR@77VqV/d<2ұ5LWM14n3$:: G֢bA GVZO)$tMX 2.`-':WDm..Ȓ|`>/qzik.vXsY{ ˴⠻z mZǣ] 3R[e\9ԑx\YL1L1ԡVr*`10p㜵Rpb?,>iAYslዣ-HQmHe#as8\ ex[F =枝T`5'did4Yܒ3HmaDGIX4Ń6qf l`|'7tb8m)$!9U[nְα4DZP{5y ,G3D٠i?h@=Lm-9iKjAP/ bx+;X(T q )*-$#cU;? xŒHsW8si X|_v H3EZTE4C}f!rR xKch;%PƖceq^>bS\y^%3G Ʊdjg*ÿz5ҥ^~8D g0.Q>@:lki:MɞM(0~(XǐyH=66g,1!U-ӊmجe;:Bb LQcAZ-am+XGyݔy@l Y 퉶`ym874Fc|HI9ϴVx.E5x8H}A5E%qyu)#~g.Q jddÏ  (' ͿM;cs=2OiVHh{ߒϑȐx'J ?F*#q&bw/e)/e+FRql]}&Ns7:fN5e`B$M߃@ILGG_Ϗ/_nIG]wG]颽h'uNjsyI4dǾ=h7A\.yu qҩxw;H17@mu)9wkkX6@ /xP9G4?yA`oSK@LϖP VXF̙pݎ-u nvz΍oi|h" r쒝sq? y@/ҷM@[`OӾýV'~*%qMPV }#x [,s rl :'g Ϝ)5~J&)N JN,|[{B{` .`8piĐ"em`T9n]NVo=h)Cj:Ẓ4E6m1Y|+EÏ8tjF(ݺ]>M@%8EA2XkQxuWоIRXL~] }\#!cW_";Nm>)ȤB!6=3A˔dᖧ҂2a źL2 Ǥ%JLx Tr\QfKH9u3D9)j]CrD]no5, [|Yzl~EҺ ә}I; k~0,9EeH`IOƁ_UZ7A^GMJG:JE=+yYNanq"*9>Pk7=1;)J}}N#bvJyy9 ~{vnńy/o']tFkř$UᄀW4 q}pAcU,6&"N2r1g{/p{E9e|&n60:a!$Np'l/r j^R >pO8kq^DPr&wGcȟdSRM8;T8wP 4(w5h7.Vs0])A aQhajjdRۓ[ '>DVKZz&<ч8˭@ zV҄94HpIиZ<9l#!"[Ggu(.bMW1=e.Eq ژNQSV93ظms ӉSpH~Gyf,])YW 8Fp,sYCioEm`d^oѶKy#xuÙ/2PKZh8ߐf`I?pɃt71\>~A_8C@JA߈(n>l$42YBǵlLj^}XC R2>' ^@vP#y\A}}YAP3e{'SRƏ/5;`?E[PcI2d&&bgw`S_4WL86/hs0dcmUD*,NVG2@oˏպN߹׿>+tk Ke˵fi(} ^TP]t|K0^0X=mejog+9=x`sEMe%*Yme:x9d&a{O s'(z%LR6ރsmeG[ote{o8E(/dKqb4]K0}趺O}5srcx"xJvN ˃NS{AȞX'(5qOGڣR2BTkv`iv$ƲYolZ8F\ v"+d- []]i&|5;Q/ $Rfx<ʡVk2;i$!>6YVkeh OMYl8c'+\t=@Z]aZ!7Q9!O:!0*)Z 4qI aQlx]D]Klx椤AѿJ(>vl}"-O|S;yrAj wY+Lv^i^ *f y, 歛!oRãت# s~GyͶK _7Mb2q S yK80q%P|ʮOV_v5絓&&mZ K7k>:K}=#ӹ|.A,ݫY$΃*kY!}h>F_"WD0=[Y@u>q5{FEOu/ZOfdLe!#Np\TҀU),A iU.\Jg{YU۹.'T ARtqYR,<]a+FAb*xL^w̚D~eK Ώ2-~ q4\.vV7zLdfqәiֲBB]گ-eZqQ2Rĥ..05vyj|E*Ij?LPDU$=Tm@k}BCfsjeb- Z˿LY}ɾn?1 :!ǿia:ZMjf: %!#d@==K$JAvICf+éy{'M“^&F ߅Oq3J$ lSzG 1B2f#;ǮD+@~,DDݿU\u1p¾T4{MɅ\aEJ@BHL%m *9TC=V@ɰ1q\\7*@H܊XwF@zY1pJ )6q{30 E# .W@{goLښ8!XpY%HwY7Nn0ts3b> ~ @ȚSQ›:)ZVob *ɀB3;NL&CG==jSXdK9y8Bxy.U(NB1Ht-TH Jэ\GH<ϴɎ ;'L L# ^XN0i^l氧2r8#5EXfJ:*z绞'n/yrTWm̀aڴ Lea-nV[b8(5XH m.e{I2mG[&R4!"RKEZi =uI2*!ZqH8ll'_b)<2ޏ4{&Kw?G(s[-UĕQ+͇<*^NFICj$+OS0Qc"]ǽ;TLG9WZ<]X]VD!"$%:0FٮYN%幓K{')7IP*i#@Byz|S84D 0ۤ&{E}9HpKq[HQEl)3oڼ-'W&#%/Go48c(?H#M]E 9%-Z_R-(&Ț/ Sˆhڂ¯8ٸk;y+&lWcmɺI*x E˹]`HRA T}BUg4}j"̍Nrf5b=u 0c nx>\HS)3|2Ƭ,ZjP_4Ѫf9e)lw S#8O' IDATZ+9oW'$fŶ6?dqȄڿʆ? n Tvz^iFR/>KQ%y G43]MaA|KSo ɿ"ԏz<*)dzLsK_ (Zw)!):yL7a1ShPm}Θ*H6ƙvW~j%Std`<".R8dE~`vI@lK5 Pt5l#Ei# ; 3rnu+SXH*TURh(&=yz$=8[}).Iy K E P&s<>`2Go˙^ <΍:-azTVBe54rRC=~LDk hf/t3G"Cj|g`#C$ɭS _ fsL߸aw!0LYS oYR#- 1ϊs`S - %g)NQa 9"3,KгK@xoeI -L ʜ_1204rH,rP0!hP,Zxv9| A6zl,uVJ7gO_}oKy/A)VPCd6}foYCg"oꥺg:TyW.*ִ/GEP\:V hQ*h?j_xM Z'eyRC$eqWEN5-W>G{orUp]Զ &Q+ˣ\W<Ҿ47A\v`,9&&@m*8oxֱ,2% C7Dۅ6ަt1,dۓqqnH,F2S:8,d(b4;tV!Ժߔ"(Xip=AGU-.n K]b,,t"AUE'}H#^sÚAUD@o |H]gGrzJq典u7םwd 4P$]\y@/FRpJ(b5gS :DT/*f.M(݆7nב2#GZ9|H%^&D Q©kBET0jԦ2{H;-_[A+D: : >`֘jar8ku#FWR5V@(~huw+Хb4J܋ &t2#?)' &lD=C|Bj+(ynV;eMgyK:lXQr5グdi(*o7L Y B@f`T5p u'APnz)߂ԋhmdA3wA?)$ "c&ԛ QI,.a'|S>B4:yc) mcF&Mr1'r5T h[),qˋ$_Ky;OBj?ݒ8pdkWrՊKA.o؉v> Iüb5Z8j8R}ؔfǁ NJ/h~nKbQD5'fo9| ocXfsgY}h[;Q"T\b _ qbj`;a%I:$t1c"]ɈȩD/:1('=j!#8{bJjpt jrHKYzO 2` "$[8SJeqJYJpjw8Rܼ;\Y?94g4"s׻VFQtpLd b %b&M$ji14:{$."'W% OH>*6X4{ aC :CdAXB ~/u{Cwt8o2۬#ʶ8#D5nP'Ҏ ?"cۍޖՍ`sn/%e*3~N.w{/)ˊ$-hȗ5>kUuN#P5:QD`4qʛ)$s%'4IT"(H%`V f`rV`UhK {?~ 9ꩻGowG7 3K 3TkB 8~IZv+0\vRFA;_(PKc<";\eA۷JEۥ!xZǛ7?E6-8-4޲ Y 0m,$>ʞԙS)5ty,(KNV}hÅj&V @+/S=-d-=x06 {`Ry)b'[Ģ,[v|%nF= ~y2r$|NS'ѱSbOl$|f dnN])fM(ҫY@R;X smKl9"0{3J.sFС4y#[R?dj$%+?Ze'aǥA`w JtZCKQPgȟ-4q{qQG@*f8oAdQ@6JjUI1d%7hΊ>ANՄe~a"9 $(ٶIxCz 4%MT7 s3\*\"Gkaˋ;(,eS(G$44>+'O,(B.=OwEnq޼r&"Fª:=Ig>t H (r`]=x'v ${8Z*ͼBo/+zZ,a 7(q[@[^7Ayt!rhg0t$HĀH.H3։卥XqlM*8?MʸJbQo%ߎ#Yz5o4?)X"$Xcz37 N`̓ynUX_ck44k}HRbAM[OD"Yu cȂ@)jϑG(Zl5w~534;6LM.)˫C.UlLOHzbE Cﹺ(%Q{s"/ AH/AYt0.DQqwy\'sU1{|`I޼%_~g.q>@r:dJ`3?5*/uռ:E(lMLdqZn !O$EK,n-q]-|A2f$dE2b`g p~GFBma,"/H]9B2liȡ!:> 'KSqIDettw`YO4u9\ AşvFe>>6_zJL͚ P+8 ɖY0gʏ{FI庻I?3y'0p-T!/oL-Ziԑ _md0h1*ichύh wAjfP F{^Bʒޘ k'ѭiwŌ1rXFyx3|׷b7G;$]1V_9^Abrn8Z/䧹M OVK'iKqWfAN~qGoĔdDp ր}|tt$] dJ$]+rǞa,O91O+ ([w{[4w9+ACY+{$9Vy(^ A#i?7i-]ֿDJ/Q3k>^?LWQԚ^i4Yeeؓ)]%(`!}FH='e*rJԇ[+.C$%/#&:I ^J3 AqX26W3pELPoi#=˕Z# M,(|;yYqˤX>;B 9?{mOBRi#ɣx^ d#Op8H x wTJ/N,^\odEJOn0m3Ar'rx5.x O\XlvԱ9["3 k,c;ɛN 6="45'XGIEwC::el3!u*^ uhS)d2J(dϽ3 7n{vz{N85 ?.~V}!o5(D1pX#"\Mm5o#ItƌE:>͞U"Q/]Ճ8Nl@AFcw"+λa@ӯҤ{tx}Gjh7 .mi(qD,3=hts"e=,7Rlxdյv'xw<|>.g7Mߔ[+V‡F.8Ad'-'St?ǩ⊥ԻضHxIЕ".^vTzⶨ&;!ѐd^ix"r#!%E1,w$b$vK=UM9QWh2A-I\=*g/Y@_T\Sdb[HsEyҶD}By#A?5TWE/hPWG/2)NO58޺ SB^ɮmSGNdvu$JlokyTB Yt(6t*:mb :i4J}rauQ OZi7M6 }Hx|]e=1Fh252-Ϣ>-AEj/p ܄&I9'0E=!=MChj j4Dᷨ `/ %hW sIY {-#(hڬj։3Ą4A)AqYzO\LCV \z닝C(؎) R1Zv Fl,j[= @[nЅH;f-Nٵ^~DA<Ya~ŦNe* PJ;8g!l-]7LE'4 ʷ>S>QBPq]yp`B>gT x}/ڈJADP>#JZ.]@s觨 =e-J9 7(R`~D&'$O ~7E^mx+ Qtձ^ai"\ȚB,Zn}.΀XN=C~¡64Vw*g|VhݺzQ:hxEm~z T`tZ=ԏxsukPIGc-/ʹ[o<0ŶMt۱alYm`% P K >4IbԏX:Fp\m{}j+u j*\%X^?14Ehv-GՅI՟KЎ$+թa:5? A?e* S(Jw`(1|(zХ)mĿ ]vJ3~R@b? &lcՔPz2&F"ĎO 35sL 3ؐdm 6fWd{ѼՀ*xK UMVLޓlHW@NN$)]N\^MtR7;Z8E:-Eo~ m- IDAT7WgHbO`(4$1USsU|2(1p WK&(IB# Va PnPP74FO-ݨg"@yZ(n 19PVu kC-T<텯ڹJu$&qes:d *xCCnkm/O5Gee"8g%(+۶}+Cߒ!pF*-ƞt{Ha]Aۉ i5EZpAԝF@Ћ-4Q(A~4|mCeIv/_Vqzܓa(ʦ Lye<[%}?Ԧk\o$\1OGpQz *=M.HwPHW zh\V9'Au*vhYnF x16h UVRGNP*E;VA!rnӚv5)ѧF9Fߓ*k66*3c6 ;Fe 6U j}H:t!q J |JAsAI ޯ5eu[j RzTԧݢNdJ"SFHP4^ > Dyefن BĆ!.B'mtXH|R.2B)wsA%hF_WDP!+b;RNV /kbMWDa;|mTID6Fw7) F* :sP r75C'%4fM$)I ^\<Ĺ4) ݆ܨD̋A炅:/_%zǨ(˗=C (1҄A|P O,KDF. Aй݄wdM:Ϯ{;U[I`aP`;=ݜ`^DxNIz>p@MJI7&o l"h&6ЦD&655qhSkjMԚ85&mjMClU/`Nu0AX8<9&AH̷l-Q7wSġV 6 w;,}Mƿ-$R&EO|I`LPRMi`PiDK@F@P$ߍ33gF̠Hc̤`gJBfd&r?c *p 2k>2gM1lfLf8sCÙlbfGsM粬4&4p&e8tab26"Mʬ1p/ˡ7 N9#%1Tġl|/8d. .)J d\VFNKCO?[Hm XN53lfvg&E+IA`IMirjtȲ%k̵#}&mmnA`]\'SvbhЦɮ"hjMO,Cy5m?Cg򋎄m;"ې{ V=5_?0~ hXPZDЇ7hǻh/>&\G*q0 ^:ncISH:sh(CW)n E9׶  ^j PoΩ>PzM9٪q(phktlEg嶛L2KrK~¡ ]:ˇ҈ 6ᣭ"m܋̡QC6- i=룧mt >N=#׋[5"Z~)^[2VՇd?H5h6kaޅ.(]6)e Yc壿JjS V 99ֈǶU2?8WQZ{:̥Ѫwqϑ_ FقQWtWZ}tW2X)/-׳HImqph@[ݙG߬|ѲA?!'B6Z MuHS^3Uѫ_Ü1G.+t[ODb*]C,8^4X>+֘pξEa&+i;DO|D: vø! S?+ ꢝ@K{zTF n8L]`=,^ͮ5ݑef 2":hg@r?ekJ&>8Hr -ns7aP׏Ko) >kV&a7:x߮MRPЄ^y %3 l7h/[Yfu%wwDcr{j+yoF_lY? !A'4*s)&e[ws٭|EҦ,k0uDT2^zf^K(F1z@h"QMgYaySm&g8UO#Cn̼F:x|nt:aNgukwwnGE Xי8zrzrd|P@2Ԃ=́~Ӹ/|䡥Y 2K1`.Ξ]d \)XR! <8e2f ެPP%Dc_?X9mY{+RT2~8@:v'2 c`wXsHFJﵓLey-cvp KKa8?],v{m'2p_ETrac>|0_KDRWQ*톆CY<嬐 '\6!O"'EX,aUK^cX3ia$B%RށwU?׫_~\d:(BEw+i[0[כ\};J-ґ Z-DOY43`d-`ngקe3WظVoL]Cyu٬d*@P~͂κz`IW1YKMA3'%c D5xWiȠw׶Q$ ^hTK&wa7˛Gϥ* ߚJțC95C y&1'ed`KKkY &JB M&+fOy1F>vQ0(Mό- w"B;?C1ۃJ[ /"ןi1χ G㼯Y]x,Ⲧo s>.]lIGevXV9'*LǔP? ,9`FɈ߇@k8O2u5n㉟ފ=7/EN@nu] UU.}LvRC59![xbshSf3< $E!( )d9ڷSYT_+qCt0ɾMJL=ޥ- G& ǰ.1lța$ș)e(OطV~9ԡĮ=5446/|V.He\?d4(̫Ykyo9[B@;`Sֶ4L']@:gX4pφ#>7ދ[DA[-FsG=Hm~JKVZ5O3zt34]p(/COd8)b(F} ~ _&M+X]TT$ĠqRXf>*uܤNҥIgtTie7.y-B]#vq0QZ] f.e$M^rnCr#Fk%'gs22Aɣbjjrj$=X˱Yà$gU I59/0`UJ!z~dL}݄wrFbz/խ8tX.LmhPgh0vYL* EBfak<j0`P~e鄫$B=rYw?1=5p I}|_`=&*=:r4xݦjۖ?hwho~L%PQ&y"D@o>&/K&,W:5+/<ٺ\4F%?^y!Iġ~Ǭ+3*G{|9OHE0jk:zeRV={ΛC.ohİn?tݡi lťe%&h$4[}e?~-NnFC%5f $oԄ/ƼY KѕL? Ƙr*6$&KS SΠr#\0vtl X|T)Z靁ʅv(eIyλ?نKS:n1ݴiԌ? tgjCsh`$,/Zd*!V{ tdSW2z1QYuLm?Z 09ʑoeu41m2;~ϠkME ĝbieC^anѓa~ 6!y}̫Nlw(o, x4WH[6|Ű_Gr#{y/dS3.oBEM/ ^i..`0=_7][#a/ˍG\:V9wȽNꉷ{nL/L'돳ۼ?mg[W (Y^#y+ٔ؎G坼fQI7mܔhiMqV@~2;>K)#w{ĭw)-|ɉ6.!/VY1-~݈֗s;N3!9d zZLV#_]RD4%"ެ $UnU7"W43wUWAu Q]V̷`Ir7ru29&[#[<;c!'ڍzO|F'$L5?חI&~nxE%P#R,@Zq]Ed=C3hc'\lK]C?{݄랸к7%vз F>RB0YJXMsWR=dVK׳dC*\&\*ʥr [QGAAb\fYyZLJ pڎo2Ab|g ܍E:vˡ{*3 ڭ4䉆K7;]a"4Kp(Rs,?zBz?$̞ x>SJX%z=^nii1PK[bƉ?;gl? ߊlG޹\“̶'ȰklVcP q>F (W( fgi6S֛4rTei}r= HXfuI(97c(£+fѸ#q Ht3 hc'7FsIG;hE7z+,w+Ҫj?x0A)U8*VI6k?F?hkTZ/á06leh9)ӄ}֮P#{ﮜVQX)]慃:) ?wGk-'o[g+, #wc { Ό| ~cëUĵ=)hrǻURP -mҡ]( jzLj5ICr|lE/ F,LSB3M`ҝXO[A~jU0k{3a*ly˾zK+Q%WrAcS(dfsOz ·1F]ָ+H+) pV UY@~CJ3oH{Xcok=dِ=yr왈TĨh`?[OH٦}F {<ύ;ÿmsGn()Aʵ.I{3XFC?Z`Ϋݔc *wBZqG?|HMMwzw0iv PaQ'h`|j' 8gTZ[wlO|s'pCZ g3vd׷³m;lQRFUJ{ɱ:(}@HvuSfkx? fJ/|~;LzzYnjKq 1$[Vi6MbgX!&XCx$ W1K9JY՝?P2~йڸ_[JkWu-؂Z֚ܞc5덮5퐎O+lb~J%MSk27.9 y"!ԡjF ^Htg,[SOk9IO`[xW&XL wV@5VX=c?O{g'3i_[a;Aw[AϽVa)6Ѻ0 C}^G32FYbNMhYfr^2W0lq GLЕ= Įk`c \[c.<ƜFbѿBe1;}(Qphѓ= #{9 =ܥ9Uݡ޺ޅǟji;Arh$ʘj&y0D ZxV".vbq+!]$Zk4mv<7ClSXIDAT݆d*=$cndh#CbT^d[+ɉo o.=AQ%\5Vndto7wm}^so9#Ak%ȡIs}ƍ3}|_\B["2lFB.HuaAQ׉c\9>s$7qq ,S Ap#.d4ox~NoAٟZ9F*URfݯ&d+P2L_X`ҏArh,h>m*gO%?2]&ֻE 5OIJ_Oiq|AwG#>(s_|CΈqJ \ð)wܭ=怫urhHيڨn,f] Hz@?]9o.JC|y|-3?ϢQ>]UD[yjxWr~sW<+H˖&,H"?E[vRgR^[ag嵮0ޢ8 oS9eqE֢a7WRGogqx{KOb̡1k:@3|E2A)V'ͲMsK[*=$t-^Ϝ#Rqr ,z>`V;cQw-Vk;ۨL:3M ^}\hNs9lll?ˎ/?\-%B2}0kK` j[}EZH,F5㴘ќ<57 Gs uM4Z}'ZGK*5ϻk=Ssmpg% חd }jCzЪu#e榖2*Q`$]/[TZֈ͖RWj0cZf(:egHIjn k ~Ċ!6"6lr{iΔ7vRp ;nASc4'-.}bB8TWϭ51i)oPŮgEWu}E;=Rg+>dV}l%,}<"eWz]iPjIGo^F)r9~+(9>A%^nJmCX_n䐛s'fTF+ԫ||BdZ-"ux~` ='YYvn<]ntg7;klRb1M`FaΔwV"vv$!GkiQ;D7SMݯs5PBXX̜¢] &@V73M lďؤv2JFW fUqGn2ڏ[2Ԯ<\TԷG*ePB4 OnҕIZ /4,̞ {hsxQX4xE6`Rab&-8 #7S[IM;Oht*"]` M`~]uh/&@prQd#\H;3ayJM_etkp(~߼P 'C|r֥yq&Td s.w)e;5 2:hܯ<3PqI[o fQ7-9U7Jz=J8REu~^,ŰZzjJU7n):2Z[$ex<1i":bF)nnR%JsR{Gko\L!An:J?˳_CPw BB]%7jS%yؔa=49I?&7:RgFhE>ynsEz]v?Gm ^tw?wAQ%iWAXE–R (pj]"TtVqQu5p¦Qbw,@/hPA[<[Qр\Dc xG2_"]GVf֯c 70>O=)@<_˞3m>WP)UJxlO%VO#ML 6^pkϦ9bq; ) +ȯ` WiBTCi#׆dsy^xD9-^[I"A%7H?XQb+!U^?}oΑ":Q528-G-3ca U@`Lf!{pQ{692_\B.evmP &WVO!iS>dٯJώivsd"2nWX|ؙ*r`GѬjG&|{M&s80 /]s0iCGZ;[5ϧO. dHzw5TY _2{4TV雁iL&PF &4:9ɿFgdžNXCE[W ̮eu,C#L:^hBRb)k356U }]?^)cڳ~HV (Ի/t^n N8p,B-q_kﲽpKKEoKG^dϳ&jAWzl\ Npjo~lqŸ'Z%gːT=}VUGh3]~ 9t87~Z58hcծcѕ[z~ex R(>͹٩>>ٛ$?mkFbc§f9Q5|Ȋv7&'UMչ}4~ @@BQΡIӮ]ۛj+~x.G6m֪?S_5׆yd^ux0s%Tuxkiio'mdn3+O!O 9Na3QQ m)8o >74 $u#6eicAQxlwm6 (E](mWLz*ݫ3җtr>CLhNrLі3_ZALaBpycz7sɰw[wpɵ~u( @dGo)}AŰEIaLRbFAZ薝.acǻ<8->I~{jԕ(Z/ &4{l&$Kj3Nm5[N(bN ۳$ F9y8gNk)&ݧs/j.fu Cp jY+%,TnOܟܥΕ766 8.\s~N0B@0ƺyul|xmCK6^;wԄ< #Dא[iΜJє/͊q@ %I$ZP^¯BJ?=82wylCcWč{vV%O5# Pr+[躨vLG}'%B}1pttr-( FCfq;=)iˑMnsRdNhC<\g'WګG%b-5q?dV/9(v1GI@"#ց]8:Tr buq<p-P76?3,9¸cy`M`CJ5|RAot8M3&q' "=tnn®əlZF V hhvEPY~f5^08O8*{<u]xS rGq5&}6ف7$~$U3Kvpq7E嬀87oxZq(2Y1R}lUpeһe_428tCm5 B.JXM߸3bŃht9b(ZU;i|t;)m\aYP2зo_62~ NZ(Ij^"j1_qf Ly,_->jil>Jo P1]leM Jg< ~1#7 BY^=186t|]r SRͤvo] U}  r!R kĒQ $YLMf`uNs}CF\[S H`K;*gbԝ暪]C'F4Yϴ&%[ ՏP y|F-т<9̏l }m7Vi?UT˴q"@ 6g6mK^%'!\ CݬL`*Ǡi~J}^7EBPr%S!KyvFX!o2U׃R?dZ>. o142Sp{&[ELX!*Ҕ%:> "Nmbys?vSKW,M4@$8M F +: Mt;~DɩhƯ+8"A(זGH/kR*Cjy#yRC"2Un 5B/YsPW=W!(:Ҋ _+ڝO#cP#!F6k~D@lw )&~Tk390K]Pc!W+{Dz'LuWsf]*j,&ymiȟ̌ h3ऌ;[x7ʉueDBІFH+7!i>LhG sd 7z QjH"c7= hl\UaiUXqUE/6$lʩo 5B?dS{;7* Js,at1ݘsobX"@hRAM,OEe8tkn910վč{G  BtƊ\4= I 5a|jRqOk"xfP%_~3%pG)P/x-GNcیlwu YcrчxELDB ;Jų^5>=ev}cTԭ?DuwMJ"prʘbT paz/.jL*/)i6:qi5$ln)9DBP0&lUQ0{)uigB.E "CТшu0Kv?Z?=( @NyҮi4?K$t윧6L&}r`qq;vh9~EBl o͏pcO%jţ`BMl!d,СE(pEVV:흘$c| 9"CPq75u]|pmv/)>FLСC(mmkp3#%K/!Vf9СB(E_|˺"ݳoL̕SH  =tzRYֳ=HnW"B4 &O[TBC&?4^J0< r챞n }.CW&D`GDUj*;111F|k4&T؎3Bb"= [9YЮW%Oaُx($D/;a#+Txvo@D_^0LVyU~ SgI_x>s dL:QseS8V>'KG8 l**}g<J.*>fT> t|7gWLXt@hȑ;Qݰ=KWvDW/ E놘}¾ \9S{$Kj]T?6t[批ajl! g ߅%ouV93Ȑ?(2|ψŵ6&sh({gpCff붻tǩ)0!8vc,(h[crE>Ǡ@X>Aga8W 4}@gC@ܦKd.WV,0e*./>a񖪪 .;=22XD%,sXt;&)j8$)9Q Sd mqz|xɍ8i<6;ݭ[;#[ !qU^oQX9u%'ԤT`GU ,Ye-mw$+4~mqg` CT *7ys}_B8m0ϙ=EzHBRx ]8CB5n1LXaؽmm )&,Ȟ\ѡ$ |f`-×fsy1CȋShYh2ĄQLxtw 5;ua"[yToood TŔԚqE-HT6ܞSى8e*JfyE <6$pؓH7eb3W@&m`d6E] #Id,6"}(z6+LF*4ܻ|\v jQ*yиCS2ѧ< .3~-H4 ܄ew'9}0NA5uh5f:MgWӉ}J48-ǹ/Dn݌L)qfv„~0Dx[gx5H1*,[>I\ܹ~H55u[!G!-exj )&j)US읰 aw†_Ye+ YT~8Gvt?FD"F4Ax1h$=Ӹq|qf|71[rg'،F6wM Π881f1=gH OLjn!*ʈq)9=ƙL^rAU)-X [J\c0/g6Jn[<)dh܌90Of@nF%ʸ@~*Xy+.qy!wgq]%w+.0,6)`( U[[[qr$A#}Lcy#Qvr.k>Py>{{W:Ճ_3:HOrII}Tw 3i7m9e.>|SٓA@Rqe658t%T9z?FztH\q"~E^VNoҐԉ(wR^𶕔xț!v+< ].t[u8R'qK+ )´ׯgkEL&]I}/RYj~]zx;!wg4kxr|fq(_pգ%[2Q* qY.,A<Lͭς^WF{;mԐ@9sә5R\}c3f7~ ~ xi0dL<% e3`C,AyМ H}P.ʪL f\)k3Az8R3Z$a(_;;Dp݈I֪ *8q-Cc4$$Z>*ǣ>EmG{OPޮf$HȾ)Jm!*k%Pndx%?4cV#<%m:[};NΣ_%YoYAm6x, r\&%Qnё+Ml!‰{u^kr[aneos1H(\,?dgH%gl Ibr>'BWg.!_f}Z`*NROz"cC?3s2=̎" iPeh}yƞ2ǹ2"Qdn繯]S{(]AX_xuq{|tZ0+{C;]/{.eLz:Ϋҩ0D*x.Q깭K! j+q>G^ Ӊe$;/"9 鸹?q\s2Hzgo;sgh{w]K|v܂aA!JQg +{B 7aLk2'8HOwTc?ǧ5BXB?% NISEz! }mr$NM17P%q7IA9#GP|D@/@JjXD (*gJ<EK I0xOu᭞6= i@-F'{jzr[GQ=֗I1[@p!ϙ3gN /Ӭ0WgẈ7S&ԄnQl_ڤ Z|OgTg5qg[pS,}>47Zf1RIZ>I:^Il(\U#F knXFFQ5/ Qo'^t)ՓWMW~0™T]k{+z1&uJwX9H[o{O5&MvS&Φs4!6 ]ܲ2q:N9Tc&JD}]v`W ">m,mRXFǙ= e=öMgH85# +5.VǙb1Nh \]7κq֍Ց9V⢹Ȗ*3Q\UEN DJ (?aœAH8j)49d[*b/|z#UbSYzwP _ 18;%b'CbpXd3ADlJ/s7Zjd8s!g*k5HN3MݒѯNY*C|hI?|_A';МH"j 8A2%?4T \Lf΃SY%Hlv*A e>>7vUj*"=o$'\2Y8f #jnJ95_ltL߳k@<9dL5s cXzk lo6^]DhA8 >@SF=Lr{-"K%gE1z 6SNą&ԬK2+:Ѫ^DyDqsM W$qA)cAT?ЀUVM]v67%J B: n|w)x7MSnBX"7M8& a(y7z6NeU@q@ܻvigޛ(' )(|'UXKB4!ٗOj*+Q f-0h./zm$P1XPپJI> yiJmNmv9/8FN9.εv=LA]yBЩV3Eґ ;XN\&sH,QSV69NvV(1y?QfLE%Z#G~"hcNtn]ʺUm;!b2D2pɕǵ!r2 *G1f/$ɕ(IYۗjBX' rDFEX7Ur-Q号:nf-1}rbʀ)r稅Xڌ((ᐢyBe" TY#jan%3osc eIDIEa)'hĉa*kCjL.`x|ВP{W/th !dD_|3ij8"682޷ /<=rA>vŞ`;aMUXH'tRQjJAg{`5%Mŗ":>SÏR5!R=}bfweOϝd2yʷ lY턥ueZH0HTΗq;e*O.nyn5DHXj,q;LGrv""oqW/6O[HlI$}鎻Rlvȁg94fQ+%G 3%gxe@δ" o_ǑcAW=Dxa~r2 4 LGц)z MOȂ*&HUtՐ #=H"`ݶT=3B́mL K=KI>hW.Մ" 9oBc0|T,9۩S!^KY^y?%Kh+,׵.;0N΅wt'!cƧΩknZRGOnQ/02U*)ޮVؽtEXM;z2֊+ƍg3ֽO~!8kYESĸ\><7&ËW1+yP֯4=/ޫBby]^MEؕupho|Ėd"_X5gR.BTGN W R+C-(2yKx34_JrϕGerzH0ƼlX=5p>lv0`q]IjByzIGla%dQO?'=a}J޵;t-y|[/?nREg/@ ihu\GT~g s*Y*~m쉋J-Tu+z89s\g#g*Яh-ޔ~dlKsL a.,<_'W0f,m&=k+J=̣npm/XJ{n3zp']ZΧX2hҊhKx4V&Hݦ9 W-aiiV"|MNnˬ9km:5LZ>1N8gSuL?CCӏOiI³p 8"D~"FЃ }9rChn>M9|?/vdYi{:sQĂ&i߿F. o@+̜O鏄k)h4"nd +6p\`t\#q0SoۂlE'Ar,Vxh>7-%a, ʲEЯ9чPv8Մ!g+ n5zqi3jeG9[ xG +1lFw&5su@s.ٶOJ۟cR9f͗N;YasσBAjvrVmsvvN>12-ZMNV5&o*#gdku䬣f5Z5YGMv7+y\RgsT`hwu6%~LɶhodSDֱ)Wrt+/]:$ SyD9H-*c|gD8K1G*K_@yUmyj|DU_@ĉA`iqH9G*cSY`J(RtSXhL* + KܦxjAiH82d[N 4hd05~Jt< Vrr B,SNB8*o 9AMKCMΚ|,>u1_ č+9drȦ!U`@ͥ1!)&xA#˳8p 7wlJ&]lQs*0%ȸP|KAvxP| ħVmnQ'8@s%4NMt'#9:{-M줦rB晄"J |ӭzM@Ӆ)Fĵ0{ Ij>N c)ݞY:M~.j&`qs%fS=rzu cg?UPJ8k#EYbgj/)]]д@4#ZjrR&\WO+bѳ멯mqז=m4 1OM QO 9U0vB3 N c z;4i5(Rzeե\u ?ЁzZ9L䫘 DZO8<.HG 7N)ierFH=UxC;_/خn[n:S;/ &U0wpɀ7B$-ĖFmHJrQLoh+5H \JpV{}VDn4IVV,:6)ƧvS{]V( y2#t*Y ֣m;X( XT33s9g?#2jhRXr{%4( QQ6ef'/vQs0 e ,l 6B(4UHQ}f8KdhÍk|Jң<䁰͠TgQiXYf4mݨ5 Xoy<ߢjݩ&3Z}yB7AQ8QrLvȵ$*8bJY ~J#jf%Z9i^#m2sXlCAqx#Oj|wDޠ~x.yJ &%͜`ȁg1[(\h:h$/LVj97̔XZ+Yx+j-$ *6/Å/d7s]T|u=u?3[)#2!+oK:SD?R{/b2.S|An0e~`ևE'u:*a'S9SvjMcIU|A\NdS#7NMIy12gBCg+aqGŞP\SQx=)k4]DJglf"n2Cޠ)2sTɥj? =cJ~OUsNc[S)SbdދxN 4 Id"e?a[ޖ[\u:O|c.rn>M\yj6j ?c7iA[|MYt)<{]+hT!ҺDyr>Dks45[B◰GC"g|ڒq:%yy.6V򙁫^.X.Ư(%<}lVGl4G 7! G,Pu,JNV6ݿG"ZW OnᵟV&p^@HRK69s UtcJIQJVKp<{,ʶK.FMpNU׵OeLP4*˔CNsFZq.v1KA㠤2 e&ۼ4muKqFVUDnUA|"qQti"w\ڂu$if;.8EՆ~)n BCkwS{BÈC4XaGU/Il"l7Ew /yYjYdվ{_#3]V _c|_43UYXgc+ `(Re:l3;paj㞊@ULB"pAqILr!eѹOgTR[oM-}}p}1'{t֢X, YÖ෉ %HRy@H}+ OzKKX⏕95BZC-ClK.d_ϞF)#q&O-#ҋ'U kgH-yQUVB?j+fVZ}UUi`t~N8%@WzA{LrΥ܇9>#V.{-eXXm!+k<_opH!I׾#5sμs`p0SL"(S[ WsFͿ ֢C.Trl/0Muh1 Q")+)7zBb& z9H|nj"8l0C1絔;`ұQS]KsdX DtFs%Dˑzg|.PkN !E*IT6jNCBU l!!h-&2;_. GJEܤϗ|)&E R:z^$ 5SD9̟D6wi %GMh -bbx(e y8|wkY7R65RS!j8T糒fD؏)Cӧym0%y 訤lQ ux^% bZ"%Gț_}[`+T-jfgS`l3x$*X*d++f{h@Dȹ.~TIޏ3_mt@`ϭ7):;GΆZ7%*4%/:,ױNHgD]ox r'OI9VRڭK5'KAa5tO\m5tܙocGSId`DČnR~[9\I-1%78 N-fSspp"(xcYbn>A>SU| a6MܿkGV8@)XQ7,!gAVr0)y#͉bVt0' qQHфqf.$5: r~z晞>tbrT&!5@q}![4Q d4_7Oxanc}%o#0%)Vij6Hl?B[YH#ҝcRE=-.?JM3MQJtIl&ϷF(ިL,GBje;I !k`%ټ@JBh=f3IGY͌qHLV#.wTe$/AQYƻKkڹ"5_[JJ}]DV[1˙_r䕡7 lJzSZl3y4˿TOΒ:ZxRf&"y~MYKDz_rS7?Y/lWݍ=Pl$ӝF]-fFت°Yd!*VQoTJ8%=RYm90Bkhzڕ~ӏ9VW[d:CW'*qx9e]O[3Gci9v>. /?6yBx^cd+6jH GfNЮ`_)6S:ǛXMT:7 1r0nͣL CaǷ]sM3<`'3Hk7"+X󤴹%Km#Ӽ a-% IDAT͠X:] 5m{ʫ{(fݯwOej̷-['ΟghPkɋR8 <>0)_fUUɁ3["1qf76Gib"gsmH`WSd1::m{9OԣMf=BP53ӕ%gݛ]Ƿ`D/=nT Ssij>bW@wm 5r)RdO%4:M3?fk5u[6wVE8&7 Z{9_ÉD7Nztq^򙥐x/Nf0ÌCZSllF#GS5u{?bƁkQeVxnw{4׶PslmST2?R:+IZ\r <{yHnD#k;PH ;S&$Q{oFIGL6U R~h:æSmԴęf?.5oԄ0 ^5C6 GfGٰ& ؿ5s9c@]~)'lR <;TziUnq,jZ[{CW+qb/-W@Yck  B"j~6xEs* Ͷl/dg+wvoV յ:jQd˶Q&YG͚kqY7Z5YGͺVGͺVͺVYYZ6Z]ͬ@|vBy<*yC'#?Ň`f1h P }lV|J} XjRVUUq#ƕOpʏe[6-O]*/0Vf[bʸ)1C%bcUSBl rbdj(O},&b\/!q~ z̲'bbʫ,11Se2?!SROˠɕqCBL1XqrشpCO*0hq%"8lrϷ!uGmqvb 2RfsjUeeSB@*0%>XBb"&s  A3UhwA˥ ;K-UY $tHU͸ƍ=$Fbq8l~nCێeUN Jݔ]1.8;kSUeeDL\yehUU\Y X*+OADzG.]ZY<&>D1ИnC:lֵk<ע* f]k6RR]囂ku퍶'dd͂uT!dnF0}8:; Pj<ue[c+Ouēw :<7Tӵ9fnR[c>ljl:L)ljisMTb!l6_ϱikf#Zwy_f/fFy䰄oP՜2un &{uO9R6#5uпmbsfDZ~V&,\◤uZC;c:|;rZLxVc,jQPb{pزd* ls~kn;/.-y]cm IM|.vmmM _GF< {+Fq)w2ņFg쌡¥y-Bx \vQ3{u?L _͌; 22N6Coq0ҦGм빅Х}&O/!1|=muV߽l~?e5>U6(|ĖiL\lm/W[W؜ǃ]w.&.BfzQMEzN3`D@G1mV?$*y}`ҴYc/\jUov~:8vtoWFty]p/:6OBbWƋ/]F5x]lR\=6PG̽5-DKzX-B3W&<3ܽtѦQ nьW\ryJ4H%zC'a(W`e})s}.*o+_=śɷ}^$ިElkI{o@/wX[;ƭ5l?tX4gx{*z5^7WDل28WK?A#k̽l5y I7 ;9 ٻ[zn8~{N0.&~vg>"GPBy-}Lai+{zAJ#~x;M2E{>DZx|;[ixTHۍ{vnpeo.Dw8OΛ{&܍cDHM,Vn\pxFwI-}dh1II_FZssV݋BW"6[z7G~kRNv_O^z%zУs/4Nf5>@-b3S))*Б߁^U>R}¶n aYwt2槉fJ呯 BPhqYtVW6=kǥ%mrKwZx6zڮݽ/fb-v&68I 6W>BA E.A0%5cWg>>gHAkb.H;x4#\Ou\ޥE%{Zx;]43rD | !Q^(Y? ѼA&c+QDnpSeҝ 7bB{rt %&s=^Ѭ5/4nU}˥ݛ/MсvR s0yhA1>Ãd 9HMI YЊ NN{1hR-b T[mQl#b^ZlpzuM }sP؜$13>ƹQb& D`ay kN󑰹 N^ЌƷE_]#㖊}L߯\Y;j{n;e5,el* h=M#?]v-ʧ(k]#휅M O=kA@q m]"W.Tw\Ӹ2xXĽ=ɳmlNB~2[܉{݋-%ŵ!zOKO{? Տe\hSګmoYt{ߐn!ùk-<"F}u)^_]=Yå {꽾ֱ9X^S4hKwF~YOc<.O,job2.ݣ75]g:Ua0UtŸt ߌ#>M#"-6YuL( Guaث9an_~Rs,tX//#8O;DUr+SМ!M<.K,Iq;^x=A2IFBx^?N\wUG$ ={> !lQ}T9*bb|Ls WmV-AʹZft2+wvZŏ_#k/EHn"\znݍ\ɫylaٔ;,H_X)iCmÖ|)^Ź2h˾}aZ=_nƢ抴Em*hmbILs1N9-Ӈ.N+ktԺCHI?ꢦQmy1qƭ 1ѷxvhUSC[5BmK_{5-Z!ڧпlYRV؄WyH±>M9t $WeD8iTmBGUB0y64qu5ZDRlxpF9ZCKiH=ygٟϠn\桹$=-gG;8[v&h \x6B]Cu=~}Y x,Z& pNI9-skazIdϞ@3FB 𒺿Vs>uMkSŽt{e]-F)p͓m7`{͚f0;&UT:ەĵaMu9o9ip Xi7VFƏ|97ꍱU_!96g}De _Ag?G\u#*Ͻu[\mTtaM} ?O28qJǫuZz v,{$͎$\]0h|&WPy7vESU?JtmLѰTvsgNQ3"={.0D@4W1tFψ>iGr .lyWKRra{_ iW\w'5 .%/yhڏQ׏߲_^)hk=3ɟ  WB,]M?[ vcŹPې46&?aAXX'}85|qȭ̸Ɨ*u-+,FYkbqE]roFr-c~Sk}/Ǭ"`c"X)=pɫBwhokk rʑG_6=֞z.kUdϓ}b5V9/vY߳(rղ(|lZXI1%E"rخo箩]3f$ZAܷ2Xߞsd|hCvRy~K:~6uKgW1OYyߩA;tt`%;ׯJK̘B"B)ӡm4#p  `h_g;ˆ.kYH'+m}}[W![Z){zB['Ozg@bg/(+Mrδ|DQ)gc/6>_s؜e>&ۯ o畑pPXfQz*8ͷi_>.%KuT:t~Q s%wkI_?OMh/*6^mU%9l~^Df1vݜ v H}45lJf̢6Y{F 糿*>EotCJ;P-g ᮀgjĂ#N}=g<՗Nt,gSP|לOL5,PmFdO>x͞Hpc>cmGQ]ʋB ]}xKޖzkĶ.w/vq/2]DttaiV{ 3)@Rq5鴚6y>iE;=lpx% yBoz$pHQ:v˝n"Ao;=7z~OۼO{X#|r-([9࿵ר r;P-;6̚3g ~ggh>oUFIؚNJ[y~Ʈ=0s]VRbsY5dvwFJvrZFVx\58:v:NYoF;gjaW%] ^y!u3þJ7,0yDthh[_aYT]>d8Va@M ɟzW˦pص頽_t!e}<-̜94>(ip{t3KE~e=l};c0o'HԲm=TZyf bk3>K~[6> ZTC4` Ez3:xܙҸYaPڲr@˳kܵ/cB7gd9K_'rJ[j Nr~OV{ClzߣiZ #Ҟ<^/E<F0}VMg;Z}֚{ j 㧉Ms& 6{*2p*B<+ڜM s2rM=k16[ER W> -~w` kb\&_ozG-asv[4vGHfd%!{48`bSRPW'H-<jcE](t}F_W~o|h$֔t6۫ `3iĈ6LXPPy;+a è!@- N/KDmaœj;J#~\)B]!{ܷY^u N/Y;zV2J7vdB@a@ nE5v=/vND >qn*ɪ2g'Ϳ?"';EFSAbK~-(7-w%/bm񺓾Z =|zIv:Χ^5~c3R|1q؎$2 eE2:5M84@cqo38+O.Yr: z/5n =+o]_l^›&@K;#Y&΋gxB #cnx4|؉cڸEe~ߨFwK^~ugT*(9Fkk=z=RcT?i$@7͇xeh2b/LтߪU&j"mi,G}jDAm"B/ m_ў$`7z9fw+Fޚ3mϾYlCr je|gH11V2F' a#VښaI;C*|]N+ws 9z;P֙ /Dz[ݎ::bɏQl.ϱ`p_ļ儚gưtJ"i6\\+p )׋pڃ V`ǯlXur}>۱ b_̷C?3&_1l>d,s1=Ԧ4Jo⁆ }p̘@cjBuy,>hݺ/&߾g}}hBX/юC5Kmcד83~rtC҄Hc*;WOw >38#O3Fh(y_u|Y$[OeQ\;B5\׿\~WjZ ;.o/CJXTOO*aN$\mrj 5`3jsuKٲyMޥ/ᘢ'}|& [lŶ^ڜԵd{Inwyl&/aM345`enZ]|&F+H8`6@m ߴis[{} (oZn-l1;nσ[{K2,JH(DwU0ٛbRMIвjͪ{!'8 J24x:ξ .536zH>|!N(WkjVY:S+VH lGC/jUtl>jnp۔BcEGnZ,E}UvLXf]|ҏҀ󲣍nӐ =8ޚۋ\iTx E}i.aauzdcO:DNRAzؔ0ڛ N2s`?]}VG҃"$ٜd8bHs:Kg Zp؝~EZW.788XBnCZK}Q/gQ*2#?\|_8Hɬf_:uh2DYKO_4eAg5I&ʐ}3g7ӻ~t!`==i?z5t|e-X$Fw4Id={3/T4+ibf`,hc]xHfq5a9@sVLٗ;l?Xv?)좄{ $:R<z9x>JXҌфFT.OƏn{PF<6MTk3)UChv$F3@v69%aMY<ėiA`=Me4x}~VƐ(جi[7$H rC(dF3/U+׍ۆcݟn8mQ+)|r^=1|~X6/ g=WJ~S [븸KI?~6`{kSvLx&:q'NgfMo  (*gL Bӳ zoHh#[ZIoO7rR kqeݘ-amCvPfmG&K#p~bs`ebw$HQZljmPmpVIپHn1X7z",+:f 8{+qO xZEϠX䪭ۗ?١ K)v=~ziA0dx{c}p5:cq!=+vl9_C`,ca]Ċzl?j$D ^1af=/8O"ymsϧ\2.泘|?"ӜTVW1hHR!߮!θUN 5V0l äY$N_!O++TNZ7<.pY9!sERUc6AۓyJ'{[[ M뒁78t7oN G/d*Z^ƹٝ#*/nR3#iE"LJľM?iLb|l8/'X(pbgzyPzYaƍrMb#wx}J岄E kE2:H:S,|K0%@|8U&8Ы,¥||li|ͅnod ~JD> {f6!!" qCyCԏVgǖ/ՠK~ʡFz}Hfw_'\ k9|&[Z;ӹ4 C&]NTmpG|wRM>ކw'PpI'}blMtq$@%/weDaټ&MhRܺ)49`yoJCڇqxe%^RC&% Q1yZV/  ȅ\Th< 2 []&M`9~I{G/]$nX#}*oqrm$zǦ4p(!2v,5.,,a$1l _.[I-푉iHg%^9, q~p㔎vle;ܦԣ@'Wev[/gU uaJq2k柣mhhrr@@YY,}tWdG=PKA Ҫa4q(u/3PXei$wf/| {Auhۣsi/`+l>Acfff!uix&Uoc1QFAbsӴh:omySޏ=n#dY1R, % -! fu!Y%d)BQ*;K=MfUZ cCE0X`tlB~͈{xX90%\Vp,FJ=ǯiH53JZy=Pl0ι^zդ,w-^bbݺPݭ6 Z;[/sX!U B466\!N143jթa e.(cXc)54Y,v{ˉ& hh%ѣncny؄"fPo击+,~ClެWӥ *;g\af3T@Jcw7~yUsz$;U@Tt8b &,066BN}S7ޘ,be,c%}1]ȑ ]zHϾmYL"疱>ؤj[- rɎw)c`d3K3/\bzSs tX#l}A06q xeC{LZv.8ȯn#iWacvh/ڃd.5g%7V&)|J@'XѯicaSThPl^]sZc0r͇ I涙2ݲacbCbsP͈ }+L32 uQFhfvxe2 J /P+wu}"N>^]fX9A<9!u@yfKs7239ᚃ'5dž E_Dim(y`1~̨=_@&A? oχ?/0S4ƞv~9#!s@װOpLcoCy#Bq"$=Zlڛ/~j[;Aˆ~ka\peQ _ܓM힅y`UԶLPޱMx2U_'xlMCf xl"8OOǦ)Ҟkc' and licensed under the * MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ /** \mainpage Geodesic routines implemented in C \author Charles F. F. Karney (charles@karney.com) \version 1.52 The documentation for other versions is available at https://geographiclib.sourceforge.io/m.nn/C for versions numbers m.nn ≥ 1.28. \section abstract-c Abstract This is a C implementation of the geodesic algorithms from GeographicLib. This is a self-contained library (requiring only the standard C math library) which makes it easy to do geodesic computations for an ellipsoid of revolution in a C program. It is included with version 4.9.0 of PROJ and later. It uses ANSI C99. \section download-c Downloading the source The C library is part of %GeographicLib which available for download at - GeographicLib-1.52.tar.gz - GeographicLib-1.52.zip . as either a compressed tar file (tar.gz) or a zip file. After unpacking the source, the C library can be found in the directory legacy/C. The library consists of two files geodesic.c and geodesic.h. The library is also included as part of PROJ starting with version 4.9.0, where it is used as the computational backend for geod(1). Instructions for how to use the library via proj.4 are given below. Licensed under the MIT/X11 License; see LICENSE.txt. \section doc-c Library documentation Here is the \link geodesic.h application programming interface\endlink for the library (this is just the documentation for the header file, geodesic.h). See also the documentation on the structures geod_geodesic, geod_geodesicline, and geod_polygon. \section samples-c Sample programs Also included are 3 small test programs: - direct.c is a simple command line utility for solving the direct geodesic problem; - inverse.c is a simple command line utility for solving the inverse geodesic problem; - planimeter.c is a simple command line utility for computing the area of a geodesic polygon given its vertices. . Here, for example, is inverse.c \include inverse.c To compile, link, and run this, you would typically use \verbatim cc -o inverse inverse.c geodesic.c -lm echo 30 0 29.5 179.5 | ./inverse \endverbatim These sample programs can also be built with the supplied cmake file, CMakeLists.txt, as follows \verbatim mkdir BUILD cd BUILD cmake .. make make test echo 30 0 29.5 179.5 | ./inverse \endverbatim Alternatively, if you have proj.4 installed, you can compile and link with \verbatim cc -c inverse.c cc -o inverse inverse.o -lproj echo 30 0 29.5 179.5 | ./inverse \endverbatim If proj.4 is installed, e.g., in /usr/local, you might have to use \verbatim cc -c -I/usr/local/include inverse.c cc -o inverse inverse.o -lproj -L/usr/local/lib -Wl,-rpath=/usr/local/lib echo 30 0 29.5 179.5 | ./inverse \endverbatim \section library-c Using the library - Put @code{.c} #include "geodesic.h" @endcode in your source code. If you are using the library via proj.4, change this to @code{.c} #include @endcode - Make calls to the geodesic routines from your code. The interface to the library is documented in geodesic.h. - Compile and link as described above. - If linking with proj.4, you might want to check that the version of proj.4 contains the geodesic routines. You can do this with @code{.c} #include #if PJ_VERSION >= 490 #include #endif ... @endcode - You can check the version of the geodesic library with, e.g., @code{.c} #if GEODESIC_VERSION >= GEODESIC_VERSION_NUM(1,40,0) ... #endif @endcode \section external-c External links - These algorithms are derived in C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43--55 (2013) ( addenda). - A longer paper on geodesics: C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011 ( errata). - Main project page - GeographicLib web site - Documentation on the C++ classes: GeographicLib::Geodesic, GeographicLib::GeodesicLine, GeographicLib::PolygonAreaT. - The section in the %GeographicLib documentation on geodesics: \ref geodesic. - git repository - Implementations in various languages - C++ (complete library): documentation, download; - C (geodesic routines): documentation, also included with recent versions of PROJ; - Fortran (geodesic routines): documentation; - Java (geodesic routines): Maven Central package, documentation; - JavaScript (geodesic routines): npm package, documentation; - Python (geodesic routines): PyPI package, documentation; - Matlab/Octave (geodesic and some other routines): Matlab Central package, documentation; - C# (.NET wrapper for complete C++ library): documentation. - A geodesic bibliography. - The wikipedia page, Geodesics on an ellipsoid. \section changes-c Change log - Version 1.52 (released 2021-03-13) - Be more aggressive in preventing negative s12 and m12 for short lines. - Initialize reference argument to remquo. - Work around inaccurate implementation of hypot with Visual Studio (win32). - Version 1.51 (released 2020-11-22) - C99 is now required, so there's no need for private implementations of various routines now defined in math.h. - Version 1.50 (released 2019-09-22) - Allow arbitrarily complex polygons in geod_polygon_*. In the case of self-intersecting polygons the area is accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. - Workaround bugs in fmod and sin in Visual Studio 10, 11, and 12 and relax delta for GeodSolve59 in geodtest (tagged v1.49.1-c). - Fix bug in geod_polygon_addedge which caused the count of pole encirclings to be wrong, sometimes resulting in an incorrect area if a polygon vertex had longitude = 0 (tagged v1.49.2-c). - Version 1.49 (released 2017-10-05) - Fix more warning messages from some compilers; add tests. - Version 1.48 (released 2017-04-09) - This is the version slated for the version of proj.4 after 4.9.4 (tagged v1.48.1-c). - Fix warnings messages from some compilers. - Change default range for longitude and azimuth to (−180°, 180°] (instead of [−180°, 180°)). - Version 1.47 (released 2017-02-15) - This is the version incorporated into proj.4 version 4.9.3 (tagged v1.46.1-c). - Fix the order of declarations, incorporating the patches in version 1.46.1. - Improve accuracy of area calculation (fixing a flaw introduced in version 1.46). - Version 1.46 (released 2016-02-15) - Add s13 and a13 to the geod_geodesicline struct. - Add geod_directline, geod_gendirectline, and geod_inverseline. - More accurate inverse solution when longitude difference is close to 180°. - Version 1.45 (released 2015-09-30) - The solution of the inverse problem now correctly returns NaNs if one of the latitudes is a NaN. - Include a test suite that can be run with "make test" after configuring with cmake. - Add geod_polygon_clear(). - Version 1.44 (released 2015-08-14) - This is the version incorporated into proj.4 version 4.9.2. - Improve accuracy of calculations by evaluating trigonometric functions more carefully and replacing the series for the reduced length with one with a smaller truncation error. - The allowed ranges for longitudes and azimuths is now unlimited; it used to be [−540°, 540°). - Enforce the restriction of latitude to [−90°, 90°] by returning NaNs if the latitude is outside this range. - The inverse calculation sets \e s12 to zero for coincident points at pole (instead of returning a tiny quantity). - Version 1.40 (released 2014-12-18) - This is the version incorporated into proj.4 version 4.9.1. - Version 1.32 (released 2013-07-12) - This is the version incorporated into proj.4 version 4.9.0. **********************************************************************/ GeographicLib-1.52/doc/geodesic-for.dox0000644000771000077100000002204514064202371017647 0ustar ckarneyckarney// -*- text -*- /** * \file geodesic-for.dox * \brief Documentation for geodesic routines implemented in Fortran * * Written by Charles Karney and licensed under the * MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ /** \mainpage Geodesic routines implemented in Fortran \author Charles F. F. Karney (charles@karney.com) \version 1.52 The documentation for other versions is available at https://geographiclib.sourceforge.io/m.nn/Fortran for versions numbers m.nn ≥ 1.28. \section abstract-for Abstract This is a Fortran implementation of the geodesic algorithms from GeographicLib. This is a self-contained library which makes it easy to do geodesic computations for an ellipsoid of revolution in a Fortran program. It is written in Fortran 77 (avoiding features which are now deprecated) and should compile correctly with just about any Fortran compiler. \section download-for Downloading the source The Fortran library is part of %GeographicLib which available for download at - GeographicLib-1.52.tar.gz - GeographicLib-1.52.zip . as either a compressed tar file (tar.gz) or a zip file. After unpacking the source, the Fortran library can be found in the directory legacy/Fortran. The library consists of the file geodesic.for. The Fortran-90 interface is defined in geodesic.inc. Licensed under the MIT/X11 License; see LICENSE.txt. \section doc-for Library documentation Here is the \link geodesic.for application programming interface\endlink for the library (this is just the documentation for the source file, geodesic.for). \section samples-for Sample programs Also included are 3 small test programs: - geoddirect.for is a simple command line utility for solving the direct geodesic problem; - geodinverse.for is a simple command line utility for solving the inverse geodesic problem; - planimeter.for is a simple command line utility for computing the area of a geodesic polygon given its vertices. . Here, for example, is geodinverse.for \include geodinverse.for To compile, link, and run this, you would typically use \verbatim f95 -o geodinverse geodinverse.for geodesic.for echo 30 0 29.5 179.5 | ./geodinverse \endverbatim These sample programs can also be built with the supplied cmake file, CMakeLists.txt, as follows \verbatim mkdir BUILD cd BUILD cmake .. make make test echo 30 0 29.5 179.5 | ./geodinverse \endverbatim Finally, the two programs - ngsforward - ngsinverse . which are also built with cmake, provide drop-in replacements for replacements for the NGS tools FORWARD and INVERSE available from https://www.ngs.noaa.gov/TOOLS/Inv_Fwd/Inv_Fwd.html. These cure two problems of the Vincenty algorithms used by NGS: - the accuracy is "only" 0.1 mm; - the inverse program sometimes goes into an infinite loop. . The corresponding source files - ngsforward.for - ngsinverse.for - ngscommon.for . are derived from the NGS source files - forward.for, version 2.0, dated 2002-08-21 - inverse.for, version 3.0, dated 2012-11-04 . and are therefore in the public domain. \section library-for Using the library - Optionally put @code{.for} include "geodesic.inc" @endcode in declaration section of your subroutines. - make calls to the geodesic routines from your code. The interface to the library is documented in geodesic.for. - Compile and link as described above. \section external-for External links - These algorithms are derived in C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43--55 (2013) ( addenda). - A longer paper on geodesics: C. F. F. Karney, Geodesics on an ellipsoid of revolution, Feb. 2011 ( errata). - Main project page - GeographicLib web site - Documentation on the C++ classes: GeographicLib::Geodesic, GeographicLib::GeodesicLine, GeographicLib::PolygonAreaT. - The section in the %GeographicLib documentation on geodesics: \ref geodesic. - git repository - Implementations in various languages - C++ (complete library): documentation, download; - C (geodesic routines): documentation, also included with recent versions of proj.4; - Fortran (geodesic routines): documentation; - Java (geodesic routines): Maven Central package, documentation; - JavaScript (geodesic routines): npm package, documentation; - Python (geodesic routines): PyPI package, documentation; - Matlab/Octave (geodesic and some other routines): Matlab Central package, documentation; - C# (.NET wrapper for complete C++ library): documentation. - A geodesic bibliography. - The wikipedia page, Geodesics on an ellipsoid. \section changes-for Change log - Version 1.52 (released 2021-06-22) - Be more aggressive in preventing negative s12 and m12 for short lines. - Version 1.50 (released 2019-09-24) - Allow arbitrarily complex polygons in area. In the case of self-intersecting polygons the area is accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. - Version 1.49 (released 2017-10-05) - Fix code formatting and add two tests. - Version 1.48 (released 2017-04-09) - Change default range for longitude and azimuth to (−180°, 180°] (instead of [−180°, 180°)). - Version 1.47 (released 2017-02-15) - Improve accuracy of area calculation (fixing a flaw introduced in version 1.46). - Version 1.46 (released 2016-02-15) - More accurate inverse solution when longitude difference is close to 180°. - Version 1.45 (released 2015-09-30) - The solution of the inverse problem now correctly returns NaNs if one of the latitudes is a NaN. - Include a test suite that can be run with "make test" after configuring with cmake. - The library now treats latitudes outside the range [−90°, 90°] as NaNs; so the sample programs no longer check for legal values of latitude. - Version 1.44 (released 2015-08-14) - Improve accuracy of calculations by evaluating trigonometric functions more carefully and replacing the series for the reduced length with one with a smaller truncation error. - The allowed ranges for longitudes and azimuths is now unlimited; it used to be [−540°, 540°). - The sample programs, geoddirect and geodinverse, enforce the restriction of latitude to [−90°, 90°]. - The inverse calculation sets \e s12 to zero for coincident points at pole (instead of returning a tiny quantity). **********************************************************************/ GeographicLib-1.52/doc/geodseries30.html0000644000771000077100000120361314064202371017752 0ustar ckarneyckarney 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,
Algorithms for geodesics,
J. Geodesy 87(1), 43–55 (Jan. 2013);
DOI: 10.1007/s00190-012-0578-z (pdf); addenda: geod-addenda.html.
// Generated by Maxima on 2012-10-19 10:41:58-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 - 3/4 * eps^2
        - 7/64 * eps^4
        - 11/256 * eps^6
        - 375/16384 * eps^8
        - 931/65536 * eps^10
        - 10143/1048576 * eps^12
        - 29403/4194304 * eps^14
        - 5705271/1073741824 * eps^16
        - 17892875/4294967296 * eps^18
        - 230480679/68719476736 * eps^20
        - 758158843/274877906944 * eps^22
        - 40605577103/17592186044416 * eps^24
        - 137919912459/70368744177664 * eps^26
        - 1897157659375/1125899906842624 * eps^28
        - 6593830148475/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 - 4/15*n + 8/105*n^2 + 4/315*n^3 + 16/3465*n^4 + 20/9009*n^5 + 8/6435*n^6 + 28/36465*n^7 + 32/62985*n^8 + 4/11305*n^9 + 40/156009*n^10 + 44/229425*n^11 + 16/108675*n^12 + 52/450225*n^13 + 56/606825*n^14 + 20/267003*n^15 + 64/1038345*n^16 + 68/1324785*n^17 + 8/185185*n^18 + 76/2070705*n^19 + 80/2544009*n^20 + 28/1031355*n^21 + 88/3728745*n^22 + 92/4456305*n^23 + 32/1761795*n^24 + 100/6225009*n^25 + 104/7284585*n^26 + 12/941545*n^27 + 112/9803145*n^28 + 116/11282865*n^29)
        - (1/5 - 16/35*n + 32/105*n^2 - 16/385*n^3 - 64/15015*n^4 - 16/15015*n^5 - 32/85085*n^6 - 112/692835*n^7 - 128/1616615*n^8 - 144/3380195*n^9 - 32/1300075*n^10 - 176/11700675*n^11 - 64/6653325*n^12 - 208/32566275*n^13 - 224/51175575*n^14 - 16/5191725*n^15 - 256/115256295*n^16 - 272/166481315*n^17 - 288/235370135*n^18 - 304/326481155*n^19 - 64/89040315*n^20 - 112/199280705*n^21 - 352/791736855*n^22 - 368/1035348195*n^23 - 128/446125645*n^24 - 16/68475099*n^25 - 416/2168378135*n^26 - 432/2722006595*n^27 - 448/3388620455*n^28) * eps
        - (2/105 + 32/315*n - 1088/3465*n^2 + 1184/5005*n^3 - 128/3465*n^4 - 3232/765765*n^5 - 1856/1616615*n^6 - 6304/14549535*n^7 - 65792/334639305*n^8 - 288/2860165*n^9 - 25664/456326325*n^10 - 34144/1017958725*n^11 - 73856/3506302275*n^12 - 281632/20419054425*n^13 - 10048/1074687075*n^14 - 28832/4418157975*n^15 - 20992/4494995505*n^16 - 48416/14176524285*n^17 - 747072/293506558345*n^18 - 175712/91088242245*n^19 - 204928/138101528565*n^20 - 11296/9764754545*n^21 - 104896/114923649645*n^22 - 1558112/2140064719065*n^23 - 118016/201202665895*n^24 - 80032/167832467649*n^25 - 450112/1151408789685*n^26 - 2520288/7803992907865*n^27) * eps^2
        + (11/315 - 368/3465*n - 32/6435*n^2 + 976/4095*n^3 - 154048/765765*n^4 + 368/11115*n^5 + 5216/1322685*n^6 + 372208/334639305*n^7 + 13184/30421755*n^8 + 29008/143416845*n^9 + 15459424/145568097675*n^10 + 24876368/410237366175*n^11 + 107584/2917007775*n^12 + 8182096/347123925225*n^13 + 1076896/68682273975*n^14 + 5572816/516924483075*n^15 + 419584/55049100795*n^16 + 3975824/720425188665*n^17 + 32325856/7924677075315*n^18 + 4950032/1612380184155*n^19 + 10050752/4281147385515*n^20 + 29925872/16434081899235*n^21 + 6663008/4657787917965*n^22 + 141444848/124429477237065*n^23 + 408253312/447273526284585*n^24 + 27307792/36907885385721*n^25 + 261022112/431449322191965*n^26) * eps^3
        + (4/1155 + 1088/45045*n - 128/1287*n^2 + 64/3927*n^3 + 2877184/14549535*n^4 - 370112/2078505*n^5 + 3369088/111546435*n^6 + 6158272/1673196525*n^7 + 1772032/1673196525*n^8 + 582592/1386362835*n^9 + 69229184/347123925225*n^10 + 479862464/4512611027925*n^11 + 13232896/214886239425*n^12 + 487333184/12843585233325*n^13 + 4097514368/166966608033225*n^14 + 2215403584/134228057438475*n^15 + 22961152/2002940359695*n^16 + 7455695168/911337863661225*n^17 + 3709076864/620766370899675*n^18 + 552729152/124153274179935*n^19 + 7124808448/2110605661058895*n^20 + 23396048576/9000398853481035*n^21 + 353516672/174201268131891*n^22 + 58336832/36371693346219*n^23 + 417179454976/325466035959749685*n^24 + 333125284288/321947484219644283*n^25) * eps^4
        + (97/15015 - 464/45045*n + 4192/153153*n^2 - 88240/969969*n^3 + 31168/1322685*n^4 + 11513072/66927861*n^5 - 90038048/557732175*n^6 + 56656/2028117*n^7 + 11176576/3234846615*n^8 + 1514798224/1504203675975*n^9 + 364902368/902522205585*n^10 + 875443216/4512611027925*n^11 + 1163297728/11131107202215*n^12 + 65826704/1077203922795*n^13 + 260103719072/6845630929362225*n^14 + 44215340656/1784012908864095*n^15 + 290929029376/17315419409563275*n^16 + 100721472976/8566575918415515*n^17 + 14151520/1674794900961*n^18 + 65554773104/10553028305294475*n^19 + 104193472576/22372420007224287*n^20 + 927092143568/261011566750950015*n^21 + 282176032480/102604546929683799*n^22 + 421431700016/195279621575849811*n^23 + 34028203613312/19853428193544730785*n^24) * eps^5
        + (10/9009 + 4192/765765*n - 188096/14549535*n^2 + 23392/855855*n^3 - 2550656/30421755*n^4 + 44131552/1673196525*n^5 + 257683264/1673196525*n^6 - 31240736/210054975*n^7 + 451386112/17289697425*n^8 + 14726527328/4512611027925*n^9 + 4331513024/4512611027925*n^10 + 12975935008/33393321606645*n^11 + 31373075584/166966608033225*n^12 + 698039074144/6845630929362225*n^13 + 29703628096/494726268844665*n^14 + 1005634034464/26760193632961425*n^15 + 341277050932736/13835020108241056725*n^16 + 2337486955424/138945682579178475*n^17 + 5486091652672/463373879223384675*n^18 + 110047548877984/12864141504153965025*n^19 + 207975286912/32900617657682775*n^20 + 116341576864/24429654030877095*n^21 + 3202897200884032/877781898983444900445*n^22 + 5239237147019168/1846368821999659963005*n^23) * eps^6
        + (193/85085 - 6832/2078505*n + 106976/14549535*n^2 - 26672/1956955*n^3 + 521792/19684665*n^4 - 130524976/1673196525*n^5 + 3724256/135917925*n^6 + 3355734064/23876248825*n^7 - 9928194688/71628746475*n^8 + 649052336/26389538175*n^9 + 27235216864/8787716212275*n^10 + 1802925232/1964313035685*n^11 + 56875960256/152125131763605*n^12 + 89961920528/494726268844665*n^13 + 834516960736/8410346570359305*n^14 + 12897954159632/219603493781604075*n^15 + 188320698409216/5097112671457231425*n^16 + 2360065137403504/96845140757687397075*n^17 + 9522329813406688/570310273350825782775*n^18 + 1062828903347216/90048990529077755175*n^19 + 44538234246208/5200397629338836925*n^20 + 15623861307536/2458772826284159385*n^21 + 1934793328169696/402591698030001044565*n^22) * eps^7
        + (632/1322685 + 3456/1616615*n - 517376/111546435*n^2 + 27264/3380195*n^3 - 13728256/1003917915*n^4 + 337485952/13233463425*n^5 - 3335807744/45581929575*n^6 + 5933931904/214886239425*n^7 + 773057536/5945469075*n^8 - 2417337857408/18551845337025*n^9 + 35074718464/1504203675975*n^10 + 122682333568/41488672299165*n^11 + 5759356066304/6541380665835015*n^12 + 21217115597696/58872425992515135*n^13 + 6327384910592/35935117164262485*n^14 + 45144358136704/467850921534721725*n^15 + 168307641997312/2934701235081436275*n^16 + 114971778089344/3174268682843186175*n^17 + 279118225250048/11638985170425015975*n^18 + 2565033841015936/155539165459316122575*n^19 + 22281895799258624/1904621101567852142475*n^20 + 499531826463207808/58644190679703485491635*n^21) * eps^8
        + (107/101745 - 4976/3380195*n + 582496/185910725*n^2 - 88112/16787925*n^3 + 241875008/29113619535*n^4 - 60768482384/4512611027925*n^5 + 110550963232/4512611027925*n^6 - 103976595664/1504203675975*n^7 + 80357441408/2929238737425*n^8 + 6763222232848/55655536011075*n^9 - 67861105568/550247643225*n^10 + 2212522672/99570961035*n^11 + 3295501210304/1163486679693975*n^12 + 901465527762928/1064232316018542825*n^13 + 6742139143828448/19369028151537479415*n^14 + 16530402013984624/96845140757687397075*n^15 + 12353373376796416/131610063080959796025*n^16 + 95765418832375792/1710930820052477348325*n^17 + 60673550827813472/1710930820052477348325*n^18 + 81981470164643248/3480859254589522881075*n^19 + 4349006711700386752/267723479189950694635725*n^20) * eps^9
        + (1270/5148297 + 1376/1300075*n - 9664/4345965*n^2 + 2352160/646969323*n^3 - 1466054528/265447707525*n^4 + 1074734176/128931743655*n^5 - 129362368/9831396575*n^6 + 262162305568/11131107202215*n^7 - 38465435392/585847747485*n^8 + 267247345312/9878255309325*n^9 + 204209273106368/1784012908864095*n^10 - 3241185114016/27616298898825*n^11 + 6531220421504/307137753540705*n^12 + 3098495334496/1138216380768495*n^13 + 6086870028208448/7449626212129799775*n^14 + 38423353322878112/114062054670165156555*n^15 + 40496366139608576/244418688578925335475*n^16 + 665236142568416/7280556681074371695*n^17 + 367678743052291904/6729661225539744236745*n^18 + 30529744338007608544/879662860195552282374525*n^19) * eps^10
        + (481/841225 - 27632/35102025*n + 238304/145422675*n^2 - 2354704/893763325*n^3 + 1351995712/347123925225*n^4 - 3628654736/644658718275*n^5 + 30646053728/3710369067405*n^6 - 2139721666448/166966608033225*n^7 + 14114295321472/622330084487475*n^8 - 409450644752/6534845820015*n^9 + 10307920635808/387828893231325*n^10 + 3499011467373232/32249464121774025*n^11 - 1206016607114944/10749821373924675*n^12 + 9545159677072/467383537996725*n^13 + 15013719882592/5721927876221025*n^14 + 34656665188077392/43870021026986598675*n^15 + 389398246998784/1192286285750855295*n^16 + 73559957119861936/456764336575095762675*n^17 + 182732593408974929312/2052546673789621992207225*n^18) * eps^11
        + (2228/15540525 + 36032/59879925*n - 39261056/31556720475*n^2 + 1244864/629988975*n^3 - 12932462848/4512611027925*n^4 + 671728862912/166966608033225*n^5 - 37698002816/6678664321329*n^6 + 11134144068416/1369126185872445*n^7 - 733991428969984/58872425992515135*n^8 + 1232714276672/56337249753603*n^9 - 4429833678464/73797400736325*n^10 + 840415474013504/32249464121774025*n^11 + 3333478527060224/32249464121774025*n^12 - 2666448379438912/24771327513826425*n^13 + 16284062335255936/827736245792199975*n^14 + 333689425966716992/131610063080959796025*n^15 + 15659534365696/20459768715569799*n^16 + 22977355952311693888/72442823780810187960255*n^17) * eps^12
        + (673/1950975 - 45968/97698825*n + 19761248/20419054425*n^2 - 5684848/3732515325*n^3 + 27973845952/12843585233325*n^4 - 500069826512/166966608033225*n^5 + 372104734816/91275079058163*n^6 - 1627062252976/290011950702045*n^7 + 12698466842752/1591146648446355*n^8 - 172098932532272/14189764213580571*n^9 + 4774693008614176/225746248852418175*n^10 - 13025415886952528/225746248852418175*n^11 + 4848026099408192/189913510939335925*n^12 + 619763904190141936/6267145860998085525*n^13 - 649317315038718944/6267145860998085525*n^14 + 31106397870170704/1637148159767368325*n^15 + 2385779859697408/971669556445713741*n^16) * eps^13
        + (238/2629575 + 57568/153526725*n - 825536/1074687075*n^2 + 1194848/995395275*n^3 - 283558943872/166966608033225*n^4 + 2715755872/1180892000925*n^5 - 780655005376/254858986980585*n^6 + 171825550350112/42051732851796525*n^7 - 996847690701056/179675585821312425*n^8 + 1628471419526944/208269119909005155*n^9 - 29311863367971392/2483208737376599925*n^10 + 10654809266315936/520197877790354925*n^11 - 2080206830396032/37399847422835975*n^12 + 156667139836595552/6267145860998085525*n^13 + 187740421210774336/1977334790368379925*n^14 - 44223083570335579744/442263881445727643225*n^15) * eps^14
        + (299/1335015 - 14192/46725525*n + 4932448/7952684355*n^2 - 19928240/20676979323*n^3 + 41885845312/30975705562725*n^4 - 106538926231952/58872425992515135*n^5 + 698069390155552/294362129962575675*n^6 - 1222675417496752/395286288806887335*n^7 + 3426171103075456/842131658762499105*n^8 - 1101372339312272/201341248976481075*n^9 + 53459494241119136/6983391102255009585*n^10 - 30879408909358352/2685919654713465225*n^11 + 522986071597155776/26322012616191959205*n^12 - 1636740144692612656/30450955771673050845*n^13 + 1047772560655445344/42799730462489771925*n^14) * eps^15
        + (1072/17651865 + 86272/345768885*n - 11421184/22474977525*n^2 + 16677632/21215118925*n^3 - 18154021888/16569779339295*n^4 + 25154349615872/17315419409563275*n^5 - 70485959553536/37493279426127525*n^6 + 17021847805184/7060227510219975*n^7 - 300116388621985792/96845140757687397075*n^8 + 53507403275733248/13263029612809901925*n^9 - 4780406888960512/887872765984679475*n^10 + 2564172609357098752/342186164010495469665*n^11 - 1706337226816984064/152254778858365254225*n^12 + 179287783277363696896/9287541510360280507725*n^13) * eps^16
        + (1153/7507115 - 34544/166481315*n + 3700832/8775943605*n^2 - 1518032/2335595955*n^3 + 14928483904/16569779339295*n^4 - 5708509424/4814305899975*n^5 + 45794146362208/30141656009239775*n^6 - 5643458496441232/2934701235081436275*n^7 + 4156028415620301184/1710930820052477348325*n^8 - 1159757261134928/375451134529839225*n^9 + 525138269596488544/131610063080959796025*n^10 - 6287452560651272656/1187587275095248982955*n^11 + 25307469319858098112/3449658275276675617155*n^12) * eps^17
        + (2554/59814755 + 41056/235370135*n - 14837824/41929508335*n^2 + 3390304/6234993765*n^3 - 279486378368/372459822539805*n^4 + 42044271006688/42832879592077575*n^5 - 908499403281088/728158953065318775*n^6 + 2673843470669421536/1710930820052477348325*n^7 - 3332038388900879104/1710930820052477348325*n^8 + 594639889428168928/244418688578925335475*n^9 - 309769385066082483008/100944918383096163551175*n^10 + 4852059199993865385248/1231528004273773195324335*n^11) * eps^18
        + (1441/13114465 - 48336/326481155*n + 9106016/30362747415*n^2 - 13405488/29164499455*n^3 + 235380121664/372459822539805*n^4 - 2367311016464/2878098628716675*n^5 + 404878095158752/389822469822847425*n^6 - 116162066506295792/90048990529077755175*n^7 + 247341466765626752/155539165459316122575*n^8 - 65920898026272999856/33648306127698721183725*n^9 + 14943489055072437854816/6157640021368865976621675*n^10) * eps^19
        + (10540/338353197 + 33856/267120945*n - 7082368/27620305713*n^2 + 261152960/665956259969*n^3 - 7940593572608/14774239627412265*n^4 + 916716116672/1316024706307311*n^5 - 163090405515904/186436833393535725*n^6 + 10548437608477504/9776747543157013419*n^7 - 26616602067570450944/20188983676619232710235*n^8 + 173518074547495685824/108028772304716946958275*n^9) * eps^20
        + (587/7219485 - 196112/1793526345*n + 3884000/17576558181*n^2 - 637552/1890061173*n^3 + 12449720852672/27001196560443105*n^4 - 466255241229968/783034700252850045*n^5 + 527323603107424/708459966895435755*n^6 - 572248526956172944/626987070702460643175*n^7 + 973916019063553575808/879662860195552282374525*n^8) * eps^21
        + (1562/66703105 + 225632/2375210565*n - 286544192/1494007445385*n^2 + 84782368/290045401485*n^3 - 49602255488/124429477237065*n^4 + 263298573036064/513022734648418995*n^5 - 186977038393815616/292593966327814966815*n^6 + 5964364063236744416/7649242262570019846735*n^7) * eps^22
        + (2113/34165005 - 257968/3106044585*n + 358566688/2140064719065*n^2 - 106220624/416550139005*n^3 + 5743685513024/16549120472529645*n^4 - 435137683275536/976398107879249055*n^5 + 340361707744440224/615456273999886654335*n^6) * eps^23
        + (3656/202606425 + 293248/4015130805*n - 38087936/258689141865*n^2 + 43924864/196258677615*n^3 - 1343496883712/4418090985878955*n^4 + 80846540749696/207527123974335165*n^5) * eps^24
        + (2497/51875075 - 13264/205425297*n + 3118880/23976066807*n^2 - 810041200/4100876153969*n^3 + 86272944083264/321947484219644283*n^4) * eps^25
        + (4654/327806325 + 124384/2168378135*n - 44329792/383802929895*n^2 + 65844896/375780173615*n^3) * eps^26
        + (971/25421715 - 139344/2722006595*n + 804004512/7803992907865*n^2) * eps^27
        + (29092/2558620845 + 155456/3388620455*n) * eps^28
        + 3361/109067695 * eps^29;
C4[1] = + (1/45 - 16/315*n + 32/945*n^2 - 16/3465*n^3 - 64/135135*n^4 - 16/135135*n^5 - 32/765765*n^6 - 112/6235515*n^7 - 128/14549535*n^8 - 16/3380195*n^9 - 32/11700675*n^10 - 176/105306075*n^11 - 64/59879925*n^12 - 208/293096475*n^13 - 224/460580175*n^14 - 16/46725525*n^15 - 256/1037306655*n^16 - 272/1498331835*n^17 - 32/235370135*n^18 - 304/2938330395*n^19 - 64/801362835*n^20 - 112/1793526345*n^21 - 352/7125631695*n^22 - 368/9318133755*n^23 - 128/4015130805*n^24 - 16/616275891*n^25 - 416/19515403215*n^26 - 48/2722006595*n^27 - 448/30497584095*n^28) * eps
        - (2/105 - 64/945*n + 128/1485*n^2 - 1984/45045*n^3 + 256/45045*n^4 + 64/109395*n^5 + 128/855855*n^6 + 2368/43648605*n^7 + 24064/1003917915*n^8 + 64/5311735*n^9 + 9088/1368978975*n^10 + 704/179639775*n^11 + 11008/4508102925*n^12 + 10816/6806351475*n^13 + 128/119409675*n^14 + 29632/39763421775*n^15 + 1024/1926426645*n^16 + 214336/552884447115*n^17 + 84608/293506558345*n^18 + 8512/39037818105*n^19 + 69376/414304585695*n^20 + 11456/87882790905*n^21 + 153472/1494007445385*n^22 + 1472/17983737135*n^23 + 119296/1810823993055*n^24 + 26944/503497402947*n^25 + 21632/493460909865*n^26 + 282432/7803992907865*n^27) * eps^2
        - (1/105 - 16/2079*n - 5792/135135*n^2 + 3568/45045*n^3 - 103744/2297295*n^4 + 264464/43648605*n^5 + 544/855855*n^6 + 165328/1003917915*n^7 + 303488/5019589575*n^8 + 135664/5019589575*n^9 + 6000928/436704293025*n^10 + 554224/72394829325*n^11 + 63424/13884957009*n^12 + 598832/208274355135*n^13 + 4282016/2266515041175*n^14 + 664784/516924483075*n^15 + 57332992/63581711418225*n^16 + 77073104/118870156129725*n^17 + 3775712/7924677075315*n^18 + 132893296/372459822539805*n^19 + 3489344/12843442156545*n^20 + 3450352/16434081899235*n^21 + 39053344/237547183816215*n^22 + 20023984/153707001292845*n^23 + 9334144/89454705256917*n^24 + 102792464/1217960217728793*n^25 + 124807072/1812087153206253*n^26) * eps^3
        + (4/1155 - 2944/135135*n + 256/9009*n^2 + 17536/765765*n^3 - 3053056/43648605*n^4 + 1923968/43648605*n^5 - 2061568/334639305*n^6 - 1104256/1673196525*n^7 - 289792/1673196525*n^8 - 3114112/48522699225*n^9 - 391369984/13537833083775*n^10 - 98944/6685349671*n^11 - 7490048/902522205585*n^12 - 7679360/1541230227999*n^13 - 316086016/100179964819935*n^14 - 839709568/402684172315425*n^15 - 433629184/303779287887075*n^16 - 2751201664/2734013590983675*n^17 - 451501312/620766370899675*n^18 - 200058752/372459822539805*n^19 - 853023232/2110605661058895*n^20 - 8347485824/27001196560443105*n^21 - 626995456/2613019021978365*n^22 - 35348608/187348533651279*n^23 - 146563836928/976398107879249055*n^24 - 38855441792/321947484219644283*n^25) * eps^4
        + (1/9009 + 16/19305*n - 2656/153153*n^2 + 65072/2078505*n^3 + 526912/43648605*n^4 - 658160/10567557*n^5 + 14198752/334639305*n^6 - 1812592/295269975*n^7 - 97587328/145568097675*n^8 - 267846032/1504203675975*n^9 - 2119456/31853724903*n^10 - 45372848/1504203675975*n^11 - 2592068672/166966608033225*n^12 - 4380850576/500899824099675*n^13 - 5700161696/1080889094109825*n^14 - 39480194224/11774485198503027*n^15 - 12840471296/5771806469854425*n^16 - 196425584176/128498638776232725*n^17 - 108093549856/99943385714847675*n^18 - 11590396112/14774239627412265*n^19 - 273127762240/469820820151710027*n^20 - 343667608688/783034700252850045*n^21 - 518367866144/1539068203945256985*n^22 - 153626698640/585838864727549433*n^23 - 38138000512/184397165884316385*n^24) * eps^5
        + (10/9009 - 1472/459459*n + 106112/43648605*n^2 - 204352/14549535*n^3 + 4359424/143416845*n^4 + 29558336/5019589575*n^5 - 4479616/79676025*n^6 + 282120896/6931814175*n^7 - 3037689344/501401225325*n^8 - 159800512/237505843575*n^9 - 128742272/712517530725*n^10 - 34081066304/500899824099675*n^11 - 739998464/23852372576175*n^12 - 329429443264/20536892788086675*n^13 - 1144477661056/126155198555389575*n^14 - 1615718080576/294362129962575675*n^15 - 145301040063488/41505060324723170175*n^16 - 39812087684416/17090318957238952425*n^17 - 8181314153344/5097112671457231425*n^18 - 307611729639616/270146971587233265525*n^19 - 9726206064896/11745520503792750675*n^20 - 1307488226368/2125379900686307265*n^21 - 1226010709111168/2633345696950334701335*n^22 - 1983732571347776/5539106465998979889015*n^23) * eps^6
        + (349/2297295 + 28144/43648605*n - 32288/8729721*n^2 + 375344/111546435*n^3 - 12041408/1003917915*n^4 + 432232496/15058768725*n^5 + 310326496/145568097675*n^6 - 99405970096/1933976154825*n^7 + 17050659712/436704293025*n^8 - 1790101232/300840735195*n^9 - 4867489888/7259417740575*n^10 - 30362471408/166966608033225*n^11 - 472100207296/6845630929362225*n^12 - 1213812473968/38395060429901175*n^13 - 2070794882336/126155198555389575*n^14 - 128880963219824/13835020108241056725*n^15 - 5213913887488/922334673882737115*n^16 - 350085462103024/96845140757687397075*n^17 - 100618233981856/41730020001279935325*n^18 - 1349417396371216/810440914761699796575*n^19 - 18226976199582272/15398377380472296134925*n^20 - 324481362977936/376192242421476385905*n^21 - 309392942008518752/481902262541911250344305*n^22) * eps^7
        + (632/1322685 - 44288/43648605*n + 52736/47805615*n^2 - 2034944/557732175*n^3 + 3396608/885809925*n^4 - 4651476224/436704293025*n^5 + 376863232/13970931975*n^6 - 521047808/1933976154825*n^7 - 33839405056/712517530725*n^8 + 71989123328/1919156414175*n^9 - 2920335016448/500899824099675*n^10 - 167196416/251311112325*n^11 - 332813237248/1828336210947675*n^12 - 189963362048/2734013590983675*n^13 - 189790575759872/5929294332103310025*n^14 - 1615852457389312/96845140757687397075*n^15 - 2759847897165824/290535422273062191225*n^16 - 89000869775895808/15398377380472296134925*n^17 - 6338477357045248/1710930820052477348325*n^18 - 38129485424793344/15398377380472296134925*n^19 - 53670222315578368/31327733291305705929675*n^20 - 189395928218833664/155234622387450402771975*n^21) * eps^8
        + (43/479655 + 122576/334639305*n - 2304352/1673196525*n^2 + 2336816/1673196525*n^3 - 12805184/3669783975*n^4 + 54763949168/13537833083775*n^5 - 122726048/12640367025*n^6 + 114617716208/4512611027925*n^7 - 34612052864/18551845337025*n^8 - 2463842008976/55655536011075*n^9 + 247179941367712/6845630929362225*n^10 - 2994094055984/524709679077675*n^11 - 64595765995328/98120709987525225*n^12 - 3099595834864/17073245711527425*n^13 - 20252388370301728/290535422273062191225*n^14 - 94673925881072/2934701235081436275*n^15 - 4125115670603008/244418688578925335475*n^16 - 49466563811083856/5132792460157432044975*n^17 - 1436846393866144/244418688578925335475*n^18 - 381175372440689776/100944918383096163551175*n^19 - 6673125752239886656/2638988580586656847123575*n^20) * eps^9
        + (1270/5148297 - 34624/77224455*n + 8999296/15058768725*n^2 - 219421376/145568097675*n^3 + 245188352/155607276825*n^4 - 8995427648/2707566616755*n^5 + 62537856/15193976525*n^6 - 300772218944/33393321606645*n^7 + 12025681693184/500899824099675*n^8 - 6752231485504/2281876976454075*n^9 - 7341173985537152/176617277977545405*n^10 + 2796003983106368/80280580898884275*n^11 - 5941399696481024/1064232316018542825*n^12 - 692086460430784/1064232316018542825*n^13 - 1345434958946432/7449626212129799775*n^14 - 71571032546168768/1026558492031486408995*n^15 - 45358930642410496/1399852489133845103175*n^16 - 261920528055495616/15398377380472296134925*n^17 - 97300359399296/9989601027520649535*n^18 - 330035192316442762432/55418760192319793789595075*n^19) * eps^10
        + (15881/295269975 + 3275312/15058768725*n - 290237344/436704293025*n^2 + 3374142608/4512611027925*n^3 - 2324047552/1504203675975*n^4 + 22749713104/13537833083775*n^5 - 9287415008/2929238737425*n^6 + 2059124453296/500899824099675*n^7 - 1828414788736/216177818821965*n^8 + 2236007478391408/98120709987525225*n^9 - 3289422168026144/883086389887727025*n^10 - 1559442395410064/39717761076290115*n^11 + 93137685335849536/2767004021648211345*n^12 - 36715264470352/6721467259064481*n^13 - 395250439858913504/615935095218891845397*n^14 - 920542128392325776/5132792460157432044975*n^15 - 1071330999526287616/15398377380472296134925*n^16 - 69392630410138352/2137657095171448169319*n^17 - 105265368113339870944/6157640021368865976621675*n^18) * eps^11
        + (2228/15540525 - 6120832/25688487825*n + 691211008/1933976154825*n^2 - 3492371072/4512611027925*n^3 + 208152064/246142419705*n^4 - 773080659584/500899824099675*n^5 + 290139660544/166966608033225*n^6 - 3669101648768/1208052516946275*n^7 + 3589606756281344/883086389887727025*n^8 - 181420012122752/22643240766351975*n^9 + 411019605061888/18926156098824975*n^10 - 37593628401801344/8804103705244308825*n^11 - 48134971208650240/1291268543435831961*n^12 + 857893200414386816/26322012616191959205*n^13 - 9146937940412344064/1710930820052477348325*n^14 - 3175025851183744/5017392434171487825*n^15 - 102210624046413824/574639004078346282075*n^16 - 75317795379180637568/1086642356712152819403825*n^17) * eps^12
        + (733/21460725 + 5764688/41912795925*n - 3194656/8562829275*n^2 + 185012432/410237366175*n^3 - 2374742464/2862284709141*n^4 + 65055690512/71557117728525*n^5 - 10435905969184/6845630929362225*n^6 + 74203317689008/42051732851796525*n^7 - 83189743940224/28486657738313775*n^8 + 970218654799696/242719651021772925*n^9 - 12979601134119328/1699037557152410475*n^10 + 182872846566647344/8804103705244308825*n^11 - 106352279311029184/22812410934033031311*n^12 - 311872072090752592/8774004205397319735*n^13 + 702432581536430432/22219880779902303225*n^14 - 3453730558896213488/659770708386249434975*n^15 - 677845730256054991616/1086642356712152819403825*n^16) * eps^13
        + (238/2629575 - 851648/5987542275*n + 458368/1995847425*n^2 - 4444753088/9821565178425*n^3 + 257876621056/500899824099675*n^4 - 926189860672/1080889094109825*n^5 + 16440112590464/17315419409563275*n^6 - 62997095167168/42051732851796525*n^7 + 14708637300203008/8301012064944634035*n^8 - 12992021530058176/4611673369413685575*n^9 + 126514656768577664/32281713585895799025*n^10 - 934589810873408/127665525684801195*n^11 + 2273402066071352576/114062054670165156555*n^12 - 8678130264714688/1754800841079463947*n^13 - 60752587029024640/1785845526459021027*n^14 + 1236016674552098630336/40246013211561215533475*n^15) * eps^14
        + (1349/59007663 + 569168/6195804615*n - 6094472992/26363148636825*n^2 + 2579500208/8787716212275*n^3 - 10278771378368/20536892788086675*n^4 + 5804486242864/10389251645737965*n^5 - 986666922848/1136533320318825*n^6 + 1154950393173904/1185858866420662005*n^7 - 25102872528546944/17090318957238952425*n^8 + 171093766520283664/96845140757687397075*n^9 - 90252717369684512/33114790065531819645*n^10 + 856168540797233296/223164889572062262825*n^11 - 523921065908336192/74388296524020754275*n^12 + 148934374703642746192/7764993721776627965475*n^13 - 4530223920051850971488/879662860195552282374525*n^14) * eps^15
        + (1072/17651865 - 1621504/17634213135*n + 25527296/163746264825*n^2 - 103998194176/360296364703275*n^3 + 5248424757248/15492743682240825*n^4 - 467691403586048/883086389887727025*n^5 + 301694693856256/512408152157076175*n^6 - 252813007696723456/290535422273062191225*n^7 + 286904030108225536/290535422273062191225*n^8 - 351698678463165952/244418688578925335475*n^9 + 37866741710291968/21596602216651186725*n^10 - 3343357802501632/1264961585514852225*n^11 + 87427882477068703744/23294981165329883896425*n^12 - 179996219456280053248/26478146293511607161775*n^13) * eps^16
        + (4105/256743333 + 839312/13080031965*n - 27420423136/178581676418145*n^2 + 69811484144/345901445314425*n^3 - 96146193098048/294362129962575675*n^4 + 15405921597572848/41505060324723170175*n^5 - 2522567523013984/4611673369413685575*n^6 + 58989773513135888/96845140757687397075*n^7 - 13345966126725050752/15398377380472296134925*n^8 + 1699738669400076688/1710930820052477348325*n^9 - 21702598557454157792/15398377380472296134925*n^10 + 1576193121961143720976/908504265447865471960575*n^11 - 2497177697166830532544/972258950742452522624475*n^12) * eps^17
        + (2554/59814755 - 14367296/228073660815*n + 1013644928/9174446936655*n^2 - 167156355008/853223565108915*n^3 + 84963738158848/360913568041071045*n^4 - 14611840804674368/41505060324723170175*n^5 + 1819399468775296/4611673369413685575*n^6 - 2858231484366780352/5132792460157432044975*n^7 + 837914285761024/1346129677460643075*n^8 - 7953299207910592/9248274702986364045*n^9 + 301043012700456113536/302834755149288490653525*n^10 - 8502565529331757967296/6157640021368865976621675*n^11) * eps^18
        + (23263/2006513145 + 44125168/949080717585*n - 1895498144/17652901347081*n^2 + 5803380481936/40101507560119005*n^3 - 19655652872896/87117068147844735*n^4 + 3287964577171024/12631974881437486575*n^5 - 46210682062489376/125190060003839805975*n^6 + 372537686814738512/905786904733664478525*n^7 - 8650226115503323264/15398377380472296134925*n^8 + 101222691712671952/160484766904763376075*n^9 - 47176442350469959824736/55418760192319793789595075*n^10) * eps^19
        + (10540/338353197 - 3712/82302129*n + 14840576/183064816935*n^2 - 2144136832/15388989250635*n^3 + 5316349300224/31190061435648115*n^4 - 6607647772488064/26779786748647471539*n^5 + 66555255361792/238679026280280495*n^6 - 44052878135978368/115777273537385685225*n^7 + 384486668476460567552/908504265447865471960575*n^8 - 3468834561318140695424/6157640021368865976621675*n^9) * eps^20
        + (27329/3154914945 + 13289392/382771889955*n - 1286021216/16459191268065*n^2 + 770506950736/7181693789965695*n^3 - 1152005167333952/7079713738148182131*n^4 + 195075922055654512/1026558492031486408995*n^5 - 8145969897756512/31107833091863224515*n^6 + 12664143027275104208/43262107878469784379075*n^7 - 651402398229792722048/1679356369464236175442275*n^8) * eps^21
        + (1562/66703105 - 127424/3811384395*n + 2102950784/34362171243855*n^2 - 37430848576/364239015184863*n^3 + 696434041088/5463585227772945*n^4 - 6373599267875264/35398568690740910655*n^5 + 545772421678208/2661698573054612091*n^6 - 8466792971121000512/31046924477490080554395*n^7) * eps^22
        + (3401/512475075 + 28492208/1071585381825*n - 5331168/90848077775*n^2 + 8186753917904/100165729175837325*n^3 - 99012798127808/815635223288961075*n^4 + 1929159053254544/13474293888733636959*n^5 - 5854490607967819616/30333202075708699392225*n^6) * eps^23
        + (3656/202606425 - 35305216/1385220127725*n + 29556996608/624734277603975*n^2 - 4014261183232/51436455522727275*n^3 + 32964315529286656/336857347218340923975*n^4 - 29338515257596672/216297875582303119605*n^5) * eps^24
        + (100381/19328652945 + 22113584/1063075911975*n - 39278656544/868533020083575*n^2 + 44603405612432/700327125194055975*n^3 - 9121454090180288/98004601813921127325*n^4) * eps^25
        + (4654/327806325 - 17462848/878193144675*n + 276219008/7401913647975*n^2 - 2750176959296/45302178830156325*n^3) * eps^26
        + (45767/11058446025 + 176617072/10656655819425*n - 1087907102432/30552632234291475*n^2) * eps^27
        + (29092/2558620845 - 125915776/7959869448795*n) * eps^28
        + 917561/273868982145 * eps^29;
C4[2] = + (4/525 - 32/1575*n + 64/3465*n^2 - 32/5005*n^3 + 128/225225*n^4 + 32/765765*n^5 + 64/8083075*n^6 + 32/14549535*n^7 + 256/334639305*n^8 + 288/929553625*n^9 + 64/456326325*n^10 + 352/5089793625*n^11 + 128/3506302275*n^12 + 416/20419054425*n^13 + 64/5373435375*n^14 + 32/4418157975*n^15 + 512/112374887625*n^16 + 544/184294815705*n^17 + 576/293506558345*n^18 + 608/455441211225*n^19 + 128/138101528565*n^20 + 32/48823772725*n^21 + 704/1494007445385*n^22 + 736/2140064719065*n^23 + 256/1006013329475*n^24 + 32/167832467649*n^25 + 832/5757043948425*n^26 + 864/7803992907865*n^27) * eps^2
        - (8/1575 - 128/5775*n + 256/6825*n^2 - 6784/225225*n^3 + 4608/425425*n^4 - 128/124355*n^5 - 5888/72747675*n^6 - 9088/557732175*n^7 - 1024/214512375*n^8 - 3968/2281631625*n^9 - 35584/48522699225*n^10 - 235136/683728943625*n^11 - 303616/1735619626125*n^12 - 1664/17531511375*n^13 - 22784/419725007625*n^14 - 16768/516924483075*n^15 - 710656/35323173010125*n^16 - 850816/66038975627625*n^17 - 25856/3047952721275*n^18 - 1184384/206922123633225*n^19 - 512/129731738955*n^20 - 17536/6320800730475*n^21 - 87296/43990219225225*n^22 - 697728/483892411477475*n^23 - 216064/203306148311175*n^24 - 107392/135328913080977*n^25 - 3018496/5033575425572925*n^26) * eps^3
        - (8/1925 - 1856/225225*n - 128/17325*n^2 + 42176/1276275*n^3 - 2434816/72747675*n^4 + 195136/14549535*n^5 - 761984/557732175*n^6 - 947392/8365982625*n^7 - 199168/8365982625*n^8 - 250816/34659070875*n^9 - 12285568/4512611027925*n^10 - 2049728/1735619626125*n^11 - 854272/1504203675975*n^12 - 3794752/12843585233325*n^13 - 136569728/834833040166125*n^14 - 983872/10325235187575*n^15 - 263816192/4556689318306125*n^16 - 166125632/4556689318306125*n^17 - 73477504/3103831854498375*n^18 - 68603072/4345364596297725*n^19 - 159244544/14774239627412265*n^20 - 338106304/45001994267405175*n^21 - 3319168/622147386185325*n^22 - 318736576/82745602362648225*n^23 - 353437184/125179244599903725*n^24 - 675465152/321947484219644283*n^25) * eps^4
        + (8/10725 - 128/17325*n + 64256/3828825*n^2 - 128/25935*n^3 - 266752/10392525*n^4 + 11222912/334639305*n^5 - 8292608/557732175*n^6 + 4484992/2788660875*n^7 + 340992/2450641375*n^8 + 11977088/395843072625*n^9 + 2246912/237505843575*n^10 + 82282624/22563055139625*n^11 + 4942336/3057996484125*n^12 + 661387648/834833040166125*n^13 + 5904128/14079866164875*n^14 + 23140740736/98120709987525225*n^15 + 12064565248/86577097047816375*n^16 + 18372231296/214164397960387875*n^17 + 27322100992/499716928574238375*n^18 + 241091456/6715563467005575*n^19 + 1114236416/46060864720755885*n^20 + 21761259136/1305057833754750075*n^21 + 859481344/73288962092631285*n^22 + 40995250048/4881990539396245275*n^23 + 606575260672/99267140967723653925*n^24) * eps^5
        - (4/25025 + 928/3828825*n + 292288/72747675*n^2 - 106528/6613425*n^3 + 6139264/557732175*n^4 + 10832608/557732175*n^5 - 162679232/5019589575*n^6 + 85724192/5472484875*n^7 - 3655690496/2051186830875*n^8 - 3604983136/22563055139625*n^9 - 7007552/196200479475*n^10 - 9537699488/834833040166125*n^11 - 13154432/2929238737425*n^12 - 200866912/99212042454525*n^13 - 6420816704/6371474674514625*n^14 - 17688656864/32706903329175075*n^15 - 21307711227392/69175100541205283625*n^16 - 5244426197152/28483864928731587375*n^17 - 417090283072/3640794765326593875*n^18 - 362186962528/4911763119767877555*n^19 - 573931129472/11745520503792750675*n^20 - 1058701197088/31880698510294608975*n^21 - 33756633788608/1462969831639074834075*n^22 - 50313491799008/3077281369999433271675*n^23) * eps^6
        + (464/1276275 - 17152/10392525*n + 83456/72747675*n^2 - 181504/79676025*n^3 + 115303424/8365982625*n^4 - 4580096/334639305*n^5 - 508046848/34659070875*n^6 + 2213207296/71628746475*n^7 - 17261467648/1074431197125*n^8 + 4782020864/2507006126625*n^9 + 1014518272/5757469242525*n^10 + 33657011968/834833040166125*n^11 + 149965386752/11409384882270375*n^12 + 1104106298624/210258664258982625*n^13 + 16287375872/6782537556741375*n^14 + 18546580736/15321173984763075*n^15 + 45457260285952/69175100541205283625*n^16 + 5907631030528/15620183993175386625*n^17 + 130174950780416/570310273350825782775*n^18 + 247185478912/1725076446917198375*n^19 + 4546015751168/48883737715785067095*n^20 + 194686818012928/3134935353512303215875*n^21 + 541960491316736/12748737104283366411225*n^22) * eps^7
        + (1168/72747675 + 128/1865325*n - 12032/7436429*n^2 + 5669504/2788660875*n^3 - 42320384/25097947875*n^4 + 1690753408/145568097675*n^5 - 3812261632/259345461375*n^6 - 1083259264/97675563375*n^7 + 220583066624/7521018379875*n^8 - 1505036615552/92759226685125*n^9 + 1611235072/806601971175*n^10 + 6334750336/33458606692875*n^11 + 1667637018112/37738734610586625*n^12 + 937077639296/63991767383168625*n^13 + 4509356511488/760165940013244875*n^14 + 294484214656/107248217893341525*n^15 + 32262664812544/23058366847068427875*n^16 + 729031420097152/950517122251376304625*n^17 + 25918478235392/58194925852125079875*n^18 + 2318317188006784/8554654100262386741625*n^19 + 558196229800448/3256287689777295598425*n^20 + 492800344582544512/4398314300977761411872625*n^21) * eps^8
        + (208/1119195 - 192256/334639305*n + 34304/91933875*n^2 - 164096/121246125*n^3 + 1760402432/727840488375*n^4 - 7092326144/4512611027925*n^5 + 223317267968/22563055139625*n^6 - 17696559872/1187529217875*n^7 - 7016842532864/834833040166125*n^8 + 860408727296/30919742228375*n^9 - 22226861374976/1369126185872445*n^10 + 21222698179328/10292382166523625*n^11 + 88454767616/442649819492595*n^12 + 50501718260992/1064232316018542825*n^13 + 7723646961783296/484225703788436985375*n^14 + 314323524352/48062104594385805*n^15 + 2532668227735552/827869751638295491125*n^16 + 40384078766338816/25663962300787160224875*n^17 + 19229411505664/22105049354683169875*n^18 + 770798397212533504/1514173775746442453267625*n^19 + 250556302305381376/803170437569852083907175*n^20) * eps^9
        + (236/9561123 + 50272/557732175*n - 180416/253514625*n^2 + 4019104/6220858875*n^3 - 25917758848/22563055139625*n^4 + 494758496/196200479475*n^5 - 12204703424/7521018379875*n^6 + 4056672544/472457860875*n^7 - 22131315968/1504203675975*n^8 - 314109390176/49391276546625*n^9 + 288234585666624/10902301109725025*n^10 - 31315082826784/1939144466156625*n^11 + 111197020252288/52765141526472375*n^12 + 14390751017248/69105994546658625*n^13 + 24312743742913856/484225703788436985375*n^14 + 622105174713376/36402783405371858475*n^15 + 60584296191732224/8554654100262386741625*n^16 + 4228371181856/1264546060644846525*n^17 + 12685404296720576/7314849158195374170375*n^18 + 29737849987907314208/30788200106844329883108375*n^19) * eps^10
        + (3464/32807775 - 1302656/5019589575*n + 153380608/727840488375*n^2 - 45513088/64282208375*n^3 + 18741801472/22563055139625*n^4 - 925614464/902522205585*n^5 + 692308704512/278277680055375*n^6 - 1431548425856/834833040166125*n^7 + 37095814581248/4889736378115875*n^8 - 57202079464576/3988646747460375*n^9 - 156331212808448/32706903329175075*n^10 + 2294120744984192/91139789909361375*n^11 - 22462403210597888/1403552764604165175*n^12 + 1062101785588352/496641747475319985*n^13 + 1839082934090104576/8554654100262386741625*n^14 + 89891107232678272/1710930820052477348325*n^15 + 513933681977344/28420777741735504125*n^16 + 74871039262438528/9896560625793741524625*n^17 + 36964023452909851904/10262733368948109961036125*n^18) * eps^11
        + (296/15540525 + 1728/24395525*n - 49758848/136745788725*n^2 + 427124032/1327238537625*n^3 - 5044327168/7521018379875*n^4 + 298545088/318031634349*n^5 - 801131699072/834833040166125*n^6 + 6305965926464/2632934972831625*n^7 - 378931864297984/210258664258982625*n^8 + 911863359318208/133800968164807125*n^9 - 192205122085248128/13835020108241056725*n^10 - 6780515998533184/1913935588096588875*n^11 + 38905530524711168/1619483959158652125*n^12 - 946513267068414656/59822755945890816375*n^13 + 83570609810086528/38708842082635234125*n^14 + 1131108186078795712/5132792460157432044975*n^15 + 131223039038073856/2407271503571450641125*n^16 + 9360216457260964928/493928343960069463365375*n^17) * eps^12
        + (56/858429 - 55168/399169485*n + 5211904/37921101075*n^2 - 3002446208/7521018379875*n^3 + 48699457024/119261862880875*n^4 - 919739008/1451883548115*n^5 + 365596999424/368044673621625*n^6 - 10263813181312/11066245487314875*n^7 + 3358672820415488/1471810649812878375*n^8 - 43146790366966912/23058366847068427875*n^9 + 200474306313855232/32281713585895799025*n^10 - 1223232504628096/91139789909361375*n^11 - 5571695531272704/2175096389591250125*n^12 + 117245774985483904/5101165235696116125*n^13 - 6362058788044060928/407364480964875559125*n^14 + 1432428366354690688/659770708386249434975*n^15 + 406876011841654183936/1811070594520254699006375*n^16) * eps^13
        + (6748/491730525 + 2464/47453715*n - 35434816/169647031125*n^2 + 2367228064/12099029567625*n^3 - 338914889344/834833040166125*n^4 + 643139268064/1369126185872445*n^5 - 42372035912768/70086221419660875*n^6 + 528871923808/521733658210875*n^7 - 9028483998408448/9882157220172183375*n^8 + 375698992716832/173371179301266375*n^9 - 3261967803906496/1699037557152410475*n^10 + 4454132788010992864/777695827296580612875*n^11 - 324957881336448/25082916539157575*n^12 - 51719952215776/29149515632549235*n^13 + 40751993548714355392/1848808028994435229875*n^14 - 1505262899486918255456/97740317799505809152725*n^15) * eps^14
        + (63392/1475191575 - 40448/491730525*n + 22100992/232479264875*n^2 - 10707459584/43938581061375*n^3 + 395889698816/1629912126038625*n^4 - 1272720851456/3165184193145975*n^5 + 57785079583744/113216203831759875*n^6 - 5771910533522944/9882157220172183375*n^7 + 400461014478848/395286288806887335*n^8 - 8980497036868096/9882157220172183375*n^9 + 861739038708736/418695852855651525*n^10 - 7151522689996655104/3666280328683880032125*n^11 + 136923421975731791872/25663962300787160224875*n^12 - 21113609897148018176/1688042113429701731625*n^13 - 121850848500674573312/107275958560433205167625*n^14) * eps^15
        + (216352/21800053275 + 276003584/7259417740575*n - 364665344/2792083746375*n^2 + 45336414464/345738935826375*n^3 - 54656669920256/210258664258982625*n^4 + 2651168079104/9495552579437925*n^5 - 9112145249388032/23058366847068427875*n^6 + 259248276999003392/484225703788436985375*n^7 - 25094568739469312/44020518526221544125*n^8 + 2852336745721263872/2851551366754128913875*n^9 - 215254033283584/237135248794522155*n^10 + 16753729491723017984/8554654100262386741625*n^11 - 39706593780549643264/20188983676619232710235*n^12 + 2373769153328288102144/473664617028374305893975*n^13) * eps^16
        + (1248/41951525 - 14245376/268867323725*n + 10222592/149641089675*n^2 - 1801381376/11340026117875*n^3 + 236349194786816/1471810649812878375*n^4 - 3691013040948736/13835020108241056725*n^5 + 371324256164864/1213598255108864625*n^6 - 2021022934670848/5206727997725128875*n^7 + 427036746482839552/777695827296580612875*n^8 - 1598379187657077248/2851551366754128913875*n^9 + 1279883225050112/1305057833754750075*n^10 - 35243011544058408448/38824968608883139827375*n^11 + 57528704095634149967872/30788200106844329883108375*n^12) * eps^17
        + (2188/299073775 + 118112/4177173275*n - 1651234880/18960523669087*n^2 + 396968969632/4266117825544575*n^3 - 527133283672192/3007613067008925375*n^4 + 712898585518304/3873805630307495883*n^5 - 102467165232448/380980097394521625*n^6 + 1667960274927658784/5132792460157432044975*n^7 - 9803797102758335744/25663962300787160224875*n^8 + 1582433972899100512/2851551366754128913875*n^9 - 167731799286812796352/302834755149288490653525*n^10 + 2057307675985255174816/2148013960942627666263375*n^11) * eps^18
        + (4776/222945905 - 545152/15064773295*n + 75166464/1485934456825*n^2 - 2430966148992/22278615311177225*n^3 + 25097198606848/221613594411183975*n^4 - 777828977914496/4210658293812495525*n^5 + 346053142459467008/1710930820052477348325*n^6 - 2300283426585485696/8554654100262386741625*n^7 + 2890306701807143936/8554654100262386741625*n^8 - 63408372990350273152/168241530638493605918625*n^9 + 379976274656827151616/684182224596540664069075*n^10) * eps^19
        + (729128/132296100027 + 1037632/48401012205*n - 312986836352/5129781278546925*n^2 + 8491740695488/123684726382742525*n^3 - 569171041087744/4611673369413685575*n^4 + 14781690121669568/114062054670165156555*n^5 - 325240456165524608/1710930820052477348325*n^6 + 264121805570445376/1222093442894626677375*n^7 - 15019589271866087936/56080510212831201972875*n^8 + 322915232383134423488/932975760813464541912375*n^9) * eps^20
        + (50248/3154914945 - 4224/163387745*n + 351214336/9143995148925*n^2 - 13428756608/171810856219275*n^3 + 149145346743808/1787806499532369225*n^4 - 15142621991500672/114062054670165156555*n^5 + 3607505909629184/25284691921957793325*n^6 - 1346982356013579136/6977759335237061996625*n^7 + 426802317284889955328/1884991843276183462231125*n^8) * eps^21
        + (402908/95051924625 + 61416608/3707025060375*n - 1594343872/35872596353475*n^2 + 176968781792/3392422200251175*n^3 - 11134005164416/123581094437721375*n^4 + 5634047312627936/58997614484568184425*n^5 - 23365464365584673216/168241530638493605918625*n^6 + 7084481509357518688/46298045273450120124975*n^7) * eps^22
        + (10384/854125125 - 34177792/1785975636375*n + 36665846272/1230537213462375*n^2 - 878996127488/15176625632702625*n^3 + 54887110257664/865067661064049625*n^4 - 850509595404544/8637367877393357025*n^5 + 909150023994065408/8631398964632556737625*n^6) * eps^23
        + (10096/3039096375 + 90261376/6926100638625*n - 104352359168/3123671388019875*n^2 + 31307137302656/771546832840909125*n^3 - 38042941521183232/561428912030568206625*n^4 + 498270120528775552/6849432726772932120825*n^5) * eps^24
        + (509392/53690702625 - 8609536/590597728875*n + 1032951296/43865304044625*n^2 - 971880602368/22022865572140125*n^3 + 391353414474752/7911102710525447125*n^4) * eps^25
        + (2894476/1093234093875 + 3389629984/325419348610125*n - 164895679936/6399913855999125*n^2 + 1620742521773024/50360922132857114625*n^3) * eps^26
        + (139048/18430743375 - 86549632/7611897013875*n + 412763643136/21823308738779625*n^2) * eps^27
        + (4247096/1982931154875 + 5788830656/685433202535125*n) * eps^28
        + 185528/30429886905 * eps^29;
C4[3] = + (8/2205 - 256/24255*n + 512/45045*n^2 - 256/45045*n^3 + 1024/765765*n^4 - 256/2909907*n^5 - 512/101846745*n^6 - 256/334639305*n^7 - 2048/11712375675*n^8 - 256/5019589575*n^9 - 512/29113619535*n^10 - 2816/410237366175*n^11 - 1024/347123925225*n^12 - 3328/2429867476575*n^13 - 512/755505013725*n^14 - 256/723694276305*n^15 - 4096/21193903806075*n^16 - 4352/39623385376575*n^17 - 512/7924677075315*n^18 - 4864/124153274179935*n^19 - 1024/41955244378047*n^20 - 256/16434081899235*n^21 - 5632/554276762237835*n^22 - 5888/871006340659455*n^23 - 2048/447273526284585*n^24 - 1280/405986739242931*n^25 - 6656/3020145255343755*n^26) * eps^3
        - (16/8085 - 1024/105105*n + 2048/105105*n^2 - 1024/51051*n^3 + 4096/373065*n^4 - 1024/357357*n^5 + 161792/780825045*n^6 + 1024/79676025*n^7 + 8192/3904125225*n^8 + 13312/26127607275*n^9 + 2048/13080031965*n^10 + 84992/1504203675975*n^11 + 241664/10529425731825*n^12 + 13312/1302972414975*n^13 + 2048/418462676775*n^14 + 467968/187919280413865*n^15 + 2834432/2126455015209525*n^16 + 17408/23367637529775*n^17 + 268288/620766370899675*n^18 + 175104/675945603868535*n^19 + 1101824/6894645159459057*n^20 + 130048/1285771264783005*n^21 + 2048/31266894280083*n^22 + 1672192/38614614435902505*n^23 + 499712/17129791366302615*n^24 + 2145280/107315828073214761*n^25) * eps^4
        - (136/63063 - 256/45045*n + 512/1072071*n^2 + 494336/33948915*n^3 - 44032/1996995*n^4 + 204032/14196819*n^5 - 42496/10140585*n^6 + 1651456/5019589575*n^7 + 3172352/145568097675*n^8 + 39570176/10529425731825*n^9 + 6040064/6317655439095*n^10 + 9663232/31588277195475*n^11 + 44557312/389588752077525*n^12 + 156928/3273855059475*n^13 + 50066944/2281876976454075*n^14 + 211489024/19624141997505045*n^15 + 61804544/11018903260631175*n^16 + 83527936/27257287013140275*n^17 + 1220781568/699603700003933725*n^18 + 319501568/310259032175657565*n^19 + 294585344/469820820151710027*n^20 + 6025472/15353621573585295*n^21 + 6149632/24429654030877095*n^22 + 1419008/8597216044219803*n^23 + 15341295616/138973997354813115495*n^24) * eps^5
        + (64/315315 - 16384/5360355*n + 966656/101846745*n^2 - 868352/101846745*n^3 - 3506176/468495027*n^4 + 966656/46293975*n^5 - 2736128/168120225*n^6 + 254590976/48522699225*n^7 - 930414592/2105885146365*n^8 - 975978496/31588277195475*n^9 - 175947776/31588277195475*n^10 - 1719713792/1168766256232575*n^11 - 189497344/389588752077525*n^12 - 471973888/2522074552922925*n^13 - 23683022848/294362129962575675*n^14 - 2875506688/76316107768075175*n^15 - 166335741952/8804103705244308825*n^16 - 7264288768/725043834549531315*n^17 - 8638251008/1551295160878287825*n^18 - 43198234624/13411551780926474175*n^19 - 5872648192/3045134945427750175*n^20 - 10622910464/8926595582882490513*n^21 - 4633606045696/6144473292884114303115*n^22 - 6324103528448/12924581753997619741035*n^23) * eps^6
        - (16/97461 + 14848/101846745*n + 74752/101846745*n^2 - 1180160/156165009*n^3 + 1804288/156165009*n^4 + 21661184/11712375675*n^5 - 6329863168/339658894575*n^6 + 77686373888/4512611027925*n^7 - 191476584448/31588277195475*n^8 + 1902050816/3509808577275*n^9 + 602135552/15178782548475*n^10 + 1734961664/233753251246515*n^11 + 32315783168/15973138835178525*n^12 + 4767689216/6937827978915925*n^13 + 354268160/1308276133167003*n^14 + 3839243089408/32281713585895799025*n^15 + 5498545266688/96845140757687397075*n^16 + 19638642446848/677915985303811779525*n^17 + 62312623694848/3992171913455780479425*n^18 + 16645612231168/1891028801110632858675*n^19 + 185414359607296/35929547221102024314825*n^20 + 2746091096576/877781898983444900445*n^21 + 146389811987456/74962574173186194498003*n^22) * eps^7
        + (5024/33948915 - 96256/101846745*n + 2363392/2342475135*n^2 - 223232/3904125225*n^3 + 179101696/35137127025*n^4 - 12169295872/1018976683725*n^5 + 21649608704/10529425731825*n^6 + 73147930624/4512611027925*n^7 - 110974713856/6317655439095*n^8 + 45664495616/6834890387325*n^9 - 38688231424/61514013485925*n^10 - 6727825408/140526148110075*n^11 - 204859727872/22156289352021825*n^12 - 5333835708416/2060534909738029725*n^13 - 12449383788544/13835020108241056725*n^14 - 11682410842112/32281713585895799025*n^15 - 15675688321024/96845140757687397075*n^16 - 564491569272832/7185909444220404862965*n^17 - 162424807264256/3992171913455780479425*n^18 - 25758343960576/1159017652293613687575*n^19 - 867930864951296/68382041485323207566925*n^20 - 986317559527424/131013617475933318651525*n^21) * eps^8
        - (1744/101846745 + 512/15935205*n + 2819072/3904125225*n^2 - 574976/354920475*n^3 + 293840896/1018976683725*n^4 - 104608193024/31588277195475*n^5 + 50770254848/4512611027925*n^6 - 2319237632/501401225325*n^7 - 70544060416/5059594182825*n^8 + 152043321856/8657527823945*n^9 - 12686255881216/1774793203908725*n^10 + 1910603827712/2714802252619275*n^11 + 4965264541696/89588474336436075*n^12 + 11708566053376/1064232316018542825*n^13 + 27753253723136/8804103705244308825*n^14 + 8328847653376/7449626212129799775*n^15 + 12046676107264/26322012616191959205*n^16 + 118607935682048/570310273350825782775*n^17 + 136251371367424/1330723971151926826475*n^18 + 3451317953686016/64237675334697558623475*n^19 + 60965191496247296/2052546673789621992207225*n^20) * eps^9
        + (13760/156165009 - 868352/2342475135*n + 2834432/11712375675*n^2 - 7192576/16174233075*n^3 + 7776468992/4512611027925*n^4 - 4603068416/6317655439095*n^5 + 23153426432/10529425731825*n^6 - 68229349376/6678664321329*n^7 + 7325440344064/1168766256232575*n^8 + 63577941262336/5324379611726175*n^9 - 44408364941312/2559670695326745*n^10 + 28661243789312/3822884804708775*n^11 - 24786086817923072/32281713585895799025*n^12 - 3817219702784/61277771427624675*n^13 - 1226804449460224/96845140757687397075*n^14 - 8872730492715008/2395303148073468287655*n^15 - 623934886248448/466617496377948367725*n^16 - 2853622228533248/5132792460157432044975*n^17 - 1724063864471552/6729661225539744236745*n^18 - 16517156456001093632/129310440448746185509055175*n^19) * eps^10
        + (2824/688963275 + 169216/11712375675*n - 776704/1940907969*n^2 + 22551296/45581929575*n^3 - 485960704/1504203675975*n^4 + 304217344/191444104215*n^5 - 2695489024/2419805913525*n^6 + 8952644864/5757469242525*n^7 - 5695372408832/622330084487475*n^8 + 17565250440448/2409982350570795*n^9 + 22610939298304/2213249097462975*n^10 - 21402530278491392/1257729100749186975*n^11 + 1752626126402468864/225971995101270593175*n^12 - 14296223366555392/17382461161636199475*n^13 - 288001255055872/4203761228630165475*n^14 - 170463009837350144/11976515740367341438275*n^15 - 30452830506323968/7185909444220404862965*n^16 - 1203551903703808/774513440279510206275*n^17 - 1344666689909348864/2052546673789621992207225*n^18) * eps^11
        + (848/15540525 - 1506304/8562829275*n + 494897152/4512611027925*n^2 - 1525812224/4512611027925*n^3 + 1189474304/1858133952675*n^4 - 74582428672/233753251246515*n^5 + 1436219392/1037059677225*n^6 - 9475007491072/6845630929362225*n^7 + 70856261853184/58872425992515135*n^8 - 16848457551905792/2060534909738029725*n^9 + 254950781338028032/32281713585895799025*n^10 + 19961192018277376/2282545405063339325*n^11 - 11266641625872879616/677915985303811779525*n^12 + 20501971947705344/2580589472175682275*n^13 - 70802116737542144/81472896192975111825*n^14 - 54344855357336576/733256065736776006425*n^15 - 19768531954614272/1259562261464658012225*n^16 - 104711917718588416/22047815933290057205295*n^17) * eps^12
        + (2456/364832325 + 1801984/79168614525*n - 339889664/1504203675975*n^2 + 205509376/957220521075*n^3 - 109868782592/389588752077525*n^4 + 54139545344/77917750415505*n^5 - 312640051712/840691517640975*n^6 + 349164957867776/294362129962575675*n^7 - 58011733055488/37464271086145995*n^8 + 33115510536049408/32281713585895799025*n^9 - 215925931198897664/29474608056687468675*n^10 + 507489742441723648/61628725936710161775*n^11 + 9972967174487194624/1330723971151926826475*n^12 - 34133956918870784/2108170346834596275*n^13 + 1256638470211792384/155539165459316122575*n^14 - 1517965285997460736/1670483282935397505575*n^15 - 10235580119040855076864/129310440448746185509055175*n^16) * eps^13
        + (17536/491730525 - 32768/342721275*n + 32768/479809785*n^2 - 87051763712/389588752077525*n^3 + 115073417216/389588752077525*n^4 - 809341124608/3194627767035705*n^5 + 476140039995392/686844969912676575*n^6 - 7648126664704/17315419409563275*n^7 + 2295366957006848/2252212575760172025*n^8 - 1505996592152576/922334673882737115*n^9 + 642554502878101504/677915985303811779525*n^10 - 937147600273702912/142014020636766894525*n^11 + 44138249302114304/5259778542102477575*n^12 + 31679339599003648/4926579901426302525*n^13 - 38784788290715746304/2462071180075516184175*n^14 + 910141441476937023488/111378501678506619732175*n^15) * eps^14
        + (6752/1121145597 + 828416/39240095895*n - 22733400064/166966608033225*n^2 + 12663202816/106251477839325*n^3 - 9940302737408/47919416505535575*n^4 + 142477291621376/412106981947605945*n^5 - 511499016656896/2060534909738029725*n^6 + 1833727522382848/2767004021648211345*n^7 - 49222696013062144/96845140757687397075*n^8 + 1755522210632704/1976431444034436675*n^9 - 3980569541165627392/2395303148073468287655*n^10 + 3693492679339365376/3992171913455780479425*n^11 - 214983640335726014464/35929547221102024314825*n^12 + 152736093675883697152/18118318684145465252775*n^13 + 1030498930683129116672/186595152162692908382475*n^14) * eps^15
        + (7104/290667377 - 5550080/96792236541*n + 116482048/2419805913525*n^2 - 37516668928/253541886272675*n^3 + 112198220398592/686844969912676575*n^4 - 12087336398848/62440451810243325*n^5 + 9147933925376/24661354916650725*n^6 - 24968440568492032/96845140757687397075*n^7 + 60100118709960704/96845140757687397075*n^8 - 12851567387414528/22812410934033031311*n^9 + 578870590466711552/733256065736776006425*n^10 - 94517652107104256/57121696694915777925*n^11 + 658362218889165488128/706614428681673144858225*n^12 - 2587762813002169044992/473664617028374305893975*n^13) * eps^16
        + (63136/12979801835 + 6603776/376414253215*n - 115496960/1322827232727*n^2 + 887622656/11561294920175*n^3 - 43488723791872/294362129962575675*n^4 + 75193702847488/382787117619317775*n^5 - 3822735799883776/20542908645570053925*n^6 + 36656101850983424/96845140757687397075*n^7 - 1972951098707156992/7185909444220404862965*n^8 + 328771821253526528/570310273350825782775*n^9 - 3105328344576980992/5132792460157432044975*n^10 + 217025910651311236096/302834755149288490653525*n^11 - 70045496023034800943104/43103480149582061836351725*n^12) * eps^17
        + (384/22037015 - 19693568/532171875235*n + 23750672384/663618328418045*n^2 - 906788864/8981300685357*n^3 + 2473671458816/24060904536071403*n^4 - 97688010118627328/677915985303811779525*n^5 + 458602279763968/2098811100011801175*n^6 - 3630274708209664/19665871494856061475*n^7 + 4490469276862251008/11976515740367341438275*n^8 - 1171359654445416448/3992171913455780479425*n^9 + 18008930028582633472/33648306127698721183725*n^10 - 1241396166426066944/1957914156238113188115*n^11) * eps^18
        + (7256/1889173195 + 4900096/346489785785*n - 31059853824/526317984607415*n^2 + 38700561003264/717371413019906645*n^3 - 2876286797818880/27116639412152471181*n^4 + 84142172780774656/677915985303811779525*n^5 - 5603644391945728/39789088838429705775*n^6 + 107992837810298624/466617496377948367725*n^7 - 192399843750455296/1026558492031486408995*n^8 + 1829483213954652416/5011449848806192516725*n^9 - 92159294855156056576/295904898052050767755275*n^10) * eps^19
        + (208560/16246889477 - 23395328/926072700189*n + 5966964736/217627084544415*n^2 - 59040218112/828510128879615*n^3 + 96692817891328/1369527243038003595*n^4 - 203186292622336/1893520275156891927*n^5 + 17678406396274688/126068586740708857245*n^6 - 714429587557256192/5132792460157432044975*n^7 + 45769716805203484672/192713026004092675870425*n^8 - 2770267341515812025344/14367826716527353945450575*n^9) * eps^20
        + (5695096/1877174392275 + 37023086848/3264406268166225*n - 135977211392/3264406268166225*n^2 + 19436995328/486188167599225*n^3 - 2916383737510912/37543936490179753725*n^4 + 1016222889010513664/11976515740367341438275*n^5 - 3851462753392374272/35929547221102024314825*n^6 + 67996526692104448/448644081702649615783*n^7 - 6002521005978183563264/43103480149582061836351725*n^8) * eps^21
        + (1293248/133072694475 - 31178752/1729945028175*n + 23344955392/1088135422722075*n^2 - 20955891089408/403698241829889825*n^3 + 31312543744/608896292352775*n^4 - 3711165786734592/45887033487997476775*n^5 + 22699071565427326976/235538142893891048286075*n^6 - 1975768440081947803648/18472920064106597929865025*n^7) * eps^22
        + (70576/29211079275 + 7439872/814404890187*n - 61061929984/2004017747638725*n^2 + 1769998572032/57671177404269975*n^3 - 70447795996672/1211094725489669475*n^4 + 48276040517729792/786000476842795489275*n^5 - 307128224790756352/3725130079472998170975*n^6) * eps^23
        + (4576/607819275 - 292864/21987621075*n + 323268608/18931341745575*n^2 - 204679168/5263836485355*n^3 + 30640655949824/785215261581214275*n^4 - 20770366119528448/335286916695178495425*n^5) * eps^24
        + (363376/186843645135 + 76231168/10276400482425*n - 192745499648/8395819194141225*n^2 + 163618760840704/6769828876875874425*n^3 - 6126423998867456/137653187163142779975*n^4) * eps^25
        + (433472/72882272925 - 1978056704/195251609166075*n + 158870945792/11519844940798425*n^2 - 1279016321024/42860359262006055*n^3) * eps^26
        + (4160936/2628224005275 + 3079920896/506546373283335*n - 128748399563264/7261342261016607225*n^2) * eps^27
        + (631696/132195410325 - 3245452288/411259921521075*n) * eps^28
        + 594728/456448303575 * eps^29;
C4[4] = + (64/31185 - 512/81081*n + 1024/135135*n^2 - 512/109395*n^3 + 2048/1247103*n^4 - 2560/8729721*n^5 + 1024/66927861*n^6 + 512/717084225*n^7 + 4096/45176306175*n^8 + 512/29113619535*n^9 + 1024/232077138579*n^10 + 512/386795230965*n^11 + 2048/4512611027925*n^12 + 6656/38530755699975*n^13 + 1024/14311423545705*n^14 + 512/16107366892617*n^15 + 8192/546802718196735*n^16 + 8704/1171720110421575*n^17 + 1024/266042730385575*n^18 + 9728/4692993764001543*n^19 + 10240/8864543776447359*n^20 + 512/771462758869803*n^21 + 1024/2613019021978365*n^22 + 11776/49647361417588935*n^23 + 4096/27897088796549973*n^24 + 12800/137977493236990407*n^25) * eps^4
        - (128/135135 - 2048/405405*n + 77824/6891885*n^2 - 198656/14549535*n^3 + 8192/855855*n^4 - 256000/66927861*n^5 + 1282048/1673196525*n^6 - 284672/6453758025*n^7 - 2932736/1310112879075*n^8 - 1378304/4512611027925*n^9 - 102400/1624539970053*n^10 - 677888/40613499251325*n^11 - 876544/166966608033225*n^12 - 2048/1091285019825*n^13 - 241664/325982425207725*n^14 - 3737600/11774485198503027*n^15 - 22642688/155838774686069475*n^16 - 661504/9402339422651175*n^17 - 10719232/299830157144543025*n^18 - 37783552/1994522349700655775*n^19 - 1024000/98334590264311401*n^20 - 38912/6580123531536555*n^21 - 1773568/513022734648418995*n^22 - 47104/22706932741377885*n^23 - 1851392/1452689867820346155*n^24) * eps^5
        - (512/405405 - 2048/530145*n + 299008/130945815*n^2 + 280576/43648605*n^3 - 14114816/1003917915*n^4 + 63039488/5019589575*n^5 - 87683072/15058768725*n^6 + 243132416/187158982725*n^7 - 3305586688/40613499251325*n^8 - 1816576/410237366175*n^9 - 26021888/40613499251325*n^10 - 208984064/1502699472299025*n^11 - 1482752/38530755699975*n^12 - 258390016/20536892788086675*n^13 - 1101824/236688927871275*n^14 - 1674704896/883086389887727025*n^15 - 103952580608/124515180974169510525*n^16 - 20090607616/51270956871716857275*n^17 - 141357056/728158953065318775*n^18 - 244905162752/2431322744285099389725*n^19 - 5751365632/105709684534134756075*n^20 - 52934656/1738947191470615035*n^21 - 46270369792/2633345696950334701335*n^22 - 57764907008/5539106465998979889015*n^23) * eps^6
        + (128/2297295 - 2048/1438965*n + 241664/43648605*n^2 - 1071104/143416845*n^3 - 598016/3011753745*n^4 + 27613184/2377700325*n^5 - 863424512/62386327575*n^6 + 14341695488/1933976154825*n^7 - 10573889536/5801928464475*n^8 + 554350592/4512611027925*n^9 + 10652495872/1502699472299025*n^10 + 19990528/18551845337025*n^11 + 385441792/1579760983698975*n^12 + 26510989312/378465595666168725*n^13 + 36253696/1532249375166675*n^14 + 53436065792/5929294332103310025*n^15 + 52137918464/13835020108241056725*n^16 + 1480593344512/871606266819186573675*n^17 + 4181365755904/5132792460157432044975*n^18 + 1000732862464/2431322744285099389725*n^19 + 43487879168/199978927019120729025*n^20 + 134786934784/1128576727264429157715*n^21 + 14014785654784/206529541089390535861845*n^22) * eps^7
        - (17536/130945815 + 1024/43648605*n - 333824/3011753745*n^2 - 3402752/1003917915*n^3 + 76509184/9035261235*n^4 - 506510336/119101170825*n^5 - 544454656/64774320975*n^6 + 81273324544/5801928464475*n^7 - 116438441984/13537833083775*n^8 + 384681841664/166966608033225*n^9 - 9210947584/55655536011075*n^10 - 56273062912/5600970760387275*n^11 - 1406799613952/883086389887727025*n^12 - 17382315008/46478231046722475*n^13 - 7065012224/63755853033368925*n^14 - 1597517556736/41505060324723170175*n^15 - 13088473088/870735531287898675*n^16 - 96767968256/15052177302514463475*n^17 - 2168797042688/733256065736776006425*n^18 - 22253970224128/15398377380472296134925*n^19 - 2024631116115968/2725512796343596415881725*n^20 - 631344565525504/1583393148351994108274145*n^21) * eps^8
        + (2944/43648605 - 1722368/3011753745*n + 13266944/15058768725*n^2 + 108544/717084225*n^3 + 19259392/13790661885*n^4 - 304229926912/40613499251325*n^5 + 13166350336/1933976154825*n^6 + 217784215552/40613499251325*n^7 - 1070803042304/79089445910475*n^8 + 1576695216128/166966608033225*n^9 - 7317091151872/2678725146272175*n^10 + 71083022336/342591383636775*n^11 + 332174286848/25231039711077915*n^12 + 180362430464/83287746471016395*n^13 + 457253050314752/871606266819186573675*n^14 + 66028500992/413279405793829575*n^15 + 2626638683471872/46195132141416888404775*n^16 + 1048407575824384/46195132141416888404775*n^17 + 1373352398848/138724120544795460675*n^18 + 341593997830144/73662508009286389618425*n^19 + 382965711284199424/166256280576959381368785225*n^20) * eps^9
        - (14848/602350749 + 63488/1673196525*n + 413696/1368978975*n^2 - 58701824/48522699225*n^3 + 71114752/164427122475*n^4 - 241801216/738427259115*n^5 + 890097664/148767396525*n^6 - 185319725056/23118453419985*n^7 - 14710882304/5272629727365*n^8 + 87149336576/6838792137225*n^9 - 1769065070153728/176617277977545405*n^10 + 39343512737792/12675881194560675*n^11 - 10281234043641856/41505060324723170175*n^12 - 1581078206464/96748392365322075*n^13 - 806631639658496/290535422273062191225*n^14 - 112074429466624/162088182952339959315*n^15 - 269338565378048/1248517084903159146075*n^16 - 18582400043008/236898113545727632845*n^17 - 1933197962104832/60566951029857698130705*n^18 - 60399947547314176/4262981553255368753045775*n^19) * eps^10
        + (13696/295269975 - 1263616/5019589575*n + 93507584/436704293025*n^2 - 143448064/1504203675975*n^3 + 14614028288/13537833083775*n^4 - 609875968/624823065405*n^5 - 1237520384/26363148636825*n^6 - 253546190848/55655536011075*n^7 + 5681519509504/677040421585275*n^8 + 214664647481344/294362129962575675*n^9 - 31278745921441792/2649259169663181075*n^10 + 290271896455168/27949535572204155*n^11 - 994793732507705344/290535422273062191225*n^12 + 1007756234246144/3528770311008852525*n^13 + 180209601368526848/9239026428283377680955*n^14 + 52513246916810752/15398377380472296134925*n^15 + 4467930789675008/5132792460157432044975*n^16 + 1202387450415104/4333088706428611154025*n^17 + 146144562349641728/1420993851085122917681925*n^18) * eps^11
        - (2752/792566775 + 3126784/436704293025*n + 278027264/1230712098525*n^2 - 1906406912/4512611027925*n^3 + 13318144/148767396525*n^4 - 385723904/479329975215*n^5 + 651327491072/500899824099675*n^6 + 2585190754816/61610678364260025*n^7 + 1285145378811904/378465595666168725*n^8 - 1896715047424/228719603700525*n^9 + 108991838453582848/124515180974169510525*n^10 + 34341601112433152/3169477333887951177*n^11 - 616093273555376128/58107084454612438245*n^12 + 79626751390577152/21536192140520693895*n^13 - 611808984871936/1906919799439293639*n^14 - 348075945959202304/15398377380472296134925*n^15 - 11052858295372292096/2725512796343596415881725*n^16 - 16246381930177024/15352874741615973900525*n^17) * eps^12
        + (34048/1094496975 - 4296704/33929406225*n + 9199616/113763303225*n^2 - 666202112/4512611027925*n^3 + 11972722688/23852372576175*n^4 - 19444084736/100179964819935*n^5 + 97002643456/175528998188775*n^6 - 539677367382016/378465595666168725*n^7 + 37863377108992/294362129962575675*n^8 - 849685773930496/337439514835147725*n^9 + 2307997411351846912/290535422273062191225*n^10 - 952506302124032/452782476269707311*n^11 - 10149533533759029248/1026558492031486408995*n^12 + 2536635024778391552/236898113545727632845*n^13 - 345761202095071232/87990727888413120771*n^14 + 170146429996470272/481454300714290128225*n^15 + 4257384430093558022144/166256280576959381368785225*n^16) * eps^13
        + (7168/4946230575 + 8974336/1933976154825*n - 93282304/644658718275*n^2 + 1573646336/8787716212275*n^3 - 1366114304/12843585233325*n^4 + 202461184/415348221015*n^5 - 411651006464/1274294934902925*n^6 + 3839857856512/10228799882869425*n^7 - 494905525829632/348782019535488825*n^8 + 3102394617856/8943128706038175*n^9 - 23750499115491328/12631974881437486575*n^10 + 6281828177286582272/839911493480307061905*n^11 - 362043035983265792/119367266515289117325*n^12 - 66153523158142976/7357084271606448225*n^13 + 278535696937581191168/25957264727081870627445*n^14 - 10888422776491155263488/2638988580586656847123575*n^15) * eps^14
        + (120064/5605727985 - 192512/2712449025*n + 3118014464/71557117728525*n^2 - 661172224/5386019613975*n^3 + 716483084288/2933841826869525*n^4 - 51287781376/468480843441765*n^5 + 378645470961664/883086389887727025*n^6 - 307621081034752/711515319852397203*n^7 + 14911080071168/54731947680953631*n^8 - 881401908588544/658810481344812225*n^9 + 5137439471148163072/9239026428283377680955*n^10 - 1347004173866315776/942757798804426293975*n^11 + 107407504440093753344/15398377380472296134925*n^12 - 260611080305794551808/69884943495989651689275*n^13 - 64625496610661007302656/7916965741759970541370725*n^14) * eps^15
        + (6400/2616006393 + 1107968/140504859495*n - 2029686784/21778253221725*n^2 + 1198225408/12989812010175*n^3 - 1367443873792/13585944459811185*n^4 + 719433310676992/2649259169663181075*n^5 - 63814622162944/456099564007946925*n^6 + 157784678176768/438213306595870575*n^7 - 442694333281845248/871606266819186573675*n^8 + 4703020945135616/20780536275941020425*n^9 - 174940641115230208/143018984957947022925*n^10 + 179184835005863936/244418688578925335475*n^11 - 3826143738499702784/3428317982822133856455*n^12 + 16560752844714960140288/2557788931953221251827465*n^13) * eps^16
        + (84736/5562772215 - 1101824/25471641195*n + 5169913856/178581676418145*n^2 - 233627242496/2559670695326745*n^3 + 70218421682176/529851833932636215*n^4 - 367435176251392/4016618741102242275*n^5 + 11260909794107392/41505060324723170175*n^6 - 157314981962559488/871606266819186573675*n^7 + 4600932081707548672/15398377380472296134925*n^8 - 2826045097184792576/5132792460157432044975*n^9 + 3358887872888479744/15398377380472296134925*n^10 - 2997036152580109078528/2725512796343596415881725*n^11 + 48333318506986607427584/55418760192319793789595075*n^12) * eps^17
        + (29696/12381654285 + 126963712/15737082596235*n - 174095884288/2803448856786435*n^2 + 192265793536/3463083881912655*n^3 - 2065111023763456/24903036194833902105*n^4 + 137907822072991744/871606266819186573675*n^5 - 1454755457867776/15291338014371694275*n^6 + 16143676059275264/63194435213976591525*n^7 - 923844554893459456/4199557467401535309525*n^8 + 1290691679389454336/5132792460157432044975*n^9 - 90880238263941996544/160324282137858612698925*n^10 + 38669172193378346979328/166256280576959381368785225*n^11) * eps^18
        + (171776/15383267445 - 4296704/152649346185*n + 786882560/36910611907533*n^2 - 1117064032256/16769721343322493*n^3 + 1268559669477376/15847386669439755885*n^4 - 6079247310737408/79236933347198779425*n^5 + 238252404104617984/1399852489133845103175*n^6 - 4954857180036468736/46195132141416888404775*n^7 + 3590745911011278848/15398377380472296134925*n^8 - 10935270658690822144/43262107878469784379075*n^9 + 4039796192998858153984/18472920064106597929865025*n^10) * eps^19
        + (244288/116731852965 + 16665088/2289740192775*n - 60094358528/1399031257785525*n^2 + 3775697939968/101196594313152975*n^3 - 11699335030784/179675585821312425*n^4 + 16586730946151936/167982298696061412381*n^5 - 60983345813341184/810440914761699796575*n^6 + 378264738379902464/2199768197210328019275*n^7 - 19768926062753615872/160324282137858612698925*n^8 + 9935173508449188352/47245319857050122582775*n^9) * eps^20
        + (2254208/268167770325 - 202909696/10519032013425*n + 1358934016/82295956340325*n^2 - 160058079232/3264406268166225*n^3 + 850193500332032/16090258495791323025*n^4 - 321074139364931584/5132792460157432044975*n^5 + 243713411755012096/2199768197210328019275*n^6 - 707822781060487168/9054859788516931614225*n^7 + 3972497411381290090496/23750897225279911624112175*n^8) * eps^21
        + (46064128/26177300041725 + 2135226368/340304900542425*n - 129082421248/4197093773356575*n^2 + 14011652593664/519040596638429775*n^3 - 11242059096064/222445969987898475*n^4 + 34969938420373504/530978530361113659825*n^5 - 31791272768638976/519442118609414220675*n^6 + 64623481105209387008/552346447099532828467725*n^7) * eps^22
        + (567424/87633237825 - 2525366272/183241100292075*n + 127744077824/9711778315479975*n^2 - 1465656547328/39926199741417675*n^3 + 64825892864/1735921727887725*n^4 - 434460028991488/8637367877393357025*n^5 + 3702905819309092864/48999787968452514402825*n^6) * eps^23
        + (4411264/3014175784725 + 36530244608/6869306613388275*n - 6393343404032/281641571148919275*n^2 + 1926123498496/93880523716306425*n^3 - 8066704574943232/204941183272696925775*n^4 + 83042824808834048/1785916025662073210325*n^5) * eps^24
        + (14258816/2802654677025 - 85649408/8407964031075*n + 24432791552/2289768871129425*n^2 - 155146314299392/5538950899262079075*n^3 + 28150215791353856/1013628014564960470725*n^4) * eps^25
        + (74207744/61002462438225 + 81445824512/18158399652444975*n - 55287432851456/3214036738482760575*n^2 + 45322371937982464/2810139455013426996075*n^3) * eps^26
        + (32066944/7884672015825 - 75653347328/9769108627607175*n + 245769011032064/28008034435349770725*n^2) * eps^27
        + (83335616/82093349811825 + 9767500288/2579721325904925*n) * eps^28
        + 4519424/1369344910725 * eps^29;
C4[5] = + (128/99099 - 2048/495495*n + 4096/765765*n^2 - 6144/1616615*n^3 + 8192/4849845*n^4 - 10240/22309287*n^5 + 12288/185910725*n^6 - 2048/717084225*n^7 - 16384/145568097675*n^8 - 2048/167133741775*n^9 - 4096/1985548852287*n^10 - 2048/4512611027925*n^11 - 8192/68023432902425*n^12 - 2048/55655536011075*n^13 - 4096/325982425207725*n^14 - 2048/436092044389001*n^15 - 32768/17315419409563275*n^16 - 34816/42832879592077575*n^17 - 4096/11104820634983075*n^18 - 38912/221613594411183975*n^19 - 40960/469820820151710027*n^20 - 6144/136720344488592865*n^21 - 4096/171007578216139665*n^22 - 47104/3580126395557246535*n^23 - 49152/6617809397848243595*n^24) * eps^5
        - (256/495495 - 8192/2807805*n + 376832/53348295*n^2 - 8192/855855*n^3 + 294912/37182145*n^4 - 761856/185910725*n^5 + 6373376/5019589575*n^6 - 1417216/6931814175*n^7 + 14614528/1504203675975*n^8 + 6873088/16546240435725*n^9 + 114688/2363748633675*n^10 + 483328/55655536011075*n^11 + 3702784/1836632688365475*n^12 + 1564672/2788960748999425*n^13 + 16384/91615975711975*n^14 + 434176/6845630929362225*n^15 + 113115136/4611673369413685575*n^16 + 19357696/1898924328582105825*n^17 + 7651328/1699037557152410475*n^18 + 188801024/90048990529077755175*n^19 + 2588672/2533347559641573675*n^20 + 36364288/70137536722648139745*n^21 + 26591232/97531322109271655605*n^22 + 334061568/2256673004666251065895*n^23) * eps^6
        - (6784/8423415 - 432128/160044885*n + 397312/160044885*n^2 + 3233792/1227010785*n^3 - 90112/10140585*n^4 + 16893952/1673196525*n^5 - 304615424/48522699225*n^6 + 129972224/58605338025*n^7 - 19623657472/49638721307175*n^8 + 112556032/5515413478575*n^9 + 1717645312/1836632688365475*n^10 + 1488896/12843585233325*n^11 + 548397056/25100646740994825*n^12 + 1909467136/359775936620925825*n^13 + 26341376/17132187458139325*n^14 + 212998144/419243033583062325*n^15 + 2574811136/13835020108241056725*n^16 + 7177459712/96845140757687397075*n^17 + 1640075264/51846388486438707525*n^18 + 42549766144/2971616687459565920775*n^19 + 384894803968/56460717061731752494725*n^20 + 4678068224/1379371555545413414985*n^21 + 93907152896/53544695837990138927145*n^22) * eps^7
        + (512/53348295 - 16384/22863555*n + 950272/283156335*n^2 - 7094272/1227010785*n^3 + 27459584/11043097065*n^4 + 44056576/7661478825*n^5 - 15664185344/1504203675975*n^6 + 55903043584/7091245901025*n^7 - 156559081472/49638721307175*n^8 + 125727391744/204070298707275*n^9 - 62808752128/1836632688365475*n^10 - 11392663552/6845630929362225*n^11 - 33476509696/154189687123253925*n^12 - 138500489216/3237983429588332425*n^13 - 950960128/88019214106796775*n^14 - 1150632968192/355098849444853789275*n^15 - 106967072768/96845140757687397075*n^16 - 305122557952/733256065736776006425*n^17 - 22689579008/133476872486363481075*n^18 - 4193065713664/56460717061731752494725*n^19 - 114398135779328/3331182306642173397188775*n^20 - 32269630521344/1935258292430215021223955*n^21) * eps^8
        - (16768/160044885 - 18432/409003595*n - 1716224/6135053925*n^2 - 784384/557732175*n^3 + 358162432/64049962977*n^4 - 21357307904/3818363177475*n^5 - 8616275968/3818363177475*n^6 + 393340928/41057668575*n^7 - 4234428416/475688341975*n^8 + 84470368256/21110720555925*n^9 - 102917165056/121259162999975*n^10 + 4928882046976/98120709987525225*n^11 + 8343515193344/3237983429588332425*n^12 + 178912274432/508980672878433525*n^13 + 633749204992/8804103705244308825*n^14 + 20039994431488/1065296548334561367825*n^15 + 2233706971136/384086510624025527175*n^16 + 4259891402752/2091137668953027870175*n^17 + 1138831732736/1447710693890557756275*n^18 + 283557603328/862777080197403107275*n^19 + 26333931741184/179665889217659219477025*n^20) * eps^9
        + (40192/1227010785 - 6627328/18405161775*n + 13451264/18405161775*n^2 - 1220608/177916563825*n^3 + 625639424/49638721307175*n^4 - 40023105536/9927744261435*n^5 + 8635301888/1272787725825*n^6 - 3905085440/5651177502663*n^7 - 601491439616/73465307534619*n^8 + 78960137363456/8366882246998275*n^9 - 3063088825974784/647596685917666485*n^10 + 318151765925888/294362129962575675*n^11 - 3436000146980864/50728407063550541325*n^12 - 141582966784/38892210884398575*n^13 - 18976575045632/36734363735674529925*n^14 - 14207981707264/129794751866050005735*n^15 - 1664495212691456/56460717061731752494725*n^16 - 105714509602816/11292143412346350498945*n^17 - 248688188440576/74026273480937186604195*n^18 - 20727065127968768/15630932361936352094501175*n^19) * eps^10
        - (451456/18405161775 + 468992/18405161775*n + 2215936/21349987659*n^2 - 186566656/220616539143*n^3 + 10790330368/16546240435725*n^4 + 69511168/174170951955*n^5 + 1481088978944/612210896121825*n^6 - 336223479808/49638721307175*n^7 + 216393505521664/75301940222984475*n^8 + 2378698436777984/359775936620925825*n^9 - 31129006450757632/3237983429588332425*n^10 + 14764481067108352/2767004021648211345*n^11 - 6488450473984/4973860874943675*n^12 + 335812940167168/3902185158734657025*n^13 + 955302786666496/198107779163971061385*n^14 + 13339668624545792/18820239020577250831575*n^15 + 8742367278497792/56460717061731752494725*n^16 + 763066338654208/17813809126428734744325*n^17 + 8502065922936832/610216578694211943629175*n^18) * eps^11
        + (75776/2906078175 - 21692416/123173005725*n + 1413349376/7091245901025*n^2 + 807206912/49638721307175*n^3 + 29159063552/49638721307175*n^4 - 392668971008/367326537673095*n^5 - 141528793088/612210896121825*n^6 - 91066548813824/75301940222984475*n^7 + 19940018063147008/3237983429588332425*n^8 - 14101050299973632/3237983429588332425*n^9 - 20817214190780416/4113114086233827675*n^10 + 36951885405552640/3873805630307495883*n^11 - 95511505657397248/16389177666685559505*n^12 + 1316229674909106176/868626416334334653765*n^13 - 18190456006246400/173725283266866930753*n^14 - 9295527959658496/1525965325992750067425*n^15 - 3078599776131874816/3331182306642173397188775*n^16 - 2480267930475757568/11953065923833681013442075*n^17) * eps^12
        - (157952/25416651975 + 63254528/5515413478575*n + 684187648/5515413478575*n^2 - 531623936/1504203675975*n^3 + 4810227712/68023432902425*n^4 - 384561152/1316582572305*n^5 + 4242336096256/3585806677284975*n^6 - 3859307081728/27209944786456575*n^7 + 7701409398784/17315419409563275*n^8 - 546830624075776/102897377410853025*n^9 + 330876058407968768/62664502843209492225*n^10 + 14091916227989504/3873805630307495883*n^11 - 34993139294239965184/3764047804115450166315*n^12 + 1800608637785731072/289542138778111551255*n^13 - 355896986804224/208015905173553477*n^14 + 19560882727191252992/158627728887722542723275*n^15 + 1508191457506470068224/203202120705172577228515275*n^16) * eps^13
        + (1938944/102771679725 - 17088512/181826817975*n + 34045952/472749726735*n^2 - 6395052032/122442179224365*n^3 + 25022234624/68023432902425*n^4 - 35317563392/152125131763605*n^5 + 591038611456/5771806469854425*n^6 - 506800255483904/462569061369761775*n^7 + 124425632874496/241947887425519275*n^8 - 98713540640768/2984023944914737725*n^9 + 205916220474097664/46317241231937450775*n^10 - 349988448862552064/60385793648910965235*n^11 - 3447444843814387712/1447710693890557756275*n^12 + 563260537104941056/62943943212632945925*n^13 - 15920738443405656064/2440426598272654503435*n^14 + 156734826902743629824/82905802001294401154025*n^15) * eps^14
        - (12032/12332601567 + 4599808/2158205274225*n + 170288193536/1836632688365475*n^2 - 290734034944/1836632688365475*n^3 + 267831984128/6845630929362225*n^4 - 1040046419968/3463083881912655*n^5 + 12144070811648/32706903329175075*n^6 - 12323923677184/395286288806887335*n^7 + 10271238256623616/11213647877205909135*n^8 - 45081806458482688/56068239386029545675*n^9 - 81270905450586112/594323337491913184155*n^10 - 26646047229472768/7301269502357655825*n^11 + 20005720522276225024/3321218650690103087925*n^12 + 47542518825522900992/36606398974089817551525*n^13 - 4201054759030906560512/492014820109376700311175*n^14) * eps^15
        + (218112/15986705735 - 290357248/5323573009755*n + 131006464/3802552149825*n^2 - 842694656/13344309803825*n^3 + 790763536384/3924828399501009*n^4 - 7426755887104/98120709987525225*n^5 + 75745991262208/354744105339514275*n^6 - 3377930257793024/7449626212129799775*n^7 + 4306377448357888/96845140757687397075*n^8 - 27137013481472/37825596510476775*n^9 + 2956012676751097856/2971616687459565920775*n^10 + 801788666804862976/5132792460157432044975*n^11 + 3289715296102045057024/1110394102214057799062925*n^12 - 31552966617464087478272/5210310787312117364833725*n^13) * eps^16
        + (294656/469127123465 + 25858048/13604686580485*n - 9844842496/152125131763605*n^2 + 175265755136/2180460221945005*n^3 - 2666742562816/58872425992515135*n^4 + 215614078521344/1064232316018542825*n^5 - 46888924340224/354744105339514275*n^6 + 28689645211648/201341248976481075*n^7 - 11152793875152896/23225305249581140475*n^8 + 650630500139831296/6273413006859083610525*n^9 - 30411772176709967872/56460717061731752494725*n^10 + 332517313573568196608/302834755149288490653525*n^11 + 6147866059759464267776/67734040235057525742838425*n^12) * eps^17
        + (13824/1375739365 - 59359232/1748564732915*n + 45142409216/2180460221945005*n^2 - 1079315316736/19624141997505045*n^3 + 13677762117632/120304522680357015*n^4 - 21487658647552/446290971233582475*n^5 + 107709256466432/601522613401785075*n^6 - 317939842858467328/1710930820052477348325*n^7 + 32625224557920256/330179631939951768975*n^8 - 8782461881349357568/18820239020577250831575*n^9 + 66561309202129190912/370131367404685933020975*n^10 - 9846754133827698688/24929716685703910836525*n^11) * eps^18
        + (27392/25638779075 + 8081408/2425428500495*n - 739467264/16345279025075*n^2 + 23711257718784/512408152157076175*n^3 - 4197953748992/94483064153841363*n^4 + 66534864318464/517888453249665225*n^5 - 113093248480108544/1710930820052477348325*n^6 + 8321651132554350592/56460717061731752494725*n^7 - 12728279499474894848/56460717061731752494725*n^8 + 30034408600463986688/370131367404685933020975*n^9 - 3791666672669202522112/8834874813268372922978925*n^10) * eps^19
        + (362496/47933369575 - 73990144/3307402500675*n + 24686231552/1709927092848975*n^2 - 5424909975552/123684726382742525*n^3 + 737167248982016/10760571195298599675*n^4 - 2806535039418368/68437232802099093933*n^5 + 141729549396082688/1107072883563367695975*n^6 - 2818897757929472/31142149510056123825*n^7 + 110767543318740992/937568901390986039175*n^8 - 1624194242334359552/6542455349662660653225*n^9) * eps^20
        + (179072/160900662195 + 5079242752/1399031257785525*n - 45133008896/1399031257785525*n^2 + 3194148988928/107725406849485425*n^3 - 300531459629056/7695341019726284925*n^4 + 4673381031931672576/56460717061731752494725*n^5 - 2564296548162482176/56460717061731752494725*n^6 + 3314224376139778048/27993128627245154598225*n^7 - 1369582736990797021184/11953065923833681013442075*n^8) * eps^21
        + (5634304/969529631175 - 104833024/6786707418225*n + 2751414272/251108174474325*n^2 - 23908622336/700459644586275*n^3 + 158037016576/3570635749232475*n^4 - 1796889271328768/49921058410019232975*n^5 + 7584413032870494208/85414930939542907620225*n^6 - 568203943290363904/10290278052624326592825*n^7) * eps^22
        + (14777984/14401062082575 + 2047571968/590443545385575*n - 105351344128/4470501129347925*n^2 + 87661905668096/4245485905837412775*n^3 - 15411476668416/471720656204156975*n^4 + 16965096326715392/306146705876497876775*n^5 - 189726703450447433728/5210310787312117364833725*n^6) * eps^23
        + (1524224/334908420525 - 8459829248/763256290376475*n + 2999519051776/344228586959790225*n^2 - 9129476276224/344228586959790225*n^3 + 22885325392510976/751451005333222061175*n^4 - 1421006686098669568/45838511325326545731675*n^5) * eps^24
        + (99522176/110050906984515 + 655403008/208717237384425*n - 4588589584384/260270395018377975*n^2 + 3208194018019328/209864695183152107175*n^3 - 4971722761576448/185532556611192442575*n^4) * eps^25
        + (356096/98232628725 - 49703919616/6052799884148325*n + 51891453952/7288065166627575*n^2 - 6483388995346432/312237717223714110675*n^3) * eps^26
        + (22625408/28910464058025 + 25774721024/9286683510194475*n - 4256878292992/315710533087678575*n^2) * eps^27
        + (98029568/33445438812225 - 650254352384/104048760144831975*n) * eps^28
        + 3108352/4619256832179 * eps^29;
C4[6] = + (512/585585 - 4096/1422135*n + 8192/2078505*n^2 - 4096/1322685*n^3 + 16384/10140585*n^4 - 4096/7243275*n^5 + 8192/65189475*n^6 - 28672/1890494775*n^7 + 32768/58605338025*n^8 + 4096/214886239425*n^9 + 8192/4512611027925*n^10 + 4096/15178782548475*n^11 + 16384/310080843490275*n^12 + 4096/325982425207725*n^13 + 57344/16565834153738025*n^14 + 4096/3822884804708775*n^15 + 65536/179675585821312425*n^16 + 69632/517888453249665225*n^17 + 8192/154457959741128225*n^18 + 77824/3508402228405626825*n^19 + 16384/1677931500541821525*n^20 + 4096/910877100294131685*n^21 + 8192/3799921640620973595*n^22 + 94208/87922324857126664905*n^23) * eps^6
        - (1024/3318315 - 16384/9006855*n + 98304/21015995*n^2 - 770048/111546435*n^3 + 65536/10140585*n^4 - 606208/152108775*n^5 + 1015808/630164925*n^6 - 114688/283117575*n^7 + 11665408/214886239425*n^8 - 1097728/501401225325*n^9 - 4489216/55655536011075*n^10 - 180224/21924908125575*n^11 - 38469632/29664400693902975*n^12 - 3751936/14017244283932175*n^13 - 12156928/182224175691118275*n^14 - 14925824/778594205225687175*n^15 - 262144/42531901957701975*n^16 - 6373376/2934701235081436275*n^17 - 42827776/51846388486438707525*n^18 - 30195712/90048990529077755175*n^19 - 11730944/81472896192975111825*n^20 - 1163264/17913916305784589805*n^21 - 360448/11786197631078613015*n^22) * eps^7
        - (103424/189143955 - 8192/4203199*n + 3260416/1450103655*n^2 + 253952/315239925*n^3 - 28082176/5019589575*n^4 + 103325696/13233463425*n^5 - 822099968/136745788725*n^6 + 1433600/505614681*n^7 - 401801216/501401225325*n^8 + 2190548992/18551845337025*n^9 - 73121792/14186705257725*n^10 - 547889152/2696763699445725*n^11 - 28002254848/1275569229837827925*n^12 - 1073225728/294362129962575675*n^13 - 20235665408/25693608772447676775*n^14 - 85799051264/419662276616645387325*n^15 - 2324824064/38151116056058671575*n^16 - 1049976832/51846388486438707525*n^17 - 838811648/114062054670165156555*n^18 - 1639800832/570310273350825782775*n^19 - 5253726208/4388909494917224502225*n^20 - 66113314816/125666122885078897482075*n^21) * eps^8
        - (1024/189143955 + 1654784/4350310965*n - 45842432/21751554825*n^2 + 31342592/7250518275*n^3 - 6135283712/1892385269775*n^4 - 10298703872/4512611027925*n^5 + 6553174016/902522205585*n^6 - 1929592832/265447707525*n^7 + 668086697984/166966608033225*n^8 - 913531224064/723521968143975*n^9 + 1061266948096/5234894240100525*n^10 - 3303047708672/347882517228498525*n^11 - 1519936274432/3826707689513483775*n^12 - 625052991488/13835020108241056725*n^13 - 340739325952/43413338960342626275*n^14 - 76600623104/43413338960342626275*n^15 - 31673898237952/66726301982046616584675*n^16 - 9749494448128/66726301982046616584675*n^17 - 85542404096/1710930820052477348325*n^18 - 27544600576/1477242708045309710505*n^19 - 138002181062656/18472920064106597929865025*n^20) * eps^9
        - (71168/870062193 - 36864/483367885*n - 8192/31387525*n^2 - 99487744/210265029975*n^3 + 206400176128/58663943363025*n^4 - 157536256/30474775773*n^5 + 1459478528/1504203675975*n^6 + 314377302016/55655536011075*n^7 - 124925476864/16078265958755*n^8 + 640587280384/128417319021225*n^9 - 9891103023104/5669196577057013*n^10 + 35120897650688/115960839076166175*n^11 - 129391717695488/8564536257482558925*n^12 - 838089404416/1257729100749186975*n^13 - 5874723561472/74058048814702127175*n^14 - 12759336988672/889684026427288221129*n^15 - 1516148424704/453920421646575623025*n^16 - 91688259584/98853780714143135681*n^17 - 128511000682496/437427979660083375388425*n^18 - 10085039747072/97740317799505809152725*n^19) * eps^10
        + (118784/7250518275 - 15269888/65254664475*n + 158990336/270340752825*n^2 - 1072234496/6518215929225*n^3 - 71041024/180504441117*n^4 - 3131899904/1676112667515*n^5 + 767602327552/144704393628795*n^6 - 7247836020736/2170565904431925*n^7 - 326399017091072/88993202081708925*n^8 + 35920955899904/4672414761310725*n^9 - 22026456501714944/3826707689513483775*n^10 + 36243071515820032/16350478309739430675*n^11 - 24770945246560256/59951753802377912475*n^12 + 17755041759232/813824712249473925*n^13 + 1642198110175232/1627470780049917477675*n^14 + 2782922322673664/22242100660682205528225*n^15 + 223455531237376/9532328854578088083525*n^16 + 100384158318592/17813809126428734744325*n^17 + 42957093661179904/26683106759265085898693925*n^18) * eps^11
        - (1445888/65254664475 + 7897088/630795089925*n + 2424832/197521694825*n^2 - 6604095488/11732788672605*n^3 + 14287765504/19554647787675*n^4 + 906395648/2630988975069*n^5 + 22769893376/42560115773175*n^6 - 4711849558016/1046978848020105*n^7 + 1066871483531264/225100452324322575*n^8 + 35504692166656/20463677484029325*n^9 - 76345812706066432/10579721259243161025*n^10 + 6068059858960384/961792841749378275*n^11 - 478285812169048064/179855261407133737425*n^12 + 11756726194307072/22219880779902303225*n^13 - 654323284159299584/22242100660682205528225*n^14 - 94770142918180864/66726301982046616584675*n^15 - 719292224190808064/3936851816940750378495825*n^16 - 499369150090805248/14126350637257986652249725*n^17) * eps^12
        + (1380352/90113584275 - 7386628096/58663943363025*n + 368705536/2022894598725*n^2 + 6750208/205838397765*n^3 + 18468306944/70018254981675*n^4 - 82814894080/86822636177277*n^5 + 2978608709632/29664400693902975*n^6 + 9194635264/44354768930901*n^7 + 764169233629184/225100452324322575*n^8 - 18918718461771776/3526573753081053675*n^9 - 3627328171802624/74058048814702127175*n^10 + 745621946343817216/114453348168176014725*n^11 - 21203780625144479744/3177442951526029361175*n^12 + 320789326680752128/104750866533825143775*n^13 - 6167729552277241856/9532328854578088083525*n^14 + 49486985870301790208/1312283938980250126165275*n^15 + 454620391029060141056/240147960833385773088245325*n^16) * eps^13
        - (846848/121457439675 + 2760704/270340752825*n + 3755098112/58663943363025*n^2 - 10839138304/38080103586525*n^3 + 47457796096/434113180886385*n^4 - 38041296896/1618058219667435*n^5 + 574179688448/662633366149521*n^6 - 16095472541696/28772238267018675*n^7 - 852568899584/1849925032215975*n^8 - 3031959594082304/1299264014293019775*n^9 + 199399103086592/36548518879726425*n^10 - 60421317679783936/45609228969273148725*n^11 - 6672117285593513984/1170636876878010817275*n^12 + 5045150093198467072/733256065736776006425*n^13 - 1924429501006250622976/562407402420107196927975*n^14 + 8739482245092077723648/11435617182542179670868825*n^15) * eps^14
        + (10240/857346633 - 1343488/18893379505*n + 49142628352/723521968143975*n^2 - 800620544/94372430627475*n^3 + 29913645056/120098788234425*n^4 - 14168250155008/51022769193513117*n^5 - 24690420416512/425189743279275975*n^6 - 16306272150519808/25693608772447676775*n^7 + 1053863745683456/1204772085980800155*n^8 + 2085142575153152/5097112671457231425*n^9 + 205141644672696320/140476425225361298073*n^10 - 18323705530956218368/3511910630634032451825*n^11 + 159481393476014047232/66726301982046616584675*n^12 + 489546767922423037952/100944918383096163551175*n^13 - 79622081860613047779328/11435617182542179670868825*n^14) * eps^15
        - (2717696/1303643185845 + 1836138496/434113180886385*n + 4381376512/74847100152825*n^2 - 1375220350976/9888133564634325*n^3 + 90641821007872/3826707689513483775*n^4 - 593210015105024/3826707689513483775*n^5 + 350306565259264/922334673882737115*n^6 + 159804932096/11168854890749325*n^7 + 488092323692281856/1258986829849936161975*n^8 - 23509815515070464/22953664252510016025*n^9 - 723446958058078208/3511910630634032451825*n^10 - 53863391092240203776/66726301982046616584675*n^11 + 6298552764167390298112/1312283938980250126165275*n^12 - 33340680555495243776/10478116882646964225675*n^13) * eps^16
        + (264192/29180156005 - 22183936/518653740605*n + 459997184/14869373781405*n^2 - 4054633644032/141729914426425325*n^3 + 35892774436864/225100452324322575*n^4 - 165276001992704/1976431444034436675*n^5 + 330119439908864/4611673369413685575*n^6 - 2591369816276992/6456342717179159805*n^7 + 3979077460688896/43870021026986598675*n^8 - 202257437979738112/1059147650508676453725*n^9 + 7722684046167310336/7414033553560735176075*n^10 - 60600652525666336768/1312283938980250126165275*n^11 + 4062175202748267102208/11435617182542179670868825*n^12) * eps^17
        - (29696/89423058725 + 86007808/113656707639475*n + 909564624896/20247130632346475*n^2 - 4874605256704/67135222623043575*n^3 + 8913665490944/446290971233582475*n^4 - 147497164496896/1064232316018542825*n^5 + 411105742077952/2767004021648211345*n^6 - 140225607434297344/5132792460157432044975*n^7 + 1872239470911094784/5132792460157432044975*n^8 - 18411038875648/89301676499424675*n^9 + 10877741177165627392/171167470301771755586775*n^10 - 10158457386319702188032/10441215688408077090793275*n^11) * eps^18
        + (135168/19606125175 - 390529024/14332077502925*n + 303955968/17771776103627*n^2 - 77308821504/2451713646684575*n^3 + 121867688738816/1257729100749186975*n^4 - 2378965909504/66196268460483525*n^5 + 173125825593344/1709221598454023325*n^6 - 14482771405635584/74388296524020754275*n^7 + 4249471492292608/190103424450275260925*n^8 - 529596339336839168/1770963480405195851775*n^9 + 27063289888053788672/89241159729983564878575*n^10) * eps^19
        + (8065024/25797739505265 + 352878592/386966092578975*n - 46464827392/1399031257785525*n^2 + 14703099904/355075769519835*n^3 - 198597506367488/8804103705244308825*n^4 + 1332322775498752/13331928467941381935*n^5 - 2265423354462208/34916955511275047925*n^6 + 49038258159517696/733256065736776006425*n^7 - 81549844466630656/379017215455930526475*n^8 + 1082408332765528064/24147607926936729320085*n^9) * eps^20
        + (45056/8468455905 - 242941952/13324107217005*n + 1904607232/171810856219275*n^2 - 12027756544/425792121934725*n^3 + 107565505839104/1787806499532369225*n^4 - 4677584484237312/190103424450275260925*n^5 + 64934853946507264/733256065736776006425*n^6 - 48138266780041216/508965975040820992695*n^7 + 6948561124651958272/155234622387450402771975*n^8) * eps^21
        + (14907904/28116359304075 + 12387831808/7675766090012475*n - 1394830041088/56800669066092315*n^2 + 129385368375296/5017392434171487825*n^3 - 339203576086528/15052177302514463475*n^4 + 352973598659203072/5132792460157432044975*n^5 - 19296744227725312/539812397770567719525*n^6 + 11106387256285720576/155234622387450402771975*n^7) * eps^22
        + (20016128/4800354027525 - 7508672512/590443545385575*n + 3266801139712/406815602770661175*n^2 - 4080124248064/173013532212809925*n^3 + 30916335173632/792219858027077025*n^4 - 206717405857660928/9768863069331886795275*n^5 + 420161316872027275264/6157640021368865976621675*n^6) * eps^23
        + (664576/1153573448475 + 43416952832/23660945001670725*n - 509581410304/27717107001957135*n^2 + 11525019836416/663751772941605075*n^3 - 189239766700490752/9176810762099651231925*n^4 + 3799119443637886976/79969350926868389306775*n^5) * eps^24
        + (24341504/7336727132301 - 1010843648/110050906984515*n + 21086830592/3380135000238675*n^2 - 15924466597888/829504724044079475*n^3 + 1205956028389326848/45388009985519896633575*n^4) * eps^25
        + (71266816/128782976258475 + 21557248/11798830183525*n - 333133422592/23807679544316745*n^2 + 125585723838464/10072184426571422925*n^3) * eps^26
        + (7036928/2628224005275 - 51925090304/7598195599250025*n + 110139925594112/21784026783049821675*n^2) * eps^27
        + (4612096/9121483312425 + 601554944/350332525740175*n) * eps^28
        + 139264/63626127165 * eps^29;
C4[7] = + (1024/1640925 - 65536/31177575*n + 131072/43648605*n^2 - 65536/25741485*n^3 + 262144/175510125*n^4 - 65536/105306075*n^5 + 131072/727113375*n^6 - 458752/13524308775*n^7 + 524288/148767396525*n^8 - 65536/578539875375*n^9 - 131072/38530755699975*n^10 - 65536/227681738227125*n^11 - 262144/6845630929362225*n^12 - 65536/9704246042722275*n^13 - 917504/630775992776947875*n^14 - 65536/179675585821312425*n^15 - 1048576/10158581198358817875*n^16 - 65536/2031716239671763575*n^17 - 131072/11964551189178163275*n^18 - 1245184/311708044139115306375*n^19 - 262144/169212938246948309175*n^20 - 65536/103349517148757248875*n^21 - 131072/481420841700211039305*n^22) * eps^7
        - (2048/10392525 - 262144/218243025*n + 16252928/5019589575*n^2 - 42729472/8365982625*n^3 + 30408704/5791834125*n^4 - 11272192/3053876175*n^5 + 283639808/157783602375*n^6 - 442236928/743836982625*n^7 + 652214272/5206858878375*n^8 - 306970624/21405975388875*n^9 + 251133952/500899824099675*n^10 + 151257088/9334951267312125*n^11 + 2152726528/1471810649812878375*n^12 + 23330816/113216203831759875*n^13 + 378011648/9882157220172183375*n^14 + 835452928/96845140757687397075*n^15 + 297795584/132061555578664632375*n^16 + 356777984/538404803513017347375*n^17 + 141033472/658050315404798980125*n^18 + 444858368/5922452838643190821125*n^19 + 1970274304/69884943495989651689275*n^20 + 1628176384/144999372559706420171625*n^21) * eps^8
        - (84992/218243025 - 2424832/1673196525*n + 5373952/2788660875*n^2 - 65536/760543875*n^3 - 7635992576/2183521465125*n^4 + 6166740992/1041371775675*n^5 - 347209728/64282208375*n^6 + 1813970944/578539875375*n^7 - 6911688704/5837993287875*n^8 + 25729630208/92759226685125*n^9 - 237436534784/6845630929362225*n^10 + 19432800256/14866774240534125*n^11 + 4423155712/98120709987525225*n^12 + 13752664064/3192696948055628475*n^13 + 84292272128/132061555578664632375*n^14 + 97583104/787358867948678025*n^15 + 82997936128/2851551366754128913875*n^16 + 202549035008/25663962300787160224875*n^17 + 525991936/219350105134932993375*n^18 + 8466399232/10588627802422674498375*n^19 + 136503885824/473664617028374305893975*n^20) * eps^9
        - (16384/1673196525 + 1048576/5019589575*n - 14680064/10756263375*n^2 + 137363456/42814146375*n^3 - 217512411136/67689165418875*n^4 - 208666624/644658718275*n^5 + 266338304/55987729875*n^6 - 237490929664/38530755699975*n^7 + 10820641619968/2504499120498375*n^8 - 3027063799808/1629912126038625*n^9 + 424329152036864/883086389887727025*n^10 - 235471372288/3616242382832625*n^11 + 8647887290368/3294052406724061125*n^12 + 1531605680128/15963484740278142375*n^13 + 14010378354688/1452677111365310956125*n^14 + 2557180116992/1710930820052477348325*n^15 + 5922357248/19605777158737326375*n^16 + 5662418403328/76991886902361480674625*n^17 + 2079991005184/100944918383096163551175*n^18 + 19640114741248/3044986823753834823604125*n^19) * eps^10
        - (323584/5019589575 - 262144/3011753745*n - 3670016/18348919875*n^2 - 92536832/2051186830875*n^3 + 48279584768/22563055139625*n^4 - 43778048/10342118475*n^5 + 118776922112/49107825892125*n^6 + 133187239936/49107825892125*n^7 - 369268621312/61012753381125*n^8 + 21431886020608/4122718907038875*n^9 - 131710776246272/51946258228689825*n^10 + 18575217393664/25808394680215875*n^11 - 3164393701376/30141656009239775*n^12 + 14365663428608/3192696948055628475*n^13 + 1212658841288704/6999262445669225515875*n^14 + 1834384359424/100642989414851608725*n^15 + 610225094656/207525301623615850875*n^16 + 164609601568768/267207136896431021164875*n^17 + 251045778817024/1620431584570754204374125*n^18) * eps^11
        + (8192/1003917915 - 1048576/6718527585*n + 6314524672/13537833083775*n^2 - 189792256/727840488375*n^3 - 28491907072/67689165418875*n^4 - 326575849472/500899824099675*n^5 + 180915011584/49107825892125*n^6 - 24383142756352/6040262584731375*n^7 - 145899963547648/259731291143449125*n^8 + 461865768452096/86577097047816375*n^9 - 14004622345633792/2441474136748421775*n^10 + 3512761381289984/1109760971249282625*n^11 - 5214964780367872/5321161580092714125*n^12 + 129418252933660672/846064691234741545875*n^13 - 41050864514760704/5922452838643190821125*n^14 - 1436339103858688/5132792460157432044975*n^15 - 12667925961900032/412956484294484305436625*n^16 - 83652980966948864/16299635350682292291057375*n^17) * eps^12
        - (937984/48522699225 + 35913728/13537833083775*n - 122159104/4512611027925*n^2 - 736362496/2051186830875*n^3 + 1751018110976/2504499120498375*n^4 + 52370341888/500899824099675*n^5 - 495914057728/1801481823516375*n^6 - 1636748754944/650955616900875*n^7 + 5727152242688/1242733450447125*n^8 - 91166448287744/71388132653462625*n^9 - 3851787754274816/899490471433629075*n^10 + 13822108124315648/2316869396116923375*n^11 - 717165187245801472/192962122562309475375*n^12 + 1293029046747136/1035574897472143875*n^13 - 207432010174038016/999894635095603645125*n^14 + 2995763339444092928/302834755149288490653525*n^15 + 939434993543806976/2252795129769097308520125*n^16) * eps^13
        + (606208/65400159825 - 13631488/148767396525*n + 216006656/1327238537625*n^2 + 13716422656/834833040166125*n^3 + 182775185408/2504499120498375*n^4 - 15302162120704/20536892788086675*n^5 + 86374671712256/210258664258982625*n^6 + 553624010752/1006022317028625*n^7 + 123755061837824/91784741983023375*n^8 - 54365938253824/12188217770103375*n^9 + 40612998252855296/15291338014371694275*n^10 + 380996869807931392/122794077994196938875*n^11 - 123568266508500992/20780536275941020425*n^12 + 706765068528779264/169212938246948309175*n^13 - 2440372655440789504/1610252154285475845375*n^14 + 41420770302229479424/155234622387450402771975*n^15) * eps^14
        - (1243136/180504441117 + 101318656/13537833083775*n + 72173748224/2504499120498375*n^2 - 26437353472/119261862880875*n^3 + 2168374951936/14669209134347625*n^4 + 72842321199104/883086389887727025*n^5 + 774414801829888/1471810649812878375*n^6 - 4627044041621504/5929294332103310025*n^7 - 992466414075904/2466344841027692625*n^8 - 11629158270631936/25485563357286157125*n^9 + 3172029662252761088/810440914761699796575*n^10 - 14495633009888854016/4052204573808498982875*n^11 - 49622588403021774848/25663962300787160224875*n^12 + 2005821013245790650368/349424717479948258446375*n^13 - 3394298700190297358336/746883560543393447299125*n^14) * eps^15
        + (782336/100280245065 - 5467799552/100179964819935*n + 160890355712/2504499120498375*n^2 + 273797349376/34228154646811125*n^3 + 75710926422016/490603549937626125*n^4 - 23330738929664/80280580898884275*n^5 - 29193338355712/483741961826610375*n^6 - 9256022006300672/37248131060648998875*n^7 + 14381676595511296/15620183993175386625*n^8 + 769074433359872/10470812852218343625*n^9 - 87967869218848768/810440914761699796575*n^10 - 246744717810779815936/76991886902361480674625*n^11 + 414848533771432493056/100944918383096163551175*n^12 + 3642053818971149828096/4262981553255368753045775*n^13) * eps^16
        - (24430592/9595782070875 + 1219100672/278277680055375*n + 105279913984/2933841826869525*n^2 - 175938815000576/1471810649812878375*n^3 + 5660664659968/191975302149505875*n^4 - 4267311104/74709183293685*n^5 + 162669271973888/483741961826610375*n^6 - 6997871323119616/111744393181946996625*n^7 + 9176096709804032/257497949506225687875*n^8 - 2742583007248384/3125558677479863625*n^9 + 184000164420386816/669494668716186788475*n^10 + 25825509353978724352/65833642423758367533375*n^11 + 474430975810962194432/191231056564250496168375*n^12) * eps^17
        + (16384/2645652625 - 4459593728/131142354968625*n + 683694620672/23362073806553625*n^2 - 4708587536384/490603549937626125*n^3 + 4981810735874048/41505060324723170175*n^4 - 4141263468101632/41505060324723170175*n^5 - 128620429312/61488978258849141*n^6 - 846813328864968704/2851551366754128913875*n^7 + 1788171473911808/8804103705244308825*n^8 + 1326028891881472/17711499172385893875*n^9 + 9596814579755646976/13166728484751673506675*n^10 - 750111204931779166208/1338617395949753473178625*n^11) * eps^18
        - (2904064/3461235175125 + 2958819328/1637164237834125*n + 4705547190272/152256274118573625*n^2 - 146247378010112/2231454856167912375*n^3 + 262034852675584/23058366847068427875*n^4 - 3520094671732736/41505060324723170175*n^5 + 192477728515555328/1222093442894626677375*n^6 + 197600147073138688/25663962300787160224875*n^7 + 16561239183333523456/76991886902361480674625*n^8 - 60789556653064192/195251292810630877275*n^9 - 4137720727496818688/43809296594719204576755*n^10) * eps^19
        + (34512896/7087291072875 - 9907994624/446499337591125*n + 3823108096/246887869020975*n^2 - 25192398061568/1517948914697294625*n^3 + 3534351694299136/44020518526221544125*n^4 - 204278900719616/5404835865381641325*n^5 + 18176218480246784/407364480964875559125*n^6 - 49000957506224128/268264414293942441375*n^7 + 632282024639463424/24291557899675547378625*n^8 - 46549976629564669952/362214118904050939801275*n^9) * eps^20
        - (2117632/16664711441625 + 26093551616/86939799590957625*n + 103808499187712/4260050179956923625*n^2 - 53918297227264/1420016726652307875*n^3 + 78919969518125056/6999262445669225515875*n^4 - 224942358339518464/3079675476094459226985*n^5 + 368415416516608/5142048146821711125*n^6 - 17484436828061696/931035320196623767125*n^7 + 410932027851051892736/2328519335811756041579625*n^8) * eps^21
        + (25772032/6694371262875 - 133717557248/8856653180783625*n + 1545601024/163766200744125*n^2 - 101307837841408/5789298962505562875*n^3 + 911117337493504/17367896887516688625*n^4 - 4578636945424384/236898113545727632845*n^5 + 373748610906456064/6851465048626436440125*n^6 - 5893247183635873792/59705623995173231835375*n^7) * eps^22
        + (383798272/2232164622799125 + 134230114304/274556248604292375*n - 1587412992/84540195648671*n^2 + 4215981839024128/179468267837672449125*n^3 - 6728033666596864/538404803513017347375*n^4 + 45351317263679488/822175805835172372815*n^5 - 14952491409948934144/417939367966212622847625*n^6) * eps^23
        + (31922176/10382161036275 - 756217020416/70982835005012175*n + 83513311232/12911695808365125*n^2 - 77487943712768/4850493725342498625*n^3 + 35707127975641088/1024705916363484628875*n^4 - 154170794895474688/11072679359104853904015*n^5) * eps^24
        + (95460352/330152720953545 + 15683878912/18158399652444975*n - 1152264568832/79674610719911625*n^2 + 16279305360441344/1049323475915760535875*n^3 - 7264491379390939136/576078588277752534195375*n^4) * eps^25
        + (319913984/128782976258475 - 140867796992/18158399652444975*n + 8628023066624/1785575965823755875*n^2 - 21496495314305024/1561188586118570553375*n^3) * eps^26
        + (89350144/275963520553875 + 38433980416/37990977996250125*n - 5437096198144/484089484067773815*n^2) * eps^27
        + (648134656/319251915934875 - 48446308352/8346157230868875*n) * eps^28
        + 13087612928/40785938165944125 * eps^29;
C4[8] = + (16384/35334585 - 131072/82447365*n + 262144/111546435*n^2 - 393216/185910725*n^3 + 524288/386122275*n^4 - 131072/203591745*n^5 + 262144/1168767425*n^6 - 917504/16529710725*n^7 + 1048576/115707975075*n^8 - 393216/475688341975*n^9 + 262144/11131107202215*n^10 + 131072/207443361495825*n^11 + 524288/10902301109725025*n^12 + 131072/22643240766351975*n^13 + 1835008/1976431444034436675*n^14 + 131072/717371413019906645*n^15 + 2097152/49889920996384416675*n^16 + 131072/11964551189178163275*n^17 + 786432/248596785819590725825*n^18 + 131072/131610063080959796025*n^19 + 524288/1552998744355325593095*n^20 + 131072/1074069426368195704975*n^21) * eps^8
        - (32768/247342095 - 524288/632096465*n + 1048576/451497475*n^2 - 19398656/5019589575*n^3 + 2097152/490128275*n^4 - 3670016/1101980715*n^5 + 646971392/347123925225*n^6 - 524288/701260455*n^7 + 297795584/1427065025925*n^8 - 100139008/2650263619575*n^9 + 573571072/152125131763605*n^10 - 345505792/2973354848106825*n^11 - 140509184/42051732851796525*n^12 - 31981568/118248035113171425*n^13 - 370147328/10760571195298599675*n^14 - 173539328/29933952597830650005*n^15 - 1652555776/1385039235280576901025*n^16 - 163053568/570310273350825782775*n^17 - 1048576/13559824681068585045*n^18 - 145227776/6285947298581079781575*n^19 - 236978176/31577641135224953726265*n^20) * eps^9
        - (327680/1137773637 - 2097152/1896289395*n + 4194304/2585849175*n^2 - 140509184/274961962275*n^3 - 746586112/347123925225*n^4 + 4011851776/902522205585*n^5 - 180355072/38569325025*n^6 + 593494016/186138916425*n^7 - 16492003328/11131107202215*n^8 + 824180736/1773020183725*n^9 - 1819459715072/19624141997505045*n^10 + 1029701632/102529477520925*n^11 - 510757175296/1537224456471228525*n^12 - 140509184/13821198909331725*n^13 - 1431352377344/1646367392880685750275*n^14 - 225198473216/1939054929392807661435*n^15 - 8623489024/421533680302784274225*n^16 - 2097152/478582047567126531*n^17 - 7159676928/6574956369780209886475*n^18 - 2451870580736/8052298489482363200197575*n^19) * eps^10
        - (32768/3160482325 + 524288/4491211725*n - 2245001216/2474657660475*n^2 + 1357381632/568254722035*n^3 - 222103076864/76714387474725*n^4 + 252182528/347123925225*n^5 + 3595567104/1236789689135*n^6 - 825139658752/166966608033225*n^7 + 2229746532352/526586994566325*n^8 - 24933922504704/10902301109725025*n^9 + 236428469469184/294362129962575675*n^10 - 220538009550848/1257729100749186975*n^11 + 1499084095488/73201164593868025*n^12 - 13072994926592/18091949372315228025*n^13 - 2040474989756416/87257471822676344764575*n^14 - 6790939410432/3231758215654679435725*n^15 - 25599422758912/87257471822676344764575*n^16 - 20380647424/379017215455930526475*n^17 - 10682977222656/894699832164707022244175*n^18) * eps^11
        - (4390912/85333022775 - 30932992/353522522925*n - 974127104/6974035224975*n^2 + 1518862336/10959198210675*n^3 + 7400849408/5901106728825*n^4 - 488389476352/149391175608675*n^5 + 25309478912/8787716212275*n^6 + 52781645824/72059272940655*n^7 - 66496793411584/15492743682240825*n^8 + 523779964928/108340864910775*n^9 - 2218114952462336/728158953065318775*n^10 + 110526137368576/92674775844676935*n^11 - 24551725073432576/86650915414772934225*n^12 + 1139122395152384/32115374244636122475*n^13 - 243837663444992/183699940679318620557*n^14 - 3944412899442688/87257471822676344764575*n^15 - 21872702478352384/5148190837537904341109925*n^16 - 79756985368576/129181259189556628880175*n^17) * eps^12
        + (3178496/824885886825 - 8159494144/76714387474725*n + 28228714496/76714387474725*n^2 - 7773618176/25571462491575*n^3 - 918323986432/2838432336564825*n^4 - 73427058688/2838432336564825*n^5 + 368816685056/157052261537325*n^6 - 72769601536/19245644325765*n^7 + 676461543424/534232540766925*n^8 + 9767632764928/3152203260023025*n^9 - 25415227305623552/5097112671457231425*n^10 + 135017417670656/36638864868825765*n^11 - 66304019129171968/41373860513360049675*n^12 + 145615781360041984/353269116690997347225*n^13 - 137176212422262784/2493070623505038421845*n^14 + 3729769993966452736/1716063612512634780369975*n^15 + 1058897908499218432/13653897438687485426421975*n^16) * eps^13
        - (425787392/25571462491575 - 312475648/76714387474725*n - 3149922304/76714387474725*n^2 - 266338304/1220831112501*n^3 + 133689245696/218340948966525*n^4 - 706671017984/6125038199955675*n^5 - 169910302932992/333610413957585765*n^6 - 42284273893376/37625234656870575*n^7 + 2678029734117376/728158953065318775*n^8 - 50720495632384/18670742386290225*n^9 - 147754295071080448/86650915414772934225*n^10 + 1991354095820079104/417499865180269592175*n^11 - 6383204028028813312/1530832838994321837975*n^12 + 13477708903179354112/6712113217128949597275*n^13 - 21544372591302541312/38708201785999280760225*n^14 + 8255721773950736269312/104679880363270721602568475*n^15) * eps^14
        + (17530880/3068575498989 - 148373504/2191839642135*n + 404992557056/2838432336564825*n^2 - 20048248832/2838432336564825*n^3 - 3228475326464/116375725799157825*n^4 - 5795679305728/10998145515085245*n^5 + 170148181835776/294362129962575675*n^6 + 465493530509312/1083849501567271725*n^7 + 208517906563072/1333091006381122065*n^8 - 260996618389028864/86650915414772934225*n^9 + 3267061749675720704/918499703396593102785*n^10 + 94463949577650176/270146971587233265525*n^11 - 374414914557426270208/87257471822676344764575*n^12 + 48107557630944739328/10703099454340757465925*n^13 - 107256596269866972872704/44862805869973166401100775*n^14) * eps^15
        - (2392064/370600905675 + 13398966272/2838432336564825*n + 969408512/113537293462593*n^2 - 65784774656/391837460603225*n^3 + 65613878788096/384935093027983575*n^4 + 491445762654208/5004156209363786475*n^5 + 167957703950336/670072198974638075*n^6 - 27991057629184/35524164265415595*n^7 - 274682871808/4774307409778725*n^8 + 31849951526912/81267337633079675*n^9 + 85896645649629184/39934769712895352295*n^10 - 14718170769933991936/3793803122725058468025*n^11 + 6913119271458439168/8290162379288090726425*n^12 + 93498692521370058752/25617068365267327254075*n^13) * eps^16
        + (18907136/3625073226775 - 4455923712/105127123576475*n + 2328359862272/38791908599719275*n^2 + 17735090176/1630549432832775*n^3 + 10321999691776/122052590472287475*n^4 - 1564119174479872/5736471752197511325*n^5 - 12271672623104/26132815760010884925*n^6 - 1687898088275968/548789130960228583425*n^7 + 85790295270096896/114963730991668438425*n^8 - 48612562263605248/140511226767594758075*n^9 - 144303099260960768/252920208181670564535*n^10 - 32925506590743199744/24870487137864272179275*n^11 + 5803202512319846285312/1517099715409720602935775*n^12) * eps^17
        - (2818048/1052440614225 + 2097152/556196266395*n + 34830175698944/1668052069787928825*n^2 - 817174151168/8136839364819165*n^3 + 9693923228254208/235195341840097964325*n^4 + 1509699878912/12378702202110419175*n^5 + 20629029027577856/78398447280032654775*n^6 - 1502359475323928576/9695274646964038307175*n^7 - 77656474062422016/646351643130935887145*n^8 - 15703217037901824/28102245353518951615*n^9 + 3216346923887755264/4974097427572854435855*n^10 + 151253870568701689856/303419943081944120587155*n^11) * eps^18
        + (5668864/1307577732825 - 35127296/1285830078225*n + 1102053376/39315814688475*n^2 - 557695107072/8710938586670294975*n^3 + 137507511468032/1606212090615303171*n^4 - 182280443123990528/1646367392880685750275*n^5 - 5069564455944192/190103424450275260925*n^6 - 1757120135666597888/9695274646964038307175*n^7 + 8143172317497786368/29085823940892114921525*n^8 + 4608940312331026432/38134746944725217341555*n^9 + 27362078865048469504/82750893567802941978315*n^10) * eps^19
        - (30605312/27952275991419 + 2339897344/1128841915038075*n + 158625682161664/7586946510970902075*n^2 - 2136205134659584/36585942064015238895*n^3 + 18482688723779584/1646367392880685750275*n^4 - 8057707396857856/183699940679318620557*n^5 + 1468225245085171712/9695274646964038307175*n^6 - 45659846177456128/12465353117525192109225*n^7 + 3630426979762700288/43262107878469784379075*n^8 - 46360400310384984064/136836444919308132813815*n^9) * eps^20
        + (199327744/56660018901525 - 1799016153088/98531772869751975*n + 10114609184768/689722410088263825*n^2 - 35751973093376/4828056870617846775*n^3 + 509942296483987456/7932497438425122251325*n^4 - 3839901122350809088/87257471822676344764575*n^5 + 820897336077058048/87257471822676344764575*n^6 - 6551724376476614656/43262107878469784379075*n^7 + 1594219615901188096/25479889743595307489469*n^8) * eps^21
        - (3604480/9407823081427 + 3482423656448/4045128729436574325*n + 2660096597295104/149669762989153250025*n^2 - 92190363168538624/2644165812808374083775*n^3 + 179628626935808/27639363896951645475*n^4 - 616136831697682432/12465353117525192109225*n^5 + 7747397749250719744/100944918383096163551175*n^6 + 3997177385754558464/2638988580586656847123575*n^7) * eps^22
        + (248348672/87234019741575 - 3932568420352/311163748418198025*n + 20285863493632/2355954095166356475*n^2 - 50564857069568/4960911468683628675*n^3 + 943092251230208/21041107263727114725*n^4 - 19962886927941632/1012825268057821038975*n^5 + 13369059142137806848/473664617028374305893975*n^6) * eps^23
        - (9158656/176496737616675 + 51089113088/402236065028402325*n + 2603006914985984/181408465327809448575*n^2 - 790244020584448/36281693065561889715*n^3 + 3890695479230464/568170272325119119425*n^4 - 77002004121387008/1824125611149066646575*n^5) * eps^24
        + (96272384/41574787083039 - 185838075904/20579519606104305*n + 2264108367872/402236065028402325*n^2 - 733824970391552/69954898394384035725*n^3 + 40925748722139136/1324318593741959848725*n^4) * eps^25
        + (223215616/2189310596394075 + 9760145408/34299199343507175*n - 64667779072/5668495129599225*n^2 + 297990161956864/20815847814914274045*n^3) * eps^26
        + (34930688/18397568036925 - 1867513856/281414651824075*n + 9746486657024/2420447420338869075*n^2) * eps^27
        + (80084992/472492835583615 + 407322492928/816625117500347925*n) * eps^28
        + 474546176/302118060488475 * eps^29;
C4[9] = + (32768/92147055 - 524288/423876453*n + 1048576/557732175*n^2 - 524288/295269975*n^3 + 2097152/1712565855*n^4 - 524288/816762177*n^5 + 1048576/4083810885*n^6 - 524288/6806351475*n^7 + 4194304/251835004575*n^8 - 524288/218257003965*n^9 + 1048576/5369122297539*n^10 - 524288/104941935815535*n^11 - 2097152/17315419409563275*n^12 - 524288/62601900942267225*n^13 - 1048576/1139354597149263495*n^14 - 524288/3873805630307495883*n^15 - 8388608/342186164010495469665*n^16 - 524288/100642989414851608725*n^17 - 1048576/833530399512745374825*n^18 - 524288/1552998744355325593095*n^19 - 2097152/21175594643621439557613*n^20) * eps^9
        - (65536/706460755 - 2097152/3532303775*n + 4194304/2445441075*n^2 - 2097152/703227525*n^3 + 310378496/88482569175*n^4 - 10485760/3539302767*n^5 + 4194304/2268783825*n^6 - 216006656/251835004575*n^7 + 16777216/57436053675*n^8 - 1050673152/14914228604275*n^9 + 20971520/1877010234099*n^10 - 2097152/2124330684525*n^11 + 2457862144/90424968027719325*n^12 + 2097152/2981042902012725*n^13 + 1665138688/32281713585895799025*n^14 + 10485760/1754800841079463947*n^15 + 33554432/36402783405371858475*n^16 + 2097152/12026520747686670225*n^17 + 8216641536/213105938808758567496925*n^18 + 1524629504/157888205676124768631325*n^19) * eps^10
        - (2326528/10596911325 - 82313216/95372201925*n + 221249536/162693756225*n^2 - 2214068224/3175541093725*n^3 - 5773459456/4512611027925*n^4 + 38273024/11541204675*n^5 - 1439694848/363761673275*n^6 + 30220484608/9821565178425*n^7 - 675505242112/402684172315425*n^8 + 416099598336/641311829983825*n^9 - 3008871006208/17315419409563275*n^10 + 2228015857664/73984064749952175*n^11 - 606058053632/210991592064678425*n^12 + 629970305024/7449626212129799775*n^13 + 11919585968128/5132792460157432044975*n^14 + 286785536/1597507768489708075*n^15 + 2127007055872/97523056742991208854525*n^16 + 1188855021568/338462373402145960142175*n^17 + 390595608576/565194011623229244230975*n^18) * eps^11
        - (131072/13624600275 + 180355072/2765793855825*n - 52856619008/85739609530575*n^2 + 153607995392/85739609530575*n^3 - 214295379968/85739609530575*n^4 + 9030336512/7259417740575*n^5 + 15695085568/9821565178425*n^6 - 1529423593472/402684172315425*n^7 + 6129622974464/1574129037233025*n^8 - 6244047781888/2473631344223325*n^9 + 901962769891328/813824712249473925*n^10 - 169940577419264/517888453249665225*n^11 + 5983846365396992/96845140757687397075*n^12 - 2497185367195648/394830189242879388075*n^13 + 1016145951850496/5132792460157432044975*n^14 + 79944201797632/13931865248998744122075*n^15 + 2678152291680256/5753860347836481322416975*n^16 + 1219100030271488/20646204777530903568672675*n^17) * eps^12
        - (38371328/921931285275 - 7124549632/85739609530575*n - 7777288192/85739609530575*n^2 + 5844238336/28579869843525*n^3 + 2206377967616/3172365552631275*n^4 - 7741853138944/3172365552631275*n^5 + 588422053888/207443361495825*n^6 - 1226503094272/2473631344223325*n^7 - 47695532130304/17315419409563275*n^8 + 1124341091139584/271274904083157975*n^9 - 18477597873668096/5696772985746317475*n^10 + 2032671912361984/1257729100749186975*n^11 - 901293789562273792/1710930820052477348325*n^12 + 42334411434754048/394830189242879388075*n^13 - 163252679692255232/13931865248998744122075*n^14 + 744321399983177728/1917953449278827107472325*n^15 + 4148491175365443584/350985481218025360667435475*n^16) * eps^13
        + (3997696/2598169985775 - 903872512/12248515647225*n + 1463812096/5043506442975*n^2 - 330303537152/1057455184210425*n^3 - 644840685568/3172365552631275*n^4 + 33686114271232/130066987657882275*n^5 + 364877893861376/266327641394711325*n^6 - 3230396317696/1025652020775525*n^7 + 250926233288704/116260673178496275*n^8 + 8017412096/6166319734575*n^9 - 375725184457375744/96845140757687397075*n^10 + 1749781404081717248/466617496377948367725*n^11 - 3629731902618861568/1710930820052477348325*n^12 + 812820766249713664/1071681942230672624775*n^13 - 136540391127453270016/821980049690925903202425*n^14 + 18969171985216569344/983152608453852550889175*n^15) * eps^14
        - (245137408/17147921906115 - 716701696/85739609530575*n - 136481603584/3172365552631275*n^2 - 391995981824/3172365552631275*n^3 + 66031785607168/130066987657882275*n^4 - 59127928193024/223715218771557513*n^5 - 115604364197888/243168716056040775*n^6 - 446272603947008/1632704236376273775*n^7 + 1557731995549696/601522613401785075*n^8 - 64333349912576/20742159082820175*n^9 + 1510914246311936/8926595582882490513*n^10 + 103393420971081728/31880698510294608975*n^11 - 17039762398700896256/4240132901869182993675*n^12 + 49758510742429499392/19243680093098599740525*n^13 - 2203163010064352018432/2180034044832455656319475*n^14) * eps^15
        + (11272192/3175541093725 - 160750895104/3172365552631275*n + 391966097408/3172365552631275*n^2 - 1484783616/52937316914075*n^3 - 1645274464256/22643240766351975*n^4 - 271039707742208/798982924184133975*n^5 + 1203213663469568/1947150978196889465*n^6 + 14046369685700608/80002507582437414975*n^7 - 2400351256838144/6154039044802878075*n^8 - 555325673439232/330614651217870019*n^9 + 150633156104421376/44632977914412452565*n^10 - 1199924118397386752/848026580373836598735*n^11 - 22180222633385132032/9265475600380807282475*n^12 + 681703202986871750656/167694926525573512024575*n^13) * eps^16
        - (645431296/109391915607975 + 2509766656/1057455184210425*n - 119882645504/43355662552627425*n^2 - 77087334989824/621431163254326425*n^3 + 989579437932544/5592880469288937825*n^4 + 18971230665703424/262865382056580077775*n^5 + 361546193567744/5841452934590668395*n^6 - 4303816224145408/6456342717179159805*n^7 + 24826556685746176/94225175597092955415*n^8 + 1074863049015296/1847552462688097165*n^9 + 74487682881814528/94225175597092955415*n^10 - 10560014891117707264/3335571216137090621691*n^11 + 8338801317940035584/3569646389199342595143*n^12) * eps^17
        + (12517376/3528771471225 - 16569597952/498340948880775*n + 34373491490816/621431163254326425*n^2 + 14185784147968/1864293489762979275*n^3 + 9593926155501568/262865382056580077775*n^4 - 433933481381199872/1840057674396060544425*n^5 + 8370378225221632/122670511626404036295*n^6 + 745576811380867072/6501537116199413923635*n^7 + 3198014784708542464/6501537116199413923635*n^8 - 18857274447495168/31408391865697651805*n^9 - 7451675099423309824/16677856080685453108455*n^10 - 21739933006661943296/203469844184362527923151*n^11) * eps^18
        - (1007255552/381428116298775 + 175928508416/60138499669773525*n + 2279485734912/207143721084775475*n^2 - 804978403311616/9735754890984447325*n^3 + 95773494987456512/1840057674396060544425*n^4 + 50744948926447616/1840057674396060544425*n^5 + 26469016886312960/144478602582209198303*n^6 - 307334446787854336/1413377633956394331225*n^7 - 1485100810906894336/10835895193665689872725*n^8 - 251158947597647872/1039541164920773499985*n^9 + 12178767189407432704/16148400332092264120885*n^10) * eps^19
        + (804651008/260339825410275 - 10372513792/468611685738495*n + 1906369888256/71256541625529975*n^2 + 788413234020352/204450852710673393825*n^3 + 602924036128768/10514615282263203111*n^4 - 2206517246069571584/19504611348598241770905*n^5 - 240955790435811328/10835895193665689872725*n^6 - 1142671088526819328/13931865248998744122075*n^7 + 194173652701282304/654666099423880000275*n^8 + 789891485725097984/16269664915311980747575*n^9) * eps^20
        - (2371059712/1963103007823425 + 6706906529792/3413836130604936075*n + 329029822447616/23896852914234552525*n^2 - 94227876046962688/1840057674396060544425*n^3 + 1433188842334060544/97523056742991208854525*n^4 - 137127157376221184/8865732431181018986775*n^5 + 1854149531196719104/13931865248998744122075*n^6 - 7709842757648384/231348170473100451225*n^7 - 12929216601344966656/2949457825361557652667525*n^8) * eps^21
        + (6121127936/2365790804300025 - 9780355661824/645860889573906825*n + 337309337649152/23896852914234552525*n^2 - 6056167547600896/2955244143727006328925*n^3 + 254426069598208/5127664795362069975*n^4 - 4848317375375736832/97523056742991208854525*n^5 - 29396030701174784/3639380359162859786475*n^6 - 326650603128022368256/2949457825361557652667525*n^7) * eps^22
        - (1494646784/2827408522212225 + 371029704704/347771248232103675*n + 180777085042688/14094964119524672475*n^2 - 1032434305585381376/32507685580997069618175*n^3 + 533652355533504512/97523056742991208854525*n^4 - 1457447658973560832/48351767628877994306025*n^5 + 528841186136871141376/6882068259176967856224225*n^6) * eps^23
        + (13631488/6363259989975 - 165322686464/15501998449370475*n + 1654857408708608/202750637719316442525*n^2 - 1083196489859072/202750637719316442525*n^3 + 16533872472953454592/442604642141267794032075*n^4 - 11374232737209647104/509412890011647838414275*n^5) * eps^24
        - (133758976/696989077568595 + 3012558848/6764893988165775*n + 10799600893952/989027501069836305*n^2 - 5380229842337792/265828613898659335755*n^3 + 2984159999753715712/729699545151819876647475*n^4) * eps^25
        + (482213888/271875172101225 - 32879149056/4259377696252525*n + 11694399029248/2261729556710090775*n^2 - 13001758565466112/1977505542416856034275*n^3) * eps^26
        - (92864512/4311163443319425 + 13999538176/254358643155846075*n + 6558828537577472/729246229927810697025*n^2) * eps^27
        + (7357595648/4987424375604825 - 82988498944/14487280329137825*n) * eps^28
        + 1104084992/17220729447843075 * eps^29;
C4[10] = + (131072/468495027 - 1048576/1064761425*n + 2097152/1368978975*n^2 - 1048576/696498075*n^3 + 4194304/3810254175*n^4 - 1048576/1676511837*n^5 + 2097152/7522809525*n^6 - 1048576/10844569575*n^7 + 8388608/328951943775*n^8 - 1048576/214079836425*n^9 + 2097152/3313955867859*n^10 - 11534336/248546690089425*n^11 + 4194304/3893898144734325*n^12 + 1048576/44031002098149675*n^13 + 2097152/1390121637670154025*n^14 + 1048576/6876468367675028577*n^15 + 16777216/810440914761699796575*n^16 + 1048576/301928968244554826175*n^17 + 2097152/3058936920699883743975*n^18 + 1048576/6799013641555612046325*n^19) * eps^10
        - (262144/3904125225 - 4194304/9582852825*n + 360710144/277902731925*n^2 - 960495616/410237366175*n^3 + 687865856/237505843575*n^4 - 255852544/97796523825*n^5 + 6450839552/3618471381525*n^6 - 205520896/221539064175*n^7 + 14864613376/40461089084325*n^8 - 7000293376/64438030763925*n^9 + 5729419264/248546690089425*n^10 - 37971034112/11681694434202975*n^11 + 1694498816/6579345141102825*n^12 - 532676608/83169670629838275*n^13 - 8388608/55688924260406775*n^14 - 19079888896/1891028801110632858675*n^15 - 115628572672/107788641663306072944475*n^16 - 281018368/1842807840665041525275*n^17 - 54769221632/2052546673789621992207225*n^18) * eps^11
        - (262144/1527701175 - 2097152/3053876175*n + 9844031488/8614984689675*n^2 - 24006098944/31588277195475*n^3 - 67436019712/94764831586425*n^4 + 41307602944/16776549132525*n^5 - 4194304/1270084725*n^6 + 14032044032/4890900878325*n^7 - 4864671219712/2734013590983675*n^8 + 15122563072/18707815383075*n^9 - 21874415239168/81771861039420825*n^10 + 35727997927424/572403027275945775*n^11 - 55423533056/5802535160221275*n^12 + 148618870784/182819967237017775*n^13 - 1342592516096/62341608827823061275*n^14 - 2750890901504/5132792460157432044975*n^15 - 21836318375936/578139078012278027611275*n^16 - 212753973248/50597537673958335271575*n^17) * eps^12
        - (262144/30878081325 + 306184192/8614984689675*n - 13480493056/31588277195475*n^2 + 42828038144/31588277195475*n^3 - 255500222464/120906854093025*n^4 + 5103004155904/3506298768697725*n^5 + 1764870848512/2522074552922925*n^6 - 2563134980096/911337863661225*n^7 + 65528014045184/19138095136885725*n^8 - 258819959554048/99943385714847675*n^9 + 775812835966976/572403027275945775*n^10 - 180518863765504/360401906062632525*n^11 + 21996665896435712/171911709191875714425*n^12 - 9225991050231808/436391261794761428925*n^13 + 29608309069709312/15398377380472296134925*n^14 - 114470959603253248/2119843286045019434574675*n^15 - 61008813821526016/43103480149582061836351725*n^16) * eps^13
        - (10878976/319073507025 - 558891008/7289602429725*n - 1700790272/31588277195475*n^2 + 22818062336/106251477839325*n^3 + 174269136896/500899824099675*n^4 - 53224669184/29906022366675*n^5 + 20868585488384/8144406757857825*n^6 - 61644734464/51815196261675*n^7 - 5434802962432/3555298306061775*n^8 + 14461527130112/4345364596297725*n^9 - 476807490961408/150125338149511725*n^10 + 4796701484253184/2491474046259068325*n^11 - 5015812205182976/6324511040503788825*n^12 + 1694502243794944/7670151687419488575*n^13 - 570392634720256/14538161742456761325*n^14 + 21341862944190758912/5622193062988964587350225*n^15) * eps^14
        + (524288/1858133952675 - 4924112896/94764831586425*n + 804786274304/3506298768697725*n^2 - 351306514432/1168766256232575*n^3 - 13920760758272/143758249516606725*n^4 + 88386392031232/247264189168563567*n^5 + 62856661827584/89588474336436075*n^6 - 4404285865459712/1804567840205355225*n^7 + 1625213007560704/664840783233551925*n^8 + 4974444544/549909663551325*n^9 - 650529587855360/240639932272827087*n^10 + 852519184033120256/246655930579647764175*n^11 - 3820296696273829888/1562154227004435839775*n^12 + 23851902951906869248/21269330629214241818475*n^13 - 22104299820019613696/65121927370528547343825*n^14) * eps^15
        - (1164443648/94764831586425 - 5465178112/500899824099675*n - 138923737088/3506298768697725*n^2 - 981144174592/15973138835178525*n^3 + 7859572047872/19378071251454825*n^4 - 711065948127232/2060534909738029725*n^5 - 944472426807296/2767004021648211345*n^6 + 8403040600064/45934454114318133*n^7 + 823118570455040/505278995257499463*n^8 - 68153245696/23584672156045*n^9 + 9360719917088768/7047312302275650405*n^10 + 330730366828544000/187458507240532300773*n^11 - 63248384131625648128/18433419878652342909345*n^12 + 35425062558380326912/12356468270305416675495*n^13) * eps^16
        + (6815744/3100175745975 - 134544883712/3506298768697725*n + 391362117632/3686108961964275*n^2 - 1431121690624/32706903329175075*n^3 - 403223609344/4722387111699075*n^4 - 18764645921718272/96845140757687397075*n^5 + 78114179466133504/135583197060762355905*n^6 - 8136706490368/128840542027965495*n^7 - 56016360077000704/104143615133629055985*n^8 - 1141393774870528/1653073256089350095*n^9 + 1292681288351744/479924493703359705*n^10 - 276681095183859712/121539032166938524677*n^11 - 161296335454236311552/224887722519558583494009*n^12) * eps^17
        - (602537984/113106411893475 + 649068544/1228702987321425*n - 111067267072/12798353476633725*n^2 - 8775330168832/98120709987525225*n^3 + 7115549582557184/41505060324723170175*n^4 + 3469524564180992/107039366100601859925*n^5 - 2252269552664576/45194399020254118635*n^6 - 56513104184344576/114062054670165156555*n^7 + 1109330446304411648/2395303148073468287655*n^8 + 22222807760896/49805650470410835*n^9 - 36414339734831104/877781898983444900445*n^10 - 22778537759673942016/10708939167598027785429*n^11) * eps^18
        + (2883584/1180892000925 - 749643759616/28486657738313775*n + 2341788975104/46478231046722475*n^2 + 2676389576704/1257729100749186975*n^3 + 3670594293858304/677915985303811779525*n^4 - 35364246288072704/184886177810130485325*n^5 + 11426772662878208/93323499275589673545*n^6 + 315463962248347648/2199768197210328019275*n^7 + 117185833223585792/466617496377948367725*n^8 - 1011849117514596352/1519600921896071279265*n^9 - 142458605834042605568/1124438612597792917470045*n^10) * eps^19
        - (5780537344/2293730882825265 + 11108614144/5352038726592285*n + 21118836539392/4611673369413685575*n^2 - 45338866405605376/677915985303811779525*n^3 + 24220595910606848/406749591182287067715*n^4 + 13456242259263488/378205760222126571735*n^5 + 3987380822507257856/35929547221102024314825*n^6 - 3711602295908073472/15398377380472296134925*n^7 - 1052474648635113472/12899654884655290676925*n^8 - 291969534449942528/29143664739406397455275*n^9) * eps^20
        + (230948864/103321210938075 - 749090111488/41463596727995175*n + 14228899495936/561964066292189925*n^2 + 3116570150699008/677915985303811779525*n^3 + 3800113671217086464/107788641663306072944475*n^4 - 11642532714023747584/107788641663306072944475*n^5 - 4973179734851584/1159017652293613687575*n^6 - 23012225673330688/2137657095171448169319*n^7 + 241570468447970656256/912779579638208368299213*n^8) * eps^21
        - (462553088/373545916468425 + 52551483392/31036793320485225*n + 5880600854528/677238746557254525*n^2 - 144514017752252416/3266322474645638574075*n^3 + 2057594272357548032/107788641663306072944475*n^4 + 22438675829751808/9798967423936915722225*n^5 + 1223011637475147776/11336060353181922110025*n^6 - 69134393521856315392/1086642356712152819403825*n^7) * eps^22
        + (287309824/148810974853275 - 40835743744/3230073512991675*n + 171677157687296/12611283685890496425*n^2 + 4062868639055872/5132792460157432044975*n^3 + 3966011997937467392/107788641663306072944475*n^4 - 25918257887241568256/489194604471927561824925*n^5 - 239035500430102626304/18472920064106597929865025*n^6) * eps^23
        - (2097152/3460720345425 + 3338665984/3086210217609225*n + 291547312553984/32013258587260490925*n^2 - 3969582603698176/138724120544795460675*n^3 + 5811037897687564288/908504265447865471960575*n^4 - 314980684348453289984/20417437965591502975113975*n^5) * eps^24
        + (299892736/183418178307525 - 5670699008/626151712153275*n + 1229233061888/156162237011026785*n^2 - 25599716360192/11447165191808296755*n^3 + 388102326440689664/12801746406172278537675*n^4) * eps^25
        - (1325662208/4764970121563575 + 131707437056/223953595713488025*n + 6957566001152/843399711516752775*n^2 - 648601731057319936/34658386611832266284925*n^3) * eps^26
        + (729284608/529441124618175 - 622359216128/93711079057416975*n + 1318364018376704/268669663657614467325*n^2) * eps^27
        - (1705508864/16537249245426525 + 4212251426816/17149127467507306425*n) * eps^28
        + 7370964992/6344479270257975 * eps^29;
C4[11] = + (262144/1166167275 - 8388608/10495505475*n + 16777216/13233463425*n^2 - 8388608/6511704225*n^3 + 33554432/33929406225*n^4 - 8388608/13970931975*n^5 + 16777216/57436053675*n^6 - 8388608/73846354725*n^7 + 67108864/1926718527825*n^8 - 25165824/3068477655425*n^9 + 16777216/11835556670925*n^10 - 92274688/556271163533475*n^11 + 33554432/3028587445904475*n^12 - 8388608/35644144555644975*n^13 - 16777216/3508402228405626825*n^14 - 8388608/30016330176359251725*n^15 - 134217728/5132792460157432044975*n^16 - 8388608/2544829875204104963475*n^17 - 50331648/97740317799505809152725*n^18) * eps^11
        - (524288/10495505475 - 33554432/101456552925*n + 3154116608/3145153140675*n^2 - 8422162432/4512611027925*n^3 + 402653184/167133741775*n^4 - 2248146944/976412912475*n^5 + 67108864/39763421775*n^6 - 33554432/34801155675*n^7 + 130728067072/303779287887075*n^8 - 12314476544/82848896696475*n^9 + 50398756864/1297966048244775*n^10 - 66806874112/9085762337713425*n^11 + 432315301888/463373879223384675*n^12 - 14059307008/209904406827687075*n^13 + 6509559808/4288047168051321675*n^14 + 167872823296/5132792460157432044975*n^15 + 203474075648/100944918383096163551175*n^16 + 71705821184/362214118904050939801275*n^17) * eps^12
        - (13893632/101456552925 - 209715200/377418376881*n + 100143202304/103790053642275*n^2 - 847249408/1116022082175*n^3 - 56807653376/166966608033225*n^4 + 303692775424/166966608033225*n^5 - 327877132288/120098788234425*n^6 + 340233551872/130191123380175*n^7 - 1644771147776/911337863661225*n^8 + 13324355895296/14277626530692525*n^9 - 9906258182144/27257287013140275*n^10 + 6952620916736/66196268460483525*n^11 - 177590824337408/8186271866279795925*n^12 + 61708773097472/20780536275941020425*n^13 - 167166217289728/733256065736776006425*n^14 + 553770928832512/100944918383096163551175*n^15 + 2304156941418496/18472920064106597929865025*n^16) * eps^13
        - (23068672/3145153140675 + 268435456/14827150520325*n - 1073741824/3578967366975*n^2 + 120527519744/116370666204975*n^3 - 6792490778624/3840231984764175*n^4 + 930665725952/622330084487475*n^5 + 7516192768/74958525582525*n^6 - 268435456/133949591325*n^7 + 4294967296/1475520327675*n^8 - 36025917243392/14277626530692525*n^9 + 7782640727883776/5097112671457231425*n^10 - 969285803442176/1444636211696434575*n^11 + 19262771556253696/90048990529077755175*n^12 - 2707075742302208/56404312748982769725*n^13 + 676791282827264/95924851171773357825*n^14 - 507232968603860992/879662860195552282374525*n^15) * eps^14
        - (195559424/6919336909485 - 7230980096/103790053642275*n - 3590324224/132421792578075*n^2 + 768782368768/3840231984764175*n^3 + 15233712128/112867033243965*n^4 - 751199846400/590006883585119*n^5 + 129850383794176/58872425992515135*n^6 - 40231411646464/26352419253792489*n^7 - 341315682304/557976209245455*n^8 + 8519923269632/3386785828210785*n^9 - 10523692446515200/3601959621163110207*n^10 + 599531481726976/285869811203421445*n^11 - 62880043025563648/60385793648910965235*n^12 + 189132496728752128/517666248118441864365*n^13 - 5202387650333376512/58644190679703485491635*n^14) * eps^15
        - (1048576/2661283426725 + 10938744832/295402460366475*n - 19998441472/109720913850405*n^2 + 14616780341248/52483170458443725*n^3 + 278904438784/19854337211552025*n^4 - 2439370095198208/6770328989139240525*n^5 - 1901239885365248/7071232499767651215*n^6 + 13414323716096/7492854217229199*n^7 - 46041636559388672/19369028151537479415*n^8 + 1655979603132416/2001088678423950115*n^9 + 88115990755278848/54029394317446653105*n^10 - 3016160029834215424/1026558492031486408995*n^11 + 440601082733789184/172555416039480621455*n^12 - 408103109306259341312/284198770217024583536385*n^13) * eps^16
        - (447217664/42200351480925 - 15720251392/1280077328254725*n - 1793585053696/52483170458443725*n^2 - 48544689946624/2256776329713080175*n^3 + 193959179583488/615484453558112775*n^4 - 17041511862501376/45457923212792043525*n^5 - 1340168745254912/7071232499767651215*n^6 + 1915907735552/5005422944521545*n^7 + 1984009542303744/2236510875885591305*n^8 - 91383922335678464/38020684890055052185*n^9 + 217388623232761856/114062054670165156555*n^10 + 1205183727169175552/2243220408513248078915*n^11 - 1073322175445659025408/410509334757924398441445*n^12) * eps^17
        + (165675008/123878451121425 - 4622190116864/157449511375331175*n + 614939458797568/6770328989139240525*n^2 - 11825387143168/218397709327072275*n^3 - 5151446051848192/63641092497908860935*n^4 - 4826842355728384/54327761888458783725*n^5 + 121985894142967808/247493137491867792525*n^6 - 9299663088083009536/39351408861206979011475*n^7 - 3754773200299360256/7870281772241395802295*n^8 - 315887059992576/5431526412865007455*n^9 + 38068651355990392832/20188983676619232710235*n^10 - 3051858507355257831424/1231528004273773195324335*n^11) * eps^18
        - (68442914816/14313591943211925 - 84196458496/98120709987525225*n - 25683753435136/2256776329713080175*n^2 - 604695332651008/9642589772410433475*n^3 + 353014314325508096/2227438237426810132725*n^4 - 80709003771904/11911434424742300175*n^5 - 124062850418212864/1192466935188090273075*n^6 - 1194565469995008/3677358084403978975*n^7 + 7413082615709696/13706516496414830725*n^8 + 360655275281088512/1779105841234645028105*n^9 - 6125829954174189568/14155494301997393049705*n^10) * eps^19
        + (1985478656/1172351340110691 - 369199415296/17585270101660365*n + 2067731675348992/45457923212792043525*n^2 - 2675726071365632/742479412475603377575*n^3 - 135473603280896/10264692338372396925*n^4 - 3462210456242880512/23610845316724187406885*n^5 + 40055605280374784/257198750726843000075*n^6 + 2039759270643236864/16864889511945848147775*n^7 + 935494308843225088/14128193445098651693775*n^8 - 72049578521657344/120450007009226799905*n^9) * eps^20
        - (61731504128/26140266367332975 + 5430390554624/4132538473890185775*n + 2777619103744/5785553863446260085*n^2 - 39529633695137792/742479412475603377575*n^3 + 85969920990380032/1356945133145068241775*n^4 + 1267388178910674944/39351408861206979011475*n^5 + 178954570188193792/3372977902389169629555*n^6 - 4539444203519737856/19510362376564804719975*n^7 - 13768334851964928/4265706469428147268525*n^8) * eps^21
        + (51497664512/31502372288837175 - 11603927891968/781831603168413525*n + 687018673700864/28927769317231300425*n^2 + 451808010960896/123358648467733476525*n^3 + 315883222439297024/16864889511945848147775*n^4 - 11534590875170504704/118054226583620937034425*n^5 + 39818830423294738432/2321733122811211761677025*n^6 + 9511520652935299072/296081645626795646262645*n^7) * eps^22
        - (15328083968/12549725545959525 + 575324291072/420986247859914975*n + 1473387591368704/290059524775481417775*n^2 - 1484013735931543552/39351408861206979011475*n^3 + 2722552774796509184/118054226583620937034425*n^4 + 2014794043929657344/169882911425210616708075*n^5 + 1634232174940323315712/20232245784497702494614075*n^6) * eps^23
        + (348127232/238789703834325 - 213943058432/20155619816238025*n + 213938226593792/16362332166822028695*n^2 + 6461637905088512/3190654772530295595525*n^3 + 60410836325136072704/2321733122811211761677025*n^4 - 7569155107689462759424/141625720491483917462298525*n^5) * eps^24
        - (20004732928/31217773947940755 + 5140337655808/5150932701410224575*n + 1398502957514752/221490106160639656725*n^2 - 137966723012755456/5411965321238255854725*n^3 + 692499587030337978368/84975432294890350477379115*n^4) * eps^25
        + (5125439488/4059048622072675 - 4424890056704/572325855712247175*n + 51535312584704/6753445097404516665*n^2 - 10447444596752384/29523810817486745353825*n^3) * eps^26
        - (573046784/1739592266602575 + 2801795072/4462432336067475*n + 1814487552229376/294257250672625368975*n^2) * eps^27
        + (70254592/64918370480425 - 5136982212608/894398938214666775*n) * eps^28
        - 133782044672/854691993121895775 * eps^29;
C4[12] = + (2097152/11408158125 - 16777216/25448968125*n + 33554432/31556720475*n^2 - 16777216/15092344575*n^3 + 67108864/75461722875*n^4 - 16777216/29390355225*n^5 + 33554432/112374887625*n^6 - 16777216/131639154075*n^7 + 134217728/3047952721275*n^8 - 16777216/1385433055125*n^9 + 33554432/13023070718175*n^10 - 184549376/455807475136125*n^11 + 67108864/1549745415462825*n^12 - 218103808/82136507019529725*n^13 + 33554432/645358269439162125*n^14 + 16777216/17166529967081712525*n^15 + 268435456/5064126340289105194875*n^16 + 16777216/3634255373619240198675*n^17) * eps^12
        - (4194304/110278861875 - 67108864/262972670625*n + 134217728/170158786875*n^2 - 872415232/578539875375*n^3 + 268435456/132956368875*n^4 - 4898947072/2419805913525*n^5 + 41204842496/26108432224875*n^6 - 9193914368/9434139375375*n^7 + 31675383808/66038975627625*n^8 - 1543503872/8232975741375*n^9 + 1744830464/30387165009075*n^10 - 738197504/54955511186625*n^11 + 314337918976/136894178365882875*n^12 - 398693761024/1505835962024711625*n^13 + 71001178112/4087269039781360125*n^14 - 7180648448/19859318981525902725*n^15 - 13958643712/1942840923003996332625*n^16) * eps^13
        - (67108864/603290244375 - 3959422976/8678098130625*n + 7113539584/8678098130625*n^2 - 4093640704/5633151418125*n^3 - 27111981056/278277680055375*n^4 + 132405788672/99212042454525*n^5 - 47840969621504/21330589127722875*n^6 + 12952010752/5530357564875*n^7 - 5504537460736/3103831854498375*n^8 + 3169350320128/3103831854498375*n^9 - 858590806016/1894133285565675*n^10 + 2349682655232/15210464262875875*n^11 - 322390982656/8139653848782225*n^12 + 41969279565824/5722176655693904175*n^13 - 218880525991936/241148873347100247375*n^14 + 1306280681537536/20594113783842361125825*n^15) * eps^14
        - (54525952/8678098130625 + 67108864/8678098130625*n - 9797894144/45869947261875*n^2 + 3333095948288/4174165200830625*n^3 - 204279382016/138575524885875*n^4 + 424884404486144/294362129962575675*n^5 - 18405142822912/63991767383168625*n^6 - 20177018159104/14815827916300125*n^7 + 533664182042624/221613594411183975*n^8 - 201738439098368/85235997850455375*n^9 + 2721633399734272/1677931500541821525*n^10 - 3710043685912576/4517507886074134875*n^11 + 621105152786432/1996108135707175875*n^12 - 441490659916906496/5064126340289105194875*n^13 + 768849625137283072/44130243822519345269625*n^14) * eps^15
        - (29360128/1239728304375 - 20166213632/321089630833125*n - 34158411776/4174165200830625*n^2 + 20367540224/115713842619375*n^3 + 145894670336/19624141997505045*n^4 - 48704828473344/54511505548625125*n^5 + 14158386065047552/7686122282356142625*n^6 - 675825217175552/412809636648283875*n^7 + 270735679422464/7017763823020825875*n^8 + 19077338759168/10714760539858375*n^9 - 117763506962432/46060864720755885*n^10 + 795676952773001216/371941482620103771375*n^11 - 3778958784987136/3041517321494958075*n^12 + 3591058194887081984/6864704594614120375275*n^13) * eps^16
        - (4194304/5633151418125 + 111199387648/4174165200830625*n - 1310099243008/9007409117581875*n^2 + 9516238241792/37738734610586625*n^3 - 335643372683264/7359053249064391875*n^4 - 22046090417143808/69175100541205283625*n^5 - 136217706364928/38430611411780713125*n^6 + 201471972012457984/161408567929478995125*n^7 - 791337814187835392/371941482620103771375*n^8 + 53952165240111104/41326831402233752375*n^9 + 4257445253742592/5722176655693904175*n^10 - 1374618086908362752/593095877691516824625*n^11 + 1102596198475294048256/446205798649917824392875*n^12) * eps^17
        - (38319161344/4174165200830625 - 733969645568/57046924411351875*n - 201192374272/7110196375907625*n^2 + 77779173376/22783446591530625*n^3 + 1923744574472192/8043616342000614375*n^4 - 5134140219326464/13835020108241056725*n^5 - 73618021154816/1325193496957955625*n^6 + 12436689368645632/28920399257141266875*n^7 + 11914712262377472/32776452491426769125*n^8 - 2836087701504/1540608812758015*n^9 + 6146994640781312/2967484445515364775*n^10 - 1130662023437221888/3077281369999433271675*n^11) * eps^18
        + (809500672/1037216807479125 - 33355856871424/1471810649812878375*n + 65364033536/843057996226875*n^2 - 364693793275904/6067991275544323125*n^3 - 165619962893828096/2421128518942184926875*n^4 - 449830111412224/25485563357286157125*n^5 + 5641720934655066112/14257756833770644569375*n^6 - 499918004516028416/1474940362114204610625*n^7 - 486984838402801664/1474940362114204610625*n^8 + 786107394424832/2750797577516613625*n^9 + 10606783160177917952/9231844109998299815025*n^10) * eps^19
        - (10592714752/2473631344223325 - 2744769314816/1471810649812878375*n - 145531712045056/11926741472621600625*n^2 - 62140576694272/1464687549269319375*n^3 + 12704342603726848/89671426627488330625*n^4 - 7144092454617088/182013917026859292375*n^5 - 1709258891583291392/14257756833770644569375*n^6 - 35423917799636992/197111845628165593125*n^7 + 87349623902961664/165126150597225943125*n^8 - 7274724790894592/223837670809572945125*n^9) * eps^20
        + (117440512/99695905291125 - 166726067027968/9882157220172183375*n + 43686796722176/1070821989801939375*n^2 - 163178960912384/18768438131334766875*n^3 - 174335826732253184/7548224206113870654375*n^4 - 2725675759334064128/25663962300787160224875*n^5 + 750779530699866112/4424821086342613831875*n^6 + 81652953558166798336/1081552696961744609476875*n^7 - 18791673242996178944/346453864668165752623125*n^8) * eps^21
        - (224948912128/102725127028816875 + 1906697043968/2845039387711145625*n - 994752543588352/484225703788436985375*n^2 - 3193548971180032/76517478535441741875*n^3 + 2736885148577431552/42773270501311933708125*n^4 + 39548874636918784/1710930820052477348325*n^5 + 2478501459553943552/229420269052491280798125*n^6 - 4479132491550602297344/21991571504888807059363125*n^7) * eps^22
        + (2902458368/2407236357920625 - 663840882688/54123991660344375*n + 3649770329473024/165147762553327929375*n^2 + 16748683190075392/8554654100262386741625*n^3 + 5156555989188608/750408254408981293125*n^4 - 14223212158493130752/168241530638493605918625*n^5 + 5623976056189811163136/153941000534221649415541875*n^6) * eps^23
        - (124436611072/105638488544098125 + 10877407330304/10467396321391288125*n + 584845428260864/229552435606325225625*n^2 - 214471771993145344/6753674289680831638125*n^3 + 3034186506932584448/116474905826649419482125*n^4 + 1440843898823037157376/92364600320532989649325125*n^5) * eps^24
        + (20954742784/18851312770495625 - 16716281151488/1866279964279066875*n + 1001681399578624/80250038463999875625*n^2 + 48918012396306432/21569427004935077681875*n^3 + 233305107083558912/13509521766934765196625*n^4) * eps^25
        - (8589934592/13236028115454375 + 539823702016/622093321426355625*n + 22135724572672/5243357994879283125*n^2 - 721163988242530304/32091098714659505819375*n^3) * eps^26
        + (16777216/17034785219375 - 5177851510784/780925658811808125*n + 570623449366528/77203926338394961875*n^2) * eps^27
        - (96162807808/269058420262891875 + 169771903483904/279013581812618874375*n) * eps^28
        + 17725128704/20644734133379125 * eps^29;
C4[13] = + (4194304/27484885575 - 67108864/121718778975*n + 134217728/148767396525*n^2 - 67108864/69424785045*n^3 + 268435456/335050049565*n^4 - 67108864/124447161267*n^5 + 134217728/447573123855*n^6 - 469762048/3396290175135*n^7 + 536870912/10188870525405*n^8 - 67108864/4092965082855*n^9 + 134217728/32818138209801*n^10 - 738197504/929847249277695*n^11 + 268435456/2346757343415135*n^12 - 872415232/77442992332699455*n^13 + 134217728/210202407760184235*n^14 - 67108864/5787572960330405937*n^15 - 1073741824/5295629258702321432355*n^16) * eps^13
        - (8388608/284010484275 - 268435456/1338906568725*n + 536870912/852031452825*n^2 - 15837691904/12843585233325*n^3 + 56908316672/33393321606645*n^4 - 21206401024/11905445094543*n^5 + 535260299264/365667242189535*n^6 - 167235289088/173210798931885*n^7 + 49392123904/95775382938807*n^8 - 52881784832/237019887070785*n^9 + 476204498944/6136991845232787*n^10 - 3156532527104/147845712635153505*n^11 + 817117528064/180700315442965395*n^12 - 3489660928/4954265502765285*n^13 + 102542344192/1377993561983429985*n^14 - 1586721980416/353041950580154762157*n^15) * eps^14
        - (171966464/1874469196215 - 3556769792/9372345981075*n + 243068305408/346776801299775*n^2 - 32950452224/48474176525775*n^3 + 19058917376/315952196739795*n^4 + 34250552246272/35323455595509081*n^5 - 14085747900416/7679012085980235*n^6 + 64179360759808/30935448689234661*n^7 - 679288269438976/398904469940131155*n^8 + 3663003123712/3409439914018215*n^9 - 2248062789484544/4228387381365390243*n^10 + 336487132430336/1626302838986688555*n^11 - 645641764077568/10299917980249027515*n^12 + 8774655565365248/607695160834692623385*n^13 - 1832502691889152/756518465528903061765*n^14) * eps^15
        - (16777216/3124115327025 + 536870912/346776801299775*n - 46170898432/300539894459805*n^2 + 5905580032/9509288217975*n^3 - 9754744755060736/7947777508989543225*n^4 + 3564488385101824/2649259169663181075*n^5 - 257937482186752/488294827349684355*n^6 - 2181820300918784/2526394976287497315*n^7 + 1340283199422464/689016811714771995*n^8 - 1013098496393216/469820820151710027*n^9 + 34875738960166912/21141936906826951215*n^10 - 274679801577472/291718809898120605*n^11 + 249518931822247936/607695160834692623385*n^12 - 15207870067304824832/111208214432748750079455*n^13) * eps^16
        - (6949961728/346776801299775 - 28252831744/500899824099675*n + 131130720256/26404576441825725*n^2 + 2771797409792/18526287899742525*n^3 - 525786406715392/7947777508989543225*n^4 - 1127691377967104/1840125827204475525*n^5 + 431369469558784/286241795342918415*n^6 - 9685634637627392/6011077702201286715*n^7 + 39917962919936/83949174760650381*n^8 + 253937189912576/219866886277893855*n^9 - 761094108872704/355169585525828535*n^10 + 339072536111218688/163449043258986291807*n^11 - 3279870352129261568/2373902771142419952435*n^12) * eps^17
        - (1367343104/1502699472299025 + 3567238774784/184832035092780075*n - 132465918214144/1135396786998506175*n^2 + 16112301375488/71601599180085975*n^3 - 6424649378299904/74709108584501706315*n^4 - 97291441461526528/373545542922508531575*n^5 + 12455942029312/84188763336152475*n^6 + 27848647672594432/33892246618794488925*n^7 - 30246214112903168/16767743064035168205*n^8 + 66986725867520/43973377255578771*n^9 + 52142753567473664/817245216294931459035*n^10 - 260303992792285184/154340427845172814245*n^11) * eps^18
        - (1476978016256/184832035092780075 - 34286388379648/2649259169663181075*n - 180670617878528/7947777508989543225*n^2 + 61736732327936/3365275161464040825*n^3 + 66288410624524288/373545542922508531575*n^4 - 129772872452276224/373545542922508531575*n^5 + 385471838420992/7884473825126623725*n^6 + 882496258441216/2234131263791502075*n^7 + 35024921427968/1557121789915289325*n^8 - 88175242312155136/67371469443668184795*n^9 + 353258965091483648/178680853741902577065*n^10) * eps^19
        + (6308233216/15138623826646749 - 28033251540992/1589555501797908645*n + 2745111167369216/41505060324723170175*n^2 - 1883871440273408/30055388511006433575*n^3 - 138534565269471232/2614818800457559721025*n^4 + 36477384878194688/1319860918326196811565*n^5 + 20047764876427264/66659642339706909675*n^6 - 81615489704394752/212880793278418840575*n^7 - 806526138712064/4835272926579056325*n^8 + 40776148925284352/95573479908459517965*n^9) * eps^20
        - (117658615808/30686399648608275 - 137275476279296/53363648988929790225*n - 113666846359552/9508432001663853531*n^2 - 23743407872540672/871606266819186573675*n^3 + 5706074921671589888/46195132141416888404775*n^4 - 94257108270186496/1490165552948931884025*n^5 - 49559085925793792/439953639442065603855*n^6 - 26648109036760727552/389358970906228059411675*n^7 + 355114185834643849216/766157975009029407229425*n^8) * eps^21
        + (1778384896/2175355631198475 - 56733296754688/4157104611220285725*n + 95240944885956608/2614818800457559721025*n^2 - 27553288945664/2149710649235277975*n^3 - 24604832551665664/905786904733664478525*n^4 - 3321420989153148928/46195132141416888404775*n^5 + 153260985824307052544/908504265447865471960575*n^6 + 39586202742075424768/1583393148351994108274145*n^7) * eps^22
        - (582454607872/288579494587524525 + 29103503704064/201139907727504593925*n - 512589851262976/144812326462121907225*n^2 - 495843902356455424/15398377380472296134925*n^3 + 2873676414538743808/46195132141416888404775*n^4 + 3616386677989179392/302834755149288490653525*n^5 - 954646975949855260672/55418760192319793789595075*n^6) * eps^23
        + (11341398016/12676618625291775 - 28490665558016/2795807791649027925*n + 2074293110308864/101527762948168985505*n^2 + 487478788096/45156531907543390425*n^3 - 263322391923392512/209654830487968955067825*n^4 - 21704426226697895936/308453210717920930183275*n^5) * eps^24
        - (1957280350208/1746838046565206595 + 1484716507136/2015582361421392225*n + 9798431014912/12381434505874266525*n^2 - 168009336415584256/6353176681453604699025*n^3 + 928284064644245487616/33251256115391876273757045*n^4) * eps^25
        + (2785017856/3260242714754025 - 5101347405824/671860787140464075*n + 281627448049664/23783871864772428255*n^2 + 200888040405598208/103975159835496798854775*n^3) * eps^26
        - (24041750528/37532941992020475 + 24928795492352/34579388172186863775*n + 9096895888621568/3418589858264128911825*n^2) * eps^27
        + (75027709952/96861031294641075 - 245770913579008/43047809765375483475*n) * eps^28
        - 5320214577152/14381121797311898475 * eps^29;
C4[14] = + (16777216/130734984825 - 134217728/287616966615*n + 268435456/347123925225*n^2 - 402653184/475688341975*n^3 + 536870912/742073813481*n^4 - 671088640/1322827232727*n^5 + 805306368/2708646238441*n^6 - 939524096/6415214775255*n^7 + 1073741824/17736182025705*n^8 - 402653184/19312731539101*n^9 + 1342177280/227295994267881*n^10 - 1476395008/1095153426927063*n^11 + 1610612736/6692604275665385*n^12 - 1744830464/54496920530418135*n^13 + 268435456/91866237465561999*n^14 - 2013265920/13075627799264991191*n^15) * eps^14
        - (33554432/1438084833075 - 536870912/3355531277175*n + 63350767616/124154657255475*n^2 - 170188079104/166966608033225*n^3 + 19327352832/13344309803825*n^4 - 40265318400/25652473199353*n^5 + 1073741824/795175736355*n^6 - 1800128167936/1909595598100905*n^7 + 2658584756224/4924746542470755*n^8 - 1252519837696/4924746542470755*n^9 + 5127117209600/52202313350190003*n^10 - 617938419712/20077812826996155*n^11 + 517543559168/67319725361104755*n^12 - 272193552384/182985594951729185*n^13 + 1987496116224/9339734142332136565*n^14) * eps^15
        - (33554432/437677992675 - 118916907008/372463971766425*n + 2921114632192/4842031632963525*n^2 - 41529917833216/66174432317168175*n^3 + 15828028227584/98120709987525225*n^4 + 688000073728/991118282702275*n^5 - 41783052468224/27949535572204155*n^6 + 511575970545664/280710552920833035*n^7 - 451179871993856/280710552920833035*n^8 + 3293434609664/3000132951160345*n^9 - 466469418696704/783034700252850045*n^10 + 3850775604232192/14877659304804150855*n^11 - 2019084526944256/22507228179062689755*n^12 + 33587298968797184/1372940918922824075055*n^13) * eps^16
        - (33554432/7303215132675 - 536870912/254843770155975*n - 185757335552/1668262999592475*n^2 + 1385680466870272/2845500589638231525*n^3 - 8731481681690624/8536501768914694575*n^4 + 220686693957632/179675585821312425*n^5 - 18664854126592/27949535572204155*n^6 - 3126150465323008/6456342717179159805*n^7 + 22847709891264512/14877659304804150855*n^8 - 8552890499072/4455723062235445*n^9 + 24140837571002368/14877659304804150855*n^10 - 902189565035413504/877781898983444900445*n^11 + 1286177449842835456/2549747420856673282245*n^12) * eps^17
        - (7532969984/440184693905775 - 3347792789504/66174432317168175*n + 628407402496/45166676026003675*n^2 + 1061963278843904/8536501768914694575*n^3 - 42469753851215872/401215583138990645025*n^4 - 5274287887876096/12942438165773891775*n^5 + 211258703872/173992581377615*n^6 - 1850811063730176/1226473706130808135*n^7 + 2759545478709248/3679421118392424405*n^8 + 14770795184128/22853547319207605*n^9 - 561234382422016/325466035959749685*n^10 + 370678562706948096/191916472537599064255*n^11) * eps^18
        - (64156073984/66174432317168175 + 119902602002432/8536501768914694575*n - 803081574940672/8536501768914694575*n^2 + 26611905128824832/133738527712996881675*n^3 - 1091076312006656/9785745930219284025*n^4 - 80232536004886528/401215583138990645025*n^5 + 40295383171072/179333130140134971*n^6 + 27565954804219904/55191316775886366075*n^7 - 7369373605953536/5017392434171487825*n^8 + 113261581835436032/72361948661717679965*n^9 - 730314374996033536/1727248252838391578295*n^10) * eps^19
        - (11934908809216/1707300353782938915 - 21674552459264/1707300353782938915*n - 7136169766682624/401215583138990645025*n^2 + 2271120724066304/85106335817361651975*n^3 + 2672234162290688/20803770977577292705*n^4 - 444331359809306624/1417628393757766945755*n^5 + 15332470606004224/124353367873488328575*n^6 + 1711864442519552/5317435835550513675*n^7 - 53216998439518208/296026153616117781675*n^8 - 18886946599852834816/22070394341823892389325*n^9) * eps^20
        + (268435456/1507949438070075 - 2452426326016/177450501167178525*n + 9324812086280192/165206416586643206775*n^2 - 8403666155339776/133738527712996881675*n^3 - 797421959095779328/21264425906366504186325*n^4 + 8042800387494772736/148850981344565529304275*n^5 + 4598266951456784384/21264425906366504186325*n^6 - 19374719994788052992/50184045139024949879727*n^7 - 2122206253634551808/98749250112274901376237*n^8) * eps^21
        - (201259483136/58563068623411275 - 503944082096128/165206416586643206775*n - 31263441683480576/2808509081972934515175*n^2 - 4250309836668928/265331517548245150275*n^3 + 127802792763981824/1210170580037118124425*n^4 - 3927713021463363584/49616993781521843101425*n^5 - 7376736415775719424/79118990084048344404975*n^6 + 247806897622756622336/25510222945671016188861225*n^7) * eps^22
        + (58116276224/103318584481953225 - 799750827802624/72013053383921397825*n + 1608466708345913344/49616993781521843101425*n^2 - 790392194996371456/49616993781521843101425*n^3 - 454932135812268032/16538997927173947700475*n^4 - 624347071410864128/14142041705844390062725*n^5 + 28145849041027147497472/178571560619697113322028575*n^6) * eps^23
        - (2953729540096/1593028407244999725 - 993263800549376/3630511740111354373275*n - 92005258259070976/21264425906366504186325*n^2 - 330227400669396992/13531907394960502664025*n^3 + 516170577441955250176/8782207899329366228952225*n^4 + 64371065618968870912/76530668837013048566583675*n^5) * eps^24
        + (109655883776/164581882229990225 - 12603581530112/1481236940069912025*n + 129935645605888/6915260457354960711*n^2 - 11155084482183168/5913944713353108571685*n^3 - 1162207852366183530496/178571560619697113322028575*n^4) * eps^25
        - (455065206784/430714287538059525 + 180582436831232/384627858771487155825*n - 9176950320922624/22693043667517742193675*n^2 - 432325319462741868544/19841284513299679258003175*n^3) * eps^26
        + (36775657472/55670554171585925 - 3120779071848448/482830716330164727525*n + 15460645461047640064/1384275663718582273814175*n^2) * eps^27
        - (15502416019456/24924034576467086775 + 14832869272715264/25846223855796368985675*n) * eps^28
        + 11005853696/17940058163291825 * eps^29;
C4[15] = + (33554432/307452619485 - 4294967296/10760841681975*n + 8589934592/12843585233325*n^2 - 4294967296/5757469242525*n^3 + 17179869184/26228470993725*n^4 - 21474836480/45112970109207*n^5 + 8589934592/29421502245135*n^6 - 30064771072/197544372217335*n^7 + 34359738368/509456538876285*n^8 - 4294967296/169818846292095*n^9 + 42949672960/5400239312088621*n^10 - 4294967296/2077015120034085*n^11 + 17179869184/39463287280647615*n^12 - 55834574848/776111316519403095*n^13 + 8589934592/966179394034358955*n^14) * eps^15
        - (67108864/3586947227325 - 17179869184/132717047411025*n + 34359738368/82158172206825*n^2 - 1941325217792/2281876976454075*n^3 + 4191888080896/3383472758190525*n^4 - 17179869184/12393673106925*n^5 + 13159779794944/10601547975663645*n^6 - 51539607552/56606282097365*n^7 + 137438953472/248196775349985*n^8 - 17179869184/61227203084905*n^9 + 34359738368/290335446886485*n^10 - 2353642078208/57002526072046555*n^11 + 68719476736/5835423432476715*n^12 - 127526168952832/47342790307683588795*n^13) * eps^16
        - (25803358208/398151142233075 - 468151435264/1725321616343325*n + 2843268349952/5441398943852025*n^2 - 1749413194104832/3041742009613281975*n^3 + 2869038153728/12798353476633725*n^4 + 7477538062336/15389343835640775*n^5 - 12876311953408/10601547975663645*n^6 + 3191160700928/2005698265666095*n^7 - 256083130056704/171007578216139665*n^8 + 62521838927872/57002526072046555*n^9 - 2688649527296/4170916541857065*n^10 + 238675627606016/776111316519403095*n^11 - 73356546767060992/615456273999886654335*n^12) * eps^17
        - (1073741824/272419202580525 - 68719476736/16324196831556075*n - 740383642353664/9125226028839845925*n^2 + 184786672943104/480275054149465575*n^3 - 366345454624964608/428885623355472758475*n^4 + 15312142525792256/13835020108241056725*n^5 - 137438953472/185992069748485*n^6 - 2361269940125696/11799522896913636885*n^7 + 13962148405313536/11799522896913636885*n^8 - 6665789243392/3976920423631155*n^9 + 47061983886835712/30268341344256720705*n^10 - 1994417129603989504/1846368821999659963005*n^11) * eps^18
        - (164550934528/11169187305801525 - 481036337152/10598404214680425*n + 60335700574208/3041742009613281975*n^2 + 2078970329694208/20423124921689178975*n^3 - 8688615760592896/69818589848565332775*n^4 - 70574146693627904/272927214862573573575*n^5 + 10019162269155328/10369277697287741505*n^6 - 26920099097083904/19665871494856061475*n^7 + 17804941544390656/19665871494856061475*n^8 + 19171565778239488/77352427879767175135*n^9 - 43066633509404672/32392435473678244965*n^10) * eps^19
        - (9126805504/9417157924499325 + 1099511627776/107355600339292305*n - 1923595592794112/25228566079733691675*n^2 + 18691697672192/106836033005526825*n^3 - 75660693642149888/600439872697661861865*n^4 - 4587735356639543296/31823313252976078678845*n^5 + 4633891755261952/18245220303277192225*n^6 + 5232575836585984/19817731506399351525*n^7 - 12071927388468936704/10442577763768568643225*n^8 + 35301152318329716736/23592490503328988416175*n^9) * eps^20
        - (3298803318784/536778001696461525 - 23776938950656/1940658929210283975*n - 31061203484672/2293506007248517425*n^2 + 30755676691103744/1000733121162769769775*n^3 + 4781985526162915328/53038855421626797798075*n^4 - 14610072603059027968/53038855421626797798075*n^5 + 1187972560910811136/6918111576733930147575*n^6 + 105931591945715449856/447041781410854438583775*n^7 - 581521673484192710656/2052546673789621992207225*n^8) * eps^21
        + (13958643712/646886309736761325 - 46935402610688/4307316159954532725*n + 484197433081856/10040800546783643175*n^2 - 112187225831112704/1828926049021613717175*n^3 - 3719479336609251328/159116566264880393394225*n^4 + 10694315528765308928/159116566264880393394225*n^5 + 64983725589372338176/447041781410854438583775*n^6 - 1741649722614854189056/4812273294010962485931225*n^7) * eps^22
        - (1476797661184/478590684439392525 - 10072883720093696/3002199363488309309325*n - 714923076222976/71256859052790144825*n^2 - 31964572545974272/4079911955509753676775*n^3 + 14137901009686495232/159116566264880393394225*n^4 - 828273098770840813568/9387877409627943210259275*n^5 - 13142314124239393783808/190886840662434845275271925*n^6) * eps^23
        + (34091302912/89625917648992725 - 206227149684736/22695274035783824475*n + 3494935147839488/121370378539191756975*n^2 - 221792729640730624/12239735866529261030325*n^3 - 1863430041644302336/72774243485487931862475*n^4 - 4307536620664800673792/190886840662434845275271925*n^5) * eps^24
        - (22080561086464/12983807936750746095 - 8985071583232/14981316850097014725*n - 148111053849362432/31823313252976078678845*n^2 - 3775266271680004096/208619497991732071339095*n^3 + 31015178546408587264/570947678950453176296925*n^4) * eps^25
        + (76235669504/153472907053791325 - 2934527815057408/411153917997106959675*n + 1924007909654528/111788392450826316225*n^2 - 76026719619927506944/21209648962492760586141325*n^3) * eps^26
        - (262261440512/264716463890811075 + 410392715067392/1707197201241669978225*n - 2623596372082819072/2194101616809595922704275*n^2) * eps^27
        + (4558570913792/8880977837591720575 - 152607815888797696/27628722052747842708825*n) * eps^28
        - 54965112406016/91993525147884048975 * eps^29;
C4[16] = + (1073741824/11455089532425 - 8589934592/24931665452925*n + 17179869184/29464695535275*n^2 - 8589934592/12989812010175*n^3 + 34359738368/57782267217675*n^4 - 8589934592/19260755739225*n^5 + 17179869184/60350367982905*n^6 - 8589934592/55102509897435*n^7 + 68719476736/936742668256395*n^8 - 8589934592/290335446886485*n^9 + 17179869184/1690777014221295*n^10 - 8589934592/2920433024564055*n^11 + 34359738368/48599000844668505*n^12 - 111669149696/808510650415848765*n^13) * eps^16
        - (2147483648/141279437566575 - 34359738368/324111650888025*n + 4604204941312/13288577686409025*n^2 - 652835028992/911337863661225*n^3 + 137438953472/128898903793275*n^4 - 3332894621696/2715766559230725*n^5 + 68719476736/60350367982905*n^6 - 18794776887296/21545081369897085*n^7 + 27762668601344/49647361417588935*n^8 - 34359738368/113846357221905*n^9 + 74972949118976/546120975593478285*n^10 - 9036611190784/172305548449279245*n^11 + 643351741202432/38539007669822124465*n^12) * eps^17
        - (304942678016/5509898065096425 - 68719476736/295301726364645*n + 86723979640832/190469613505196025*n^2 - 6665789243392/12697974233679735*n^3 + 57999238365184/221952194249856525*n^4 + 180938382245888/551300611523837175*n^5 - 35321811042304/35908468949828475*n^6 + 239212498518016/173013532212809925*n^7 - 91809220919296/66459166342063495*n^8 + 21784074125312/20226702799758455*n^9 - 2430333014245376/3580126395557246535*n^10 + 20911817807101952/59560284580634192355*n^11) * eps^18
        - (2147483648/632789413638525 - 3058016714752/571408840515588075*n - 1168231104512/19703753121227175*n^2 + 2740292214063104/8952071834744213175*n^3 - 471827927269376/659626345717994655*n^4 + 287384886069690368/290535422273062191225*n^5 - 126580520233467904/165573950327659098225*n^6 + 73426760892416/8191814633902174275*n^7 + 7949743946727424/8971987456178571825*n^8 - 118514262413934592/82342907097816670305*n^9 + 2867242032764551168/1965489391160928347715*n^10) * eps^19
        - (292057776128/22856353620623523 - 7765300871168/190469613505196025*n + 7284264534016/308692132232559075*n^2 + 68719476736/835916799082365*n^3 - 59394793498738688/456555663571954871925*n^4 - 20119482240335872/132848746027604123517*n^5 + 42939215642347175936/56460717061731752494725*n^6 - 948135883385602048/780562908687535748775*n^7 + 986509869987135488/1010572041655022771925*n^8 - 270217970507055104/5022917332966816888605*n^9) * eps^20
        - (178241142784/190469613505196025 + 28621662060544/3836602214890377075*n - 238250425843712/3836602214890377075*n^2 + 373730874228736/2437749538523023725*n^3 - 22471975741209706496/169382151185195257484175*n^4 - 16232352634898481152/169382151185195257484175*n^5 + 70734537952329728/278131611141535726575*n^6 + 139064563512243126272/1427649559989502884509475*n^7 - 26056261464529829888/29571009561752012208855*n^8) * eps^21
        - (313532612608/57755302159640085 - 44873818308608/3836602214890377075*n - 217016107532288/21740745884378803425*n^2 + 1808506343460438016/56460717061731752494725*n^3 + 209591930143637504/3456778595616229744575*n^4 - 40204026742784917504/169382151185195257484175*n^5 + 17961121261241237504/90031954233572253978075*n^6 + 121171809712218308608/784564172606843927523225*n^7) * eps^22
        - (2147483648/26814079094227425 + 1452764097937408/168204718158088637025*n - 122625576908357632/2971616687459565920775*n^2 + 10274283326537728/174800981615268583575*n^3 + 270955536650862592/24197450169313608212025*n^4 - 714492347456237338624/9993546919926520191566325*n^5 - 17971202853986776383488/203202120705172577228515275*n^6) * eps^23
        - (1206885810176/434637514620384075 - 31478708665581568/8914850062378697762325*n - 1921327850061824/217435367375090189325*n^2 - 2008361067347968/1026558492031486408995*n^3 + 43335953522509217792/587855701172148246562725*n^4 - 56042554411652231462912/609606362115517731685545825*n^5) * eps^24
        + (229780750336/921431530995214239 - 309821760864256/41464418894784640755*n + 4327713982090575872/169382151185195257484175*n^2 - 2828328495191425024/144834013332268408573425*n^3 - 1522125277009729814528/67734040235057525742838425*n^4) * eps^25
        - (98573794410496/63225886967224806825 - 47942074225393664/56460717061731752494725*n - 46815176099431972864/9993546919926520191566325*n^2 - 530028984910848458752/40640424141034515445703055*n^3) * eps^26
        + (1007169830912/2724017805844152675 - 20291933767204864/3375058061440905164325*n + 5244397854327308288/333665222832795693314475*n^2) * eps^27
        - (15753940041728/17017099469449942005 + 4223018003857408/88233660749097949295925*n) * eps^28
        + 1187558457344/2967533069286582225 * eps^29;
C4[17] = + (2147483648/26442675480375 - 34359738368/114584927081625*n + 68719476736/134228057438475*n^2 - 34359738368/58301075453075*n^3 + 137438953472/253891780198875*n^4 - 34359738368/82295956340325*n^5 + 206158430208/746759603828875*n^6 - 34359738368/217627084544415*n^7 + 274877906944/3510419494172955*n^8 - 309237645312/9193955818072025*n^9 + 68719476736/5516373490843215*n^10 - 34359738368/8702300426731275*n^11 + 412316860416/389282905755779035*n^12) * eps^17
        - (4294967296/343754781244875 - 137438953472/1565994003448875*n + 19516331393024/67337742148301625*n^2 - 52639119179776/86577097047816375*n^3 + 549755813888/595684901368375*n^4 - 14156212207616/12993617106622425*n^5 + 357616156934144/342762658157453625*n^6 - 11407433138176/13731232715302375*n^7 + 825733232459776/1480226886709596025*n^8 - 20478404067328/64357690726504175*n^9 + 16767552323584/108488678653249895*n^10 - 192002218000384/3008095180840110725*n^11) * eps^18
        - (672162381824/14093946031039875 - 446676598784/2219925565328625*n + 1168231104512/2927727919491375*n^2 - 504504038457344/1054957960323392125*n^3 + 56045268763672576/199387054501121111625*n^4 + 299170241970176/1433226184574654925*n^5 - 2212698431422464/2787440241206382125*n^6 + 277867204182016/232091323700110875*n^7 - 4011293296033792/3171914757234848625*n^8 + 91101719546560512/87333386315866165475*n^9 - 97236616472428544/138973997354813115495*n^10) * eps^19
        - (8589934592/2927727919491375 - 274877906944/46618436871901125*n - 246840360435712/5696772985746317475*n^2 + 5429663295864832/22154117166791234625*n^3 - 2036694657362034688/3389579926519058897625*n^4 + 1858884660575076352/2113502777711883783225*n^5 - 15175708525948043264/19960859567278902397125*n^6 + 132330897327259648/827869751638295491125*n^7 + 7537479862869557248/11790007152641932339125*n^8 - 6483944038931103744/5327336565267836093975*n^9) * eps^20
        - (6762426007552/606039679334714625 - 1044982722985984/28483864928731587375*n + 9552007266304/369920323749760875*n^2 + 222305823613779968/3389579926519058897625*n^3 - 34475324527869952/269336935690419972375*n^4 - 470625336426496/6264960282668182095*n^5 + 3519193123127296/5942893780988789625*n^6 - 43409782051822370816/40923615560714660899125*n^7 + 557434867142939901952/563689801433069683997625*n^8) * eps^21
        - (442381631488/499716928574238375 + 8108898254848/1499150785722715125*n - 184992831373312/3640794765326593875*n^2 + 14573614309310464/108679816155783497625*n^3 - 34212953565691904/255544432582517953875*n^4 - 399858431600623616/7185909444220404862965*n^5 + 528521220698669056/2220661309496144389875*n^6 - 1001307509790605312/60886354858624251581625*n^7) * eps^22
        - (2407329169408/499716928574238375 - 282471409123328/25485563357286157125*n - 34565896798208/4911763119767877555*n^2 + 119606249259008/3783571030633519125*n^3 + 14237438629117952/373488016851372394125*n^4 - 322117427598983168/1599881725316995799679*n^5 + 501588313596791619584/2368323085141871529469875*n^6) * eps^23
        - (17179869184/118537503987377475 + 59923383713792/8714418438297847275*n - 975266813837312/27566017508901353625*n^2 + 46008514308472832/827869751638295491125*n^3 + 98201781523185664/89069045632143673721625*n^4 - 170579883200610304/2434995583254800593335*n^5) * eps^24
        - (6444598427648/2572828300830793005 - 139397458558976/38592424512461895075*n - 196192800411222016/25663962300787160224875*n^2 + 367602162055774208/168241530638493605918625*n^3 + 18650877066060234752/308911706757635416887375*n^4) * eps^25
        + (4294967296/27767187952228725 - 1173316345790464/190103424450275260925*n + 11436993233410850816/504724591915480817755875*n^2 - 5081081138781356032/250310569974344145391125*n^3) * eps^26
        - (5310727061504/3714569735242026375 - 11122006791553024/10738821104584698250125*n - 22042390638362624/4867699621635467175195*n^2) * eps^27
        + (1176821039104/4297247340770187375 - 175646982537216/34544538700609955875*n) * eps^28
        - 602006238527488/697370271282346822875 * eps^29;
C4[18] = + (8589934592/121132637200575 - 68719476736/261391480274925*n + 137438953472/303779287887075*n^2 - 68719476736/130191123380175*n^3 + 274877906944/556271163533475*n^4 - 68719476736/175853464600905*n^5 + 137438953472/515432568657825*n^6 - 68719476736/433617875220075*n^7 + 549755813888/6677715278389155*n^8 - 68719476736/1838791163614405*n^9 + 137438953472/9299029598849991*n^10 - 68719476736/13570354199278695*n^11) * eps^18
        - (17179869184/1655479375074525 - 274877906944/3746611217273925*n + 549755813888/2247966730364355*n^2 - 824633720832/1586402947854725*n^3 + 80264348827648/99943385714847675*n^4 - 29961691856896/30891591948225645*n^5 + 1649267441664/1725969189601475*n^6 - 274877906944/349009509323475*n^7 + 2199023255552/3989829883314275*n^8 - 22265110462464/67438908352020205*n^9 + 224850127880192/1323561879569648719*n^10) * eps^19
        - (1769526525952/42711367876922745 - 137438953472/784174440824775*n + 557177517375488/1584816544906870275*n^2 - 9758165696512/22411547099693115*n^3 + 210556476719104/728158953065318775*n^4 + 6389949263773696/54029394317446653105*n^5 - 1126174784749568/1765666480962308925*n^6 + 24452176529063936/23653421475379871175*n^7 - 35240447181848576/30623395201667356725*n^8 + 6613974757933056/6617809397848243595*n^9) * eps^20
        - (17179869184/6743900191093065 - 274877906944/45280472711624865*n - 549755813888/17415566427548025*n^2 + 37220942501380096/188593168843917562725*n^3 - 5061923935373754368/9995437948727630824425*n^4 + 210619973515608064/270146971587233265525*n^5 - 540556749854212096/733256065736776006425*n^6 + 62215590579798016/233849231775512347995*n^7 + 37208280525474627584/85128663889892156358825*n^8) * eps^21
        - (575525617664/58696909070624825 - 7490422964224/226402363558124325*n + 20753281974272/769768036097622705*n^2 + 15646943816450048/302892059052352449225*n^3 - 173465276589801472/1427919706961090117775*n^4 - 312763435504893952/14608717001986537358775*n^5 + 95646928817094656/209864695183152107175*n^6 - 266525260705169408/291246946317918204075*n^7) * eps^22
        - (3058016714752/3697905271449363975 + 549755813888/141480246694611825*n - 11279889789353984/270146971587233265525*n^2 + 390507497523249152/3331812649575876941475*n^3 - 1085215777591656448/8257100914166303724525*n^4 - 259937076091977465856/11204885940523674154180425*n^5 + 3732761141304157536256/17525590830049849318077075*n^6) * eps^23
        - (809755954118656/188593168843917562725 - 104456628295696384/9995437948727630824425*n - 9252940103548928/1999087589745526164885*n^2 + 520739427153084416/17264847365984089605825*n^3 + 236963197894260686848/11204885940523674154180425*n^4 - 2173497279199697698816/12896189478715926856698225*n^5) * eps^24
        - (8211977469952/44424168661011692553 + 549755813888/100049426442396585*n - 5772652649614671872/189913321025824985664075*n^2 + 64786503302480134144/1244987326724852683797825*n^3 - 281804537728895811584/40205767198349654317941525*n^4) * eps^25
        - (481783661461504/212668892526119804775 - 20856155030945792/5754949121994696535275*n - 324453099534024704/49799493068994107351913*n^2 + 20093572867302621184/3997064575274527037456175*n^3) * eps^26
        + (7095285972992/82463448122372985525 - 496704377847808/97029641238005820575*n + 218039311403828903936/10849175275745144815952475*n^2) * eps^27
        - (410444254674944/312819619211135826075 - 102777261723222016/87729180127319230317675*n) * eps^28
        + 601295421440/2991617395646009559 * eps^29;
C4[19] = + (17179869184/275520749478975 - 549755813888/2369478445519185*n + 1099511627776/2734013590983675*n^2 - 549755813888/1157645394380475*n^3 + 2199023255552/4862110656397995*n^4 - 549755813888/1502834202886653*n^5 + 1099511627776/4282269502849065*n^6 - 549755813888/3480662403793575*n^7 + 4398046511104/51436455522727275*n^8 - 549755813888/13487781670404041*n^9 + 5497558138880/321947484219644283*n^10) * eps^19
        - (34359738368/3949130742531975 - 2199023255552/35542176682787775*n + 347445674377216/1670482304091025425*n^2 - 134140418588672/299830157144543025*n^3 + 8796093022208/12523618357388775*n^4 - 10995116277760/12697860004100271*n^5 + 6390361580634112/7301269502357655825*n^6 - 129742372077568/174349544044569075*n^7 + 14759844091265024/27312757882568183025*n^8 - 6955510557310976/20568867047366162525*n^9) * eps^20
        - (17179869184/473895689103837 - 256735965085696/1670482304091025425*n + 1099511627776/3531675061503225*n^2 - 26276678636404736/66262464728944008525*n^3 + 234554417506942976/810440914761699796575*n^4 + 1092364802195456/21903808507072967475*n^5 - 70701896200880128/138724120544795460675*n^6 + 3123725178895335424/3507738476632685219925*n^7 - 50355798566745669632/48316268694263115771225*n^8) * eps^21
        - (137438953472/61869714966334275 - 70368744177664/11693376128637177975*n - 35184372088832/1540987551835907175*n^2 + 4714705859903488/29511854038941449175*n^3 - 121949033659891712/284749510591948577175*n^4 + 10624202627199533056/15398377380472296134925*n^5 - 5751835595965988864/8184723112142932179825*n^6 + 455215406085308416/1345736145123231436575*n^7) * eps^22
        - (33775622815744/3897792042879059325 - 5945059371384832/198787394186832025575*n + 6597069766656/241318671795096025*n^2 + 140795762471600128/3511910630634032451825*n^3 - 609362538252992512/5410240701247022966325*n^4 + 4538644361482600448/288062328068835393548475*n^5 + 155909009391241658368/450559025953819461704025*n^6) * eps^23
        - (50783693307904/66262464728944008525 + 998356558020608/363301099720761977775*n - 362953186375368704/10535731891902097355475*n^2 + 6835782537139191808/66726301982046616584675*n^3 - 8847585350760005632/69884943495989651689275*n^4 + 1707339911901640392704/720443882500157319264735975*n^5) * eps^24
        - (8097250303541248/2107146378380419471095 - 103462944662093824/10535731891902097355475*n - 535446769564123136/200178905946139849754025*n^2 + 12306584060557262848/437427979660083375388425*n^3 + 557162471658373513216/65494898409105210842248725*n^4) * eps^25
        - (15530601742336/74721502779447498975 + 881509258313596928/200178905946139849754025*n - 14719628353967489024/562407402420107196927975*n^2 + 203822997141859598336/4213122119883960931372725*n^3) * eps^26
        - (8392074038607872/4085283794819180607225 - 14119724364492439552/3936851816940750378495825*n - 438401893076171751424/80049320277795257696081775*n^2) * eps^27
        + (240518168576/6628488955650844425 - 2724235770884784128/639258103371923087191425*n) * eps^28
        - 1197385342517248/993297829878681822495 * eps^29;
C4[20] = + (137438953472/2490990160674015 - 1099511627776/5337836058587175*n + 2199023255552/6118982798868225*n^2 - 1099511627776/2562650915765325*n^3 + 4398046511104/10596907840867425*n^4 - 1099511627776/3209349231805563*n^5 + 2199023255552/8914858977237675*n^6 - 1099511627776/7025073203261025*n^7 + 8796093022208/100046732170579425*n^8 - 9895604649984/226031506015012775*n^9) * eps^20
        - (274877906944/37364852410110225 - 4398046511104/83626098251199075*n + 730075720843264/4097678814308754675*n^2 - 1974722883485696/5097112671457231425*n^3 + 474989023199232/769649491701519275*n^4 - 4398046511104/5673092076423975*n^5 + 1222656930086912/1524440885107642425*n^6 - 3003865767084032/4282952962921471575*n^7 + 31067800554438656/58994223069918334275*n^8) * eps^21
        - (18691697672192/585382687758393525 - 1666859627708416/12293036442926264025*n + 57887088179150848/208981619529746488425*n^2 - 1334644388399153152/3692008611692187962175*n^3 + 4521191813414912/15890998328660780325*n^4 - 655308930154496/394830189242879388075*n^5 - 7714173580476416/19078608653013827925*n^6 + 600012291370385408/783780392214629298225*n^7) * eps^22
        - (274877906944/141299269458922575 - 1218258883575808/208981619529746488425*n - 180610178024996864/11076025835076563886525*n^2 + 479664146640535552/3692008611692187962175*n^3 - 2637051095871913984/7256706581601886684275*n^4 + 184775141265151885312/302834755149288490653525*n^5 - 11443717021892608/17286398928081978975*n^6) * eps^23
        - (536286796447744/69660539843248829475 - 300168873406103552/11076025835076563886525*n + 43017292925108224/1582289405010937698075*n^2 + 6426889555932086272/210444490866454713843975*n^3 - 425316984525521158144/4138741653706942705598175*n^4 + 30568622275428352/748214369811373640175*n^5) * eps^24
        - (237219633692672/335637146517471632925 + 1614083069575168/852001987313581837425*n - 857627865758302208/30063498695207816263425*n^2 + 370804592201131098112/4138741653706942705598175*n^3 - 3142647162680895340544/26116886987185190176705725*n^4) * eps^25
        - (38242113925677056/11076025835076563886525 - 215297570858074112/23382721207383857093775*n - 4560536737503248384/4138741653706942705598175*n^2 + 6519761472431813820416/252463240876123505041488675*n^3) * eps^26
        - (40956808134656/186729805560296995425 + 146855171052273664/41525835990370662597975*n - 743768959490749104128/32929987940363935440194175*n^2) * eps^27
        - (8472149408874496/4536435864494274065325 - 1836887006316068864/522698221275618022860225*n) * eps^28
        + 549755813888/1740393633548117723175 * eps^29;
C4[21] = + (274877906944/5598218305347525 - 4398046511104/23919660031939425*n + 8796093022208/27257287013140275*n^2 - 4398046511104/11301801932277675*n^3 + 17592186044416/46076577108516675*n^4 - 4398046511104/13698441843072525*n^5 + 8796093022208/37181485002625425*n^6 - 4398046511104/28489709287725975*n^7 + 35184372088832/392422769866419075*n^8) * eps^21
        - (549755813888/87705420117111225 - 17592186044416/390687780521677275*n + 35184372088832/229023871340293575*n^2 - 2761973208973312/8186271866279795925*n^3 + 70368744177664/129195108363095775*n^4 - 2234207627640832/3210001538559995025*n^5 + 3764727813505024/5118651102028100175*n^6 - 4204532464615424/6372198310688043075*n^7) * eps^22
        - (364762982514688/12892696757215350075 - 479387069710336/3985015361321108205*n + 261411088526999552/1056029070750093674325*n^2 - 1277645705615245312/3872106592750343472525*n^3 + 228698418577408/827736245792199975*n^4 - 3003865767084032/74608217578045944975*n^5 - 333714973169549312/1050254139752492917725*n^6) * eps^23
        - (1099511627776/642744413116307775 - 5875790138834944/1056029070750093674325*n - 18929192183791616/1659474254035861488225*n^2 + 4683145478139805696/44142015157353915586785*n^3 - 4028567116287362203648/13021894471419405098101575*n^4 + 109531870615417389056/202999121583588988240275*n^5) * eps^24
        - (1451630226571264/211205814150018734865 - 285991770477559808/11616319778251030417575*n + 841091210876551168/31530010826681368276275*n^2 + 8952412789352169472/394602862770285002972775*n^3 - 629287817602805006336/6789192844073365051146975*n^4) * eps^25
        - (109401406963712/168352460554362759675 + 12015463068336128/9596090251598677301475*n - 13419213961564258304/566169324844321960787025*n^2 + 180572689076536213504/2302421921033575973867235*n^3) * eps^26
        - (29879503362719744/9596090251598677301475 - 36156340367785984/4193846850698681191015*n + 1788694312159019008/11512109605167879869336175*n^2) * eps^27
        - (2476100185751552/11101359310672979623275 + 14029979476654292992/4933761259357662801144075*n) * eps^28
        - 1109241755926003712/651628845575540369962425 * eps^29;
C4[22] = + (1099511627776/25032202359006375 - 8796093022208/53329474590926625*n + 17592186044416/60440071203050175*n^2 - 8796093022208/24831967238462475*n^3 + 35184372088832/99933526691373375*n^4 - 8796093022208/29211338571324525*n^5 + 17592186044416/77633737644511125*n^6 - 8796093022208/57987648934471575*n^7) * eps^22
        - (2199023255552/408859305197104125 - 35184372088832/906601068045752625*n + 70368744177664/528020402268405375*n^2 - 35184372088832/119122926001954875*n^3 + 12525636463624192/25949405764193286375*n^4 - 35184372088832/56153124521819325*n^5 + 118289858962653184/175219345863661609125*n^6) * eps^23
        - (525566558076928/20851824565052310375 - 5154510511013888/48049856606424889125*n + 2498090418307072/11245711120652633625*n^2 - 1009738702391345152/3347473343580933942375*n^3 + 52541456158950424576/197500927271275102600125*n^4 - 3862311669493399552/56035146807198982598175*n^5) * eps^24
        - (24189255811072/16016618868808296375 - 2779565395017728/528548422670673780375*n - 25825329113202688/3347473343580933942375*n^2 + 1561165773953564672/17954629751934100236375*n^3 - 9549604208874704863232/36142669690643343775822875*n^4) * eps^25
        - (3257852953100288/528548422670673780375 - 202310139510784/9022839201026776125*n + 15361127418077118464/592502781813825307800375*n^2 + 27973484562807259136/1721079509078254465515375*n^3) * eps^26
        - (1996713116041216/3347473343580933942375 + 8584986789675008/11179297770072175618875*n - 713879932158309564416/36142669690643343775822875*n^2) * eps^27
        - (1669577620452278272/592502781813825307800375 - 97178602390656385024/12047556563547781258607625*n) * eps^28
        - 2014305302085632/9092495519658702836685 * eps^29;
C4[23] = + (2199023255552/55699673461634475 - 140737488355328/946894448847786075*n + 281474976710656/1067774591253886425*n^2 - 140737488355328/435019277918250025*n^3 + 562949953421312/1729960384279552425*n^4 - 140737488355328/497891037426798015*n^5 + 281474976710656/1297921080471567475*n^6) * eps^23
        - (4398046511104/946894448847786075 - 562949953421312/16728468596310887325*n + 21392098230009856/184013154559419760575*n^2 - 57983845202395136/223164889572062262825*n^3 + 6755399441055744/15730858404721234775*n^4 - 78250043525562368/138358387178269092835*n^5) * eps^24
        - (226499395321856/10037081157786532395 - 140737488355328/1464295659624029925*n + 2098958901331361792/10488749809886926352775*n^2 - 56978557323073028096/206278746261109551604575*n^3 + 22721223070037573632/89241159729983564878575*n^4) * eps^25
        - (35184372088832/26287593508488537225 - 51791395714760704/10488749809886926352775*n - 3048936947729825792/618836238783328654813725*n^2 + 21939285584735371264/306902524925065430436075*n^3) * eps^26
        - (58221339713994752/10488749809886926352775 - 324822123124097024/15867595866239196277275*n + 314868042047701385216/12583003521927682647879075*n^2) * eps^27
        - (22570774694985728/41255749252221910320915 + 434597364041252864/1078543159022372798389635*n) * eps^28
        - 19316123519745523712/7549802113156609588727445 * eps^29;
C4[24] = + (35184372088832/987187829649819525 - 281474976710656/2092838198857617393*n + 562949953421312/2349104100758550135*n^2 - 281474976710656/949637827966222395*n^3 + 1125899906842624/3735242123333808087*n^4 - 1407374883553280/5298831849380518449*n^5) * eps^24
        - (70368744177664/17440318323813478275 - 1125899906842624/38368700312389652205*n + 2251799813685248/22091069876830405815*n^2 - 201536083324829696/877781898983444900445*n^3 + 436849163854938112/1139248847616811466535*n^4) * eps^25
        - (11681211533492224/575530504685844783075 - 9007199254740992/104143615133629055985*n + 864691128455135232/4779034783354311124645*n^2 - 21446141425538301952/84635164389081187336455*n^3) * eps^26
        - (70368744177664/59108538319086761505 - 595601050719748096/129033939150566400365415*n - 22195990763495489536/7871070288184550422290315*n^2) * eps^27
        - (15058911254020096/3000789282571311636405 - 49153412233028435968/2623690096061516807430105*n) * eps^28
        - 101260622871658496/201822315081655139033085 * eps^29;
C4[25] = + (70368744177664/2178260166157928307 - 1125899906842624/9215716087591235145*n + 2251799813685248/10299917980249027515*n^2 - 1125899906842624/4133980685950289955*n^3 + 4503599627370496/16096137564444745995*n^4) * eps^25
        - (140737488355328/39934769712895352295 - 4503599627370496/175098605664233467755*n + 927741523238322176/10330817734189774597545*n^2 - 58546795155816448/287359727216405038965*n^3) * eps^26
        - (41728665297354752/2276281873635035080815 - 269090077735387136/3443605911396591532515*n + 34481810546962202624/210059960595192083483415*n^2) * eps^27
        - (3659174697238528/3443605911396591532515 - 9007199254740992/2093620869719522426745*n) * eps^28
        - 260856934666600448/57289080162325113677295 * eps^29;
C4[26] = + (281474976710656/9577116718477165935 - 2251799813685248/20218357516785128085*n + 4503599627370496/22507228179062689755*n^2 - 6755399441055744/26920410174957334805*n^3) * eps^26
        - (562949953421312/181965217651066152765 - 9007199254740992/397627697830107519005*n + 1927540640514572288/24255289567636558659305*n^2) * eps^27
        - (178455135234555904/10735947841412903013135 - 1031324314667843584/14553173740581935195583*n) * eps^28
        - 562949953421312/591592428478940455105 * eps^29;
C4[27] = + (562949953421312/20981314404210981975 - 18014398509481984/176842507121206848075*n + 36028797018963968/196134416988974867865*n^2) * eps^27
        - (1125899906842624/412632516616149312175 - 72057594037927936/3595797644797872577525*n) * eps^28
        - 1142225455491842048/75511750540755324128025 * eps^29;
C4[28] = + (4503599627370496/183273143743796188005 - 36028797018963968/385505578219709223045*n) * eps^28
        - 9007199254740992/3726553922790522489435 * eps^29;
C4[29] = + 9007199254740992/399032089736190248415 * eps^29;
    
GeographicLib-1.52/doc/index.html.in0000644000771000077100000000126314064202371017166 0ustar ckarneyckarney GeographicLib-@PROJECT_VERSION@ documentation

Online documentation for GeographicLib version @PROJECT_VERSION@ is available at
https://geographiclib.sourceforge.io/@PROJECT_VERSION@/index.html.

You will be redirected there. Click on the link to go there directly.

GeographicLib-1.52/doc/meridian-measures.png0000644000771000077100000001747214064202371020715 0ustar ckarneyckarneyPNG  IHDR@TIDATx]pWy?G(!i -NZ ʹ4B;I:a20RnobRR5(Bݤ4_d !$ZG*3Z rc[w_-f#O/jB! S.]dnh M69Tp/ UE,ۢp^x ǖZ}'/rE]R 9Rˎۀ JC*=)Z8dXݧ$P Z3@P|Gyްza!Dz =jqLW7Pƅ&tҮg9$6\o ."vB7q㖰e (iq%rAh˥x h ]ɍluLEIo)aϥz2E7AqUGd'MsWl&M&fh2(K--,p5*k2@F>[ !LcZ M0oįaS4'M87ot&h*pl㍪ xa⛔&`x{VrEBWe"]O7iw>/{jMϧMRSТRP=aC?ǵX0Qp(07 gDM 7veiotSأ'6;E[b^&Slb˯&2bŜKXEb=>5bKy<4b-X\ӆ/\f{' 04m|τ\m}fC7C6D#vM4M$M1*6ܺvoe4l&̥m :ϣ%?_os\d!hiȖ2hӘHӪ_@Wv`7ni * ؕLIt|?z3} /{ onjet><~oo檕+dtc@{sA1youPz2YcPzC:oUڜ܈E4$2=}&8xqvPn̻]DoaAUV: BdAlp(L.vI[Q.W'B ?6dLobZcV*,:D:  r)1nZ#v&, P:DT 85@k2ɓȦ-&wiqi7zf(])(5<Ty)LA"G rDj"' ٣c1c,||x_$ W]ۍ:\SH,%8'~{]V6?/$`.b1sKd]{u.SrjXb֌Ӻ8V(-95WR$aZ&o\n( (7jBOo&׵(CW1\ +*`LsȏV'tYOf{d [1NL)U[T$" +%NJASdJ@Lb|I[M@,|V Η niA. L|RK7ݡ 1_ AHL2R30قb')xXTB<:frd :( L@gGd @i}BCY@2_ǀ:;!N0]yLVŃƭQI,CRxfR2/7x =𤦂PzXbAou7;0(f \ ~H-.;)s ECSTVUCQAbh#wWiX.uY=Ff- + ʺ[70)Ibd t7 W)R')72ߧ|K)42Rderjt'h=YYB)+W,U2LBy Fe#|q*<<zˈW*ܜ +Qfo ^dC-0mMQ#E`w[9I%uu~0vNC.A->\\0y @*DхZ+;THAH94+M T`|hVwV# Ӑ;ܬ@(PLhTp ;|aJ͑rO$42aw$z􄳂Tmthu@-I!Uia2VPt{IhOdrk |:*@*sL t2UIi)X:]k) @,T;MF-e JM!Bp I1OLV j j ku6H@e+tSUɢLb5R[3*=@{6o2@* ,%[:;QbyۻDώ?4v+/4HÌ$}hM&NLVd &s4F(ԂZ?z߆|㉼1_}nl[&(wlC#xѱQe\t7?^6f-^O hWiZXݞvվdGOk@7 1I'쵃Nvn~ ~zZ~wA'4Ֆ90>rr H,wۉ;T&eʔ X{a[0)>Rk,5Dmox[[ߤ ww/vxYsykv9 n߇8}) |qG s^p6!/ΒT%jU[Tu̲YGXGε)kYѻE"jTUrjʳ/ ޠ!js j"#q(>Z=hJzYfSMr-xAmؾLQHu{&Y Qu}`&4g9 Q@DN2u+G_l fq 3D&D|aR Lb*'sg9黋YE%XaGu.(5 @~ɴDK 9P-!U uy(~%y*"7X^U)G: D*+JUs*zxS* u4f`h^rF|[e",%?̗WDP mӐ<Ԯ ઉ>fIJq G$_lӔn$#u3ĝ["Q,#xڡ*'-4L5hF^UbZPqDb.$D@PQ5ER/K+X ]D`\xxbJѲss `1t%DH+2)3u<сD3:T&$']m N?GU V?,C"*ɧ ?S>D%PK"ȔyTY/uD* BP#ŵ^Ֆaf";2MW!b"!YF+jqWbpW YN" TebJ"Fa-+%ݨMݍkG(#s!Mz!JG (DtZ1u\ Ox"X4 JZcM:ԚS]:d <ҠtZ$<ڑQ2GVER]6v3;ڑYd9W#It#S֎@i2LUIFIJ$e k-rMډ@h3MD r,{s"ұ#Kݪ DTC"Z}vSu* jh:< Da0Rv!<4KTD-{(`.{dQQbGI?IEH3yxIЙIE=]{f2,8xF? bZ+M]f$ _rΨH"AYߞ2ib1>!%D*bMʪ"^"W`dUQ$Q5~S8"8U mMLd%pfe;B "nL: ȉ*ژ<8!|M==~Y>COwFUyC"9[Y1.b1#ˊؘm)g3+Q,hђ"UU 5"vhq1C^C+hGГsDL&rejmv]&rCs.ȬWE "TXfdSCtjQ~DŰn)@*UDNDSYڊG02CX_EzafD:PY64QX";{v-т*f>Tc"Xge] HFTm萠번FT$#HB5"ȫ4"(>p]т:\Kyj{1kpM,Fฒ Th(|mfnsO䚛0XW "s j(%h: _<6pD닄Ph[KöO3|g%2fѧ޺4S>P3xS W0X"OSDF-;2<͢_Y3[vq &/JZ,ju BUy!Z fQ鲂.Cs5DypBDKgԑ̾+6uD&5#@v+7kyX y*u$T񹇯8w6aԑ7w./$yPhᚳgfmx]= J[W/b쨪w:ëh^T*KWRhPWRu%5 V(G hJ:® D=Et-G>#-ßi)=E4.l}dwåhnFusݙu`?DCuX(_FBBdpDf (yOׁf{ÿڴ #m, g+t !մl`n2.KN4߻Rsld_.:f^%F']CtU'*a@9|#$߭Y"}g}_m1M)w4L̳N;k ~z<:pYPP k*Ĺaɋ*ь-'/*DwB@ Qc!ʅ]5$ Z"LIG:cwP#vf]8kUzg zԬDAmTJF#Pm(״ۛTm 0T/u @]7TqmӍ>Ѷaua6:#j-Յ ~hOmM5c#|5E*o7l*;IAϬIENDB`GeographicLib-1.52/doc/normal-gravity-potential-1.svg0000644000771000077100000014441514064202371022422 0ustar ckarneyckarney 0123R012Z GeographicLib-1.52/doc/thompson-tm-graticule-a.png0000644000771000077100000006471514064202371021765 0ustar ckarneyckarneyPNG  IHDR1s$PLTE~~xxuurrooXXllhhee``^^\\ZZDD__WWUUTTRRQQPPKKJJHHDDffJK<<6XRRmmyyyrttmmmEE``ccc{{zzSSIIInn===??ZZ555FFaa---Oء%%%4FMMhh!!!XmWXTT[[vvGG}}NNiiUUppAA\\W\HHcc~~OOjjuuVV\\\JSTTT]]xxIIddPPWWrrͮyyۛ "QQll{` IDATx\U׺/`]\a!E# (rAFU/e?,;FEEuLlGĖQD-A">Q,h1"k1_F`j)n:Q80O #s$0YfM-?2/ɿ(v _17@mܐkSb#_?ԛ/CNr7-zJo%O&y^!ZC;f'}/eXɛM_%ڳؓ9Ni uQ3m{go9o:\بF ۛ.* m S$ =o6[?o^ p<C$n:|]G0ڍn. R2-BfWא/C` PMx~W-I=C? ۤ[X7^Rpeo17B7޾CGl}Aa8m[@?HF=~K4~iq!y(ҝOӨ7LUJD'&藠*:Ato̥~}%7TÍK fdMǛRr[oWFox5IOco 4JHHˇEq ɹ?SSGD1Lc/eϗo'ahM],6r8O»3s;[VU} $s/ U槴J#uW;"L@ThpOKPhI4b;vef%^$.igt;[KrQxčrnF8y{ Eu]b@<^yf]K+^"%j -$_eڹy*wäJoln^ ( % icIV{@H*Xue#2=/@΋뇭Xȹj,u@kQldwoT.tPKuAklXBtxY{>?lVѳ2AB8Ș2ks:h(ĸIQ#'$Li+_HZ&0K8} Yb LaFCV<b (xF~kժa;'ȏO pG7ät-)u{hmg;mnl*\jiR*v/l꣪vv#Y9V ?8cd*yrR#yrW. 鑯+3l_P^*ylPGsm{Tp%[寞~a_qez(~Rr[`_}5{6KY\j' 7`\0Sp4Ү"a%&ɮpY;B{ x.E{)\]ljg0lA+4 Ћ`Tdǫ~uv:Me]G"ဇՐ Ims0@fCQ\ϦYHI^,nTngD⟌΍06?Qz(Qɤ$?֍  z\R( rKhŋFw>b}_\1uB*<;3)ڏU'0w0 a*r cHwNXGʶ ڞ7:ƕ:?En+&4c?bTM`ݍR@"~wQB5ĕ{fAQ u_E32f0'V[QxBG\GkG =2Un6cћ,mpF3W):`D;Iȅ:WP4Xkml;(oUS j#'|Eڙs D:@.^3X2ϒ; e/ǟ/aNk;?q;7+=#XBh<.sϤ)`"hЬ=gbY@H2f%ܷ̚7?W~fԬf U>nVTs;׃ 䜳w!gJy ȉ8xA Wsl&覇vh)je" Pb &C 9 Fg~o-#۹(l:8uA[~WxLwV0لjCaPu@w<@ $\w_Bw=Ki _.%E(3uĴz6MUÌAI@2GG,?B32;7>Ri?NۃSa6R~sYƘNj74[@YGʶmAg Zʩc|;uڛå$=HYBlZF˺\0),B6Njs ڏo(HL!@%oPAğ$4Ե{" },њ c9Jyt.0sdP3:# a@ϧ$+F%Vw&3:K??! Vo؉Dژ=wJ4BJ.lJB d1n99S:xH6ğKKB\'Ɍ*$l< <#WpT3݇mmLx"4]G\*oN&CnV>/7%kk.!=:*GMά{bN.;U\U0gEt43r) q>3TuibFT'f'd9%O=|K!])z4wq>|;@+/H7GmK.Z. T*(sjڹPX> *2dŠRui"/F7 +}5|xl|i!CUٟm4$ ; e0-N.+"/4Q3Tvum?ķsby-3/%{|;'ɝn 32ݭοz;촲ho '%;VF3"/ο|Q{@fpI;q п:du!s cH;9n]qEOAZU6DFhxܫO:-)ইyGg~ճhǭ!ߋu6,P@KLAVH*`T:=3ܽ >J^>CVfEH nЫ疽!Qe]YFх~ Hy)Ge@;/%.qɁk, wZIftB7o]`ӈ6<2,<;֡tg3hgOOG+=K!Ȳ.-ByӉPy\ڵyw+lo'p0bcBY38a'֔tqR˫dRJXٚMԔm]NҐ!?V/Թad-5+3j(ZP~Zd-xt٩k< V߃j~yt!˫-ٞB#J0/֨I(>"NkXJх0?j;3}j wTlöcg . w͏C[Q(((%maZ.lKǟ=D:?DvD;śSavu@`ܑa[rFI2|\n9u,g?4Wp0t u9Ԭ;y~yZ <,߇!,W,QYIœJ{ )R-XjY"-Q:;&!l0 ~\0sTrKu߃}γaLXOxp;+bRU3xcrpA\ %J.X!&} p&pʳYaxa>M Z|WeMh# 4] *65ggC72Kf0}JjD+I&|xS&T-RpS[\r NXL}iQH_"puh>{:bW/˰S'!RhUsbi1?IWKhbl]f~f'xVc1F߁mgԬc}RȾl4Iy{ )Nɠ׏ DUrC",ͺӄ8XHUqԢ ?8'NA8z0pLWDz^?Yw sn [K<\SY ,T0.HH]UCN00ՈwNX=P2( `GY]Jɗngvv"#!rʏs Pto<}-(pU:$N(:8QsRv{vF}@amkn憧jhZ闚)55*x~X]pppUHJF-߽CksS K!gTDgGMg6>3E̫Pqk٩0^LdEVvʏ/S~˘w<̙볋(R?7j6uU Ra ):fdi*^`vv&{20I#;3)XefH狼Wlgў_տʚ1EӼkbg4YDљdV=A{G`Xf#`BjXf3/ϟdΒ\m; ܄Z@$ܿ_:)}26j?-keh҈VvZ;rM+Yi妕GW`Ol4/t01.7aXYQg)Aóҧd2dEqfOO5bǾ`J,y^ ~2s~VaInq{3,gԨf-C}fX| dNqITf&E/ãM fėIgdDO_PN'73Gq)' @▽F`7ˣHn6Ec9,s:&F5> S@ҔIQ=DQq`J8M,srZ3FDFLO*f3ڨD+FpӪӭV_"}鐭DM0_ZJ"bvrְY$X#n!^t^ RY X#S#K& ƕ2i%J ZѹbNGl IDATNM 5>} tj)pS8蕸YDiv*M,{kx67`ԝcU&5Pzg VP,nbRY%5K$K+_x]TQnVڴl窯EnеP-!w^)*Z(Ir9DCjn ΐdֱ+o:8΋׺k*#U[ x:u{$8S50P'ҕĔiyJû@rVtd^ %n~`9[ܓ3 %H` B2V̔?T7ÌVg59U i~${kZn$OӲSđO/}u)ƜdT(M RXn΋!|4!]uU\*7hrf]ׅdB cx5+{vyv#8n"N܌V:*HMzٔJ6=rw;3HbS::Mt-4[8@O1e+$ⷕolz}us|X%l~O*E]s"6訂|4J,GOٮ%V3[X):0eiSȳ'[D/-kF-S4b l;|s]uɁpG-*HJ8S< jYhgl59vKX1|p XKsus2VlDpVSGLJ s̾>豗5lQXZ?G7#o-Mݳ)(v8h2ѠyTCnGEޡ#e-Be&z&=Ksvi6p8?ÈQ5o|GĦuX|kw< n5ԩ87/: L(ʤ=ޛ)n6rJi[e7NWk\NY-a–_7kALT{7OWOlX@N;`Sl87I0jP4 )e«&Nj.2M^d$6E(7S6ZKXEs@w4֧@`|y*C RR&Z&y3&iİ zt6T`qn}{=BAX%- qm?w*:BAG#6bݦ_gu9S:h3ܜ`{ۊXW ^rfSMAwSO\g-BW(79$̢+>nap]tUhqęw! ۞ftGWy`&.69lX/tѷ&į&eh cxN Ć+c˩RiM**6s <*4r ŕS z5PQȫS)sa/cW-c0^zؽO]JJa\K^|ڭhqbXX-G֚"zXB-6k&٨@k|tڪyvM0n$Ո,MJ|Kzf~&_k ǍniցMAGryP^vrE iIK2z4IW3 #]uwiI]9Y~}Y[ Ź"ܤ fӌKC &ؔE"  @}0:2)T RA#YthiU -"f8;kMk _Q]a^V" }q@R"X&s*Y8Z{nË4sVAy\Gp"|p̅=F0ooǢt@jE8ۇw|*|X[o;J0c@/~X܄ֽkQnp/ H<` (+:ׇ:P. .2Tr\uz&V(PZ\[W,;F;UZ Z>V rrodWp.Z+ՂČpE!r,;qTO6`ua՛<@$ϟtUŀc(7yzɧ=( [}1%Lntc| 愋,P z{|r8; B 9֒ܤ'#.f6s~a43M)S? 9axou볗*e,Ւ\'bYW!D#a$OH6"$kl@KZ7z~T믶ɿOYDm_BjfqMGCuTrY H[t6zo2#I_qqS;t F;)Tf~Tq \f I~_M{x"jAnr_!i(E'+; 5G(8td|к ffT8 @Ftg&gL-T5[p%v={gxx@t;Cp Cshp_?rѦ/1BJx,^(=Sm@1j[ N\B7` +.\1)z/\48мS͛޿Ec*;7}/o>ӃbKvbCvjeRR3Q&哢!l#s=F^=q>g l(";YMVrܤJ=LCrJU>DܼE3&Ƥw ^-+"88Hh+/3 ׻a>k_{SxKt(r(ѥ:1 Er6J;\`Ka9M>?gcϠW)wm)n^P>` 8ӱF2Wj d-D^'_f{2r)ѭZX_h6." Fl -smR`,PLuv*0f nn=߾@H:?H AoBnD< ,P~S|0 a20:D,\ _Լils[] >!y]lIsߡQf^l#cM1dԽױm߹'[ =7/ڿt7sr Fwj/4A#RiUGVѥBÇ<zx4~e5/HtQ|%P%A>S'ZR+ gec#U&ܥlW$z)hWc?p8& 'д""N-)4&I 5'[8D2v,MDztgExR<|*xFbyh*,l= {wp3K!xmܦhЂGwJ KgJ/g(u~rB<0 goAq$}хx៪2iܠM yO 襐xD-M8D{*#9C9<;wƒK`d\<4H[&u`‚ XE?&FQi柳NY0y7 Dסq{eJg:'[ઽKo*O[wPݣo/Bb*2/7aG]Pq0_$U;P"?M<$l4 %Gq|+_|ҼFLpOY#qWYcTAgVnޑpx/AVGs4T# wCJ0+7u"sx\‘DLg:)jVq[;K+]B3(q]U8|5o]L5}#lVKCUEP ̜ UR+c(hPGG&r322 ~K|X$lA*2a׶D;V|6_ SC,t]q4Ϝ 6^=7QD3R`ث4RtL"qCaᥢPrݽ;jf<73S qۧ:.R6,CimsLVn0c:ϏԟC'\8dnʿP`J)"`^nfySw7ST WVƥR~>&sFþF4V7`HGT$^ZBп䕙bP.KMИ`3*1T+ Wuև+iy)7y ]ނojC5V7HƉ֟y*[J-G':) #oZOO ^ sp1PSe9DτfT7'PںM,]TpHjTQ`Q^~66wʙjzVtIgnnjCAd47I䒜>377-|XnɁ%Qnaz]n\(*2772k1k WG^ Nqsv[kvvjvW/6F\=Ӹ& *qS: r4b)з7Unˁ_PjvC 6;7Z֗dQnPMSLfqfqẆZK94#{H%ԭUn H)xPwaY'90.JO~ Xd ՜t_Or3TA-/_> 7MnTInFd~&pn5pF Mvd,93rE֌q58ύ~rT@[Rt{=xYh“'t)8xlM q3ߍ~pT3ys!:[G/>K"iՋh'7j!+YiVM3R棸qQVnZ妕ܴrM+Yi%+6d%+6dŦdŦͿ$# SF7o8K3 6j>L/6ʈJ 463 8io`ϗ}'I2AҞ3v ̊ kTGqQR̤qqQ#9ǍJ+H"׫wkbTTtQHtF8ϩI# }{5$dR̀s_4dDܤ@f3@a]XYfE}B*#43'0)ad)2Xl:& 48 ѰtпaIII^0yʸa4hbxfRLb8 {2IlN@߿ϊ)GIlΟD`3fF/& OI^2)?ι/)I$QجгQL. Dl7'O?"oB\#P=%4"qI\7BcSLw!jxD7 66ulD֘RTtpkpͰ*||%<6@|YjŦfl.UzLq0^vɁԕJ8گmS` Ծd2=y* KeZlx#yQ U}Ŧ!fiB̾d9wP‘%j"B!|qnN/fsl~_$ \aݣ֟!\RqUuU䴕5xﴹf^.]z^Ɔj^󪰉l$6 1|)ÙQPօ$MWc/NK-Fu9~ /NVv3ƅ}?:o M>B_G?iݸLlaWͫH 9sͪz״@q mU;Ŀږu&C]w j 4NiXFl~fe6n?'n>j[qF\HSM$l"N~:c5E_ݩb mn ˱YwNSV/\`ӱ9˙' +8yzzڿ}x;WK2l<ɝO]J[* 9C| 9T@4`(>2p5-Ϙ#Qɫe}}r`ZeJGV-!$@+ba{zz׸ 7` ˣ8?|kO ީfYfC ubȏ3ڿ;33r!`f?Y}`J;UMڐ ?^luQlnZmsr qc.6A ']TU]iccӄ<2ڑ9J6*_;Db6~Ft,@gK 9+ozta; MgSMпAq!a{ʈFT㙠1[lna35c ng )?Qc[o>8ם}Լe:>Pw-c2JηI2#Nj1܎{lA0]MLizaЂ\1r(Xӣ~MwY@M9l6E6z]ى},~<Ό/TWr~*ϡڔ/H?Uv,ELo\PɫmK6'orD=@s4ױbCֳW d0wENP{+7] =-,հN[cV h%0BwHxBw߈<#iٸKC$tB0?JoѱbC/oA2 E疘#%nj,7`4NxߨۭnBiō.bna"Bz"yfҗzm=Mm^TbE^⇕5M=<<\TwxUsf{lvo͙|c!E'a8ѤWw$Õh*FYjjc% .li}saso2"C-]ē%rDSA,\߱ه (P9sQxt~&>v$a1PrN)j}(IK {] .r*!AOO;cڃןQSʻFGڟ׆%Bs=&2+o8Л"au˿3LZtbvg[#5f F1˜A1r=ogOUc *ҿ}(Pʂx sPϓcHɹk7mn^c dI)uvFܓ+5H` G>0g2v?MΣ]?'z{6Ϣc%/?hY)'07~Hn2`ͫh6sl:&ط}݀`\% َFztS6aدIwTv!~w[޴ErlK^y&*KoxfNm<<<ؖ̀zMtl1˄ǟ/KB;6- f&Ei6Sƚ`N k\ʲeDCnXǵg (y.lzMdvQW F 99YZTUЕ`8жH$lqsĬe2Nߔt?һ) lG/qzGJ~dA5 !`󈧨aol5b{6Hn:>)ԞǚF6 ەnZUʣexK=[j&ZL6:;ll&qj42>JmHqVV ٤6~7+hRZ a5 43Zj~T#K{D3޶vzxxB"aI$G1'Lh#a-Py PtRq93+ >Ӛ+v:j5&tJ+܇lpi׻^y 7|GmڶP‹gO){MOiwP1^ŞlH١*q}>]ϐP4(>bU+:Qs^]qK\=JP`,e%^n˛pU6 rK[zGh}&B d~-B sӳK gMԾ=xj'Q܌.qZ|24i zx/ymð 0yO/ol^egx\~һZ -Z,ThOEm-?ș G@cCiڀMcrXA\>d[[=+46oە=*o6 /~ijP CK}rYpe^lu f kU: $1/]';ԎU(1t> I4s|,@:<<{N#_mxmoh<0Gt k16EEVV\z#65-SI!y3ҖuNiRG?=5׬0 Bum'W<-F6 X- |}.P!zܺc3@h! /V0`%rYʝ`zIͲ,WSubNv7\obj9]P9yYtC :avsyɋQxBTぷ`s%HbS"@s1N7;)zbM37޶3x$G?{bT{ğRԚ<z(6Vۢ5[lD&3*tُgXM]uRIQVܹ@ev{睄޶ )\{_4"~@7_Gv/=Jl66zM0_>Png?bMr?`eu_Lޠ n{"1~ik7{#/|o<ۍPA/R>R& qMd6"-6[Gvqt2ɕd*u\GkoxbRny%#o|6a]l} I[ >=DS^>Mлpe4ǵTKߺbSvu/ 1{/g!p`3!GЮukKޟ4`=ۻ좗¥surgpPxc 7ؖyJ5o<; F(*wPѭ`On;` ;^[CNj5\~" 3~)gj{uۤXW-P.W&DzhR[/Wč,ŶXVח[73l@lK*H̡rιUV{oªMQQ6m4CK6D~ž-0i74Z p@3 ݨvjaSƻbW %*mӴgܳbs8Z87l*\MN~TLkucX2uKsMbyup|ͧ<%M6-ySƠV=={|PhUCj^y]$k܈I?$7 ]`Ӡf q\O]Σ|eo۷-hG0< ߾z鶷ĭ51ѿ-,60_q4u|G~*Uc>Nڧo֘IKsiLOeG i1 NpNoI.8Y2Wx!>u )#@DǬY~$[D [ oJA*g]# z*麢)zZo'3Oy[ V;CD+ۺ/?V6N39 $ 6&F8hDK(oNb'>.PepxL rIsBk8 Zro7~f5K󡥣Oh'efY9ۛ2FWB\t>p 'J_G16W* (K֙h4+h_ȸ&r/al< {ࣘF(I7u *|!- KAܽ{ .cYKicGsfheMJe&3zy4ƘB<D>ФR.ilQ26cq t?? Z T~WY8!c<0fpU*Nxs!_dE%V?!B!%SMZyh}æl@w^w[ /TbOI2\cu-Ldrí?}G=:;w}EXȥ7[lGo;-Hܮ۹lǧx}ϝ[Y%aӒZĨ,uK3 \^C-Q7}p^6`C#2b\l){06cȒ3w6uA8ED2WV jXr(~-lX`,n<_j?Hȷe}wy  p{.6qr> Qң@HPI߫2Ӛ;t1Mq0߷JHNys1$$#e'F6x9Q_6+l|s$*Y,d2+/BPJנj`Ǭbg'՚]ź>f\_񃞔ux.HGlH.yûC(zM?씋>RtF(- =n>TM;LHߴx/<1lAIɻ4))/WN<\m^>+.<;ٲ476vH)o?ɨc&ege }IZ,fW}rG>҉Ho*%@!~rHeS~G (U;^N~ZՂZ7M^P-P]|ˎlq7_ vV{_z|\=Td_fD\h Ah e-*cղT@'wSV X!CX_I}XA`S%.u̐)V0Eߟ/Tmu7-.^X)q.9 w7؜/MǽΝv$CrELĎhd@SYKXVKj_\rЅWh"45t 1qfwS9CcM6nU?6acW-ڦaB`qoFh^h 6vEoiCR#eOWj^ JG3&sm3 > CM,ZQe 0ƽ~`Q%KY@0]4)l{GΎ;>s1f̶ۙZ=فOHASs=kHx^l|N[0fu&Fr:]YfTѲtU-d2:sq>55X}JG`J٠͈31A}Ag^DzW5?]I0XZ7Xh?}JxRMonCYFwyk|n`%SuL&ô-;زMe?Oӫw*O[u :,'ڛ?ql]uc=oɦ:0M]U<9pNZ%s5s|}66%uq%R,-ʽ4Ss{N|U1jt×i vIy  ܑUj4|wW vr 8At_uTd66ǃ]&;t'93un' 32NXFNGU5uJ=BS%^_( -c6fTp13?绐Ad.Qm<.uҎ:!H4?{nȯ Ψ v42tD'Hݧ̇@>7L}칓z/z~zGн!W~MYZI =vcWW)_&H[/`Ci~ׯh=wr.“v@.ӺdMp_UhU7bRl}UUՏ`Ԫ5`Ҕ=uNWM9KBޏa:ăJ ] ~YfҺ)7OKO^#TuDU5;wR7G{u d^𙓌|̮dSw؜Bo˩Ot\a{%gIDATk&΂3Y'1pqrfZC:9r\NUZ~'!’,(1,5^av^)UwuFFdϺM2B tNM`b>; 7hŠ|] R21~`KæN+W'Baȅ]u;mqQiu?kk5-lICh=G*<4tb/`LaZ[k6ЯNc|f0}˴u!cte:WjupAvsL3OuߙsU<&|6egllw$Fx%HmY@-2˷882Ww(T>맯6ȈpYk A!u`ݣ3_vjrw29kJ忶W"؜bCC7Xx?Ad c1Di19<h5'c,>m{o\ԯv\h-M_TO5m4+`duls-r>OoXؔ2z=jPjO(c39>Bw7?%y/n`sLmKҌT׫_##z`:/8,(>RvؔK")%芺!hK -[WM6nu:>O?[je_,Zg'ش,M?a_f28^ :CJ|+i%YY^k*sM,仐kT鼓ecl>nc&e}_lR Nmi=ҷ]9UbS-Dl]POΆ}C'ƦY W*!J]A uɵ=$*jeݕ T뇌RѼ G*ݫk,/zOa'>:img([Ry5MxJ '\̬sW?WBUҩN,j1lfIe<6CQlbl^iP9-` ҥ-hS}Ź0m>>T`dHw (ɏ"-@fݴiOUmM?} jq4 dZ'E(nϞp+TIӤ={&~ ;2?sz}/R>I9iϰF;)g9C+6@_^И F$?7Jʯ}%9Ϫ;Nf /{D3L"?s8rәkdo'ɲ`O >tYnMȈKW=yq Z51?n=fg+a|ab3Zx40׺{&Ԩrg &loZJuشش$gzVlEpNau{YdVbJVbJVbJVlZJZMѴӞIENDB`GeographicLib-1.52/doc/thompson-tm-graticule.png0000644000771000077100000010313614064202371021536 0ustar ckarneyckarneyPNG  IHDRAfϔPLTE~~{{xxwwuurrnnXXsslljjhhffddbb``__]]XXzzWWUUTTSSQQPPOONN``LLJJIIGGFFEEF2ffCC::mmNfOLѺYYfeEE``[][LLSSک???uu4_RK{ײaasrߗhh߼TT[[-5ΜGG}}DByAZMNNUUpplg1\\HHccϟgrrrOOjjhʅA>Ю__lxxIIddּ444ԻWW(((ӂô^^ɦH;'JJ $W.τQQ9 IDATx \UG'( * pAɽ.=QAEvب3.<{4kx%XE%"*E%%sQ|y&Qq:u{G%^9:uVeMu緮ut=Sk5;UCeԿs`xmPg:UyN«U @9S70E9RЁ3N; H5+[Tm<`4EM ̔[ԗEBܤrt/sͅdIIGQ];:3RE}&R>`:H3WnnWB>/cOݏѼ#?q`T,\oJ: _vwt1 _b)`4;bJ|#-&T}HrIU% Sx ᙍݼ|v;  ![pT'8)>". A 8 Dhmi2gG3{R|#LDD%:Bs:X|$:]$,(c ۘw=2JR}r*'^ AkU62EJ<82Ha%miR IiUx3SM G}`>vw$ENGZ]zP(EZP`K}Z'd(ٜطwzY·OH?B6BY::pD_z5DVz `[)D/Δ<.c8kE3^h 5ʓc:É:jhydHUK\@%vLqyE :22LmV{һb4gv!3WI&&J=z9[0UqNs't=ĔŐ5\;YNÛNKw5pB5OJ*)X.HoZ_onԑ ԟܡ'e}5쥾Kx#-V`Ӗ4\4zooys O A4RbW{Ag+P8}_ W`@G' Re7@4꬗ޘjq?ARN.j"SD+HK-A.Puv~DxN :?~F?)?qn-A`뜒0lD*״^Bw swD"xnfuǓIx{ (7sZMzoS:0eǷf&mOS5fɛȪto+O@m5BJoGYӈofSaz9?cn+ θL"z*Ǚq]P*Ky)T&G6 CޔS&p!)cfďgA(IhheKO@<`,tLWҠ={I_ ޳0)XdL\'h "9䌨T /ʖRAQ nC3&X}mv3 h)/]5E iz> 9:ɘ9/SbYǙՃl|B F/g|?X" s [vE㶜OKwJ7Os} v;;U^4ItȲ:IHO)@wHa,lr+ug$IpW]{'($q;U\$. |*{9! EhNوg#?PzoN}  MSo ׅ\MUrKYѪE/ o5+0FHRaH;MmN2E`Xu~ O Ll*:#\4<6FIO5s)O8̽غ |["L7j*n\DX#IDoz8<8 QǦ#LI|LSZ6)yOzT+'M0v 8:)kkf+i5>jfF3f򯢕zk|kښn5=ݫlʌZ7e.ꓭuuX[A޺jjܚL'Ar&%,Y?:S|ek=j2{#_Lբ͠%pL;yd owZ;BuEJDJðliul d\8f%[#I+F:}";W d'm+jhq#N0./zMccWWPfJ;?rφ nZrVke K$iGl| A{bcT_,W97WF23ANFJ[8fO^LtO^r}|Q< аLZ*]Dgr+i}*se Eq1GGVt+}p8SWR/a 2 ZEۥT,09(,Bfhx9TbfymA BVn5$ZrM[pslr.Qxٙ"Vy R,SAK:<]хF22/[cEW%AO e;3GWcxN6UM}C8B&h#3BVxvA4y! }~WeZ9kuq JzȘc=ڸ@qHdl)f jnT/vhcY5ğcy,LGM8<469l{hgSW.IANc;)E|7qBC &$O&G<妗Gs|u?3"hc=qW9+l9k!f( fv4`ㅵKǸ8`c!V Vb<P~مh䎠%_RV9蒽Xd4MN'HOAe-FB X/s,tXs~ 4mPL,=B'c7X16<5F{ ~e%,8Z_ÇVv3Iު u7 \#gpfF<"YMx(#x!Bspm ukXyob蛂ϊ-}(Ds*p\5"[JbU617EyI-4 ~>h*Ivݞ62T\H+3dUq6MMP h2gi<`7IU䗜 w<#Rg8+KkP2kql(suM Bî!hݭ2yQ5K%ͷU[ &,"a%gT%mX!gm%-G%!nłl {gv*D 碧Hq㍖phE ˏrͭhM~JB꜂(@¨M:u @J*oVVAӏTt $i/"Vl赫چm*|Ha$Ih2VZZRu98haoZ,Of#6+覕q<.Qĺ&KiG8R(^at/V)!2kjtNw|m|R .--e?V%O/d-iy .sZI R)8xSԉSGK~f` ꈝ7r/`!y8:n~K-+!Zz_v|X\w, k~>,#vu#>"9U.eJCyEF^)jdYf[NAaIAx3)S$ˋ;݂eSb,]׺GgmFYlE}J()6鯽2VcُeVJ慳 VqskKzū_[yu J!Jg2[7 ěA|:S)>XO2SVQ:!j[ʨx$Lʭc\YY )Y:~,p}?Dy/%gI93v-w!:|s_s 9.1SKn?c9؆Fat0D#ߧN>,PT\|8oOϗƦZ:h wy4qPz 0:7cFp3q; `0xtrӚ~{cua >j nRa v ]bɭ*7ІH]q ^c+ %t)ᗅlDݖb !qb)Umj]l0θB+"qne)>/81tNo6q~SoF_,徯\nLpQ fhp4!NO:dY\[δ,UqhGCА 6AbY@t'lWʞjaTa R] 4KvaYI6$d%o9@aœ:٥j]o"̧BO8';{߿sw@cgS%TeMg_3$RU&ЫXZ&?\.ݙ":3;3˼/#pd/H9ihIW0.z0.rGʧ!)^2֧O Y),M 8fn=QOp`3iGW$,m`Aݵ|6'9[Ӏbɑ EWB:y4|ʎU0]U0>7*w7~edhV2&1,"#EqkٳaV,sIW\ș^3:;vR˫ }}L\k4_`{y=UKv0}*-!^!Ú S,(BMdILS0RW+Y7.7?=.ħ @PU !y2h^|5aM ]2]\\ C;c5%;i|S2\l Ji1$>ɛ 5:p'bz] %_ w`?ˌ 9*X.Df0#D| ~[ yw*Y[1לub [/ iw1蓾hgp7o^>]y,oHEPrVKκr~.*bu#fJy J6#AKi tBɚHyD%[ĊODǣλ1]f4;װ>NV"-<|XMGp+lGwE~ e+I :V#"+Giǒe&QAV ،2D*r<_ Z&3#D-+#C0As.]?8ط[SKH_Wy y㣴b/Җfò Y (XV([N4y UJ%KG`Hr(upGecf',K[( qdW_-)4Verq<ςa;<` *ð<ЊXr߭qR,V,!6d|ALKЛb9 +^:@Ʌ!Çy{\/A&ASx1.EǼ ctⰙܯPC ]K+O d'pl/jϙqیS` Yd0ENgHፗA?{K$aj ]22tF6M̈́K(NBnb̃) IB}X@(u)CU2C"fU C IAց4,] k7,DΚeTQš+͍lN''&7f/^x=wŌ!?L%H6ӂ%Y( 8r@LO O}K\Se\L5R y&8OI bML`9P̻i޶S#$њ2דPcp$m{+~Nm)XK?BT`k%|`9QGr`jfJX^pE-yf\ :Iz 'SJW6ƀ7ք*HH$e nxZəl;dX@2M$ dĪͶajkEMsqsӄ2Ҳ|Ryux{(+ P1:̳okƲudTo'ڃ&_)Wp[zcV|:漭˺tΔb_A"x|% AQq E nM4߁bAk8,0Bgv{K4:`7JUk٨_h:D1S{LM)Mj˫Jl2_>gb Jy;0qc* )Ch'rXau3%~/P|с?{wLZ懆j-m3tKw[w`| [4{&Hq9*$QY$T۶64nX54zWs)>Oy_$i[Ns.)om+VDzPu Vu0ɼb!iwܶKppWdI.) q9I^䀦7?`BT 5t_mr"v4 hz9pؤ_hy%?P:J#!m[Wd/`J3SR\cDj|/ԺFs ۀ%& vh˰=_*7rLbNgXbyS,>m[IH-U)\]` tyg3 2ӷþA}3]e˫0AvbCuvRH袍6 a}GhtXbND|TIʱ~z`!guaD̖~Zg Km/ 6̏*{_'NU;0mW]Dao׋W/칹^?^(e!X擱JdlyM S+jNު6iyv@Y ԅ_%?Me5mau5+/=R3Uc#] LayOғMԫXfO꭛5jH˺, CTӆe1Z[bJDz~,쇲Ce?iP2W0[!38MZYoK4k]k,z!xXo]D|݉t gZ7śMu{Lkfjzkfk|enSB+m{?CҩZ3MVS+`]=2et>i=}N@}]}z4DսLG| ̦Lp= L4ئxV!HgMV|`P;@ޚ\z2n;NKCuÍ2ߔt""xs֡3ө'[[MPLЎj"vC/K?n(M#~&Izķ74aqt~Aqs.B J_sN@}_D28BdgcTF>ʈ^[ȥEofLP:1z2"bsmUDw+cPJ^C p/텒NEZH'e#G؝OX縑jVB{JoJ-PB"L81*(hCd94%Ǯ[AOWFNjCZLb#:݋^ ŸB9%[lJO{[8 CT vҊJڑB&˽*\f2jC;7JJn~S@p"4PtO~7KGJZ8dcȑB^I_ JdMjJtyu8z'z:lT]-eůڜ  \FQf}DZ2h G 53J6 eLμ̻.0qJVUCU 5//N#SFS_::z])fld !gvzwtyTLyrXQL.{<< eMѶ\bc*_DQ*Y27D+Q@_C^gt%̟K-W ue(/,=9)}w R AMP:{^5_}eo3!2{ +rѺZrYfI @lC0EŠD@O bz&0F*ⓧ*B1d3]8"cN дU&4Ajsqr0PY@993΀ 6gT4gL(yt,i*@yA2I4E\XiJ9O= õ K d Cv*v'eh7ИN=~qae &fM>F.I3/Y#ͭ<=e>юvi0$45vXc9/5^SzXd"e,dH« sdQ`sTDFm5lP*>B^k?/TD[]zPPm6(A²xn8-<Ŷy)A>7]%G 1e#Ldnܶ[fo^̟3L(Z*=vLKZe\ƺ\%pV u]IJHEM'[n B{ V1`B ii$4.a0 ۲/g-<2-{Q5)J)}[7 Zfc5ʇz(B9re+?VQj:ˊdye0<9W.Hf6Pᒶܳ1T8d ɡ,pt^(䳖)_fvWуqw:O:QkRN+}Z%S?Nin0X!)h/? mY&\i ǰʢۍ1\(86,^z`=MN]o%F}O6( X^OBM?]'jD6gPҼwx8 9;E/e bܗjr [BU{Ȃ Ku;*bu*};JT=pd(AK\BkQ9E CcˑxiA AJ:9R;l;m4l6V{K<+EI܋HJwdh'ɉ8^fV4|,%Z:%>9sIY#+yȹCa?8#<'H-yQjX"AcrS%Gsh鉡 MUAh)5%x&XSXPf>~G gN{sr_3ߠ!wxmHe,'zGk'mhC3LEn0O(K<QAkߵd~2 |uLm &bo_o?f  sޠyNJQE[V& MJ 2ڼ1 tj  1BDGGA?9[{7!h ~`~@R&g=UӈΕnTL4PÊL6(qEH4 ЦPо (`e\ȷv d9Hp&-%+3'h1tI%z^v\+b@8,Фs;ۗR38GZ#)YpعuyU(RbDhw3"H˄Ʊ- ҷ'G (p zhٌC %tȄ׷#"Arf.H)QK3\*=}-W!nGW@0 ˥P3ȹ30|p!m56o\A\TJ#1YP{3qn(>h ƣ@J/8i|j ypHg1"sNq%&Цؒ^u&l(cs*/ÛK5>݂]z v7/WVh(D4J.WRX+_8h 9 57d+ IRŷe2J+A63=rHEhBș#%!838z>($o8?VX{\aIЏtQAc,mZ5)Rxy֍vAsZYFo]eM[  src~`zku`6k^Y"V8VJQ |W?pX{N6=p唨hyzY*^K K%ž VX74H8G3DJ!_ 4GprOvf;b)z}^^7#X#g ː關8L)͜a *J1F*OCgJ( P}. !0Q, T ¬WoE^GGƸ.(b:\0}&-4E nLrs eAqj;F\mΗ!GEکRԢ𺤘%7f߫ 2|ȰJnEF,)hWQ9u ^T>џXM藳7 ^;? 3Y8_D*D/jbKNB Aae@Qg*Q[vDkw@9\*+J~]P҅ :C qf̮C -;HekFҌLer> kiXy%I?@*^JCBӄrPY'wpލ3-ٽFNAPL(whI sj s|(gA;Ez6L׉qq \Qo93ϻu>$YƯhz1kT)'knHNM= Uy8Rys֏ԯM|aeyS5X()$ mHf>5: x.(B]mΒ_ Y)xDVT@m 1WKz`K[Jno^3JX~[UB,_cHjvBWĘ k_$ ;Jˬ QE(G+]Priꢂ}!Ǣd,} K@ElQ_< ae#)DJzTڍ) Vf8@;bbTAqJr$iyr戳/KrPN͎ ʸaqy\W@N#*6R ;\42[Cn >= * otBEEಡGX? Q^)m|"AĴ(ԑk3aӾw,4P luYL^*RϸmBF([[KGj[fG8RHpb3BYGM(HYIE\]:G82J1%NY\l4h>sScE,T+ر))JuV(]Z )?VNnbBfCjUo7 %V'V@HCZŸ:NdP#Um+ܓ[=k;а|n6GPk;{K Rίtv(.]:)55%ƓIlGɥI+ L<)*Omۨ>NND]X M;n,u(+%$#o7۠LG1(|DI,},_Q{mLSt7|i#Pf%HL,Rmr"& aCZS2kIyl۶@9E'4Kɗj(%+fqK%2MD}+[4ŞSi)^jP(J6@ܾٯbitm,К L\, VMPfuں:㵽xїjH$Ie<eVnʤe(7mS4_4:mGsek|pT׫$~mLSUSlfiVp(_K~(+-VE?zMV?UYC+K?PC_/T_K?U~/*K?Umu.ggk?<_tk: : gWJc{jʿ%h&ݺVu頾.93<{Lޣi=:1zJ~B|!Ld&$0SϡZ__GUٺ%j]]!ꖇO&КOcҴfYY1E_T>L'Lu4s)*u韨6:DOM֬{ 7m]Woi2eQ'2[3J:^ eo>->G M4fӕmoe4c~ɢgRI:S6O#%TgbS1[)oߔoN[7sQdn ut+E6z쏱 (o(J`u Nv{;c˽oLW2s[O*I6$_N)ZʗTy&۪4ܹ'?~{.B~Ws!?r TTȉQeB$b/\їT UlP%η.|7A=7tNuMq BL搽jB5şWTzOlV.ѻIa?;r{F޲[T S :'pM&t[ac ûf3g0v&06ܔ.8ʏ7)ReF!1Rvtˊ~X_JӘnr~j_3U΁Zo*JQ4S%Œ6ߟ_U[n5QejxU]A_H!>㼽~u~t،JqgaoZ' &_e1PZhu&u%F^3_o͔A¤|QؼIg'VQCI7@oO3IxژDHrvo b=2!NlLzTV0bofdx9z9~$42HvE@$%1[T*޸>z`O2-iL~EoۛtҒI3M=T9>dJdw[;>96Q!o0ml02ܲ<W~%xx1O b)bK9p[lZl5sa74(KۖroVj\uv{+;fX_%R;L wCm3c0Jxک뢬I3NkIޭ dCP[N02>U:j|o]HItNݹ/q{jzK!Iuvz77o&j%azolF:x5Qʻ[.]+`ތ=[^"MxuhT'=#L4*:sHy3` ~'{y̛6܌h^u빇`qikFdJ )Ydmf#QgCtsϫ60%_K[J3\e#O#F?fD6]\ aې7Iz1 Ƶ[yJZdŐhߡ[I6߼ۧTB/ûCWoyv8ԧY4yQP/4JaҒSZ]`pydX Msow;3qTD@ޔ<p5cG๴`̕Ş[Np߬X {UoW!R6Lknͻ$}IWC$S]r1KࣞsH>J i8FûT+;z{`S;OgBCgFs{{ʙ1[n3U&2bz&KK8{,%EVRWwYqw*#UH&!<=Q2Q(SU:!~ؑ0z8zmPE7RDH'oaI>=<0k" zXbQ xLjqwDnȘ=ԴxYVZ^JZlVI6Sj)|wwpdJ_%[`%ZFn*:!scd萦gP 7ߦmrc?2ª֗wsn+NǏ~̎m1Ss!ҿP2;vR437|4oh7 pO}d;Y%fv1bjboˀcZA #RoxD5[ΡNW$򱞠`FcBc7o Qѭj 0 %E,k#%-GNqWxy 9bJyqXy[Anq[fEV)cVabr6DjєT_p0hk'75TdKUV:24rRy@y(xX&翍UGC9C =VG{T["8%N19|E(ӶLB?Ms搞iX8#s/}Pm̖re4jh1=7.WK=HבÛJd4n|t2ŒQE8hZG1lhsmt`gB~M^iP䝎Ӂljj`L~B=яi8g^…lL<=kvY:^^اD9싩@8A!FHŹNGg>瞞Ζ; ϻr:cq u o[݌YP6GFOZ v=.\0O_ vP4޸Y͢5"?R V Ijw,t80+!rB{ɦoYe⟼rG K(BHC!hݘt?DC\/ lؼ]}0 Q #|YؙcavPwot^O Q:t%'Unj>v}6BqNkrN5I}K ї6<5η+@/n!Lp`(R0;Hŗ $|M%k͔u9yEG"I^9\S%oAPCo1}rXXF@cg#2pT\.Oܲg-[orgw6t{U3Ծe7Tp?wt%:ȨG%J.L.= k')۬ z*Euj KUI6D8=)51,PPvu[~te u:g-U^l<ʅΆ.II43Ekrx9z<6b#ݰPŶo(G ΰ| [x@ޠ!"ᭅ_d4ď?n_g|(E'?dyWg/KIƌ5Vؿor([b #}zϰKQ{0zu=ROZ5B~ 7q|shQ5#L0مȁʦgN ݔ% D>xV3*C:.M,am4d-qCUҙV1Wvc A/(C;=Y&[# /3sԁt ]бWFFo D A ] /6S2QUXW?r?57RFո]JUrb2UCZ/b 6 PbgDP|"^617ӜC?u ? 7XX<=&J +pZaN@zX<||efEO%&},-p#O-%cVj<` q>`5 -yMrD;.G hxA(ZZZq=09AQg=({M-~J/ut%Ӗ _ҳ5Sw"IKX&80v TcAdA:{= ^G}Lfw_jCnV &)*,F'5y$eEhx68 .ډlN7s`bZi q*-7퐜v, Md15x̀q Y\MRԕ1\Q.?} dlP۔K#O2gR1u>cts9&,`&vrYe `˓c 1&XSyU1⍬[tp 5%hhT9VWTFý'r\#p w'SCL4t2N*dfG;ϛ>(5"ՂyhXTKo3*`qtl%u1N Ke~"m$bݳFEedtZt+IeM2iQpfwN `#bameؿ^=AA;. Na L/=úkz̓Y`k3z^nOXq>ۛT V~Gt? IDATlX((GDSWLci iLNvKN66Q-9́v9 LM`!q= %Jn b)Y#W׷98I]pɄ 6pJ4nIGj:F{Tۄ1nI ^IMhio|:$|IgkvSL*'gE,ߤu$;>,=wˉ*ih=2OF*2;)Gͣ?+r 6jm ~>hϕ&<7 9[1{sX].Nq sXPd;xlq͖!xf]wwQϐ1OUzulFw؜呾f&[n2\ ޮoxgo/ Geӱˋ_okG ƐQM Ì-KPᕵujXi{1};9OfbY#_(O>wҹ˵!r}!"[@_h+'7F(=a:f]n8]~elp+ ]L(]:@*}*,^K9e˨ q~`'f3nrQ0U>Y"np%2YfIFԎJH:UQ vBWl5o8Tf B4g7OaJct%S5~lQ߃FJ]Lx ~Nh3JcY'#u^kTcZ>;o LWyX^cIf$=}6?#g&㏼3yk?6g~+ 7=ۺ:&`W޲$Ex 8*AiwwSގPu+EbcKM9<poP5A '6|hmÏg En!slS^X,D8{7*=  z!s{#ة$mé.rS|G$}Sg9. Ǹ~8qprc ~_rn~nn^m_ݾ bVug'N<68@Ծ dӐds, N b%LFQYvJC<]_Vve33|7w[|7OsǠ0yVx}_*5q8a"[Rscc&L"<3A/\?CM`! u<ԁj1_޾}BQYK PYu' 8K S*KPlgʤag#EX L6OLabJ Hg7gu:߂9]5Q=gn@ob.}e2#\+%z'a3=UdAd"„=ɄCR'T@Jb-iZޟ&r,U7)Y}9'숓8ѽEh>%f琙YN!BiWh05K](4&h˳ vX=+cs54VX*1'|a<Cz6?3m2 '0wlaxCz oAURC% /r[t8JY^ȱF-.͚tl42'-Fjt泚MQ%Opg دb<,]@vTI44+6 (Yv=s}d0\~&偩nX P P Mn[vP;/@s769Nbi(;Se-#LiU<[$dJs56D LvWʊejn5p\=JjTfBh 0*6-<3QziLTE?UzQio.̧J.JLmE;fm\/b4.bҩ׾L?ATAE*aڭ܂{{V]܀D9:E8ISUc) P˓ܟHpIP^qBd-qT HK-{,} NiЏyMS^\iqwN4?x[o둿l )* 7%S;M1uVڕvIY-Bb,!ǰ&`b9 1R[{Ƴ^c:EeSk>p0,IʴKDk| 1QiARYqS| E2F1KyXaB7 頻 $+c_0)h(}pk5Uu$G0 5Y<17xؘ|Fx;?Ny n`dGc;S:IQD}ȑeA<=q7 @6 li-gyܗ,Af^ !*3Po]񞥱} ""O!LzK@`*Rɧ]/:f6~1uO`3e TK,C$?;s=e\rDl0TOp&Eƹ|TN5C?}tؿdI*%MT~Ǎ,Z"dSbGFղ akHQ0ʲE`=42~biz?lN\E{-i23ynT&Jw0hn"XG`SܓxJJ S5l/{9Y6[-}AbBڨ\nbҝ@w*sQD2$hL*>zOZ)FeفG!oxA}MM[/A|w?SFee(XWaI:WR$8+HhHԮɈ b,~sqIO4F䚛Iz7s wa?k^Y_5T\pn]7%zJh;!i0')5}Yv߈ܲl*#^$!ffXx[M䀇Ka@Jg`2|SE5lnػԊ[.4{`r#?g,7}ͺMDcC ^rznX|$ղW%Bm ޭ: vS5la/!mGkI"rXҴN++c0k2.qh\ d] ?%~}_~ 5ٟr(P 0#茨=CmG %]T12LVTv,T}W$^# ᖖ)|boXkEgΟ"%]Tbo;qSZ#HQpzo,JS-WmYpדWsX c?mqzxBW[6 +b\9דּ`71+^Eh] eCMJ#dMds颒$Dޕ(R#7*}>1xX9J4" {J #9j>drg֞=>K[Z_dhSSRY S")N㒛Ƿm@ vUTSM N>KRqYӻҏ`IWvb^o '(+:jWHv#wVX Gn>^`]#Kʨ,)"`HkA__ejz N^ tŝ#H 'V$[@Z D|EA+&楀;.sA' Kʨ\aG &nVIZ D=rjjr8!+l0*Xw)P9%,zܱ͝y7i,U (Y%mTb;ڵRs"IUx>΂SOA%x+rQvX[ `xGWuG:i!XpOc(1T߈˓u0P0:{svj*7W{?,ǻGfIz5E#ّETfL^Wu jd(; u#[p7%L눁NiuN4%fP,~axjEL!&潋4>iդlKJMwьTdY26*vi]]] { 4Ri~Q&>*;ͧ"}E9{&#x@|}1 T+'zi}=ybA#HNy%̒r4HܯÇv `S++ k\W`Y .%(UތK<}V: T]տhR ?xX(ĂYgIAHBer;Yd%-/uMo| Y2pl}̟_ TVn:}W% ҐeQ۝!yiExTʺiQ ^zhOTvPaFe~W RT}2N%j*|[k |6Y$t量K&~__B%%Äs6Ph$ȗ$;&T@$ yo~u@^MXBq12Ph rt {7*e:j 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.52/doc/utilities.html.in0000644000771000077100000000131114064202371020064 0ustar ckarneyckarney GeographicLib-@PROJECT_VERSION@ utilities

Online documentation for utilities for GeographicLib version @PROJECT_VERSION@ is available at
https://geographiclib.sourceforge.io/@PROJECT_VERSION@/utilities.html.

You will be redirected there. Click on the link to go there directly.

GeographicLib-1.52/doc/vptree.gif0000644000771000077100000052667714064202371016605 0ustar ckarneyckarneyGIF89aE: +++333666@@@KKKMMMQQQUUU\\\^^^```bbbdddfffiiiqqqwwwzzz|||~~~0!! NETSCAPE2.0,E@pH,Ȥrl:ШtJZجvzxL.zn|N~ :\4$.ZX(8RS.+91NP *C6 2ќBL3E!ĶM*E,丶JE/ 񳖛F(r)De  N0$j Cx"6I!! IBtfC=(NE9F7HP(" On9!0Ti Lt-1lî1BvTQwP^xC &[-c@a~L^P+k 6j͠8i7=Ldc1,Y2;-&n&sJH'WybʝKw)kr瓿G9|GO/=˟OϿ(hQ^-c=(VhfXj{xq"q5RxHMub;8?ťx#1#B)U5VCmDFP$lJi=Ffe8EdwK[^2e!N&i&&y10J䛥՜ti"矍I&d'(x&#}9)b)#\)!.:.]rVZXjkrJTv)`zgĮvVkWP!KU(zq*_6ה:{jՖ飸H)nr8KR˄{Z箰;l;/*kpcd,ܯ YT-+pm;Fbj1] WՋ2s]2MCc[8'rwVmд4Y6o^bAڤ8,Ǎ evgY5-ݾZKc]) 2iO쌕޵=Aþ#oѳ(wg!lf:҆ ]kȸˁ꾀 yb鱭!_?fo)ێ]Z&s1fF7d_``Ԗ-n Oݾ&< / 5bAu+;EDSq\KaDtIN|KH Kh10f|ԵP**E_8&I!]C}+TTCh3ʕ skI|ʍh*lF?I2s$qt|n5&"A= gz1LH~0Y<h.Z23"e"DR=<JuTЍ&g˟Ny/OqSn1B_GI=KtqX\~P5 C9ŝs ^i=Zzw=AfbsIV2XKWj]CIne:z8tTCYɘ;XUԛ#EDSS_5inC"Vs'&68jPf*we-RЅb9 ]#_ ɡ]ىČ0*e(*:YQx.&p 5z.*ңowa@1{|+6}'Ah1$Sp~P1wsmuyC eAIb3KK0h4Ȏy׋x2h2ls:2LTpn3Yыfcr8w6};N^˅5Qr7H$}]5zi"Pu0](2OSM+"ki|ΆuMmX嶴Vs%gv.I~>Z< S]oz tsݛHVA K;A;~^|c_gǨqD'B:[bBc(x]7 \L+}?rV)M"G_i맯BTWWԡ/r4q<爊8]v]ꥫJVPh*pzɭmYrɳ72J;٩{0cS}QnޗEb4PObh䇧u=K<:]d.>lpV~ߟTEs.VW{X;{eF-o>`yYkg*{/im%J9Wl|TW+|ߕqq]Tpw;^.dv6 oDk%5k47spTfZJ~"xp|/~ЂcM6=1q5mAD7?s0y޷Q@j 1zɣp;xVoO^ƁbQ%W9sy7E24t0HWgU(C}BTܧ~+Tj|uօDcGkHN8Z[{bVjȂ:Cp膿E|g{xXfFLSfexsVlGWiWy/zJW8ʇuƆ+g}VfI،^jyX^1NAȋ{sLJc!Gڥlv#Xy17̆8(cTpxu ֎qnv5W(+egq(U<ȍzXxgvQh="ᇏgAFHC(~uyE"k7pg8'pbP495 t:i֐T'o8ox=fO)%g7x(IvXItuY@WSxu_ՖFI3pIKDQax{p[iKE |Wdjyta >.ǘɕ7\kI'yXY %Bs2 6u#d.؊ov֘!BqMyɀg):='y91)S1$>ɛjtM4Q gtD[zwXy:ri_g$Owx׏LN)IQԳvR(*:3gy/՟;G(Ḋg'}DhZ#hoi!J`)y&g,mTX2g7(c~yS2 Hjp9ǒteyN B5J?;ZwGɂoS9PÙW~ !Ɍpf_uќsQ\' fZSuXVJQ@*8DTZw^(M=-DdNɢSn)tJYtJ}w5UaɠHM *jZ='/EalFVjMڒ=EW٦]^6بX> :;L[IGf]g\y9jti6*tj"} Cz^8Tpì` Ijvbo)!Q!!Gp<4"["rHMZ$zCµeɴBc똚@Z@J8Wqyt||˴ -;};s+Zn a H:3rD4Z<5$ 4*Zh&`Y^3{W3Ab26YǟQNWfvDӺK sX;:({QY@kND艾c40 )RJY1& r2Xɫ{:nžд;"GL_i % .xIKi^rp R슸qO'KteH/k^rn$?&wdEM0kˮ_˞M۸sͻ NȧNnt9sKNس\4Ȣ{7xIśzn3Y"hϿW_! E }W vėP q!i ɐx }pxz Jhu~Bx^|4BG?:cCr4K <>UHIJĕPEy 'ε"fGbd mjW'fEr4g8fw`N5|V8ݟF,ר/TU"&}h_yɨ]*Kkim؞ʚV,%zUSl66A֫'izR3cNP{e(~N2<nWV+חF&hAbr&_]OzJ˄ЛG3B9/ͥ/wgqQ4CK:(L4D#Q*plq$/ Ze2wi,_TωJq,!HY\t75D+3+AS[I s]OOBc}Y+ϘMaF(7Uᔦn.N 'rm7h3E }gJ/=F7[x[sÞ_^鼺r.pz9⭛vY"j\7algy~3ޭƺ(X Vw{g:)Yս[zsU8k9g[s5JVB1ֽx}GX!aK?ÝBiL Efņ*M :azw>tDq\U9 ށFC3u6 aÏ[eB98Z2X,xb|&7\1}DXHq=$e&F\ 1(1|1KYˠ'7F%BG5?;n{ĬR4*O\RX;4 ԰}2.vձL9Nj%u)+WPS!J M] $)Y{yѐf!ԃ2  IBY Lr$P"˴URb3T;ˑ K !M nܑakg?M'NhR" TS`= j:bx=\Kůn(nEb =kp\9{5|fygn|M->^7tSᇰ!E}#]J'z+ه\eOLc5&>mȿ_QoOMF~< s~Vɷg8瞋kfR?w}"(2śK_t'ZxGSWdnu@{F{afs^sG'qq*faqG]"Ho0Yo7+eRqPh@Xu_ tgUЉKzF4PyHdU'i.%]U.4Guh7vAXr;BŸhzI7e?ЇW5j߈^77EWW}`8{Me`e稆$hs8NnwbxOt @ 4wlezO8He2"qz:z|t$|RطiTiqc$ZQIhŔ$iF*u|uuOgjN`8зV΄7sxvirTy&rE9tٗ v2p(G:wx8GPu8_uЗchcdyY6~1)PD[ΈB|ZՆ5d^dMgՙogy4X腛=NVy # uuֈe)P(y0hНH ؐp$h O idYVI[%ןhPEKOU{ }[w |[3Rp֘z :U\7h(Mh6ɗ"g4P~7V)9ReMĞ9|C"ItF58KfsHJ_hT{qx}I{Vs0KK#'ij?WAɣGrIV U:fTI h8,Y? *Z h~:X#|㦠6:|鈅XuȪxzhx4':J:JwJ%u"\`@EPH[N]:8a6emK4xSWesJ#$ͩQaPdTB§sFy}UR0*U'.qxYȟ! h6-RY3I~ Z75HXsZdʣC+>NTܚW/ۏjr,9;G#D/8`DI;uKU ᬤ )&a@J)x=ɢ7`4 [ʴl'lK˗"3fhO 2=)oYp/{˱[j%\@K'dK@ꘋ orKʔXbY\I>R14jL=ҹպa][~UƂEMH ;E۲ěxL[M \ 6UT r 25G2۟YxRjpsjʧdTZwfv5fG2 bxYgk Ka|@vltz+rJ\ֵ`:q‡9Z%b(裏Tt: KF`S mQ+…R&7pBD1`JX iIDnA0̏\Bi^yh(ePn6GMJ)bR#2"`(&,EdKF'7ŬJz5˳sX@ŤtkpgQQ#lnF̾kDU9<ɋE~,<(^1!Җ}\ݻX K :11x3ƂZj>F11iҫcފeٸޝwhēj級& ,~[jqmß2nYTE ?>t˧7}D)R e&xIk 68zFxvVHSfxHvHbh~&,0(4h8<㏖rBI\|F&L6PdQUbeUe_z\Bayav HTw-p)qi:pm-й8)&7~ڊ谠mi$AH8$Y9[ni J , {ʩ%RHTVk$~q첊4~*"ީnR-#"{͹\Zș] Onzf!;I.*6.Ϣ9y ,+6 ${O7^"䱊{Rʔ5<,K3&6T779G=x!ݲ< n׾tum5itJAvn_a Z nlmow0l]-!iT7nH͵banWSzG\$neޮ=5ٔgߕZy6!@+$Y޺RS *~4]g藿.𼓄ZϒSu.Q>KOaF#Ff]<8!Ćkd_@ăRdV 6aӢM=Y)g/CV"+j}0;E^` /*zӻ0'VwKb\GxMd,VEam-Fle;4lSkM\Lsjfq T]ngwFLrxu{:nM_#[]~UpCb`^FK=Zbm+P)fW}lh FE%,`>ņa?.Fl.;2@H7g^Ep#'"4VxEH2"af+w+a ._QA[_yTPhHs7|^Yf2'Tۍ&e- 4$YdR]]1f ge*eZe[Kb˗.6&dTAB-9T-%P4w2{T}'c]N,la8!r6WlTY͵9+m3ͩ1r_K[U0»akmgfy&36ѧ\yzCjI. 3c"qVxOڦuܴhy.>/&X'x&r|BUU#(#:X5qَn/p2jkr1^.1D+$W6zϋg 4cq$vxf'՜[lv29i~S?V`%(S9_+|8]"D^m[U8(Нw ȯ֓J<C7눉x([q i7 )$~|؇{!!u C 0tr8׋I>sxxiSosdQHp.THx %o~yb6ՉM18kp4 ņV Iyu%O߈wQQBdErta I<HsoHJ{ j3%oy@1+Ԅ{;%  -Vʰ kDJ1; +˲*q>Zj`>*2;8VH;ף=Xa9Q:ުUH6j&9lʔ9N`;dBoɖkIڱ?cSQ\WCJK+nz5YDtk;X K3J#{nZVk}G+l`\9$6@T;O^*=d&sQAK 6ksBjP%uW@"H67Iz'dj+Dh aEgh<ׯfȾ@c b[[:I1{vTxXFi ˶c$bҳP;ec{uE"\Nasr%s?c;FϑKAv㈳{968pW;Z?H\@~{:; 5f :v |7iK 3Ak b\!03{ KgOlA-Gi ŠRxP ,C\:\kzTeLTIn/Hǵ{ngȶ^{|ɓf,aXJɣe7e]NS9s.LuصFJAZw\Z船<RȘ/UTf:3ڬ9cgSy؞kOXm8ߌm&ƥxFnUsWt\ ]X6[U;v\mtSCSM!-X I X(2znɶxp%}d#vβ[1뙀4D b— {̼ѯYN9cLS_G>!ib Zgw**o(Ϳhؚ9&\WjN͡Ekǐ_a*Ԕ:1uJtyVc*d-qy֩" 8|zNۃs}mNߚݥ7i˗繷ݥq͋7MN$׾V_!O]"Qx`x=p<"d%0.&rߛE"-z>Q}n|矺罳U NK0mt64#NUnL5R$̒)]#(:ꍵS=~H{Z0[K>B{w»ECj'c{ܶArm iЩ&} S=addؽhNw :qM@9yX8g^Gn.b,: ۣ͹d?s7*K/L$V=^'tի@f|:r;ևf^F/DH8fX2(Z >ywo<Ζn_dosdG$Ty?TvOƏM<>Fob՚_F`.  zI^*?C<)/*Kb{!,E '''///111666u=+z;*8`;IV7sEIIIKKKOOOQQQUUUXXXZZZdddfffmmmssswww' ##$$++-->>AAEEJJSSTTUU\\]]^^__ccddllssuuvvzz}}0Ճքٍڑ۔ޞߟߡࣣ⨨⩩㫫䮮峳縸繹軻齽鿿xʹhNOkӎW( +f;; 6 1uH@>J L lǟAJ;q&8"FL@ \AvRyGZdJws#M}=# SkDe@DS'%P~`$XU:eDF sUd.iK{7*Roax؀Ҕz C46fB\2lFG֪d_ jǞ|}0Ȑ MWœ>w& z-#]VλYӣ|O=j̗ܽ:! XHp1(ax:8фᆓLᇏG≇y/b$H8<@)DiH&L2ic= euNiXf\vI$zRz)ՌWv |x gpb_&yMsR'*蠄 g4 JC*ƵM:)BˢeYe*jڊ)+ny*)RG0ze_񒪨Ȋº:Bp窸Z""lm6ž\gnWnVtd.s\^F/KpkY".P v J*PtBqW_zS1|d+oR (-_XwLΡ3|r)-)%z 7/DfpK@ 'Wc4Y \xݹH#ַuVvqm/kLw{22= xXp2xeRR!\ղn"&]|9MzH9:v}2- 'Ὰq*Hy>U7_7"X'M I뵈K˭ɡx %@bgIE p4 m8 "A,pxB8Cg/Q`Ax?p2#ܤDN`$*il׌ WNVr޸FngEu>s*ծsz2y]q)=oG~o&4Xx{骀䝪U&X{ F{އ{;ોa.h^*E;B swrZ^L0'-3Cxn̷e6W&r8/XmܹaܐnXj`"C7ksTtsmz&iA%Je@R hSw]jmj u;ׄb r?obN]B&0(c"vY;>06ld#m7Qs'Hn&qcn q+NF&>;38*0ԂBV.7 %V+Ti5sƅgu=wiVw4ORndžw6f\\a0Hhqii6c&h!Zk~ BbtsL8Tm`7cwXhP_ȂmUPX]s#Yp`Y W2FT9اcXZ@shbv;a`TWfwZ%uK}$(q}'ifC8fG Ս7I]le;chxmXJFIWS\W䨏Iq\; yBKF Ia^gv(Cbd3Eĉ_wTi9!AuXS˱!AƘC2؏;G4B8Io8$9r901( "0 Gd:v]RF9" GF`tÏ߆2y{Q{' Y>HSdaڈH~c4YbP0E&sg,^wG G(Sybuk攦ŀ d`)jp<ȷpGEEP?ԗǕzc@GOLWc`~v!ȾkL"Wש 懱 ee;k Ẅ9c8ۮ '<-mLR&ƕKڼJ.~FĹ8#sZ`wLPwlDe!P4\~#K hnѤ]+A* 05W#lfB20) <̈%eЍw]jfE M)=P0rt:Lc6=4fu~w}MMuObtwI)ȷl4!m dVf~7ל׍qctZU3l5{;8ղW^\W(<)Jڅ}eT=؛K/qYJ!4mĝ۪Wx8rRI=왁9o{V3WBhFzY"SDc]ڂ1mJJFT5-~쮗ꥮA'mֳ~>O`/Wy2N6([it•4~eS9kmM  tC'dzC&+INS A^0?!lvpOj븠 &;W3,2L]/_/7N،#LUA/㶢?Ï#9#|#*$#?R^Bb>uC>ZJ]rO6O%HO#GgH)9IY8h J(x)X +::xx *Q{(<{Yl JZ<ٺ L ,zh[;jmKޮO?%C3 6Vȡd'1J1n4ˆKQ#3|K!< 3fyM<-%2{j+n:w3ibH-B׫i|$*zRPP*m*i%ֱk5eUu(!}R:yW9ϻ)8~Q6g/_|HƜƖʦ  $By^HPwLxfbbIeX&:eUng>%\'p(&jJ@h 0 gFzZ!y h4h駡!,E 888u=+y;*9_;7`>@@AAEEHHIIJJLLNNOOUUXX[[^^__ddggiikkmmooqqrrssttvvwwzz{{||~~0Ԁքׇ׈،ڐܗݙݛࣣᥥᦦ㫫䯯山岲浵輼龾鿿#H*\ȰÇ#F81ŋ3jȱǏ CTHQȓ(S\ɲK%_ʜI͛#cɳϟ))haѣHAL(ӧP*UӪX&]֯`}R5ٳ4B-ەcZ;7Is2Qy RkqK4p\/O)Dp@6|R (I']BUL#ԲZnZ%s{2&_f|M o:9K߾s3`ڑ)7z92>?L(!n}=ddQ |jl5f߃ E&ن!6!:(؄d(Q"eP6>BVh^9.cLh?GdCC.u 6yJ:ieVFY@^xQ"d!B[l~eyXZ'%sHdA])Q8"&ZDY?Fj)R㥜42e(:ң4"I3Z`wх%(ĮdȞtcP&묄ٕxޙfkj-Aڢjz;n oқナol'Kp0 /kɪFGknTƣ~ 2"li&CrʉS]b\/Ū3׼WG*>Wen]4T=1bkKX]\w.CTWڏ*0)-hf0ܴCa5XZOe76C[vD^{F}*8- Ⓩ >.G++ptt',\ 8I%DV!bļ䁰!_Dx `A$JEς 3nSS(7"Ōm2^H%HC#U%Ϊ!Mxb2IfԨDo'h@xh) dH=*}9WA"3ԪCM򩊛DeI .S&Rqd s) Kmxae0yCѝ!.c[0< %>T3i%H`H,0w4rUKύ+ίlJbw%JR>&}bU$?Y&G-mHlҿXM\_B% *vtc=?RtQ)-^4Ћ )D1ܤ#Dƈ"u7; M\?cĚZUZ2UR9e XԮ*/Ljԑ4kۜD,)Y*Z;fNR8xrZR,\A*e+K%{U1k>`̓cr_ \N, dy˅IZ#؄e%aRO 7&1)%.<|ےڝzNyD ^o\_&QL$ SM?ސA ~T8BX;V2[/;Si|#K.d , ꇧLz79KM;AX;S Qiy֭駒29 HƇ1LjTx%"ac,4UzَeRb8"m+)JNHVeձߋ]@z-[$ePH4{.FVh .s˧GG-_D?iSBW$*I$Ù#(4HEPӠnuږ%[fWODr:~ q+l`1mV0Bꂵ^E;34kZ9s#fy,LpOଊ0Z⭗` k>+ZڕSAݐq>:|Smy/n8e+, LŇ[Wv7zqk*(0Rks GZeBxYe*6 9)""tnMŖE&2;PF/ 8e$^JTFn<>y0o˵4ғl a˚B}mLb HEqw}`gnr`dbprģgSPWG;zWY(j>۳<}ɤxny(ә"l+؋ܻ0-J~;fF>{3텈lbچI՟V,Tbdÿ4bdLe}%mgGW%W`^Ms>:&|]Ewv*e7GuwF>jjV$QFǀ{(4T2,3GxH:jr7J\B]cKIF4<}w#XNNSƆfY^PײERJEFq.6L=6K`x&E7eqqNL1~n(o;WdWckYoJ(OăT~yng}d&uiHox؆xX1^Zs$c"QV{}>)eFH(vEfr>XCH}=,3&VH#}dqSΥn ,>'Md>kXXOУUK|`u3t7J׎؂⅏5RP;D[kցM*u`LPS~lc~aXh,ʥJ$gGX,ǎ"dIy'oFEf%}83b (Gx0bl(`$;G\,0Vj~u}]Òѵ}J׏lz`h;&5lrTij\6I0VKXghC[Rw'i{{E8w7 _OEWvl4$G,Řmom^5${"Ye7T!Zvfwt9hC!sVMF"'D뢉y+ҴRs6bؚ;R)f:ot9WIRYe%+n Ǐ94yEԝwtL W($$҈uBsez!BrPn%{ZL餐 &a20jHLjr ʗTJؔ0r!J'h}tբVchP)utZFf`BR~{ɢ$D05E^R5Lem{ءǣI,%S7/X9(d@Ca1t9uc:0EK5CFlEwsJ-<6*'.vN èڊڢ0d񔩌&$ARb)1Csf9M"jPb<6ÖmsQ.vkBZt2RUqVʩٸ5n`(W`@3? ӵ3g`hӈmz*gٕ*Hj5'!&oDuʆhétFɫt5bDwiwFђ @kŇZ+[gIC~t_IzVhQQ:quswԪ?c3k0~las]I ?[|++n9i︩ ?AttS^{H Cj6ws Pʬo\L4zo--QZqzpQ߲,75~JhZ+XぎZ7S}ykrgoiR‹[YBWIhogYX",mD=\\ՄDK52wBF 6S7}j+5벭Q,r밇ۼŚqOsR[zqGV!= )~j#ԫBw;.z$.U+T3)8sz+ʢ"j)dV(nD/1T.Fk+& å*X%w4c4j@~ R򪼇[Y,S${Q1PQ[LH":=ۛiÝu\w,[Üy)GfkIR<`w;8g}L?#'Xҩɭ|Shmyâzi,+<>HM2H܋TLx)xt: 3 3mm}̹D͑u̬6[|RKhiiTRVI\X̤RaŖgFL| ϋLf| qZi9y (h$x`KL;]\Q!?H1kҭZ}JjĽgnR6\T}A^]_9,5钼޼. mYq|r..雃p{ ޠDAgN}aAGg=W^NS)+@uD෦ǟĮ"|\dؾھf΄nZ1"Rn%JK]KسJ*6wF!P&XE8@YQi8YDI=c_r|t@j4&-e!Œ;<̭:Tۀ>hޗO&X Rd{DORG*3o KCތ8ukyDN#Ӳaa- :d)^Yo@)vmkoQXeU}l%}TŖF>,P J󉪾=F|y f$Z"nms"7z92M4d2;Hg!l Yi׌( ? :2S1ЫjA;Pj% g qKK: s4S\mFBl$ rDlqq3RKԨ\&Gp +8t7ɀLȄ{Cк;>7|ŒtJ;uE:kL<+n7ij2G 2]00]KB QKe45.P/RӔ,XM/qX[,Y_L 6_Ea\(Eu+eۖY.:BFȶi6Z6]su==5|U_w6>l;r[=#t*G3P,^DHWwT ֫lTG)<We$OFS Xފfxd9F٢SCHu cuquJrq#Y~]Tg{0]$R?X;r;5C, ohgc; HXw:*#4 xR ]x!@-ij4CE|rr+ $, =OG|\ؘh@'&bHla(Y# Ҩ5Z f2qpuaxgl1S&>^ Ȯ=9 ,뒘$k&NZ&gǷ%FG)qfMF0&cjY$Z~쓨(iXѕ⯈=U%7)&lM8җf 7zL$p*3R(vZdizok/d8eYXxz(Ww or*e=ouD9!a<9fAo?lh"Ta~Ӟc`C'A)BO#bԊ+NW?7ũQPzA:4?S;\KNe[ It5Hf7Μͭ%TY!*_U,8:^ K%Wݕ;<`uxDj1Z3UJvvh$:3+g9Kڐ6Cej-ڙU^xh\)[!7:~X=K=hYmL|Uvbe>F]T&́n 0Jqm>ݦ pBEH..Nï 1> K&:o}6 Ãc (տ.5깴ĢnI[fh ; c6 φ&PȔkyA~, &w8*ɤ a]0i5&șiTf+pQL!,E """'''111333666s>+y;*z:*?[93b=0d>UO4VO4]J1\K2ZM2@[9CZ9DY8SP4jD.oCnBsEqD%jA$kAQQQ\\\^^^```bbbuuuwww~~~#%/$' +"-#)"*"5'1%0% ##''))++..112233446688::<<>>EEGGHHJJKKMMNNOOPPQQRRSSVV[[]]^^``aabbddeeffjjllmmnnoossuuvvwwxxyyzz{{||0ԀՂքօׇ؋،ٍَڐڑڒۓܗݙݚݛޜޝޞߟߡࣣ᧧⨨㫫䮮䯯䰰山岲峳洴浵緷縸繹躺軻輼?HH*\Ȱ!C#J$bʼn3jqcĎCIF&5ZDA.9ƜI̋61̙fL<  thFU -ӐL(aTWjJ1V\z%96Ye՚j۳piUKj[MV)n߉u%ãE]QٵK3B/3t7pд-ܸiѣfͨo։ssFѡ:$(:sչ6r_vs(#(_`NkusC&#{w\q9sh7&וY|md#.>g7|Wwyz XwC%Wrs6\c7J4#0 Ix%! h|9Ġo c15#`IxyXH$D>9Ndc}5UV U)c[LgfF'Bo@M8З:!Y$|>oc-"[8os0B qrriX$8}s(PbUe969թ&E웩+jБBwlJ,6;խK -FnO.l+nhf k]Kj&l/[oo Sp2oE^q̱#{%<1a~6㜃zb]秧:͠.2C_;ڻ;[E{,cHJn#_+4<Ѷ>==߾=~?2?}%SMbZKzZX>P(X&H RJp*ȔĂ*_gB `DH0K_t`ޚ@kbFh-P:&CWr/%PW\Oy%C=IRՖ r<|V?-, "3P"EǰQwct?M= :#(4-w:$jf[I(ɽI"1BZ JetDI:G_,ACQ3;Ȧ7Kh]9*ٕDga)KX7T&[u̔wN ʕnacFԔG\.唊ʶif [8=rv6ŝ>GUX̕Yrf2<)6"McI4- :S}"aw"E"~& d c{ǛdFd#GУvFgM hP ZӈQzjkfGlK>MZ֗R4r&Pe%e배$L *&Vd±ib^M:X7^$i-@iYȯHBA4PE;Hx O3rDLTq q$蒘Y1nm^"Xzڏp X RqtJm[5m㺻篳;KEzJAHGd=ZUӉ7>=ж kXza+mlA<(?lSv`2y]!Z>n%x'NfkͮqMk&>V!SF[b  _0ӯO떛5C?Q@bh˞hʠiY zFTYQyᦞAMSj=0Ͷs\D"N UE E4p\le3ŖŐbŀ í߲ Hl2{L8w!&3O2ɷ-Ye~o*$+7䇻i ?I3]VAŻAuMTzvq}l?^ bUo1Ʈ4ѫkg n0 ebOK;K04H[($7}Y~_[]fR _G2PS[U0f y{@y#e[hP_uxDz'0Y ttUiWQ'RGixg6с8FUZtK'-NP^11'V?.HlF}vKX8;SL|pFօyjֆcde8+Q>W#qlIe+A@jWvfMW'pgE gpGS&"fwlMY(##SCրZpgT!ocD!"%9b.CFR/&4ƈL#RVwGLsgdy$o@,ANXec'@btqɨ}sX#q9=\aoň`W]s+T8˶<xxa 9ܨ3:وAp] d(eSR=%7+*5v'؎_AdS*iRmǐ+|o{LHbRVN=&,O,V 1gAS{wdtpEi5t%FY`Wt†C85dLaHVYԔHThy6njjf&"Gb^kzgHщjHDtI:oI4el2}U6fH%=,/W-p`N{'4('ꢩi>+B-DzIG3jVp79<)cr9y3<H1y}2]|l!#bESVgL@wxm&gf0lX:wi߄*>C9S?3Vqzפ.IFtzGƧvj&nPFJهk n^CFh[gu(U; g n@XyP(xXʨꓦ2J1/@ h?5gLJSb' Tr;Xc酟IOTh_:Dv\)DLc744Xj: Iz _Q˃⪠ǤnZqdN7Opţ\"}ZzR}Z)JLCp`(!k$N b96Aq5g?1:k6XǏ=;?9>+ZڒagQ@;QNS!JhVx@CQӲ%i&Jٞ*k8T:ӈ(ZʈLvy(Ojוr dt;>E| e$hA8X*?_7%/w'J+~JrA;yg6MvmtWbQ:G8ZՔ~ p:j*W䲢i9^|ָ5N ĸSR|6oqa+&TV+~ 60qrk,jWgSu!rTC1caKKK,0KdiIYو$E!|S5 yz{Вo)B(!LXT{ Sfv +XKCiKy\|GsѪJlB{m0 tKUR4%"\h4Q6Ub^X)qhp,+'yʍĉ5_9ˮMPq| {MvȣilMgK5/ņRv&;ʻ bsyvHj N"kșxeJR 2 H<+Uv:ڙ_|<`JLDan` B SSkܬQ7KM\1y2qG d~Փ]}Na`vڬby8GyLXM(,{#|ٻw9N CPqG9[#=4 ҤRtLCR)5j m:] \:_0Mxh$-3}X+|h/\>͔FM{՟:7QHK/i֚1-`yPWDs餰fu*KD:#rahb@ QM83O~s&p@-eA;)ngo>ZJ8PV#2|FKk^O3=|H -paQ7 6pӭnub^Ylil)Ԓ < dHU.gi濭Q^Q گavy?^y5nwK֑ㅨUsz>\씣v&٘br&uayi'0>.v& {!wjO³K+UlwNx&G9x@,Jzb ^\ Psz>`|Nٰ8!Qp{%8l f_f6cd=M^O];;"߅~'AY*N=;: n?qϾE[P1,_~j-_Ʉ|L)Ń|g{IzczXp/tq?צ|= Z@94Dw+䒏[^8Fƪ.a :4`}IAN"7K-?cm UM c;)dy*ɭOoedGO FOP9ۛVQKQ ?UXSQa!M@ D >Q"A7-^$ŠYF%4) e"/nLsL5) bːu|J M jeR6H4bρ-B)SjUG^Ucn}hTd fzCىW9ҕIխ[{u(ۖ~}ڕvn_v bcu3-xΉ%FH%_/Lpvr5iϺQ= p L\U[Wm7]&=9eַŅ_fXn=!_|]4I=7G%b(EdŒ9fS*{8MQ Fd9$|,~^*ja;׫bkͺ6{Uk>{5ޤcwpՎ ,h{% |U.ƒ]+(ٕ I j:9k,ֵrښmCA& ,(u"bi&=M}c2]kbD?++j[Y_{ɗJ)5}]( ~sv`ķR˞ O\cKx& QkB?h=; ~g0$@sI*؄7i{'@PVYKڈ O虷 %q!IgV%[ !!^znWV׿-#/Ť݋wO5]cJh/|9όg#niQOs|4>;Os" !GaRVoLyNMF=/s1jH ›{1{<GJ6qgZ_(=Wh,iFztKyK_to0wLfڄ8Q&֝_,d": qd%8,4t @.1Qg!8IΈ-8]IǨĥ0\VZ5c z?ؚL&3n\OD+7Q44!"qE/ EșKے 5g$mfEG 8>ryJ(ڲ)/:d~ҙQ8$I @F 1EOQԶe[V=6%R[Tա.F.)F3d4 }ubEsg-z0>@Dpil6g, KcWWt_M+*+YFQ^ױĮݢ\o:s*8o!_5{l ōQQ֚SrVZm4N_O <&,]emzw$"S $h25SZx]ٝ򽄄Q*GcؚefRS>M*vDLI#gPӼ!hzߛq\7{Ù&$-LEШ߷|okʧE[PI5l)V?64Ba#3؉"27~#;.lڿÐP:373T>K2bAԿ"<ԂAﱽ+4d4]A#ڠ@X)lB 7'l4]?Y 0;# $T%0qA.?!? ; 6lCs@0B;8^ڕvi H-Ĵ43)CF>?8sD>34d8Ѷ;TC877MT@?EAi*X؉EA&4,B'|LCGD>t,o`U4}jA ګ7 lTNF` 9v쭺 4x%PC:yFf=+e/h A!F<@'ÚQѴnõ۵A%94x+C dEitz DRM6L$ 2ӰtL6;^7$KߔLCܜ%{2N"DTN;s" "^;L~tʬ34O4DH|NbN,LỰQPلODUt y'+{:*<]:6aK0MmQAlud˗ICe`'?2y2c,F - JO ~Nj':zb+OaA[S9r: u$4)P4,C[/#5+v65cQ&a[#WOPT+b<ޗtyn)Iy@_Bl.z袣6<쳫~;T w5:A|/}[:oo4~WW);]%,KAЃ7qYwK\~9\Y^ r-}BXI%V彞hcP SQ³Td!AڭUXU0[a-n,,`[G ' cQ %.ya?7c1Pȥ,b41Ӓ鄆gW'մ81[b2S#ôXǠԑXy8vC! A=#=((m[RdEM΀#ؕ@p˹Y>҂P^VJJ,cZ1$L9!H3]7sr9mAO 'NqCh N!  `2Qr@XSǘI/}0Ny VgaJR213r\:mYwYJ{h8,J:T+yaG53fAe@NzqETYӒʍ?C&dJXS[9:by3Tݦ3eUZ[i`9+~V_QFB<1dRSqU7G*Vm)9 ;-&C}(vCհ6G`N=ŒlK`4ބNݒ 8}ΧkcRW*Bl b[j ?<v!ͨs'<"L!~ xiѐ^ŏUNaf)\s+G!JY^' Ob+2a$5m]o)=l0Na-HJ]b RC_A6e $1:`N\m޸:7E "2B{kEH%TfsɋW'Kd3(7ƻtY3}c[_C S"ejQt\_q @`~Pғ4ׅD\eO(Y:ĭtubh3\O,ڞGH·9"+ ZV Hh{0B9(p2l$ B! 6_WKpwpWOy3 #y@\gaF[%] c]f6 YP Dp0TGHCAGq+ 48`H*PC=Ftʲ&bd? B&,qn0i:D[;[P-`1vX(+%arPW+wH 9XWFNj+J2 nq/Kn&KH',[2B rd.hxA, aWfeJpBiV6Y6gGAX1]DDG1tTIyqwT8hG8!H*{h_0q*5's;vd%K6CD|R~ԑA6c;=Cr"]ڦnHY[cKp%-,pv)>&zqI'B&YF׃؋YBbC5#HJ' .Hy@mH2a" <8)|90j&QYu\/iJ9fWfЈzT ^IiZ@씟]dĠ4Ơ9.I9Y`X&(+`4G?'uY B?Q+^QVJ0{Ee$ӢVSoG NQUEj؉F$ "e3J*ŘRqFK"%b8y8KȢ&Ewc~g|Չyh1zS6U#Pmt5Bz]V=/s4v"^ NuI/2(!$]90 u!'ͥQVVɀ (v5S5rehHƪB@ˊħ%E+/ dg`4z6ZX8Iu.>Ks+5) v=j F%B"q3eUcFƵAa77RzF 10BK窨#b%[ ڊHɫ* `0&'zƌ *; |T vas< *7:GK/LK+-|Xl)w!jTG05F sZ6.J6:A Яu59T6;lGU; WjgjW ׷TbzL WpCn8?uIjK&'qnRSoZ=O R>*rE&gS~A6ȕ"IʕīZX";ŋ'En6bËx'8v`WuRI1ຊ5 ݛ׸*5-QB~[S{m:+iH@ xizxu3 s Y\-ױ|YkzRǒP牽/oj`i<9܍ Uh!4pwQi.ng:!ļhW35@or5FRJ(<^[%$w(`zdV}N#^A>UzIFR@?yݕ ,A7WfC,.A1鹝Z`F)r@bPE`@/|_U;v@~i6X 2pLS8{ҀAH1g \J.,,n&7KP{ ~|!9"': wTE,č]8vM-K SX݅=+EP݆ %S Ѣt7: gj y)zTywִI NQ'_nzSۧ}ɍoP~PE%|f&޲|Eď||Ţ𦤞zn̿1+~8աPM+L[GE偣Hތ呚^8z:w z0IbQ;G셌쪌FbH^)NvghAH@)!_U _7&g*a-*w f6* n1\"Ѕò8: ,E; -l]Y6jN߹a5_c_o]Q]Ty]g0߳lr(_pbW;:bTpdGf 5v΃'ZF7b r?M2ˈ^v Sd_nAȚS6ֵ)j6ža )*HewKd nc%[X< vf~XݲŎwj1O:^ٞ2ސ.ܗGﻞM5Ky942Kx;抢zn|؝|iJ-6 -#sR?X8\*&xrbb3Ͻ[Z Ԋ_+PT ij@N<􁮁 IJl#%t:YPöBЄ\Caa(5DzˀcW4f!mu*| ¬of?r6Iט ug36Eb+У6z{+nB Dt0Yid<6l|V*njFn3DD"#Z1&Gh2sZP!b=AJ02,./B7\J݋N vR-PQHt *b#'(#ˇ@#pAMJ )бN6+L I!R$NxaM/n\c1w7O~R^LaJD.ԭE 5{9K$zp¢]Y qW$|G~`Ҋ~N xzz2<N- PeƐuD)35)2Ur}0׋vlʂ]%4䠥&Y )4RK&_|,RLƟW> 8PϜ6W)eaюc]$Y֢V åRosҨTfuxDFOK^9]>0 aS=f /IE] dLQz1V.Pa$ 9D/S0M M`9:{&*5kc5C+9Ư~% u%22ԫzY M,WE.ǥY4;Ed+2ř8HBocR>،C^P>M1 d;'O|3̹؉*@Ss_rwf2T%~e*L~+ֈ0e UDZwczv4;0p Zב2S)2ޮL:z'/:=iQoD͹Pl)vw7VX&ȥ\ $Ѵlknxf^"zϳŦk}9-ΪX@U KV8@klKucpNdÞwVf[ɖس@h ,WH4[xqH,9۳>/ }=n̰F"^.-kヹ0Fqs:>8קs! ń 5Oʅ`Kc,\'ځwTZ!}֋@BYvFZiyY'5إ?V\<{>Ey{ijޮUFS+탫(p!b|Iۅdvy٤H$hW x=Ν:%]hzd( g wN=42C5,zgcCFg>{j^x^WOs{Y7SY@u&}wwyW%01,Uz]5> R Y;k RtbB'xXR-hwfL8 D"(Z $6Nw>rDX@T? 0VE8UI^]XQ?%D-UHmQuT(Eu~x~W}nUDOgRQP.hL=1[=a }8>eB 24#H9~4#b6-ꔞZ*; 90%xⴰkjOdȯ |װ~}ۮڱ"[ %Mʰar;E#{SI7.*7F e7 ;pDzydx ֖9oy-^Y<{bGXAI*5;>R/`4jwjc+B|<֯gG5`22LK6s:k>kβ;-,S+:0>zRD=[X%YnKcŸ뺷tɋ)g76:PZ;Z9Kv)$`9ɫGqʽ{qKH% )t`zk?w+*[ڹݳRY۰![y&뒐8  IzDoZj4觘na52 +z*3Pm #)\ʱ.,%kdW^ 9鑞r)1̲$aS:x3ؒ.c_f[l wrڒOw9 p:p}ƞIZ#u9*ӂ]0GuĹM,U'75DJgH2J[zսI+{:*=]:-f?)h?3c=VO4\K2GW7KU6CY9RQ5eF/lB-p@,dG0aI1nBsEqD#lA(i@DDDIIIZZZ```mmmrrr# /$& ,#(!5'1%6(##))--44;;AAEELLUUYY\\ddllqqtt{{0Ճ׈؍ۓݛߡᤤ㫫洴縸齽__ƿɪ˅Է׊ȃنܜvic+[($t"o j$Сd ق SZSPp"{d,sd#YtR)(_dbtUKl`{k#Iz`ܙv xWMJH>uE 0mbl)ºNܬs>ǛJDܡY/wZT]@*%K#:0Tkڔf{ȏ7wușBg<D ?k` [p&(h7%AΝk۷a1}c}~U tqyHcA%wD`JʹsXa\%`#{q,vW~c`[Ku@#`R6K\-}PH=tWWM4n <9Ў# 7iI*I#9d *<'ԆTXX@93\C 1ejT; *Nz).phgt}aJ͖J7}jkrj1ReV[r}EݱB=:y*jjwCUr~{MP 2eX\喬JP?jf br9o$5k]{J /G9>;tJ?86h4"% ز# 42 RP0ۜ?? $ Dpz)Ta"*H0)BP:K3v fHXAFX0+T@SPHEzOu2qubFx :WDF/rh0IUK8c:vr48!+| ^Ѓ)$ !5yKJc U p]X n3ҟ^*RZE-!O lc>!ԥyDUæ/TMl/ |RsJ0U {B΀E34+{ھvUǢLbkM:őPXT}LII9>]% lT8EiԚJU4'Dnz&.F D+eU^s`2#?2˧ HdV5m{k74~S^v8}XPD ?3y#~7M[iKlB$6SNk F y*UM(٪ǭKG*Jժxo 1Z2 I>(p]YamFgZ Jf9XβO8|Hs /W 1 }o:vS~uوl+LAu>iha')rʦ𚵭&8vBzQ({;u9~Pu )SW˺[Ŗ&#fDcY]/F:g`MSJ-uF`wŹBh·V7o=?n"ň>2P)>V3=>X;e8*l\6kEtu/4YNgƶV%;!`De\34wNy>!e @;A3-cㅷuvێ3h{P/ԽM^nbЃL fp6[BF_bO =xGj-ۙ7AANA}. Mj59L>恧`[a4G"BSO45pK5V g:W'm/UAL6hPF+nB*Hw°YFA\D優-P `r;r CSD[_v?jH[J4~e fB WFh2.UtQGSo8)1[nS/{9[}S7oM3qe;HXA5n-O6! ӋAOd F*%m w ~17,%2l&XkXrhCF(l_Fga4P/$K]3z]d%JoB#8p1F3^SMGi?+82:KLuP !)(P.p b/HZ~wmԎ,\(F]VFVB(1}cTt$.f{DV6I<77hU&QH'_.W>GHe~F@(hSE1^{ _YlaiKP(P$IpsS>㇭ə$ J33A-rSn.uȈ tmIW&@." %2@4N@CJ]+EhU W ըkPBTvY+dV^| ,xhbg?ZfA@* pW3dYN*]-‰+3R0Jh#uPJYR*b3dPd^J9gAQި28pDA9Ii&Tz6/30\T9GU_CE8% t gUVB x"umA:+8o"& Q_tՅU}SP΁/!]t«CB"rYs4?Bfa14 "Qa[P0/:E'E*3 IMYP3!YӇ,7Vڤ)-8Os ix-`nG MlzmxesZVY؄$`Ƈpnf4~N~hs 7Z6PmkbWRZUsEy 8)rTuptר!;(gOX=\6(Nyky;^pk 4*`fJuzt D38LfXs^Pg1zG:'e@f81ꖋx_g3Ⱥgx3&hqLU4k{~ Sm}6G>#LyA5ײ _&j1!pʉ|RXt K2'90}X*T*XҴ٧g%# )&ႮؾjVy*Z&wr5DhF{_nz.` WÄ1GG[((Xx̊r9 /`pd>)bA٥+(GN ]̅WU۵>\ fܐ8US']"w]Ė Dl|\,~Lr:0DS2 eX9mɆl(2vS:c2h.eZ]FH] uԇmeT\ZWidmʬDŽ~fԻrZ45Lj/}Ga &lf;kmwFexfu|T𡲔c <}LC1Wyz(R* ]r+ɩY`eSPͪQkdT (gK(S!cx0lZsOˋJ @ؘCKĭڢ4r}1XKѩvƢjݰB `,{+.=\8)ph ŌDnh\{Z.'(p3AIڣ,; 4e㝵޼X7+ ^3NP~(<=7@F=Gs⬬N%ރ(3Ր;w2-d๸砝ޔ*u3飨L?,i6)iW=`:[jJT!FCV8P,:/qaΊ%@вpJ=4=.#Ϊ ( +y+~jL;p$Bɤqe:Ιv.p 15ފ-gc( :#޻z}fH2߽&SBGOȀ7r/ʡO q]\P~}2 BBvʇH{W?n-G_4?y{|8Z {2ĕZIJyo\>O}@{i.FĵYh_^1[jo4'vˢҰ{r+BrwYB݁}g.-%8HXa(3)9IYiIəi5":H::3ZJ:iykٛ8j*l|LH`U|: kٳܬyb,Q1QF"&:Xq#wB4(qƍ*^7aJF j+r 2^2N{ ӡA6tD&nՐRU2LXR)^Vx3l:Ƅ~A(PJr׻@# z$/K,+р.%ɭZOt'W\`Y%(<ց-Ձ]AR/zt:YXP3ꐺYnAQ5Pd(t;^YjQu$9N۝ ݧ 'xs'Z4Ie x{ zGx `G!X!CTx"A -РDrނ7WsyQ @ƌ\'f; M Sha8`,ԐDuT\9ޘ,f5_qXp5!f{J+n5^V>";eT_[Ls~MIo2Y=OO(9XI(\ Xʢ4De/P!TAJx0*9Q1nduaR㎥C?5:o洚J @Л(\ ,e])h:|#2DL"վ$?ɢ.K0 ToA +T3WOLH T"AލjfvP@L5~LEj@yH wBq7pv >-]DKO Rpps}Mhy0gb(ל9J0K xUK\R}DAX'C~:Wz-zb 0 MD&\PXΤ-LkD(&M7WntSӘ 6FJ G0 &p#(e,,1^JsDIM1jq FըpJ,Ig&ƦSꩂܲB@%'PxfVu*$X(7N@QҨ56~q?)U*'\5!k0Ux'%OS:3p5Y4z[ ,!;x,p( 0GNs\:,`2Tt1) H]3r5,o>W@ ftkWJyv"#yp`ie- "X@ 9l&#%cHJ)׿mzV E(2ݣ>S|a cbï7)Wx"-My"]&2ҥ|]ńε;IrgveKh+=B6spʛ,[b8D`;e'2xO374=e]$ s-'L@h\݈jX+ӒG_r_=p;tH·\6;&b5 VJŐ33bVv-!ZXZP-BuN٩xgEg)ikضGؓL6jmw8k< ^@ob&)[PG3zԏ3 p]њ7y.Am`Α-7s[f9g~¡2u$7Ie<~dZMIנv 6[{b8%O@k3do+seFZ#׬Uv\mIZ(DymzwIuG2Cw9IN2 0<`aINR9tYQ=' Qk M7p3Zܱ%WXO06PDBx(K2# 93@lVfs/]h6AL'f)A U lmOIĥAh<ĠAgU%;LR{HLx~LHu*,+\k2Il* vG895oaCNc̔@AfBA6 $M&}ƒ}̭󳲞sC|yU-CPcgкqWWz !sz ڇ, @SP,4"v7Ο C̼|&J@da'aVI B!ԭkBk-Z0R{,bרн)` x9Yr8r}4cDd?U&D)֘k1QuGNt%( )<(x3fφ ݁}wM Pht0}<~ S0=<[pb=Œn2&VM_~8(K!o P/$i/0\Lb( naչq7Ya(3sP Ҽ,-k'Sྎ-:hmGd>77NdVG<1gcS@ ,"{vjY:=.Tc.3s!~ݗzq /~Pmv 0 RyMcCy.T-3mur;Q#PI^B'>(MT}آ m7_N5JKSiY-GyVTf H \ ?+_@9)훖[ukMzV͟Dl~X3vzS[ACdLj^- 5J)u/) H6:􎹲1OXԄw)un|O㋺b7^qhO֯r]%/oQ%g+b[̃˻__==_ŦʂΆѼӑȵ۷ڹ#࿴ܓP-R' `6m ;wL>d4"J.""琙;C ^-$1&27NM},N̖q4DF9o%MHS9ݘm^#::!Ω@?D*љf]nUHFȕiܮQeWlqSIr %^#{`îdX/ 9tפVm1`"yOMSսʖYWl)cC!gQr{!e5VKf}3;e $4ůi|<`R=wXeM_vԶ@`^ !'3ႇ}U#Op I V`seU9#JCV=2`JU 6eDu 6;_?N&|%* 2E u9T#fI=2R) b؇y\U` evR]{^Avmfriaq^$ hghtO]"xߎJ}9flKG=tm}j9a%Z"(b0E-8{6H0`-MW㧝ϧuUhm0EZgfhc/C)+{:);^;-f?)h?3b=8`9*2$t1 F)NjL ;ׄ p-A!=g Ai {I :+s5aqDf!!ynByPiVXaB T ]Bv1r6"2*%YZL! v[]?t@Rf;Ep%^p)y>nO\OEf2T[nLdt#_P\ޭV-D,urrӓkD} D2ɵd-[l6 `сT 4[Z|7 X#j[B`\qqjc[ P< C Zl&}TXս~By[^qTޏm˛.5t,*HPEYd wKE>$9,wDy`TJcH\zs5oy+u.&V cpg5LlKO t #-;j"`"bpYxeB \/DYr#ȻӱBN1c}He~f9uA*> yTB`)H݋1{Ӆ3a<깡4J3!̠%`A΋uJ5{^UTl0CLPpc<Ẓ4Ɋho m(Vԯ'P l=#zγ J73DW܎U-ץh{zSPT6wM|\|k[3K_qL`fFz|\)c qNs>Zc94&4&*&3|a1QAK!qY@U $O!JK_6@iZ.n*\7LTG11 ~UAs`>)#|k]t|~c]"'}Dp/U7tFr})I˰bBC x}N9CV |:~$ORG"Jwwpn'Ujq|il};2g`z0Q4w)`Iq~-usM@DWb AU i -lB$U4<Gd8(7p{5z!BZ~2d0(NS -T00RNWiw,]㴅}<?0:ɢ -e}3`(K b7y ]0V$-ED)+0q+zXg#T'V=ˆ+LVuhB'tZSQbaQS[ #Vnc^rP](n{rW\LHQBB lCfU.jC0T8F3%-<'uG,h (P(?GUeC2G[`M%&(]VtQ?Al/0~QO 5}>`]JMC (pUs; Ou'S֕T).g+1[ 1y'M15̂3'&HUnv;xi)A8WՖ&:U`bDr4'S &&>8Ч~S6̂1]IP8Qi^tU1?S-5P&Y!҄>nk54LY]jdb//,)x zwh3@^0>3bpdłRH31p5i@0[iM O: c``W_$6Cvh@)NfpI$T`N9!Yq4iy)'ch0"B v(Ep-bVEa ҞW9qT  (=àsv:L0aVqv Oē>BLEog)#t?C ߷w6HTm$eWad"^-a 6? &nB:S  S>9sd(jy&:2Aa]j#Ll/5pݢpb ]+XZY-`6 " c xpD?I^$LKerf5[P&C:ڪnƉcyoA %4Z۲N3 IX#PK&FZHm:FVdb Tڬs }:!B jht@!m7EW*n YgzO!"T 6r*VNne);%m:fYjBS0)GC! {.Gė 5ksC87@ҟ7pT" M+.=0[oB Cw]ۜQʫsIvH6WxH3g!Ն`0nPj$6 ~h,Pϥ?DoGJ6&<ϔ7`-_/Zl Ϥˑ2r<b2|q%n7V@Իb-vS@a /pWT:a(ࡧ7xjQ @`0UӮd7EΛtP,ѥ-Q+[fJSHy@ [0B0-N);ijAO(@CH"kK͢6k|0ń(!۩ A)2TC";%i, Cufđ 6(pjG7EFȳ H)uZqU\ˬ)f췫u0:03*@.|J<sŁ,3|>봧P:_|hVvYLĸs >1\ȼO Iܯ\E-$H g acp'q,U;L(,ëU|F2ыA5v^nB AJΓ@.PLtitȅ `o1DgAx>˜y f11 EM ȩQGqU">EMZ>aϻ[.(kAeƄU|0Hu%g;º`.z#Ұ6K_1PUݼs\cɇyVy2`ǙA"[Z30;G])^W`lm;֑عKC/<lgѦ> {i# QR|GIN*MHYA)[U-v)|91 +ݟ865 ܂i}=ȫsUlYZyGsl)g~d-hּB4.jH Zz 2 )*)ʡ8)aga,ۍ`y6@#פXAaNMiaz3^bV 5+ڇh:v(h,-sYԘ|}'b01 `oNbyøk*i]dST5vxzPbݛH+tFsh<]3&4{; ڻyn0f7~HI* ALiۛ軦Lmde` ˉ6 ݶ\NnFdxʍ; 76-iK}Vx/f>EBx|/ܮſsfx}^S;$beʗRHǁu:dp{|h[Վ SyE&x4Kcn )_5P>@:J>>\<4(?Oi\KO??{剓G`;08| ;1 [1s]/Z% "j x8,0̘&e֤ TU0kzxyBG&bhPQ͊ͼM7Z ( Rśt- 4VKH2aֽ|Qy=Xs,u"CÌ$\F iA#$R)K. d" ^v F0^!\ 1OPO 1|kOCG(x䩪{5liBZ@+6 f;Č>ZvVagcJbf\8p\w')g\re7PNFU@ȓ@^ɭR`ux`1yV)V!7`xIY'c)h`)cd+7~фr.%xqxE&+@YfD)%9f!"S ,5RMID=y )S]%cTQ%oRMg}!ԨX"MљJi,  Q84aWtɗT+_uc:РCQڜLp O@d02U _n58P|` 2ܰEW&-&\Ja;@YQ R,TSNFb]Q (76Yp4DPKfFjfr :H&Bzq]8-S2{[ P0!;w3BrH&rѼPXqQخ|伔_(68de  #Pޡ{Ck1LmMR6`k/ڭKkk:ym xI멈?vP:aOA5 B<䛪y" =(@)DP܋vRN<++=98Bg6PMK:V0VK: EC/.wcZd+en/T8N+r+| 2r.`(B[ }g$dȄO-<dKv1葟M@ cWF<㞁ÝDR9ZE>A `5-*!@Q WFim袱9 JOt;٩hȇ]?eae6hlmbA2PGLX0@B(ONZ~1Qe#E!ׅ0xuke7PphR_\$B8@&#, AT8J*Br&bD3i4 [ JN58P?a]A=7"8˙ĹE_xέ!gĐlKeMJ-.8qО~HD@DR&eB(:3218g=^L9Y8u}S|t|8j1G&DcT%36N]o)>3'`hfŬS >մq3 0B!*DQ`f%Xm1T[[F8Y#U!3W! n4TFBwgaB c_P Uܐڞa nkY`iNB:0rv wO7v"G Y/ˑkѲ7Z-<3{?nF28n*wѾ-2)Z ZIt~isI^_ʒX&VtsDژv~[ _t`FM.r,C+, С~9GWIU%$ڱ 3OaXcjOtpoͣxĊaA& h l}=p{ߤ~hhi&uthP b( FX H1[XEE9lwiM!.`UZߕ̓fF|B?sK΃[OYG8rizx64tk'•k+RJvnd gy_.A`60~/9~@PU" }aN;-^@ r,x&3%c'N2QVG(Z3=@bM`RX%g@RCDF,sV/$0\ Zs&5'j% q @uVzcBj1QB5XD U"Op(H"j|eB#ANXdFC ї".0EkJTM,BKcw(HsM؍0u/x@ ,p#Pq&$(g)15jXt'[uHg  akW~csst T0@T4 Bs}dp!*T08_(Os!>(p`ՐAnw5Y:B_b8-oO0? $PGC BS|̡,`  li֧wi(<Q+6d keqwy'")Qy9l☘jc97&L)(PÃ~3Ll6%\.cO6P+fn%J] fB3ChfĔV3 Xe[7lmdH(L)?Dk> ː)yHf4T@pZYK- ,p9,KrA鐼YÀ*@;@.az~`~tL$(,W7u;D$9UcJ;\";$Y\yj_1EUy3 ,@ u1R`0CړiזeRyiQga3kXN% P8c'n=$bW Lp:{'%;ez>:`Su߲-f%fĖ^iзV$UW6(-mx"){I{7/:13.\c3ʚ Cp`ꊈv5n&闶jP{dٜlǕ f8g1FG&䡧Z4mAeiYe O;1PE里M&(ucF,ydh zP8B/ mdS1eu#nՉ-f8)oes^pUV]ePF z':f"t;4huzDdXăn{ zu$rv.J*HJc0qr:tvx*:kನMpzDx&듃^a5Ag0U=P:D8;着 2IT+ۦ35O%xʹA9 R:nPɲGM\5:릿H+]bZ Z9 r]ʛFҽaE@'8gӹ*+RCۻ)F$ '+!^`n4Qp dOzM3T .@CpK'q6;wVk}'ts)ev-" [=O+yTW8,5F(u .\0oL(`Ti}J٭–ʍbeũXY{mM5/Y'e8(j'TCK^tjx̌ ۀ"3Hv^rj3uМR}ƏqDoeP0 gti[5!^@$b.H#m̹3ruImt{j r3@C O wFMV!S qK6qhh@ёWG;5s)ƬU$mŒ˜1#D4 Ȏfn]˦:}i)= qޜU\Ň&JNP'xkjbk˹Z V W$|p0@Z{2h. =. 6̗ D *ѹb*hŨ͐MSHTBsL\ðPQRygsA`e$U׋J̑ɬI@čNpr#" W83ܼ`=!+*ޯ9NեZ4G-ی P7Ӭsl& RU{=eC@^YK)~E9!T:Sгil ]_J78+%"[2 Brq-+yc3@?CN, Ӕ ǃo=inY|7k2Ѻ s];򠽘 C ʬ7t|JYpH>x̌0!s'茓~( \~wC<?2NZXv̾/q̵6RFTn㫔eA]5T)̣MJ^6Qg@vz;4͋@tb)<'."S,C1.VW1wc+͆320Bl"A?)`}X3$ mrnPO3RwIֱ20-V9C[mTvͺY<+w1 .E7}%lBE|b"ޖ!9Eb:kX3Tn 8OZ3 V QRhC/8#IЪ)ʿmA1e~@\ ;psocU,erh(bM?B^gC((C(CC-(gʟͶδϺg˯Ҫڦݺ㽋B(4RɊʵџj@Sҹ8ZCX EE\;iJ NT8r?H Ȫr:)Dg3+kL1Uf54MǵءcK/ Wzꕕa"ҍggPӁMi1 H tQXJCRQӓ\%w!k"6x w(ׇ(0FJtҘx"E?[$h6`O|1b99]:wJZw`&lƤk2^(F7h`M,Lx~)6"yfiYk.WY{P!6H5l)zfBC!:J>CJO-٦!ܭX֮ SƓ <\j6䣮4e'U@ vc1a-eeO^b\ˈí <+#G|Κ!,;8")옥LI;Аd0OV2gp`!UXV*\THÌ=FH=R~5v۫L˶)[\7׎=c$pEr3:"N*"Oq75D-${'$ӃZ+'ztyEJg7q]*`oADPAi5l0~>ɵ7$ aL(hF6݂r\aO|1)a0,@_ݚumOLOF!%|9ܜS @@ip+TJx E 0sPBv:'Yx߄fLK !)(4X;S$\2:p #2EgS/rFbXpc*=1ISP`aBRux,}ɰ/BdM/9b8T1 A=Xg@31R ]SB;'b ISҰ݂!eC%/Q Qz+H)@6[aZDyIP3w5/X/X y$'>}H ͂4FbwI) 頄Q&#mH_ `6py8Rf 4G $ &[ye/ϳ "[S+dN@>.)_xW&h0fʮ9L<"uh SM痫ps1m]la5 N$oytP< j\*toAz|3ϊxXhx#<㞼!^w2\0 `VfpK)1r iئQ8c5r{6ÊJ޴D@Bu|mp <_*^%bUqorJ260$p!\|N  Y kW.μⲺ)nxV/92`T%zì^sHZr6|CU4=eϹv^TN*7e%WZuӪux\kq&7.PtQ4٣1o؉ T4t %FP"~B*疾}?o$U_˧$*K{6>#~Y)$GLx{'{7.DdP #B}&(\=%bno@ӄhu hM6> 23HGO6;)L#hw%~IH #OhOQHq=CHd9_%fgz?X-l8.Qi[@o]x|)}_7!3Wb\Ey,RhCh87 /E.bO`r>'-&8{Y}y§f@Q1D Q.ZJibȃ 1i[ CVoI4X~h{bVt\W@)Cq:ʗpiBM3#i&E5 qF "=n/9L6 J4|w!D*C|XOXb=>"F#>Ԋ|ڀ!ثj$^SG Q;_#W E(Dh 8{⚏++zb n:# q>@!e O* kO<h>'e"vGjH[sĴOwZlj"4Z\;&j  Ni x+@9d/hy`ˠ() ָeRA Tt믳_W >nY( +`+Q~˹f+ٷ ._Bg_aP1Cæ:;J-ޡ`c(s5'Mp4,sZgd(50C4Ck 7[r:p{s\`0<E9!o+k+t~K{U{H_(B,KQW j^ak܃69[, 88*[̴A}cG7pDQ<t_L- ȸN l;9v}C M 8X-l95 ;@a-,lܓV\@d ?ܨbUE S$MLfZƟ{mXҗ~;̣ (GblN<ǞW M ʈZp{_!)Q.i|&k!,E %%%+++333:::7(t=+|:)<]:-f>3b=8`ɵ:,tB(*m\zo8`h$3 t-e]XPecw_<̉6R&]c$Vd W+o*D)J I#Ayn@ƛIը`@~3dKWFV"0Z]P&&e&C"L,!c0Z`R+ eXF {%9|拀 hej"`$wL: BR_:jgR7]J|iZ͡ivVç q>Pz0yz촥A)6ݴѡj4(޷!im{ 1}ʸgh>;pinYހU 2]0.wæSpPpB{*8sD &oyˤ &T !DmH klHVmPI48Q@tCfXcO? 1(ob6pYwmbi< .~ΝM[D D{aN)y;g,n5LG4IX˅{׆Fzqf ,μloUnE^oZ*% y,?>ͳx1Y֦?W=ߖlDOS?xjX֮95Ё2THeb~`x'l`<[:Mex#.B~TCZ9Y/56cB4BFĝDDvDI!` u*=ˢ&vJNˢH2&3FlSFh:veˣ'tr-?-)YHCXn+EH1#J鏘,&uI(n1{dZQt T gpDڐ@h~%mtҏr?p9̼X-($* >&#Mz ` |@x.<Ӏ%'<H!(e YC=u.1 .2?ZoOŀc`%"~_,3z @*# vJu= (竰8i:#/zπڂŤ_jV"ggq=_%rj( ecֳ&ܡ(>\XkM) *bp Ip+7TptX['\P@`Ƞ/X4E,jJ T!~޺p?S"DdQ;&!:̭x h.2NVfu ^VkvN.hD[t拶g%0(yn,(ec fgTbp;R]P(;w(Aqn5%U)vO8K)eXu\DD^\uӡEM8sw|azKnp%[8Xɭ'"@=^۲!3aox#O#⤓TZ=S@%\+yc +Ӂ!CBHwNdy4-gU.cdkj2Á|)vL@Bi!>{W,·f1dwg14R`i@V9'4 (mnEEO豀ne&i$ Qx& hpƳ)03 w#K xd`9x5t9D$huvV*k.Wa3z\zdE2|>d}C,Gq5/WKAN8 pLOxy;cX#(4cG/z㑋0g˔aс-edjYLYoHUu1O**\p6v1'~A$0DpQ?8 x)Ppx@d L' t;Z&(=#V u9X8ŨI ͨs[EXom֣?%p8{U`(cH'*!a.(O#3OTH?B;A8@t$1'sSp<`6QUV:Q8`yxU3K D95@/PKJ|br9u% 'pi~/$x%f-'i{+$+V8^D j3 cm&/ML@aD@M4E%fVXhleXP%c1鞑@'3BΆ(/MeOK:\0?e/D-j yصZb@cN`H `6:P2'tj8Sp'1Sp' c5`7RFB2Bn0?7#x9Zh}ӥL w7ǵ6Xꑉw@ ehS{v၊ _sd ~*D(paaa(px+u8k8F&oGDw9ngT5wsV%N7X6K:[j鷂*rXW+̰)gT( $Ornvnt`x9wrՖC. w1"X~ZJ s9@`jkC _(QC J`7p6`eI0,GQ[]l*,) bvI"SZvW\ ɗ_I8CMQKePKD0@:s1B7` 7ڲE,k {sb[E\*aG &;@N ` ~[KAp:8~0AsgPKPSk[n:Ebx?S3c}b!9 p %y$.曝ik'Aж[]!y1`+@rg}}ZTu~ m P0Y0][q_nUqv7AdwSICL8Sv8(eZwaq6 Ԫy LهeR_dUw}hæ(!TDJ9,ͩ!jpڸ\WP[vJgRpZkAt`w+9#u}`iKuK$} iGG8#6Ŝ5.қKa_!әPLeZ1w "fU'qbѓÊuƊ1S:ﹿ5![Rb9vfxV$T`r]b8N+oK_B'uIM GE(D+ycF!{0H{6#Q!\TR7ƆArvz:+ ]%4${wkLS.B7[=%Ќvk%CA@<]\ HavAADsAL+|V,I00p2a l|;QqWN82',ʩw`0S*b{zC*7[ <>UǤaEүL)dpKaa5?0+,Mm%E cՊlY>{Ia3&GOvpr &ܩ1Ǽr7~xtKk~Kxّ}iM#[!EMqqTm8(ɿ'&N=}Շ-ҿO0gS<6zr8z\Y >P'ꍃ&Ql{R]Z`(j*-,О)Q@ @iYJ]R?]e$p\u 퐪V@c*+΃!  չ*޹)5P46~Np'#LЫ/ R.4⹑de(^GN1סh%p4}ڇ V sd#.[uz'7I j逽I|M2Gn ;>|`Y`(RmN>+iCoW9#SVχK.4xӜU.4 p2HF뉭|^-d~ޅxtsx'1o*^$ю\`tƦ(кz/0Riϼ'>L>ZθΡ:,/r 0KԦϲ-eޓ`Zah~lrRcb IM?!{`Vӗ &.F9|+.xʽx\kǕP}7;IjSf!zD(-X ΪN}*0QKơƐ>Z?|UѤGH,;&);0Nv~Uc>ț6liKM1PZ s؁{0\91 )@@,&4ͣ.C[ʎHw6ȚLS(['M-ZHIpX91ᩜ1Q6HXhxh(HHXRظR9Y HY9JZjz ڊ:()Zֈx눋Kzk k( 9yʹYx*]l}m)ݚ ˫{Hĵl(T:L8+>MJ]-0`+ocT*qnݸ$(J\*nzED[7jKwHk -ԇG;~ĥ |8dK ޡf+TѤr E`:%EXMpͣ'bB2oTZL۪V˔PdIc2q )#$- 6e%6ѥ.>m jT(jtZ{Ym1QAI.Gǖ{,}&D@%̼q[7ωrTA2G|Q& ֳ{{G㧻DzRHӢۛ|;y Ѐ8q {a2̣K"LZ Ã37& RÀHM6W,90$w2b;D0*<:tb*L-LDRj# H 11DV >4NĤrfP!D2c>zPt3,]舋0$ inD!㰩Ά‚x) >dL'5KΪ^fN%Y01齺K yZb.Lhk&'%2P1k餴zg6vi4|[:gC =K|Ɉe!ӆ8`IVGymxbSK4D@~onIZa4/%6ʠ1nUメt taIɨM _| !Z OMqnVks.₦uJ\M3~tT|DWC^,y:M-B,DDW H1zm ,\MbRƩ\$3[/ZF#{K -gFhLw^I$D )ZӦ-/w)2vߢ_@&cI 86-1>䀉7L s0|j_:u*>`w%%l"㿛Brn>&Po]El]kt 7@ Y2RYVS" BU>0 1ܤ5+ N/d 3Zk%K &eqv'Yp #*ahlc̡!`Ip,Ј ($иEą0y1@B90@p QII{Hb!< H"&`8F$&;yDe1i'=iXa>eRhG7FeQr:{Qr:ykX8xĀS$6qx$"N3GhJЈ&lD1ش9/1! 9/ܘ-1 ޡ>%Ig,9R:zrp\()5Nd>$ zPL  `"F `` &JHuɨj6Qb .T-L!%>6Ѐ  |VH?B|& ?jcffqbn-Ǟ9;9'ǖN$"l(/5Gse[BRZef6i) d믮9([mXr{pM&5fxp-%1E&o9"|Y6XxA"hY@#m`}mCgY߉e {7 m5[3h%nBC2sO3k#NB BT8ғo@)ȁe2뮆h[M`Ye:^!`b$z;1[ɧ}sz?&M\pYjlQ;|]WAչ:PXl^M*8G/Ζ\\==j3kC@D!~zmJ pܹO{ax,.&`@*&yp$Au롾!5 @# `nt0r*FO\sEuk>Qls 0@r XvtGWUat C#;300UBLP\F25C/48lA*vm"|Fg6y%@8h\%k(pIT#?U cc?uB,x^]Cw~YcĤ:p%qg@3\U[0-jWkUxIS.gar!{tB0;r L`r-](s7b b,43Gt p!#+(U8J"N }E{HgymWE{cQ@?p&#=U`qX~g/8 8`&3|gA V*'p $ GuUx C[#"|ecyȋjބ]#~ȇwTU: /91͗@p72' R>}$nuGCp|Q7:(u ]PR5e R.x`{0b-)=A7e1DR*XH(QI)֚ u ÚԲQHe )@YÅ-<>ZhxfOtW"/ScbnhfyHu[ė0C Z ):$7[4V'.cv `_^w8ŅdMG)ZzA .`N!2HH&"jiZ]5VĢ=c(wTU 6\QkzpW뤢)zh&kDvQ" % Yt!9k*^ |{}7GdB\vãy@R,C d)jsYZd&YA 0juɋM"ꉠ%$3yWƹy꬐ )vm0 MZ[F  袧Ț/sW% 8s: 1Xv40:d0 MԘقd[縦SuF AIGeXeEb#_2oч7Ir u7FُqscҲv ?PU:Aӷ"үv4FQot0G1cQ(f5k5RDD$A4}6˶E%ʫ4pk2 Q G)4z(6.rW{Gl٭ 9s (IXٴFƥ:00C(l5O$L7~yoŅLU*B=FKL42pcEK󵊻B˜+[9MC#.J5ݩ0/B{{ RD3{vϪY2L ۶[Q)%i7EW" 9L]pw0z0;d/*$ [s¾i}HO ' qfgm!u0,J}YK:r Rx j`\0V] ```B`h'/c!GgCC|ZlY{JC]  tiK!A+N@P $ܸ~Y77|tH(`1 'BKGE2hQck9.orlW˅\d: |c(9SYDY'˓'fѼ%g'vBF7vN)c99x깉ΌuQm?/ ɣ"e /Wl;B@!]Pξr$V%B lG#QZ o5wb(Auư,۷P2pZ"X[D":J+2t$~yʕ'O*\K<#4kdAS 1 ]MpG!l_&t)o,,]]5(b$NVhG?#dpZǶhT[j &秵"ݕW|I u;ЙX&r'ڱrt+; &ollNIf( Zb CV ڨ4 r`mVu,xf0g퓌_?cMٞGKЍ8xDy_%`kMMS}iϒ,gWqC~:0fwX1b aͺpMfڍ6?d4M߃![C I.V9|d= Jy;@I쥲QC\HJMFT5Ct3U L]N`t^.^y9oMi4ni͊, |K^X( sO.`eX Jm>.lF rL#|p߲wP~Q MmKrd]3ƒZw6«*@](>e\ %>5}u=Ծ%D0DxVҐh{w>mt{]zIV^=!LdQzBŮ@t%PEL~x.^6'-qGB3fˮn<$¤'*oJ|P4tWcµd>~=_ѧ̣Z3$/dV(p̻4LPeaz D%.K"CC(. 5lOqcv6fY 0cM>'; xoʫ\YN`;q̅0z z4v[uXܨPY.=z>Bi|wsQv["?y(O0Heo\CeeDDe(e(e?(D2B4DND7ʃb,6Dψõɢǐ痌5@`YICհ̡*Đ ( RԩB>mX $q#+ծ?%[&4U.RPiCV)_zi(|$dp": "`raǯ \<@49H߄s 7(h0ؕM̗ E#6Y?Ox,ݐbٍT8g\mrٲ[[e'e*SeU(z+ ƇT:Վqj2\PB B@E1Zv/&OJ"YR\~cδ_NJd5,̈>Uc+5o6M$Mײګu 1娌A X 0!0(;NE2: ,v4Qr % Chnv̏.!c1⍒^>86G-l:F[-:jŠѩkJ6Zl! #adAN7C@uX`xvЀ i|ܧBZ8HxZ"`Đb.,:$lJjgTLa aSNx.}ɒG`\\. o"Ջ<]Q&0Q A[%E IF6P@E.[ sHQїW\hX:+kn^&o4)]ITFeN-At3c˔}%䐬(kGG 1N9uCr{cIZ"K,l-s fmЙyrg\c.A'PU`N{p8,3)>Xv%Ar!v~P],$2`@(\nNeeh0p$9*}:jR :#UD%P@3 %c?y/ g JDPPSȽxgV&j)@ %AjҦHsÜ6"  Y{$ZT*lP? Lf%۽s&g `1DF5*F Q%Y8#܈x};!B\6ʭjNv^] p[?K$b`{W^Wlz{.Er:sZ8r({P[`oJ)`5@ 6/QG2c X*<(H D"lʚJ£ƝU< -Tž1<)a'ؠ  gQg ݭTP$c񅞐hJrBa quF cHKL[B4b]Jy:-tOMb|>?6Vh2P e<*b3Ħ*սֶuQTŕ*$IL(2B^(dq63` qQLENG rSw^W*gdzRQ `b)7כdK cݍhKٲ2t Lho.R'D^k 6 )H*, }4ZW\W=XQ|wo!n;Iޮ;qm=?%c3fXQl:#`@6pe{'&0 d|T`FPyRm:Sy^ZB~Щ8(`B(pFggiLE 8ACF7! R*K9!d,yIEl 4rfؐmHaS٭iKX j'Dh[G*Wߓiew]BjQF3 Ak*uuEgwfYp>`qe&f3u sfWJRR[ DMDTG#BPYaQwQe,W!/@&dpR;ETwHf<*\| CF 5V8ǡFQBR'@0I8bKHi&j\,bf/ sXE1g?OBM87O׆gU DrrR@<(0Lx@&7b%"RGZD N7P*po% O 7D`I L!Ty>E48Wx30pt(N4ODq B.SDpz8[2Nt&ax.xC1>{z5[t!|1Dӥ mU/9P53 _f"7a0P$>iŽ; 87GR-(:@Ȅ1?{}6-<\aGhOzBscF26(I'^EAU_Ef!N(xpQ=XLㅈ>W[@b7M:%D)" rXX8{GJik0!Vk;PR 8aTU`.$"z4%R2Uf& [H;kG 7cuw,>҅ :$.wvT5UXN0cȇЌ-83iqX[BGW4;D @GU9E7‡vt;9@_q/eK!^PͣJS A6uÞt=_I@&>@F=٢xDٔI7Do\_/ Y ]p{S,Y: 8Cd\r!JeZ0 ωBЧKO#Oc0N6uACixq3"Y`)AXF(ԛe(Q(8 t7Z!ҊUoe|ؚz)6 sC6ة FZʤYHS-D Cuz4=BP1atziQUC3fT1;7:KBA&F&y x<zbv~DDܴO;Pƅ*ǥ_PQ4:>^Ex`@ci5C6r(x+A_ pQ7p:&stQ:àpW ȗt)2ej\#@eteBgC (=L#1W0aph&Dj$~R rLD6zCb12@8-s1k9")G@pUqɱxy18% XR`X{kUտ_ڰq_5v&i[xL`42mk_*L"v;L:rQk<ͭ̋,Oٕn} NpbϷq x9Z*|տ D͘A\(k4;]BGsR:C3j}c{(n5]izYy+ ;0,lTIdcMvPP [m-w ƽځ=@qRxwy:K$#_x B)$Mz=sH; lpe0<z ]ܟ ·v$jIG4 {-n/t 3n_0ac@EyzMj(َ|[gpx-kZ3F|{@wV]FJ1lm˄?8qbYװ7+-Kdt~ Ҧ5\AR d;R>wA`n~͘.I1/uy煨=4(YfqʅhٵNޔ⫎d Y0Y6["ql,nu^˘Rբ pl'%NGގs~1wWm>  .Rʬt4E%%7I{95gt%xi-em1=@Em@n~Y!Y:+K= $Q`ꭞ WKj %x.JUpF(0@vGf^qa< 7pBZUL+)u찷}HԅD&s,{ae)g[j<UNu8 ]Kè>` DoN}6`&oBTD,(H`V\_݀Q6HXXh8HRFX(H8XBBJYZFIyyj +;:kjkk)Xy!Z Y{Hlxى;rIj =^n+J(J.ݾMTŅ,/ - &v<\Bn K7Q%J 8C ^1cjСJu'|ii\FZfL)MGB+:0dڴt4²(( DN*3 ~((;%kBB-/pMmWl8OMo`?ݭ$YI9uҭq.ɐ碋̪RA| *1''_IRVZ9nSʱoلJfh'< rӏ0snbɉwv혳ְ_y >-⛜y„xv:o~}/Ya_8)H߂afu QEVLV]98Y}\t! !&%M B`)ceA^b8+!R P,ÏQ*$0E>H6-3B#X]]aJ$! >`Õs*,*I|`Hwa~͙'{g.IFDQVMi5裟B(Le2-?A( EЩK)Fg[יPӰdk+t)v9ٮ5#5̰UOeں煄Q;UhfN.d֧`6KtSBZ(E2'Z+8BMuPR;_І(.iaa3@!02j(J,UI'Ṱ),0Uȶ,rnHr}1<387uDE`U)AELY+}H7dFQ0j׉gd=7v ᐢt+|:)<]:-f?)h?3b=8`;VO3\K2GW7LT6CY8RQ5eF/lB.p@,dG0aH0oCsEqD#lA(h@@@@KKKTTT[[[ccciiittt|||%# /$& ,#)!4'1%6(##((,,44;;AADDLLTTXX]]ddmmqquu||0Ճ׈،۔ޛߡᤤ㫫峳繹齽eeƿɪ˅Է׊ȃنܜ꠻%IP^CI蘱4a7h j$c.A,!7QeD)!2aw-W̸\S1+D1~$/EFP˗ؑJfMaP.ڰ&:-2Ȯjݔ\~"6\OG! C.׭C/ 2jГw'd0{/ΓBʂP DVٯ0:\{pE !PŸKg<.]tPA&0tw<ϋNI^ ye@@ UtYWyyBeH|bPI)gaMC@ER"BW!W $bdb,8l(1"B` 0XxBl}kxvOA[`a4C'{okU)\J?\AV-᝽ +e"q%`@kT[r o ȫ4Ak({eI$Ƕ;Re+sF~UR>B,ZwWR}bIO]DVc0p6TN+#|k*l\YIѬ&[{RjIM0jR$RnMla,0 Wx%_7]$f-ADy V#zS՛BfaZwtyZv~%lcq|IM2fz"kuP|xo\%B/cҬ; zjbƦMW>|ВᅲP"$}kvO.;JHD]]e-VM-uҭ'_0jx5c$86|8 d-=$R$1hCnS\(=9S卛3ځ>؎܋ _zwJ[A7' K~N;򻃑KESXy( CfxAԂbPi;DmWc%$ [vgx 8D^z L{ؗ#Kf.U};omiI_!}.I@} ȋ/^EN?4wUf$+T8S`ND6dC 6"X 2\VYmrW~Z4$5}v$R&&!~%1=-`GkX|ǥK)]5ld-5v x`nV{E($jo(NP}3M3%G|aNwctT Y85,3]-Wl7pfgmp~ˇXvS^51K}Zf6A,8~j)g\U@(<30AS\/&i(؊wx3؁rHCψUը2TO2.XEi@U?@*q~dq~QeCSCw@*47"Z80N ϊAd[6%R`u plz3:W87C@u"5H E?`4Z(p2)jU)p6061ާre;( uLFM\A; 6I@IA)z3mY4;)v6"a\ `Ȯ֘iNC<hbV-įk*|]/[ (6VT9/6!Eq-ˡrXqFsԎ䄂$`2:֚Hx U;9 HJE@NJihrJYDj+)N)ԓ'Pq ;l]6}SaڛDn!*U`b #7C(K4(y$\#.e1 6{ICtĽŽG( Tű1uPwĕ#^tcF,D! wN9F;E؇]1c CpqwOmSLNZg_K}yғOYˆ]G;C>edxwXHPh=! OǴ2ӁŐ):tʧ3ĵڬkF\U4#emrj}ot!u n\W'=sM3$  g|B}b ʊYPI])T>حͰĠ?baJ#Ty70͏|CY\$"+DNw)۽ ='Upb0e$;{_lvK0\հ/0;m/L!AzB=PCNxdvWؼ!Xa`$/;v;tk,/Wx=Q@4y-4Xe)/)w76}"֫ʡ^ o޽:G*'Y`|B\LIJ^@e6޽4EѴne9Y,: l춸~aSwތO~a"[&]L +7`-;$c]Αz1﹆d'lD1Ȇ' ȘӄK \aw_4ڛS;^6j-J1Ϩnƾn: O3\VCa^_QR|:+WY͡͵*lYK<]i_ɼFoL+D1b뾘tR_\J8l( H[s4sj8l\|574>ޚ=,jR2y{-?7]8nʈ)ȿOڹ^$aCsZ͕.6w# 〰Q6HX82Uˆ28)(Xٸ!Hi: *jZFZ 2(UZ{J+I;:,HKiWEHJ9NJ1Ӄ蜣ެ|zޭ(B ?,q~QRu ;4z&EY.LÄ(<֙8N./bfˡE@)H$tD(@ВCD\\a& {-~Rמ302,fŊ;w,Y\bz˖+ܰ%#ab#nq/$snDt$WE;Qi??Bj66*ơvF#*!Z3dСk bmKy ؋jĩ/DQs.e :D45 K vA_:NibG$ BbLmjN,zR/0,8rhsK1011-<7%0z2ƳDu9x@䘫XhaeB$f P 빉UKr @!-B#^PE B $p2!cB \7xŞl@-IHĉ0TBX"?peI7sB;ƱbpW&k?ˊsDq&g !T|jY>^ >ޞA 8+xC2'E\T"{NT)@ Ty&ic]y6{5LLaݾU[231!JU1f9mcKDJr*7KDuh<\xDAH)ORt/%SJv"LfTh/Św(B[qWk$ ǃZ$ )!|lqEd]ҳ|\H`_Bv@TKa!zaEHV!x?iPUR1m *"pKQjMVY*H:tu>E}` $zU[ )NBꕯsPv[櫅DA.q (jBL7>I- m` "ɨ0T4 MDO Ej4UҒ|8d(m@BIx! sIDJ5 $VKXRK*y'XKPp=[xY->]nrûNjEC @Svv@*1 K &@7"q##VM؞;/m,לjW%̑Pu ;V#3A ٹJ )eBkܿ$ϔtL(:r hq]eTe:S29HGőzDd$ !g mMWZB[*E:v$PP$z3H,[igi0G i.P̒?U5VqlCHYV-@̸ R#f%u'pDNByI3$a.PXAIϕa?趃e AX.&y!TU~GI&!zU]-cZ`~%S3%)$sQSĞ̙XNYat:g#Oq}l4w Eb ASI#Nj[4Xk F?}] (@K@M@.l6M1fNzRNhxnZ(/-"A(p[3g 3(RT 'vX1,Α;e$B`/,8<ĊDh ZGݗytteN \)@Msq6qA1}lUXSvW4ZJ1c^(Q(MQ p"V:$hn5+IA\茦S@uXN= !U7Qf6 5>!ƅ SDLg۲|[\Ò\sGdP>Ц e*{M]VTum;Sf< sHYN|CtJPo[ Ə4#2).Osc\DrAƅK4y2GePB Ƙs0vgSQogJh2%yGCRt ;7Tؐj?gW49GE 31(0 Ɠsǔ2HW6"tiASZ2 URyZHE-tKL8f fay©&h(! 5S3'j6xdPSDKCa =(y:PId38Ĝ+vIGec 2ab ~AwwɠY(s8#I39l.P^u r1"`0 ʱy63J'fʗ; L3 O;[UYQ0qBQ(^UJ\]]R{Hiqɣ#(P-: PUݡ qR1x*w *uhڧJƗP/jV9:B`%Em(+>f0~Iڝ8Ffu9b}Q4^ƢV7 u Sp} !d[ IiyIAQg2%T8h=#1*>""0ƨ'3k\JXR4] vI$`}1XC PgwJ!Ap5 bK"H6; a@CUqو;V 7";U 0$ ylۗF61@100\ 5ibY0/8%>61 /˶v$   {/M in"F 4` @GzqOZtcQY<\JʸBU?s k+%_; ZK\iE[T b\Rb布̀8~)udo,;䙼M§D[@ !w "FWۻHj!*xqTtD˅w'k,0itIMG@XR ֔ )`;@Iʰ9 M Y<˽UR 69G) \oeR?@q\Ӿ f$}26!$0q `wPk @]I3Lj{#c%A+]]%W<@0] ª {t-"V$!;UtC:o!Sg Fe[|4^s3d05!T \62ey2Aw~%wl1f97p-h!̀RτC>@ y.`z\k >S*wHj^sfUK@Jb/9&< $0}dŒl9]]@]G4( !&d ٱwv;Һy.SlRlؚC0YPZݱN {P A6IGD†bjr8ue],%\Ѷ!3VgUOI(|X{ܽ-!0M7Sc`CPсڃЁP0<ǻ.]U, KƦ\= {3\ZPͻ˽C[EJ$1-1'FC2 oN<5Qr]P '%݈.c()8Fً;rE䦀 RRdscV(: z[;sEX3]*=tda3E5JU3Ci9.m$"1>mW &̓]ZC>97sj3 Uc+| ds`ȶ U{W0Ǽ}Fqx*5HHk0Vg2[KJܖ ]pP6B AΠ*?9e m*sk~Qt!g(@[~݈Zg.5? kl vp܇Jɢ Yl`fLS^ՉM<;k1VQpG؆XLمuߕ=26 ԅdב``ԍnt cj t(''p!?l[f"+{J|l'5(i6 ;q5s7bpdi4S| 򀆲7Z[b=">ꓬ̨K:3A}jV&͗: )s=ɸwrW!,]Ov/ S":H ia&AV x| ,?DB< Yphr#~h~ S~ :}*1pU {ƨ@3P@. dB@ShnpiY]8B >rqb증1Xᘂ #;8w{s5<_.? ^0w /]&mY€ x~\g SOZbW)q6WT C6c ;RH{.̑n)K傂8T|c#c 0F XGW.#R"aAF\AxO88b;3vuotFo`5b54tI0vzX8|'' wh]cGbEgH':"sdhM?0G <X]~r ^XG|~xn0ep05SWp5` B0]1V8P7C5%z&E0[ fm gy Q j('mdDo%s "HLappksoѳDuH|iz2!Z)V+VÈhRX;]}|5^ghATRB~25P;4hH?]uD}oޤ=gt)}%9kipEp#+H 9A L`%~{hxP(u6=17vcd1S{5L|B=5.^sCrI''3P+.{q5_r1(y!US0apT J8K3s!w'_CB1b#SN<f>)2xUT0CT0>;ep{dRZxV~,uwqP߸Ȣ- $Sz] +*U(К( b U *oc'>@P@W'] /Jz WZ>0 *u 7u X(P[^CBCx6j楹ƒTz.!Fw?Jj11/j|f.sƹZj 7#%;P,p<`0A@::ba~e D٫J:(P%SM`9T{O05^4A57CB`vAڭ`8$xW?)OAQ1*9'M@)vjuŌdCUGK`fDŲ/h8i0-F ʑ"1A (]9+U$ zzt,N!<0Qv7Ѥ<ĕ-2]O>w 0@Rp5XM*tOD0aFC 8uQ,)I3C߆[x "I %2-*. i7q-odșL8h_(-H]QZw$V ?`SH!fx] |՗vԬCfmv;Sfa Iؚ㸋P:H?.)qCWVp$ YA`v97yfT ;ifA<>Q~ B JU[}c!AD땑˴J |Jߋ«X̠gCU`+G!Kp^FA6b<m*Ѓ!zʵ+CVDPR&}P:K Ŕ+jҤ`X8S!CT89wʨjFD1=* U!D"qÊ,Ot wf4A!J==*kf5pP5pueV& lɃ,jZQ0pl"g ۨ 6Z^L; P >.C E^C @6N=8 `="NDU="Rw g_˦JhRНUW5H0, ^ 2;,d8w43պ끱yP` " )WFpQO;b2/Y$R;w@Pu>!Վ$} #DΚBDN#}SP  5*fUϧ«G 9p fTM!>{HA7 17 kܰURK͞:b/* Fr;-4T#\\ "㌣;in|Fpk1C`%A'~9YG*qP:5@qZGb]WRrZ2q^؀b'@\~ x(Q0 fKDPp?K~~6F[4%PR RCl{ֹ z[RPD+)}QlJ ;Uj`@[FfP(0GMnWr 2*\j`-[KF.! 4exx!rk2:[ OnT_!?ـ]-v_ZeE>oUD fw7w[>ty򒇻,2N 86"MN +s}{Zoppx铦 4m.Fz&;=,ORhkbro)8dYڻkURZj"9+Qv θE)UWi[x%pݭ[ *`Y/σ20ӋAjNڍ&vO q4U1ɼڀP&81hx(QXhIIXx8iH6T5JiyyZ) {*Y*ur3E;j(*H올iZYxJی834U,l*:LΈn>K;9 <;H;l @K \vA E +X228k#}"XȘ3NQ )%q񠘨%ȖT\͍I-1*xr"@tVk24CAE6.]eēDm2֬BI3,KRY#rP˔N]uƨdO}*Kj\XU:!?Hʔto9:vRs9:SWyֵީPT!S!**YК'K;-= c"y~ Q\Cd|w~Wzb)[ ^J{ŬjRFOh!UO&%A;SdI p<\2F\"`p"X(hؖ" BfdrU](&4’0DBTH/8A`^e5Vf`]gR֔iQUId&"H-c}l2ä~Ny4nve1yO>RPãեR x2^%Rz*Z #$^ t0G>v5Ii!QFlvmlMP9Ѓc9UؐihomԀ%5q[)7]H4<'c!sh򤟭|L%d2B>,ŃpBs#ŲCj_%Y2'w)4`TK|~#n3 /Xfȁš5#/0:kζY~p:M/=glQ\(ZAxt d' hpIQVXLэٸřы \oV[c֮ \0Włtф|7kCh= :B# i\t 'Q?qAEL 6u!n_`>W'~{hRŋj7/z(y`qߨvb|odEF@ߠg@a=^;ȌaT/?$|!+':O"eq܈Xx% . S+ᕊͭm‡ :p@ G@ԾS!*;>@s ,@4))g"+|t\@ ТCS;z  h˙N}I Ju=rqnFVH /GEdi  ŬHڔ"bWh)3,NbCD)؃"[21 Yry%5弈>'c6 [cfIJNJXyC|hu|Hj*AxaR!A`|Dy Aу4U,edD"3E .4 +\Aa)*ru\ CC!!TH֒42'…I2}'{GhBeNAk(Cp biP #Ɵ,="iyzd~ilp!H|X qy4]]V `Zrzu n(l0wpR -W]!d׮LUlSqhϵ XZ55iXY3\:[LU0kP |1S/ [qT@l8Sc7h_^%~='Yb{gԛer\ej%/s[(K |`-h~ʆ Sx2G6~UYڝ3mb|bNp9Kbm$DZr|寻0p>\XU1 V!H4P6 8x /xQKOK;oY8^\ BHbDY@  } }w$qZe/RZ#{:IXKkCTL#>AS49e\#WFrtmu%饕ل|֫,ZjhHRnG`Xհ,)+~ϭq1,.MdnS!I@5jT ]ݹv$L gzs ۃ2vJz[#@5.@!,E 6667(t>+{:)<]:-f>&i?)h?3b=8`;VO3[L2GW7LU6CX7EW8DY8RQ5fF/lC.p@,dG0aH0nCsEqD#kA(h@KKKUUUXXX%# /$' ,#)!4'1%6(% ##)),,44<nYD{eX˸%{F7yA2hɕ,,aɣȋ,'RM[ϞihO>뼰YBKpvFE>QBZC>ZWgn|Tė[;WJg$^Kkw'`^|͗f!O~wQv-ҧo㡃V,Z1\]%i*R}!J32UTbWrsuםwↆxO=8K'!L= X]L Ht+fxaItM|EP,]6'pBĜrY'%)//E5w&v0B"ZkAȣ%)Qb#vZnU`٨t M{&z*jSh`FKdH#P"DJ l0Gx&Y%.Cw]RHḴYHBW6Sk,ܢ oP `vC!ԛԸ*UX qlpDTK٫Tz/\LuJKUPT,{'3T4˒[T R3􍹞RKEB(q\Q46-5C{6`qzpjL"ZL,z5l]Ɋ1R:܅{)ȻBfvN{O_UV@<.l, y ڲN8g"o(a?טFWw{~:';+?8X bɛJ?yn@X%b 8 V2ȜC7 q̕T 9 &CtI{nfnF_8L1j[4~pd?1nъ]4|c>/ C"hDNM,@EF~5S .p@:퐄B JwE2d S#&9BX(.`?yD zڄdCVnDeRXw㉐N#V… 0 X s{eB@Kよ ,-k[yMN *(|IMYyNqlJBGNeәG-(!eA轂ԥ90@'|EYljS[;Mt >,婠)Ar %ǧ~<= O3Qxo@RTk̗tvIzt(,Uz:u#*0o'@5,N*pʘMwy/Bi)*WԚ$%iar&OFCI'6uR"jhԂ Uh%Q8ɂ ,rU$XHB ^#o&ƒG˳/V*znm3q(t[V#V Ɋ=U6NbXdo_HBM83U"h%{LcLC=dWo/"0}1"f&}-g)|92ԉc0];!uL5V %g-8,Uzy*x~-q\֝ ʱ2Hp٣pGg9WWqu#2~fZDCZtsc*z6$""Q2obTdj٭J'$b&IhBZzaM_$ (\`hgM_q_1:eܥ(^r#W nj#cNI6AتfhE%A`"z:PY"c.zk7@sv" HhNq VsyqCsZB6,$AӑH cQLdكSoc14z",QD-FD΢`!0Auu1ѧ51Omsd> L8Qk2w (. p,=т{=X FAEP#d= ygܭ|13p>E Ta"a龹L1Nk%ju]r&?7J  0Ѻ(V`J25-s6o~o?KT 77D n`ee2Y%}(KV?CCv>:Z&!&0*`'PFQx1,:r5#,l4hc3 &Q/6 ʧ)BtG\FEc8\gOd*p逅&%C +p>jFkq=8w@J}_FІAm7rTY2w yH )Zw !PW"\MXdRx!KpQ@#Em"'΃](E.E1!Qp7b`AxLntvRV"P}"g=[?20 dt "h /@k6$')1"4,L`wgRi֌*K7dj?1DJjA%y5o!̧thT\L `\7Pz5}HMh9SQ3%6Q [guu10LipWИaHg及5TCT(p(D@lKYǂS8q#CH@)YhFgxw?4% g@ XQD?)Py*ebT/~z3ЇM79iO]%07H"đw/@QyQU`9>"&;swD> V>ѩ`xii׉)A+i4`.G>t9NzhR >S2""PvZcAF1zƵ#wa239EpX|Շ;ěf*@a?< ūFXu7IݡNBvw BM2bd飇pBje 87A5bJl"zj pJ'IX$q|Oh2\?y7&g3YW J0 rG3Zu16AJo 9- "0DeiulJ+@ nCkx%sKPb'nVE`,l0LW-gڪjxC23oF2S"!dV2lJklo7!p!)R}p9d*-fy;vn WP jb6FTHY[o2R*,Tٜzj6<v!e7a4Pa3\PCIILP9`7:hM}*}qU-ywQS(![3MCK[o5-.ks8d,5#&/\CNGu!gMU{!=@FҸHvlב$x͌pʖ?MK-ιЏmXrùhJuO1'YԁE1pї'#jr)~rQ<27|eLOEx"ty(+'&p y5$ȒRwjp NNPnd.Tݜ`z|\lz[-b]D4O^Sݭ|NbN&,1 0j;#(p>GBem}u拺?Z`Zݻ΍ÃJxW"܍ZQqh0{% nN~~!4xꪡG ng;nQ~V;݄fgjuײ̞<ѕnȽƮAwlp?h"&dӝa׏.f*a1 SpчǙ@ʑ0remO^ڮASQ]]y?}v&^9)-V1YR}Oߚ wګ70PzsRB_di04ю+-=(Ep(&`x_kg ȏܰ8EQ)I<{j{v"N[:IXcKրySnUCCO١`"a#W0\Зyt͖M y FQP;kՒ?8ZD#]+дFK`r=.1<{:~%88A BxaX%bysiy鸨)$( ˸Yۚ ,x`I̐nQF&)J}&̤AZ]¡˞v& |5hrzv@ !ThΫ̜" dɸ~4ХoJgi\o;RY+kCDߣxz{Y3K&;R΄xWKl"HF/`[woq]·Q~"/Wх- M:'2HSDve%XOBa]3]s-[ lyJ(RB80!qQdUc tߌ 7[ixP@*1^b$&1-2h#Jf9R=!G%D7{DP&#Y0S964rx1Ѐ6+)$P{ P?ɓX SR~Ugx] J(^ GAA9XD EC)Uiq>Qt Uh0pg=]$`MI @ >, Fw..6,GH^7jQ$ghH ZW Y+!`L \KJ(9(qcy\('ć(1Cz -{HZBK;Kɽpr\l?S|ϡi6Bupp+U aXi"\ZmP suG^Rgš*a0Dhrp1nE7f\&2,.q1K``[$$1Bb` #tFʎU UP@ HJĔKe9F P0Aplx6HX+S_*P\lBBlH-{bPfUڰ^R?ENxќB ՄEm DKт 8l~)KC8AHMB$c"聕 OaZKD66mLp;Z_th!*iHu`K9,Y CnTR#{ xAЃ t06M ""V4P$Ieg =GMRUӶɵ24PE`ltQfBka4<, 6$!"S %P/Щ%|z$ɥCO;? Tu^Sa)F9x(4i# AtFiexhBIR2yicN۳LBf }`ŴXբtjA T229| `%Ѓ!D*AB&S2nT8`}ԩ< 97p Q^D[x =@- >'] ‚P,oD L8P.i8aX= ubGDCg"bp7:IY*x\[N(@7v4 bqm!kFqt&O-.,9_7+rjpIp`gbʜ3E$ d2/ʹT viB TO!22#lEl {%X9\j!9K8V*CSSrVYl̖axDM@GoĸR" AZ`i!8"`w"P\|wTX"w'ix@/ { c Tp4p Cb0Zg2fEO`P2!,Q ;E(1Ru>'\YEװI͠OUwfUsblA IpD`u *2W cW(5Z`T0vakaN@hs{NbF/3Y0 s& 4=уCanXr057 ;+`FWP >p.M Zf|3ffhV1!* }lCQ"ۨ-(-`9J>}9q9a؏7qB3!bUp=9a?K099q#6()n,a(n 3*$E[%WS<"+3`DG|KA';Tw V gLFp0ـ[fJp( 7LAC+0$``{UXHy?Qzj?|2[C$d ii@q}Zce|1i+iyC&zwKq>0EW#_#G x7`429ʹXf*quv?=w>mgW f .x yy4`3JԨZ%_d4@b6)B Q#p/7t)h#  [ 1*(uȢ Y`>@ ءC@9-"P -yK7Fgh6[KS3 !18p (">`:aUQ,S[@PD`L@9fy0 s ]*J&X%;BoI`rZIKB6ЪU"q@Y@Lq._s97!ZcdCz6E@ZKVPiLGQaqD1P4`wq)S (`s+PP\&|Tbv P_*c%z'5Y,R0# y&kj>z&G@}6 8Mr<2{rST)\5hr_h&$БS79"ZYpz +Nks "g # kj8G)yD_a3m>HnK8UֆVKa۸u!ڥV{Ṵ̑67X@(=*-~0A @@@Z" Pk h/dȒegEzҴwHA,v::ϥ |Q)$j 8^@VJǰ`:"HvG ےɹ6 o#\) /&#]a B Q]čb9vT;B>k~lEk*KNƙP`VV2]:jb3f1Hb8_8~ =P'lCՉ+d%RS7 A IDY+9/'90 F"J"4 ;"{3s GZ ɇЇꊬy7s Mdl^Xcq]aIБ gفF<9 ڎZe50M k K" }as|J 0h `EoTda(Y'`UjlfF^ {쥮oR"ͳR;x*@@uՊ{tbU`)0b>ġ ?)@ӭPu8i_7N? Ȍ 祜9p M[59:=.iࣧf<}2e`DIS`/~yȝ vi4QxMWJ@Mz,1$-$PO*%z ʓRmO5# ~Mll;qC*nk?);(2m`M#P أH1k֊cZfP>/uL.Kmp5=g`N Ʋ"p+#%>N};vr|?O'*Nd` ʥ09p%8~_q :#y kdPgpD YhUh:$.IǑE$QΖ "-|8!Jq $O渷v?V`Q5sY"""ZZ9>"191"=""> >>"4Ï>Zľ΍2ȓ˂ڿϓK727KZ /"FZTU"%Q)֪Z5]rELXR Å=2A ^)ƑRKFH 4->mGdo*LfY6"͒JJeMD )K %#p%yğ$]LDX$\Jt,d԰QۚſDx5+ۆR^hjl%5>6#&,Pk&~&C*M>]=r\ Yjp #>{ Uh؇7JB䚊|ޭ:⇌`nVBEJZVlׂ-5Ey,Ȉ&Inp _„|fLcԀVi4IU"<QhHt Aց);4Уv2R}0V Z{u# EoL BG4 fDK]יnO &hw el<` ,ϕU4!Hj9AO I U%٦% iUhOlB ~(>M,2h=B sifÍ1r:+e#C㆛4C\ ]rֱ* Bik4 +#k/]( ks?F7>ʳ Έ"̠խFXU @N7+'CAֽN"'v-ƲJV'>l+ ehEEU* >v|X^bJrhC&1q[-S'1q+*'R%' UT:S4rFI)j1_UaQ|RK Ql>M0qYfwBcHD&%iat&2qK4,HYܛ6Jk6DtOˮ5-B(}CHIC kI3(DLYVǯ_scXw cw7Fd!7 %~x r؇xݯ~䁐=73"8[PuSLhVHi-; v?ci_"P.?@ґ ˆot3]@"hpD,5f9 BDf@ ȴOoTx,鱫W"`B*& 8ȶbKpG+&pEMBػ X!C% }EtݸC&t㭈0 }ĞBPamS7>Z!kte%*QQURpLpI\bUTM6 ͮn LQÈddO@L!0ImKcH6Fj0Dޣ)ZOwZb ~4lS[(rɒ(&7Z C(]0Q9/nBTB% :+-\$gR[l2Γƴ6ƛDZ%>-1RKWQ6H?*Vx?W^tT0iդ䡉/5t&N%n9,:^0PbA1H70A+U',C4’icN Rj:Q#M/I QA!pcD,0 7`> =R;&!jv33PJ^U}c TD4@oEh$^dSlvIpan͙Όz1F"mv~ +d1 AB: kU!/ptᴵ&_;7 ȁZ4|᫕ 00B@ýoB!Z&` 5X70UW #e0"ACFf}$ wB7(bT`O X*Y IrA|ٺgTĭ.ddl@[%-,Q|+.%RJ X'=w1yҾGHUЁ3q@ ʹ__@&#҇>kL*THtnuhXQKWfuűFv/JʂօA+ͪ ꭳr * B^kۉuW. ٤Upأ A$6 "xV@xqe2 1K!70/>7Z%F=&0,( -%'mwR d)# d4J!*fq|d'YէZ\S"(k0ff29Po*Fq?Ǡl]W< eD-L4}J"7rnH^;vVhU 17"&SXOu"> aJP)#&Kdv cQJ(=N3uBp50 DdHEt腋5 7#vn@Gx3bXtl@_2z4e$P" K RX' IpE& zy.ȧ=8TAWF1W `kPNPryCSP )VMd4 4 rIMi #Gݨ[OYeFj:e7Nc+A@fAfP *&0;_A&ElC L+ %rBrl'$S** LCP7&Qgw:@f ȁp<4BQ#*kI hfg*i:u$M@"JS@%4gY6|j--!0?DXs^ߒL]4{ ) c8P`:Byi4L0"@F(0=X[uhQ#vhP!GB"(Ĩ!%EEfhp ­fUNp5`r$E7٠D8>@ #\v.rkpdZqhJdqPJX7MsNTZL #Vy  D4i0Zp<h0HZj<'TdoJV'a erV@)2@@+0=@&3'Q`6G$`ߊIlnPIP !7VYu\!9RI}FǵNq)K }2|+K76ƞS Ah7379z"X57,:g[7;JE`.BqS;@%Bk įB`U$`S]yԖXT[)KkfL[iaKSx_$ t=An@7qٮ %KTc0>JTiiR]6P?"`:Q@D>yz?eI@JjMëtm`j=* $1@+l3͔w+ )%$%)S<UpC/ĒM>Fp<=RPY>h ¿?=: 1yxZiNJ “aҘR$l95]g_#KpnY iH(b,ʔ2PAt\kDvX\TpXwn`2'R2R 끫 ˚\|kٕ Ǹa$T{R膽Fڭ.@680AKEs4x)jVYa .$R&dD،AhqKT$0\5.V)fi-їGkijMrOη]9\H& A DY4I^E9Ts7x ֚BYARJr4]ܞ q T\"uuJymvFоڵ 5Ug.1$GrXn'g,2WjNs@5"K[U8Mf\th"0'rţÀ%8H8Qa"(#""(Rx):I))3:z(yJH[cx{h*ɚںXሺ1|T%B] n*NzX٬== }JJj<o/-IΖz(sdؽ13xU$2"ġ -72ߣ"X|ΡRd!Y%mэUjX^6`:rQdІu{K4k4V"#23Z"A#9٣4GLpa|T%F_yBBnOODEBե8PZ8IlF-6CvPi2Q,8 i" 2`P'AS%zO}+eVlM ~+MS44_ {(\-i谂'V "dqK|ˑcWYU#i;ViFvqo7vJ}A}1v LA'wh_!`cT YPqh: P -Csl$ .LrL}X7 qLa{OS dWwGCZ$iۖ8:`PUy[RC06&1iQLg9u',Oq>>HD՘U>b\( X0A]"EMܹxLYX^LCEUibEey582DC""/"lJ3q0B*~PC'Bu#@8Fڋcj'+C'WGuА @$Ψ|B6S5`$:Tqbu4 I|(L碠ZxA'`w2eW"+BtzNdʮ >L h靉7S5!qE=eiQ#ȁ)B-vHP h'20 W:hcV`ŕZ˶uvnfHhs+SX:( Jhe+]_<D8bm;Q˦HD+)7F!ANJ-RԌY̊!ެ _I걠-vTqD%ZfK.lE 70-'jU0P+t"%A Xaw& B4I!| 9ZA ?@Њaj dѢZ @ԉ ~VBэfQ]")5ЁR H_^$É`P|4 cC3aka=b|+2%FkED9wZfeBuNJkl܈y$WD!BDtѸB|P#UX?1#s)|ErW4e B2sRD h!;5fwH2 ȼ/rswo=YAH4ΨHlλEȢ^j[<$<Љ]*Wȉ_B5Ǟ{r 4~ݙ0mBN4"$`)hzMMHv' HGZTĊ\2\)mYúq/$=/:XdXŌ9 k! 5!st5 2V!sb)l8k` 0dB=ppݣ+ D d[Aw{Cd"Ag5` P: B\t`sS4rt-9 P 07? c"0U:2iD 0',.J<Э"d㤇}M$9& 7G8Ԡ-ʅۃ_*Cd@xI 8QcvF?p(`G:"# p b$0Gr}!2(1Lb8'G(0G7Xx1Js -1k!A=P.; oVcavSt*R_#$4+w%.Qs"P!@8 9`$)=D\my2 Z0}7cqb,T~b>|ɇd(Ng_PZ("0`k>^-ЇKS(0wÂwdqh Aqu @(aw*ffA~),X7#x@;}(6UgHXlאׁ,y_(+Q3Ay{=P"6P`'kH`1 M'?RF;FYrF p^ѵI23wP&9^0T#al,kh6_w@6 Y N ofg.EfRc,g:@-jT+Ya"X M>`}d+Y.}1"~6ׁ w3Ww7P=u"oՇ)SѰh郩Ffv!I Z@& E1,+u a}q֜L9gU͐lcF2@10RPuS1'IД`g5u JsX8T1 ݗ :/A7ó!e/^$k%1!D9H=@V8I㏂u}3yH('YX>= 0@“ v)y'@[ʥ(6)G"-@5Fo>(*y]ldu"!dP @@(Af4%DI)NDj`&I>Ѐ`&Xu ]\WUc$- Q"'XbYP|p 9=)*ЛQxG 0 究)yʙՌ[<,^"*`F**Ш0YRp(0 =I8`F wѪa!QpC6`&@į(|#zA&ײB ś@ > Jj*IeHY\K-:`>{ħA{olPp& $'ux.Q躜,j+3_pEPfSz[OqGQm{j  Jh룓˘;t{lF`cT*Efئ\r],y4ؚ0~"%̮~۶n `:t)( }-ƈq=gR0\y. Ƞ"btͷa}+]TPCQp!)dH݈tX!@?D X EB Xv9̕?ꔥ,u_uhaքN"Ly;XPE$oN&0/@I2ȐZ b (`=] kd#Dnq;_rVQŠG8P Y n@?"2+ T=,DL!Cnx\XDHp|9F rp{,$K8ѩ яC҅']`1 XDKS0yiJQĴyqlYq1ӹNr8LzNz`f5E jt.ىOnĐ3B Y,"BP'G|mR)Sd єIT#+'`? mzW: )(`p1Rs !AW5"QUw BZB VCbX[I0d EIA`9|+2FNCrbA?];XzѬbh pgh :*~xM!+ :pAxiI* --&*g95Í К  [P,VYjHV07NuUyPdfW X5/RxH6 s7U۫D/(<TNq3PT) 3Q@/'v M vm2E$ɱ@YuW78(x@`79ЀAˑHwqqm{Y.H_Tp"T<#a~ka.|?equ̢QTc\0IjI, r@n/@ mkt`scr:(XA-5V̨i8#Z;`Su %mj1p;rvQmA 9ÎU\5W}(2аB_K\:D8[f{@`/g9k-On~m3_wyY\ʓi  L_~Y|Dł^0*1dM80`y}]Aȣ!s.&0/Ā)A{lS9>~Ԩ0B̄S.u7qj*ٗg,p-x&P nT4KLn+l2Ng e C<d;-2pgP0 JE 9Da6CTR}pJy-e&X=pjpu#3_Q10g0[y*oSL}O7Xgz`D?@:28Uud!@@"<08P{X89^BN 0LNHB?$e4/XE gPi0Q(cxԔcMtc6C7AFw>T(0@h2w ,pAPrv e!UGg;guEbaHX X8 '_90?h BkcWS(VJb[fg47hKp`C W49foZ!e[&TKGq89ሲ@ t\h'g%2 1\4@p$cYk)8} pf. u81/QpP6Ak1d; El$cPP'qb0q&e;5_93 3qG_…RgYObV 1S)M/PFXWb")| ` "ॖbQ553_#7 UW0?CDSP>EaBUFU(%P6wsB97=D5Q@)CPIrDQ@SsщйIvQjHZ] X4`5!Xr7*=0?O8rylIg38peϑ;@42Yh8=?yt}dU"2svc.8\)1ZVp7%`jyvzӸ2<gp8 e75Squ#9cdPv{e(Fu$FbFViX70`/٤:@0/$ 'U5?uE0/`P} Ew3:4wE< V<@4)քC9ţFg6mC5¤!D"x2cx2@eWg0c07_`OdLh[ݕ7b$8Ti*=Qh'7GZosy"(@p #n:``YavArzlbC$EPc1P I951u'xJȱ_Zj hU?4:*THЮH eBe[Ɋxb 6^DJ狨Y:,]U9@&uAX!7J/%kiYd@;Ai ݅E>=U _~A e3ajqXqfdS}G_ 51XbiW>q3A2DW W4:*qzW_'0ZDP]+a ) pFwd4 d g4Vba7H(O  PZ'(pp]U prh& /`E8W2:3_z*I 5O 3{Pa8z5`=l9kl9  ?ydUPe,rF@A9uR`@ʭJd U_^89PrI,דg/T;` H2Q0cQ'6LGh 9h`~!>2iPVYK?K @$QyYY)@ Ez`آT†;DCSd, q`.6 ; Wuh]:E.$N zMT3l"05D1QLIӐDCL h| 3E2SZ;Mzcsue8M@Qĺ\RD2 XE㉪\~qGbqQ`6|50n]l-p2"G78V\rM/C;g.@0=W 2,E <+{`To#K -\R gRU"95cTk ПÃH=Z쓠 0i{9M 'PTDk 0,5]9p&E@EqPWFmI3 c%/ =gMz0)yOFxJ+Qp pA(8ES(e|E-p=3BY"K;5p/OzgR=U}ԭdfZbW =PUp+C3_Lph \~Q_Mߝv4mF= |v*)Lq94Be &1P40m8C;\ǝ>k=PH /GMPa2JbZG7|\4Wbϊ1?Ezz\3/U&OfW/睤eBٟ `€PRRRxXTCihyֱHZZ:hjQ$j+: [ * \l1Iy XÙYYYXB; z\ZK~nn>L,O[ei3;֨'aP[n@ ]>Vd='ѣHdff0F<8DCЛ744SfX7z8*O⹤AsǴ)T 0hӔ q(X$N=ȐΗ>TN>Uzp Wݼ %*5 oV *"A`^P3"ҏ6C4Ppp@^&8X$<}qCz8(g jqro˓[ *tyVB+Upr;_t.i@dC]yUy0-A.DL!,o vRbE7EKj=UA?P@X  5 `@CE0\-閇RDc[9Ue`׹"k"-5 !Ʋ(܀ +!TMriEɝxZx2 ӡ sV0h M5`p[䥠I%)'HNIȴ{M)|%SHdmAO!DFފp--V%h4?)u3^Dg~eqxf[E6V)04]* &<a J=*3p`ЊU@FHY^  >#P{/(\48D!T^GڒByNS`ȰE_Ž:ѽ z8T$*"2;0(q ":(+pN2'j[7tC"Lg I5^ #dFfr x pp1Vg +=ѫ}!^=@0Aw2ppT.MuTr0/X4Ax!|<'K9^0StBj x 1k \pXH0"-? 01ĵ$D1Ev`k82Δ8 H݀Lӡv€:G3U⨖Us3ا<#Qe-sf+#nDiR0(gX  I`Wm +|1-s %2,)kkWq"ye] )' B5g < F| C¶'Mμ=¤,6̣L;C==q@; >Dͮ5)O "E, ب1G,IZHU=j3s% We M͗0vR \;.:Bz@2ϭ;+_0\ã)0:քCkh:\:c5^aB/""@Ihnًkȓz{rN`Lҳ[X<ׁ%1y aJ=H<xj!|EtPΤ_K=P~}pL H|q6g]@>} nw~g2 X%3 JKE`&^v WX0<0A+ n$4c  ZbzU%(=-WyEL3@R uW,ST *}3U!NE_$8 cT-:hM @+ T)( :X/s-GP[]=Vm@)eI}D9!u,Z]LĤ.[9(p>`*cډ"LJiҮ:^1N+Y%8|Nj^0?#Q# Q!'g&<2~Xym:AI,{؏9SDǕ?:' S'}QR]PLe;Rh0(-P>'N_ȧmH4)۟>^@!L8!aPQ}r]\Py P 7FM\d3ҭQ{37IzU3ߍ}]K$2VO @R PL0A^")@//O3wZN95E (1d) pX +=SI0R9''=ΕK2w:C RM4^;@Qc(י9eJE)))(E, 3+* DE@hhEhV EE  hQ1>E9`3)2)5+]`A9\И̥,=(-{8}*ʗfL  a \=d֡. tq L"Z C)'HHKVXp USbs>>&ig G^Λ,;wgZOH?l@%"8-!Y: ?_U$ '#0<A&[tW0FEB岝W$D уo:H+B9MS@iRj(@7EQZ(&4 )\[yAS՚ZdL|6o'c{ @D]*uh|a!\q,P3<`O0ê fƸ)!P9i l-CR G̖Vpd.% TF,z@ u%woeP1^htu EE`FD%GW( d`$DZ'aQ㳄dXV2D MPPH?"!Ea#g0L~&7UdX bqQcA% C/#6Xr(#>WR{W+TpHո16#w1jW,Bpa$'B Gp5sS'9Oɀ AA09*e8T3()ekNp 3QU`'؄!W8}i2?aE[ЉA@iW\ϸx QCsq g0'e ;8[Y2LKPE 9HM1gD>7tPx ][YdVK']g{=)Yȇu d@eI9f#cQG)X~{THXT r3x}Ӑs? _XE~}29<^}al9 x}5 `T@ mFh= [4<1@@ f q3ORa8/yxZH;XzqÖˠy3j_,b@(/zaP0ѥ.84'cAO٤@aN8WSg +7/ ]GL#РyNQ-V]9`5bVW>W&R2/1!*rTk0ڷ'P"e{&Wbdc&N19h6FLJ4haRX'qXZT FL$Ry \apap7) BRlx#;|`My~n*-`4/V`R԰=rӿYzD8)c0 @PEO l3-=vQV qlň?# mNxEzag@C~5=<ǿw^Gd{!`CouD .pSc%~ܞXzmqŞ+9KNe S4? 1Hyۯ v!6P- :o0չgZ,< 6a/ӺN,1@ȁcj_C)0Q# _z3\UT"|MQl,u=MH@{懧dPeʤ5g0'ΡX#ӝ=U#W0 ;m?i P,4$6ΘPGɹ]/˽} ݏ*QG yY5EցFXhx(H(8HX)yvR"Ay(Z$ZShk8ۋ[ۉf9;Q -: zjZ(M!SD%.,+hkK}L P]4x1ɊVհAH5PQVAuTSQ2[ѣJ@c? 3n 5)Qhh<qJV@Ë^X4tЗ@5!O$2]΀gҗ c4 ü{ 9oɘ9\x *[4f1P}E杴hM0iFMU]PdFGL(J ߸2=sVgBBhځU2CɴZ%yRC )];0*S\ P7" d4aAE{"Y2 1OPA!=3U)ЀLg8m.R0bO]FI:@q:8a`Iɕ~!'JJP ؀] Rm@sJQ)[B'M2M?I&ITyv$pxgT&zѽ2&Á+&bC69 %*Qe*PJgaA =tj-{{ MD ki霒+ i2[,uBj6BD A @VZYXRyG%+%r;zQkK\`;@U`p f,d,lH?ދFo@@Q de%@2aE 0d`l6sF9^.`%" D⌭Rx?2 ـk--+Lz@" @@3Xa1@YCBc*8PD-^8htaEh<_7V2I⅜Ș?b@uvZpAVBhxt_t'Ϛ#sUB@UB8XA='[݊hp( Pf 60Bû&kf_>l"rF9p 8)3>mN H(% P @qyu) ,aϙ[Dh >ACpEv0_SX&hY"cn(` `(s0Q 7#TDBuXekᏐV <8㦕T !7̕KxV Q!4BH@PAq/ ` `p nkK9-k|)!2Y 6 pB6.P@ p6r@HRҁ`L4&q.rx"hJS|w[%Q<"fSrT2(02P/|gp)P6HXƨ&V2 &Rʄߝ(j$SL&!5"9pW~!YSMց XDd6PBVM{@UK(i'o CH4@pa3p:ƼIK4t  \ B.(O A8ʚҬHe=X9!'gpUeV и1EOvB l !jo"I)Xh W^) ȁb4Ɩ)S jD@IA? Pɐgt!B8Q,JFVf21 \m5;H 0n9 ; _nV(.bj?0kQؽs<&KP@ܧm ]9?7"(QQUx㮰At@x 5lc~Kj" ߔ& crDo!5 o´65TS_J&CԔe̠ԑw| ";)9.Fs*4@Ufv16xߪΨ"!f18  B , p@~gycHE5X~!l`a=IpAP dA8##' 8T*V U"mz%+2 V 8WgE`|cBv!̢GϢ1 0pOpw$sC 71a1@o^6A $eic2gE7&2fwWxN/ 5, `YWGVAO]UD;4/B87@: q$UTRPr<@0͆W4@ 8w)pCP‘A@nkal`zP4OE'@rű{`}hp4PrG) 3P7|@D9P+bG=C ]@@@d0<8Hn ` Tt>=PCR)`Ԁ/ `LT7CBQ)p ]?DL]g|RhCɘK30O3s@+aCU]E2A1oUDl)pATP5zpVl Q)%h,QpU/d QUToG  -G{4i-@*7UcPz6. @ ]P%6 ]E ѠI6v5t D.Q 7FD_2&m0@Y0PWt',$8R P 2 3F5:0C ljih0?.& dإXao zV ;ԁ_PY 6pd{*`&0?Qx 0?OM.GE.>4 p-*C @EؙsQCCEH&X"G_98&/:S:<5`g~6T2ሶ{:@fŀBIsxE,h0@x@р2 pW}VCBe AgTP."mCK x[/w5*A\_dԂ_GEBn 'zb(w!M yҰ<9N1D*JyPSD  oE`:=<90d3 *hjQ`NP`yi 0`vE `C@o0@:`ذ `EE@D0~4CU`rӯBqe03/@lw5p4 P/ q2hAt K(g%S0\4rSDvrBc9W}' ,P pgDGwp@L0:R 3h@n`,&+Dd/zw;*% xڍ&EQt- ڧ ncYY; h0' [Wi";V(}16_)HhU ND`ykeK]{IՍY8$AImwB{:g@QpbH(a 3KTp3;hTw E Pa6C(s`?t-HǕGP컔x Qڙ| SIu/o {`y)}%>OZC OЧE`ػ7 SheDB3+CG,0d@DCC bVLJŇ~pA4eZ[Y VpkĎ`2 gB8JS4Ą5z<Pp\Ȓ ^8+ \4p)5pUN"lTCЋcxDTW=ho{j$6A144V 10yԄ*?0q4@WÏ:A 1 1y 208 ?e0UPR$O XX PDXU|eX(`|;X'R>*TYUH)<7/qv}m<4/ A( 8pBQC zf.ʻ\7JZ9P,'tQS A􋂅" qڸWךzbKD? NБ PV /p=J{~T)4p]l *`ihD@̿-[_o2 Ԟ =@ WP>u[瘾O֯h { `7hh0E.g?)E)EEh7d_Қٔݙ̦V5).B^Ւhê $6U䴏\AU丗"ʧx*F"*S Ѹ'D%,c2DRHŗIhAi"/X*P))KUe4+%\r(QCbJBʶEl Ff޿ DtDqhEí4v5|˵Uz/^t tH^uBUpuZNVuvWeͳF}w"j`(vBSp|Pĉ\ ^bE/UD‚-"%uzT8d]"L@.pPEQZŵ^0O@C&C])DFXHF29C S=.|N:;T ==b4%,wJ\EC.(P0hCD `81[hTS <B 0(p0'Pre?Xru~b5Y26$0)\P}Pz.$a&DO L{Rh g"? 5倶JW]@ g{@gv0@64ᆨG+ikƫ;K0>X !| 7墋7&z[>0Y.@XP<[ NA+^Kr+BY&E@‘($T!a%qsW-!ğ7T].ӲX?UYQ L-@@J4]IEp; @EL-N¸_a4=:;0S .5UbtӜc9ۤ {QȂ8 .?Jk;paAh/#qK q ^oWQ9J2\@!C'ۮ `:k/] EOS_ w)B/.*?gRr*X KsH$(K3Ţ L"idN]^Hjm,h` BJ2LECˆ0Y܅00B_5(C WA!4 ^BÅ'b8#K"}kQ`XCEcVh%*|u2:I\VHO!,E  '''///111666sEIIIKKKOOOQQQUUUXXXZZZdddfffmmmssswww0nH,Ȥrl2ΨVجVFްxL.ofnnn|Nϯv:'VS~|jNExwJCF\H`{yPǒʲRToքÇOMYrDmtK倁*B`Ųы'd_;k" I ʓX&_-2B! 'h fbղnFIb `RiL/ Hm&T)UDb٤ 2?pf6I$G3=ܮau2x/&9bHhc\cj16-)CÅM̦c:h" *PX 1"-#(+spӈAf?ů_{~D ՝Z}eajƮT9> ?7I {(!=gWуOh yFtztQ3"w_?ĕjp2@ ՝gf qFhl%"^.D $HBF$@#x0AX-4:8#blxԀaBI%0 @Re"JDS;*'6-Garmfz猋v2}v 鏉(~R΃יqiQ-~醫~*W gԺ- [Z* KLDf#w8\dxuLH9ּgnf,LTxynm&u W)}F:ڔ"[>8ĒKkg;8&\r) 9tX!# @D"C,-ׁ3}']uE O<|BSCVIGҤJZP<[iuRo( Ym~mbM,~~9cc|o+x1+m3wF.7kB_*%䐇.z62íʈ.;~%`EGJz\G|tʏ.x"Otq†|[>~m5B/iƋ>3s c= )Ѐ2Rl@,O_P!q-u1T?bdOw$( d'X Dy-%pB@>rn,tt-.rI8QVR]E(?bl |eFYG饢fۡ8DD] * غyL2I%;߈hR7-+Z1FXCEJ{XX3f$bFHUؽ+,շXyamFKuS%rSY n@Оyẹ#{Ut*rZEPmmd}l)B\=īUjSA;p-;cmbo=-Vv :zս7,~ǫE`=ID]m*zeM}*b+(v;bdkӥ}M~Z2 \(Բt?h7w;<0ZP8x;f~5@h.f\e~EՑP޾cY=f)"/ MTڸ5xI9t-M%; BgNŞ6}d?Ǝg#8evy[!5ԝfD(ƥ%,mڟV)asY9SViOp O趣QbErߕld/ m,|*8Z^KsE Imo39\=]{*A8 ^:[s"?[O56qb&d3J.U2yd]|(X'vtxsYv;k`eѾG9T\u_GBj]*eUvp`Ysۼ˲#4Q4K=skGMEiGkFhf j\5U2wS~(|?Qa33kw{1*4t@Y0G5cm7_G%h`+'WSf6 yuCQYuG1l4]Rv/t͵tIw d^ەk e-oІ##el6k5{*`4 /D`3r d"5szfXdG@7kri,a〃p~G6X|2z'SD#?V^7hgeV5wm49XGJnJ^"a z3`/U/v06= qp\.J;C1TЅHP) 58gJVBewP!mG~d26$T#bkϧ{!.V$u{; ZRV5} ҉*SYniwHz FʗCѦ p_='?tMg~IVDHaW/#s8x[eh*eqDfnA &(dq@GA7 xh687VevA( }UT,NwfStCQb%đU(1CpMpvb#IkzWj3GアDžkx|%097I|xtqyBC(U!9r4EgS'y](t?'.՘~81J '`y0eo= 2a-"}oSO#xwn]vJVqv;08,hc*:/&ԏzW)F`(Kmɢج#zrH^y90s&DoQڊ4WԩRT/st8ȉfCEH([{ IFioxeK)eSel(~+Ǭs /cҥ"EW~unϘu6YhJ6:4.0(i:l@8<۳|xqYZUaf53泞:U[6 M֢" b}9t[8ڲ,Z=-Ebr$6LJΊ{kC*T)IOnT÷Q[yyc{%vv}m'ՒI 繌{t.ʌv4cWZzï=Pۻ`>{d{p귱]̔BMvpP1ǹ[ԫy;eYS3F?LJ 8 E2f[Fc IFX/Fyv<{rA=֠k+˽;)*Gz_9fLD\z;$cřk}š7ŢǎS2X9u{yC[;ˣc/\Xrd0v;XI]@tlcȴ+,8h`O:zc&}8u- JwWڊb]dy鱓6p8*9r2E|R;aV2+D*F#40-iźL<$cLJU{%qE}3lt^&p5xML򝲅UŁ clS$/U_{qٕXUJUr,^A<{=I U9vgXEJ$)|BwsRZX7&P:Y uFrl^7O*}x`ZJNdfhKs2쎃F ~)Un!|ZC͂MBW"TX "L^_Cm-@\1\ݔuFh "2[8ܼJzՉϗC[h|>`7<4HCR^egʁ~lc\F^Xd@rN@};}'YݛTzHvo.1xu蟶rw߬t1yy7H5?IhD{LBch[sm˴̙OwBRI˼{?ä0~09yz瀟&5R:*ݟ_-k"yYFXw h[LYwCw jA5hFO>.o\cViBm.L˘͈Zb#ԒR6F1&VY*iGDlWl}XhǫSNS&'hUڒgk-y> .d%"YM+$ډm5^E!*|℃Gp[hكʃJ=/@f־_8~rZL' aƸjMj'g n 0'0 p#P5 n@d 4{KD<7Z1;nl?/iRl.EH@oE&sۊF QsĬ@ |,rLEypIkrf2f`źshƠEJN,zr^|3\AL.MR"B TcR%ιB퀜ت%JTC,IlsFsܻ < BR(cJ'J) T\JrM#ͻ{e%xO:O\?mD: @;,4EsEUS';(Œ.ؼEo*Lm~<1 Ia"` eH>5;=?`[cdOnfSc$>RJ],Ng`Qi:iWBj1~wh~Yn$3nx%yl7{^Td"{i“z6|K';@d ?WzGw''MَP#/R ZGtludG5[aƴOf}c5XyFd5x&Lc) BJE Eg?ʝ 5.N-лn"ٍ=\E+D3+l7<(sEšZb%9nZ3B&nU lB#0#fN?t !Ce 33`{H/H2I>LTS5E4 < r`PLֲH (zӎS'Bh]lXU\Us0켮 BK)׌3j"EB;T˅F7Bm5/ЬR@ %G3-.UAՅ3f*®&'M&# |O^R]Eh5p[ ,&u咑ߛffv ]=C8ƞo殄? ^dRg0.EjS&/%=@_k7;L;4l7.r޹?ٗTqډ̴* 56XZ.1 8r+AOfݹ8 .{CZd+!oSnGTF&Mʜڕ[6Atgʩ•rF'eixӤdFfꔜS+֟6Xѩ8j|\ٗm&GrSTtJ\l2c>_m'rIZZC@`aT)$WI%XXhcNMn=-Mz[67E3Ngkn5 ? m~yrv7MM<*u / )BͅTI|LΞ]a)z;m{M탦C:Àtka}۝ߛ13HŊoxw ]$l ƊC!z>j>շCtR{M]5--u uZ2,YÉ5Y̜< 6y50Ӟ"pmV{QI9]AbGpJ7b9}Vm-􁮔R]sMUڧ؋vPo ̷$I5@nބheFV6ggÅFIVZfl*lzΩnĭpw IF(PBpTF ʅWCn0aNIN*mk~j$OGQhh/ Yt0nP@DmJr!I n@̰0,"€E&d*YK)+ԮȜ䭲zne}|mH\*ċ *, 2/Јpbok\ 8^q#0ˆ~pOsc]jn-İ #hȒo[jF~BnB8rk/dkq.!  鄘ofv4mQȋ@-2"(O}'YUif&= $o ʰ4*"uLqp+0DƐ! ݂ "M񚺱Rkk+%F+Pk.ާ 1$TRVI˯r1KGd' Or)1̵.kwd6 1;((l&0#5d50"xQTTF%70B7jckFo/pҼ 27%,ˑXfts^WN2`> `E3MG::5 䘲;:o+$͢'2Ni$4r.Us~y&ڮn0ԅ:n+o0]~FDSJ'ȓL`JH kn %93}&<1jQm&0-0Vi6;bTn+nΐD$Be ELCh-_vgKu:ij~"j=Aʙ4 @0gJRȏf+ަ4Q!~r'~,MITAȌlT3ב**O5col#bHT2g ͔6W&Ss,LFs48{5.U\3Q)%b[j^! G S،UD)42r< k_V(_5- 닦8QVcm0L+,ɄGdsjY5;)of \4.;ʵXy:Zv4`=S*uuHH[9TI(nP &Q>CH1 Vb}U(M8]cVRn,^Pc@6:gV@sѤ[.ft7N,j]+V2RctUlihb;3X;046c7VESU#u@Kr!a a[Ñgr`VuuohtRƴiK'/u7K.1EK>w*n 7Vf,ͬy N2770-é:f6Fi7kR̡=C8b]۶kiYs F!i6\?6xn5~GNzgk*tEs/1X1b! 4Zُv+g֒H$UuY^#mZ+_T|RWdkQFxp)t~preIs i1GMul0WsB4Sz j1>g\x3|Wm=BDN^DkvƎ2ɺOڶGgY}]RN:8mbaxK>sX·]Mt &թ]EE*yeMAɭ1b^IiUYU%]6N־EҊ.9Z}v!QA r5e^U?ZCa>Mמ%CM3ױQRd헟riHlQR3fLs#D:kאM:OYQZe0P=D,kr6u,G#CDHG&_ݨ\xXDo|6uAy碘$EG˷u9li jKGgK/”+-7pf.QLz)1?cD/I eہ.bjಲ(&Q\7[eF+yU sLqÖMEz낟fȊgV{ptL,Y7zP"G2rӍy2QoՆ#~\4U mwJ˨s4P Z_wRtZ7^T940A>XYqЌBxTdcPaPԹ(e2N<-i_eSBe(Xa(mXDK0^i$P6Z gDܘ& ]6$'ZOeBpbM)*ml2#ɗ&p"z)VM哒0j[qDϙYX-O9jC>lRʧsZ:w޺ѨD+y.z,^[f|j:&XҺ$f& ~ n\qZ3^Vh /q9btsBmviwæ6LrE,!!%ߦol((72GX$gmAO5$*Euŀ5q)ga,SN2,o K_u׍>v(;73]vSxKӟs-(3zʚ[E $j=L=p#"qƬyϑK3k/dcjvNT.̶tҗ֓{M-|R֪7s]HVI>><5dvAaw3 ~1h0js{_D .QY*erA[d/D]Y &ٹSGlJ%'o_sG/ /T=PZJH2K-,bאވc~eyبj4@hr"nd 4RS`5q7'19Q%\R7OjkluxGml Y;DVP".8&SLS5nS^͖d"קU&r8ǔlf#r-`G0dk\xyQ{orU(`l|j 9Z’f|Q^DL;WO XM;^DsW2#JH4Q};V&?H툺2=qwudJ҂N:JQcZr?oY3qh6q.WfxRw/BgYSc EhCŏ&,W^2C.]:nL%M'D+aV4Uf]y **EeَȨdVC3Ֆn@1ZgvGQ#G;ڬ&hca2=wתҦm-iEiGq#-oټl6"^Z)[ qH ov~Vr-=\eAb3xgrYdtڭÆs䶤J]+hƙof?P&Uw|s&aXA^[P%փjt`H K3ܙ{{^=f\.*&qsk/m~6ȣ2{:KxT':IyT $ y5Yz8(OyR\!b}r'}-mJvq:jjyW}﹫mRޓv|Inb/v_>;ta՝UUY]s``;GeographicLib-1.52/doc/Makefile.in0000644000771000077100000004335414064202402016633 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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 = $(DESTDIR)$(docdir)/html 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@ pkgconfigdir = @pkgconfigdir@ 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 FIGURES = \ $(srcdir)/gauss-krueger-graticule.png \ $(srcdir)/thompson-tm-graticule.png \ $(srcdir)/gauss-krueger-convergence-scale.png \ $(srcdir)/gauss-schreiber-graticule-a.png \ $(srcdir)/gauss-krueger-graticule-a.png \ $(srcdir)/thompson-tm-graticule-a.png \ $(srcdir)/gauss-krueger-error.png \ $(srcdir)/meridian-measures.png \ $(srcdir)/normal-gravity-potential-1.svg \ $(srcdir)/vptree.gif 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/Ellipsoid.hpp \ $(top_srcdir)/include/GeographicLib/EllipticFunction.hpp \ $(top_srcdir)/include/GeographicLib/GARS.hpp \ $(top_srcdir)/include/GeographicLib/GeoCoords.hpp \ $(top_srcdir)/include/GeographicLib/Geocentric.hpp \ $(top_srcdir)/include/GeographicLib/Geodesic.hpp \ $(top_srcdir)/include/GeographicLib/GeodesicExact.hpp \ $(top_srcdir)/include/GeographicLib/GeodesicLine.hpp \ $(top_srcdir)/include/GeographicLib/GeodesicLineExact.hpp \ $(top_srcdir)/include/GeographicLib/Geohash.hpp \ $(top_srcdir)/include/GeographicLib/Geoid.hpp \ $(top_srcdir)/include/GeographicLib/Georef.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/Ellipsoid.cpp \ $(top_srcdir)/src/EllipticFunction.cpp \ $(top_srcdir)/src/GARS.cpp \ $(top_srcdir)/src/GeoCoords.cpp \ $(top_srcdir)/src/Geocentric.cpp \ $(top_srcdir)/src/Geodesic.cpp \ $(top_srcdir)/src/GeodesicLine.cpp \ $(top_srcdir)/src/Geohash.cpp \ $(top_srcdir)/src/Geoid.cpp \ $(top_srcdir)/src/Georef.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/GeodSolve.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/GeodSolve.1.html \ ../man/GeoidEval.1.html \ ../man/Gravity.1.html \ ../man/MagneticField.1.html \ ../man/Planimeter.1.html \ ../man/RhumbSolve.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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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 \ cscopelist-am ctags-am 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 tags-am uninstall \ uninstall-am .PRECIOUS: Makefile doc: html/index.html @HAVE_DOXYGEN_TRUE@manpages: $(MANPAGES) @HAVE_DOXYGEN_TRUE@ if test -d html; then rm -rf html/*; else mkdir html; fi @HAVE_DOXYGEN_TRUE@ cp $^ html/ @HAVE_DOXYGEN_TRUE@ touch $@ @HAVE_DOXYGEN_TRUE@html/index.html: manpages doxyfile.in GeographicLib.dox.in \ @HAVE_DOXYGEN_TRUE@ $(HPPFILES) $(ALLSOURCES) $(EXTRAFILES) $(FIGURES) @HAVE_DOXYGEN_TRUE@ cp -p $(EXTRAFILES) $(top_srcdir)/maxima/*.mac \ @HAVE_DOXYGEN_TRUE@ $(top_srcdir)/LICENSE.txt html/ @HAVE_DOXYGEN_TRUE@ sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ @HAVE_DOXYGEN_TRUE@ $(srcdir)/GeographicLib.dox.in > GeographicLib.dox @HAVE_DOXYGEN_TRUE@ sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \ @HAVE_DOXYGEN_TRUE@ -e "s%@PROJECT_BINARY_DIR@%..%g" \ @HAVE_DOXYGEN_TRUE@ -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ @HAVE_DOXYGEN_TRUE@ $(srcdir)/doxyfile.in | $(DOXYGEN) - @HAVE_DOXYGEN_FALSE@html/index.html: index.html.in utilities.html.in @HAVE_DOXYGEN_FALSE@ if test -d html; then rm -rf html/*; else mkdir html; fi @HAVE_DOXYGEN_FALSE@ cp $(top_srcdir)/LICENSE.txt html/ @HAVE_DOXYGEN_FALSE@ sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ @HAVE_DOXYGEN_FALSE@ $(srcdir)/utilities.html.in > html/utilities.html @HAVE_DOXYGEN_FALSE@ sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \ @HAVE_DOXYGEN_FALSE@ $(srcdir)/index.html.in > html/index.html maintainer-clean-local: rm -rf html manpages install-doc: html/index.html $(INSTALL) -d $(htmldir) $(INSTALL) -m 644 `dirname $<`/*.* $(htmldir) -test -f `dirname $<`/search/search.js && \ $(INSTALL) -d $(htmldir)/search && \ $(INSTALL) -m 644 `dirname $<`/search/*.* $(htmldir)/search || true # 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.52/dotnet/NETGeographicLib/Accumulator.cpp0000644000771000077100000000560214064202371023346 0ustar ckarneyckarney/** * \file NETGeographicLib/Accumulator.cpp * \brief Implementation for NETGeographicLib::Accumulator class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/Accumulator.hpp" #include "Accumulator.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** Accumulator::!Accumulator(void) { if ( m_pAccumulator != NULL ) { delete m_pAccumulator; m_pAccumulator = NULL; } } //***************************************************************************** Accumulator::Accumulator(void) { try { m_pAccumulator = new GeographicLib::Accumulator(); } catch ( std::bad_alloc ) { throw gcnew GeographicErr("Failed to allocate memory for a GeogrpicLib::Accumulator"); } } //***************************************************************************** void Accumulator::Assign( double a ) { m_pAccumulator->operator=( a); } //***************************************************************************** double Accumulator::Result() { return m_pAccumulator->operator()(); } //***************************************************************************** void Accumulator::Sum( double a ) { m_pAccumulator->operator+=( a ); } //***************************************************************************** void Accumulator::Multiply( int i ) { m_pAccumulator->operator*=( i ); } //***************************************************************************** bool Accumulator::operator == ( Accumulator^ lhs, double a ) { return lhs->m_pAccumulator->operator==( a ); } //***************************************************************************** bool Accumulator::operator != ( Accumulator^ lhs, double a ) { return lhs->m_pAccumulator->operator!=( a ); } //***************************************************************************** bool Accumulator::operator < ( Accumulator^ lhs, double a ) { return lhs->m_pAccumulator->operator<( a ); } //***************************************************************************** bool Accumulator::operator <= ( Accumulator^ lhs, double a ) { return lhs->m_pAccumulator->operator<=( a ); } //***************************************************************************** bool Accumulator::operator > ( Accumulator^ lhs, double a ) { return lhs->m_pAccumulator->operator>( a ); } //***************************************************************************** bool Accumulator::operator >= ( Accumulator^ lhs, double a ) { return lhs->m_pAccumulator->operator>=( a ); } GeographicLib-1.52/dotnet/NETGeographicLib/Accumulator.h0000644000771000077100000001037514064202371023016 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/Accumulator.h * \brief Header for NETGeographicLib::Accumulator class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /*! \brief .NET wrapper for GeographicLib::Accumulator. This class allows .NET applications to access GeographicLib::Accumulator. This allow many numbers of floating point type \e double to be added together with twice the normal precision. The effective precision of the sum is 106 bits or about 32 decimal places. The implementation follows J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) 305--363 (1997). C# Example: \include example-Accumulator.cs Managed C++ Example: \include example-Accumulator.cpp Visual Basic Example: \include example-Accumulator.vb INTERFACE DIFFERENCES:
Since assignment operators (=,+=,-=,*=) are not supported in managed classes; - the Assign() method replaces the = operator, - the Sum() method replaces the += and -= operators, and - the Multiply() method replaces the *= operator, Use Result() instead of the () operator to obtain the summed value from the accumulator. */ public ref class Accumulator { private: // Pointer to the unmanaged GeographicLib::Accumulator. GeographicLib::Accumulator* m_pAccumulator; // The finalizer releases the unmanaged object when this class is destroyrd. !Accumulator(void); public: //! \brief Constructor. Accumulator(void); //! \brief Destructor calls the finalizer. ~Accumulator() { this->!Accumulator(); } /*! \brief Assigns a value to an accumulator. \param[in] a The value to be assigned. */ void Assign( double a ); //! \brief Returns the accumulated value. double Result(); /*! \brief Adds a value to the accumulator. \param[in] a The value to be added. */ void Sum( double a ); /*! \brief Multiplication by an integer \param[in] i The multiplier. */ void Multiply( int i ); /*! \brief Equality operator. \param[in] lhs The accumulator. \param[in] a The value to be compared to. \return true if the accumulated value is equal to a. */ static bool operator == ( Accumulator^ lhs, double a ); /*! \brief Inequality operator. \param[in] lhs The accumulator. \param[in] a The value to be compared to. \return true if the accumulated value is not equal to a. */ static bool operator != ( Accumulator^ lhs, double a ); /*! \brief Less than operator. \param[in] lhs The accumulator. \param[in] a The value to be compared to. \return true if the accumulated value is less than a. */ static bool operator < ( Accumulator^ lhs, double a ); /*! \brief Less than or equal to operator. \param[in] lhs The accumulator. \param[in] a The value to be compared to. \return true if the accumulated value is less than or equal to a. */ static bool operator <= ( Accumulator^ lhs, double a ); /*! \brief Greater than operator. \param[in] lhs The accumulator. \param[in] a The value to be compared to. \return true if the accumulated value is greater than a. */ static bool operator > ( Accumulator^ lhs, double a ); /*! \brief Greater than or equal to operator. \param[in] lhs The accumulator. \param[in] a The value to be compared to. \return true if the accumulated value is greater than or equal to a. */ static bool operator >= ( Accumulator^ lhs, double a ); }; } //namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/AlbersEqualArea.cpp0000644000771000077100000001471314064202371024063 0ustar ckarneyckarney/** * \file NETGeographicLib/AlbersEqualArea.cpp * \brief Implementation for NETGeographicLib::AlbersEqualArea class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/AlbersEqualArea.hpp" #include "AlbersEqualArea.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** AlbersEqualArea::!AlbersEqualArea() { if ( m_pAlbersEqualArea != NULL ) { delete m_pAlbersEqualArea; m_pAlbersEqualArea = NULL; } } //***************************************************************************** AlbersEqualArea::AlbersEqualArea( StandardTypes type ) { try { switch ( type ) { case StandardTypes::CylindricalEqualArea: m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( GeographicLib::AlbersEqualArea::CylindricalEqualArea() ); break; case StandardTypes::AzimuthalEqualAreaNorth: m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( GeographicLib::AlbersEqualArea::AzimuthalEqualAreaNorth() ); break; case StandardTypes::AzimuthalEqualAreaSouth: m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( GeographicLib::AlbersEqualArea::AzimuthalEqualAreaSouth() ); break; } } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" ); } } //***************************************************************************** AlbersEqualArea::AlbersEqualArea(double a, double f, double stdlat1, double stdlat2, double k1) { try { m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( a, f, stdlat1, stdlat2, k1 ); } catch ( GeographicLib::GeographicErr err ) { throw gcnew GeographicErr( err.what() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" ); } } //***************************************************************************** AlbersEqualArea::AlbersEqualArea(double a, double f, double stdlat, double k0) { try { m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( a, f, stdlat, k0 ); } catch ( GeographicLib::GeographicErr err ) { throw gcnew GeographicErr( err.what() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" ); } } //***************************************************************************** AlbersEqualArea::AlbersEqualArea(double a, double f, double sinlat1, double coslat1, double sinlat2, double coslat2, double k1) { try { m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( a, f, sinlat1, coslat1, sinlat2, coslat2, k1 ); } catch ( GeographicLib::GeographicErr err ) { throw gcnew GeographicErr( err.what() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" ); } } //***************************************************************************** void AlbersEqualArea::SetScale(double lat, double k) { try { m_pAlbersEqualArea->SetScale( lat, k ); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } //***************************************************************************** void AlbersEqualArea::Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double lx, ly, lgamma, lk; m_pAlbersEqualArea->Forward( lon0, lat, lon, lx, ly, lgamma, lk ); x = lx; y = ly; gamma = lgamma; k = lk; } //***************************************************************************** void AlbersEqualArea::Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double llat, llon, lgamma, lk; m_pAlbersEqualArea->Reverse( lon0, x, y, llat, llon, lgamma, lk ); lat = llat; lon = llon; gamma = lgamma; k = lk; } //***************************************************************************** void AlbersEqualArea::Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y) { double lx, ly, lgamma, lk; m_pAlbersEqualArea->Forward( lon0, lat, lon, lx, ly, lgamma, lk ); x = lx; y = ly; } //***************************************************************************** void AlbersEqualArea::Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon, lgamma, lk; m_pAlbersEqualArea->Reverse( lon0, x, y, llat, llon, lgamma, lk ); lat = llat; lon = llon; } //***************************************************************************** double AlbersEqualArea::EquatorialRadius::get() { return m_pAlbersEqualArea->EquatorialRadius(); } //***************************************************************************** double AlbersEqualArea::Flattening::get() { return m_pAlbersEqualArea->Flattening(); } //***************************************************************************** double AlbersEqualArea::OriginLatitude::get() { return m_pAlbersEqualArea->OriginLatitude(); } //***************************************************************************** double AlbersEqualArea::CentralScale::get() { return m_pAlbersEqualArea->CentralScale(); } GeographicLib-1.52/dotnet/NETGeographicLib/AlbersEqualArea.h0000644000771000077100000003162214064202371023526 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/AlbersEqualArea.h * \brief Header for NETGeographicLib::AlbersEqualArea class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET Wrapper for GeographicLib::AlbersEqualArea. * * This class allows .NET applications to access * GeographicLib::AlbersEqualArea * * 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, γ, 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 γ 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. * * C# Example: * \include example-AlbersEqualArea.cs * Managed C++ Example: * \include example-AlbersEqualArea.cpp * Visual Basic Example: * \include example-AlbersEqualArea.vb * * INTERFACE DIFFERENCES:
* A constructor has been provided that creates the standard projections. * * The EquatorialRadius, Flattening, OriginLatitude, and CentralScale functions * are implemented as properties. **********************************************************************/ public ref class AlbersEqualArea { private: // pointer to the unmanaged GeographicLib::AlbersEqualArea GeographicLib::AlbersEqualArea* m_pAlbersEqualArea; // Frees the unmanaged m_pAlbersEqualArea when object is destroyed. !AlbersEqualArea(); public: /** Standard AlbersEqualAreaProjections that assume the WGS84 ellipsoid. *********************************************************************/ enum class StandardTypes { CylindricalEqualArea, //!< cylindrical equal area projection (stdlat = 0, and \e k0 = 1) AzimuthalEqualAreaNorth, //!< Lambert azimuthal equal area projection (stdlat = 90°, and \e k0 = 1) AzimuthalEqualAreaSouth //!< Lambert azimuthal equal area projection (stdlat = −90°, and \e k0 = 1) }; //! \brief Destructor ~AlbersEqualArea() { this->!AlbersEqualArea(); } /**! * Constructor for one of the standard types. * @param[in] type The desired standard type. **********************************************************************/ AlbersEqualArea( StandardTypes type ); /** * 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. * @param[in] stdlat standard parallel (degrees), the circle of tangency. * @param[in] k0 azimuthal scale on the standard parallel. * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k0 is * not positive. * @exception GeographicErr if \e stdlat is not in [−90°, * 90°]. **********************************************************************/ AlbersEqualArea(double a, double f, double stdlat, double 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. * @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees). * @param[in] k1 azimuthal scale on the standard parallels. * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k1 is * not positive. * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * [−90°, 90°], or if \e stdlat1 and \e stdlat2 are * opposite poles. **********************************************************************/ AlbersEqualArea(double a, double f, double stdlat1, double stdlat2, double 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. * @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. * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k1 is * not positive. * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * [−90°, 90°], or if \e stdlat1 and \e stdlat2 are * opposite poles. * * 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) ≤ 160°, * then the error in the latitude of origin is less than 4.5 × * 10−14d;. **********************************************************************/ AlbersEqualArea(double a, double f, double sinlat1, double coslat1, double sinlat2, double coslat2, double k1); /** * Set the azimuthal scale for the projection. * * @param[in] lat (degrees). * @param[in] k azimuthal scale at latitude \e lat (default 1). * @exception GeographicErr \e k is not positive. * @exception GeographicErr if \e lat is not in (−90°, * 90°). * * This allows a "latitude of conformality" to be specified. **********************************************************************/ void SetScale(double lat, double k); /** * 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°]. 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(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * 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. 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(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * AlbersEqualArea::Forward without returning the convergence and * scale. **********************************************************************/ void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y); /** * AlbersEqualArea::Reverse without returning the convergence and * scale. **********************************************************************/ void Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ property double Flattening { double get(); } /** * @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. **********************************************************************/ property double OriginLatitude { double get(); } /** * @return central scale for the projection. This is the azimuthal scale * on the latitude of origin. **********************************************************************/ property double CentralScale { double get(); } ///@} }; } // namespace NETGeographic GeographicLib-1.52/dotnet/NETGeographicLib/AssemblyInfo.cpp0000644000771000077100000000275614064202371023471 0ustar ckarneyckarney#include "stdafx.h" using namespace System; using namespace System::Reflection; using namespace System::Runtime::CompilerServices; using namespace System::Runtime::InteropServices; using namespace System::Security::Permissions; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly:AssemblyTitleAttribute("NETGeographic")]; [assembly:AssemblyDescriptionAttribute(".NET Interface for GeographicLib")]; [assembly:AssemblyConfigurationAttribute("1.33")]; [assembly:AssemblyCompanyAttribute("Open Source")]; [assembly:AssemblyProductAttribute("NETGeographic")]; [assembly:AssemblyCopyrightAttribute("GeographicLib copyright (c) Charles Karney 2013\nNETGeographicLib copyright (c) Scott Heiman 2013")]; [assembly:AssemblyTrademarkAttribute("")]; [assembly:AssemblyCultureAttribute("")]; // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the value or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly:AssemblyVersionAttribute("1.33.*")]; [assembly:ComVisible(false)]; [assembly:CLSCompliantAttribute(true)]; #if _MSC_VER < 1800 // RequestMinium marked as obsolete in Visual Studio 12 (2013) [assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; #endif GeographicLib-1.52/dotnet/NETGeographicLib/AzimuthalEquidistant.cpp0000644000771000077100000000721714064202371025244 0ustar ckarneyckarney/** * \file NETGeographicLib/AzimuthalEquidistant.cpp * \brief Implementation for NETGeographicLib::AzimuthalEquidistant class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/AzimuthalEquidistant.hpp" #include "AzimuthalEquidistant.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::AzimuthalEquidistant"; //***************************************************************************** AzimuthalEquidistant::!AzimuthalEquidistant() { if ( m_pAzimuthalEquidistant != NULL ) { delete m_pAzimuthalEquidistant; m_pAzimuthalEquidistant = NULL; } } //***************************************************************************** AzimuthalEquidistant::AzimuthalEquidistant(void) { try { m_pAzimuthalEquidistant = new GeographicLib::AzimuthalEquidistant( GeographicLib::Geodesic::WGS84() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** AzimuthalEquidistant::AzimuthalEquidistant( Geodesic^ g ) { try { const GeographicLib::Geodesic* pGeodesic = reinterpret_cast( g->GetUnmanaged()->ToPointer() ); m_pAzimuthalEquidistant = new GeographicLib::AzimuthalEquidistant( *pGeodesic ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void AzimuthalEquidistant::Forward(double lat0, double lon0, double lat, double lon, double% x, double% y, double% azi, double% rk) { double lx, ly, lazi, lrk; m_pAzimuthalEquidistant->Forward( lat0, lon0, lat, lon, lx, ly, lazi, lrk ); x = lx; y = ly; azi = lazi; rk = lrk; } //***************************************************************************** void AzimuthalEquidistant::Reverse(double lat0, double lon0, double x, double y, double% lat, double% lon, double% azi, double% rk) { double llat, llon, lazi, lrk; m_pAzimuthalEquidistant->Reverse(lat0, lon0, x, y, llat, llon, lazi, lrk); lat = llat; lon = llon; azi = lazi; rk = lrk; } //***************************************************************************** void AzimuthalEquidistant::Forward(double lat0, double lon0, double lat, double lon, double% x, double% y) { double azi, rk, lx, ly; m_pAzimuthalEquidistant->Forward(lat0, lon0, lat, lon, lx, ly, azi, rk); x = lx; y = ly; } //***************************************************************************** void AzimuthalEquidistant::Reverse(double lat0, double lon0, double x, double y, double% lat, double% lon) { double azi, rk, llat, llon; m_pAzimuthalEquidistant->Reverse(lat0, lon0, x, y, llat, llon, azi, rk); lat = llat; lon = llon; } //***************************************************************************** double AzimuthalEquidistant::EquatorialRadius::get() { return m_pAzimuthalEquidistant->EquatorialRadius(); } //***************************************************************************** double AzimuthalEquidistant::Flattening::get() { return m_pAzimuthalEquidistant->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/AzimuthalEquidistant.h0000644000771000077100000001702114064202371024703 0ustar ckarneyckarney/** * \file NETGeographicLib/AzimuthalEquidistant.h * \brief Header for NETGeographicLib::AzimuthalEquidistant class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once #include "Geodesic.h" namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::AzimuthalEquidistant. * * This class allows .NET applications to access GeographicLib::AzimuthalEquidistant. * * 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. * * C# Example: * \include example-AzimuthalEquidistant.cs * Managed C++ Example: * \include example-AzimuthalEquidistant.cpp * Visual Basic Example: * \include example-AzimuthalEquidistant.vb * * INTERFACE DIFFERENCES:
* A default constructor is provided that assumes a WGS84 ellipsoid. * * The EquatorialRadius and Flattening functions are implemented as * properties. **********************************************************************/ public ref class AzimuthalEquidistant { private: // Pointer to the unmanaged GeographicLib::AzimuthalEquidistant const GeographicLib::AzimuthalEquidistant* m_pAzimuthalEquidistant; // Frees the unmanaged memory when the object is destroyed. !AzimuthalEquidistant(); public: /** * Default Constructor for AzimuthalEquidistant. * Assumes WGS84 Geodesic **********************************************************************/ AzimuthalEquidistant(void); /** * Constructor for AzimuthalEquidistant. * * @param[in] earth the Geodesic object to use for geodesic calculations. **********************************************************************/ AzimuthalEquidistant( Geodesic^ earth ); /** * Destructor * * frees unmanaged memory. **********************************************************************/ ~AzimuthalEquidistant() { this->!AzimuthalEquidistant(); } /** * 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°]. * 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(double lat0, double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk); /** * 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°]. \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(double lat0, double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk); /** * AzimuthalEquidistant::Forward without returning the azimuth and scale. **********************************************************************/ void Forward(double lat0, double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y); /** * AzimuthalEquidistant::Reverse without returning the azimuth and scale. **********************************************************************/ void Reverse(double lat0, double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); /** \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. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ property double Flattening { double get(); } ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/CMakeLists.txt0000644000771000077100000000320014064202371023113 0ustar ckarneyckarney# Build the .NET library... # Include all the .cpp files in the library. file (GLOB SOURCES [A-Za-z]*.cpp) file (GLOB HEADERS [A-Za-z]*.h) add_library (${NETGEOGRAPHICLIB_LIBRARIES} SHARED ${SOURCES} ${HEADERS}) if (CMAKE_VERSION VERSION_LESS 3.12) set_target_properties (${NETGEOGRAPHICLIB_LIBRARIES} PROPERTIES COMPILE_FLAGS "/clr") else () set_target_properties (${NETGEOGRAPHICLIB_LIBRARIES} PROPERTIES COMMON_LANGUAGE_RUNTIME "") endif() string (REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string (REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") if (MSVC AND NOT MSVC_VERSION GREATER 1600) # Disable "already imported" and "unsupported default parameter" # warnings with VS 10 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4945 /wd4564") endif () add_definitions (${PROJECT_DEFINITIONS}) target_link_libraries (${NETGEOGRAPHICLIB_LIBRARIES} ${PROJECT_LIBRARIES}) # Set the version number on the library set_target_properties (${NETGEOGRAPHICLIB_LIBRARIES} PROPERTIES VERSION "${LIBVERSIONFULL}" OUTPUT_NAME ${NETLIBNAME}) # Specify where the library is installed, adding it to the export targets install (TARGETS ${NETGEOGRAPHICLIB_LIBRARIES} EXPORT targets RUNTIME DESTINATION bin) if (PACKAGE_DEBUG_LIBS) install (PROGRAMS "${PROJECT_BINARY_DIR}/bin/Debug/${NETLIBNAME}${CMAKE_DEBUG_POSTFIX}.dll" DESTINATION bin CONFIGURATIONS Release) endif () # Install pdb file. install (FILES $ DESTINATION bin OPTIONAL) # Put all the library into a folder in the IDE set_property (TARGET ${NETGEOGRAPHICLIB_LIBRARIES} PROPERTY FOLDER library) GeographicLib-1.52/dotnet/NETGeographicLib/CassiniSoldner.cpp0000644000771000077100000001105214064202371024003 0ustar ckarneyckarney/** * \file NETGeographicLib/CassiniSoldner.cpp * \brief Implementation for NETGeographicLib::CassiniSoldner class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/CassiniSoldner.hpp" #include "Geodesic.h" #include "CassiniSoldner.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::CassiniSoldner"; //***************************************************************************** CassiniSoldner::!CassiniSoldner() { if ( m_pCassiniSoldner != NULL ) { delete m_pCassiniSoldner; m_pCassiniSoldner = NULL; } } //***************************************************************************** CassiniSoldner::CassiniSoldner(double lat0, double lon0) { try { m_pCassiniSoldner = new GeographicLib::CassiniSoldner( GeographicLib::Geodesic::WGS84() ); m_pCassiniSoldner->Reset(lat0, lon0); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** CassiniSoldner::CassiniSoldner(double lat0, double lon0, Geodesic^ earth ) { try { const GeographicLib::Geodesic* pGeodesic = reinterpret_cast( earth->GetUnmanaged()->ToPointer() ); m_pCassiniSoldner = new GeographicLib::CassiniSoldner( *pGeodesic ); m_pCassiniSoldner->Reset(lat0, lon0); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void CassiniSoldner::Reset(double lat0, double lon0) { m_pCassiniSoldner->Reset(lat0, lon0); } //***************************************************************************** void CassiniSoldner::Forward(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk) { double lx, ly, lazi, lrk; m_pCassiniSoldner->Forward(lat, lon, lx, ly, lazi, lrk); x = lx; y = ly; azi = lazi; rk = lrk; } //***************************************************************************** void CassiniSoldner::Reverse(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk) { double llat, llon, lazi, lrk; m_pCassiniSoldner->Reverse( x, y, llat, llon, lazi, lrk ); lat = llat; lon = llon; azi = lazi; rk = lrk; } //***************************************************************************** void CassiniSoldner::Forward(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y) { double lx, ly, azi, rk; m_pCassiniSoldner->Forward(lat, lon, lx, ly, azi, rk); x = lx; y = ly; } //***************************************************************************** void CassiniSoldner::Reverse(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon, lazi, lrk; m_pCassiniSoldner->Reverse( x, y, llat, llon, lazi, lrk ); lat = llat; lon = llon; } //***************************************************************************** double CassiniSoldner::LatitudeOrigin::get() { return m_pCassiniSoldner->LatitudeOrigin(); } //***************************************************************************** double CassiniSoldner::LongitudeOrigin::get() { return m_pCassiniSoldner->LongitudeOrigin(); } //***************************************************************************** double CassiniSoldner::EquatorialRadius::get() { return m_pCassiniSoldner->EquatorialRadius(); } //***************************************************************************** double CassiniSoldner::Flattening::get() { return m_pCassiniSoldner->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/CassiniSoldner.h0000644000771000077100000002334014064202371023453 0ustar ckarneyckarney/** * \file NETGeographicLib/CassiniSoldner.h * \brief Header for NETGeographicLib::CassiniSoldner class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::CassiniSoldner. * * This class allows .NET applications to access GeographicLib::CassiniSoldner. * * 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 90° 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 + * 180°. \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). * * C# Example: * \include example-CassiniSoldner.cs * Managed C++ Example: * \include example-CassiniSoldner.cpp * Visual Basic Example: * \include example-CassiniSoldner.vb * * INTERFACE DIFFERENCES:
* The LatitudeOrigin, LongitudeOrigin, EquatorialRadius and Flattening * functions are implimented as properties. **********************************************************************/ public ref class CassiniSoldner { private: // A pointer to the unmanaged GeographicLib::CassiniSoldner GeographicLib::CassiniSoldner* m_pCassiniSoldner; // The finalizer frees the unmanaged memory when the object is destroyed. !CassiniSoldner(); public: /** * Constructor for CassiniSoldner specifying a center point and * assuming the WGS84 ellipsoid. * * @param[in] lat0 latitude of center point of projection (degrees). * @param[in] lon0 longitude of center point of projection (degrees). **********************************************************************/ CassiniSoldner(double lat0, double lon0); /** * 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°]. **********************************************************************/ CassiniSoldner(double lat0, double lon0, Geodesic^ earth ); /** * The destructor calls the finalizer. **********************************************************************/ ~CassiniSoldner() { this->!CassiniSoldner(); } /** * 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°]. **********************************************************************/ void Reset(double lat0, double lon0); /** * 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°]. 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(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk); /** * 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(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk); /** * CassiniSoldner::Forward without returning the azimuth and scale. **********************************************************************/ void Forward(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y); /** * CassiniSoldner::Reverse without returning the azimuth and scale. **********************************************************************/ void Reverse(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e lat0 the latitude of origin (degrees). **********************************************************************/ property double LatitudeOrigin { double get(); } /** * @return \e lon0 the longitude of origin (degrees). **********************************************************************/ property double LongitudeOrigin { double get(); } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ property double Flattening { double get(); } ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/CircularEngine.cpp0000644000771000077100000000550714064202371023765 0ustar ckarneyckarney/** * \file NETGeographicLib/CircularEngine.cpp * \brief Implementation for NETGeographicLib::CircularEngine class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/CircularEngine.hpp" #include "CircularEngine.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** CircularEngine::CircularEngine(const GeographicLib::CircularEngine& c) { try { m_pCircularEngine = new GeographicLib::CircularEngine( c ); } catch ( GeographicLib::GeographicErr err ) { throw gcnew GeographicErr( err.what() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::CircularEngine" ); } } //***************************************************************************** CircularEngine::!CircularEngine() { if ( m_pCircularEngine != NULL ) { delete m_pCircularEngine; m_pCircularEngine = NULL; } } //***************************************************************************** double CircularEngine::LongitudeSum(double coslon, double sinlon) { return m_pCircularEngine->operator()( coslon, sinlon ); } //***************************************************************************** double CircularEngine::LongitudeSum(double lon) { return m_pCircularEngine->operator()( lon ); } //***************************************************************************** double CircularEngine::LongitudeSum(double coslon, double sinlon, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% gradz) { double lgradx, lgrady, lgradz; double output = m_pCircularEngine->operator()( coslon, sinlon, lgradx, lgrady, lgradz ); gradx = lgradx; grady = lgrady; gradz = lgradz; return output; } //***************************************************************************** double CircularEngine::LongitudeSum(double lon, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% gradz) { double lgradx, lgrady, lgradz; double output = m_pCircularEngine->operator()( lon, lgradx, lgrady, lgradz ); gradx = lgradx; grady = lgrady; gradz = lgradz; return output; } GeographicLib-1.52/dotnet/NETGeographicLib/CircularEngine.h0000644000771000077100000001460114064202371023425 0ustar ckarneyckarney/** * \file NETGeographicLib/CircularEngine.h * \brief Header for NETGeographicLib::CircularEngine class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::CircularEngine. * * This class allows .NET applications to access GeographicLib::CircularEngine. * * 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::LongitudeSum() can * then be used to perform the outer sum for particular values 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 for internal use only. 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 GeographicErr exception. * * C# Example: * \include example-CircularEngine.cs * Managed C++ Example: * \include example-CircularEngine.cpp * Visual Basic Example: * \include example-CircularEngine.vb * * INTERFACE DIFFERENCES:
* The () operator has been replaced with with LongitudeSum. * * This class does not have a constructor that can be used in a .NET * application. Use SphericalHarmonic::Circle, SphericalHarmonic1::Circle or * SphericalHarmonic2::Circle to create instances of this class. **********************************************************************/ public ref class CircularEngine { private: // pointer to the unmanaged GeographicLib::CircularEngine const GeographicLib::CircularEngine* m_pCircularEngine; // The finalizer frees the unmanaged memory when the object is destroyed. !CircularEngine(); public: /** * The constructor. * * This constructor should not be used in .NET applications. * Use SphericalHarmonic::Circle, SphericalHarmonic1::Circle or * SphericalHarmonic2::Circle to create instances of this class. * * @param[in] c The unmanaged CircularEngine to be copied. **********************************************************************/ CircularEngine( const GeographicLib::CircularEngine& c ); /** * The destructor calls the finalizer **********************************************************************/ ~CircularEngine() { this->!CircularEngine(); } /** * 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. **********************************************************************/ double LongitudeSum(double coslon, double sinlon); /** * Evaluate the sum for a particular longitude. * * @param[in] lon the longitude (degrees). * @return \e V the value of the sum. **********************************************************************/ double LongitudeSum(double lon); /** * 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. **********************************************************************/ double LongitudeSum(double coslon, double sinlon, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% 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. **********************************************************************/ double LongitudeSum(double lon, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% gradz); }; } //namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/DMS.cpp0000644000771000077100000000704614064202371021516 0ustar ckarneyckarney/** * \file NETGeographicLib/DMS.cpp * \brief Implementation for NETGeographicLib::DMS class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/DMS.hpp" #include "DMS.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** double DMS::Decode( System::String^ dms, [System::Runtime::InteropServices::Out] Flag% ind) { try { GeographicLib::DMS::flag lind; double out = GeographicLib::DMS::Decode( StringConvert::ManagedToUnmanaged(dms), lind ); ind = static_cast(lind); return out; } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } //***************************************************************************** void DMS::DecodeLatLon(System::String^ dmsa, System::String^ dmsb, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, bool longfirst ) { try { double llat, llon; GeographicLib::DMS::DecodeLatLon( StringConvert::ManagedToUnmanaged( dmsa ), StringConvert::ManagedToUnmanaged( dmsb ), llat, llon, longfirst ); lat = llat; lon = llon; } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } //***************************************************************************** double DMS::DecodeAngle(System::String^ angstr) { try { return GeographicLib::DMS::DecodeAngle(StringConvert::ManagedToUnmanaged( angstr )); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } //***************************************************************************** double DMS::DecodeAzimuth(System::String^ azistr) { try { return GeographicLib::DMS::DecodeAzimuth(StringConvert::ManagedToUnmanaged( azistr )); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } //***************************************************************************** System::String^ DMS::Encode(double angle, Component trailing, unsigned prec, Flag ind, char dmssep) { try { return StringConvert::UnmanagedToManaged( GeographicLib::DMS::Encode( angle, static_cast(trailing), prec, static_cast(ind), dmssep ) ); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } //***************************************************************************** System::String^ DMS::Encode(double angle, unsigned prec, Flag ind, char dmssep ) { try { return StringConvert::UnmanagedToManaged( GeographicLib::DMS::Encode( angle, prec, static_cast(ind), dmssep ) ); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } GeographicLib-1.52/dotnet/NETGeographicLib/DMS.h0000644000771000077100000003530214064202371021157 0ustar ckarneyckarney/** * \file NETGeographicLib/DMS.h * \brief Header for NETGeographicLib::DMS class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::DMS. * * 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. * * C# Example: * \include example-DMS.cs * Managed C++ Example: * \include example-DMS.cpp * Visual Basic Example: * \include example-DMS.vb **********************************************************************/ public ref class DMS { public: /** * Indicator for presence of hemisphere indicator (N/S/E/W) on latitudes * and longitudes. **********************************************************************/ enum class 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 class 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. * @exception GeographicErr if \e dms is malformed (see below). * @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 ° symbol for degrees and the unicode prime * and double prime symbols for minutes and seconds) may be substituted; * two single quotes can be used instead of ". 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, -20°30'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 * - 4:59.99999999999999, 4:60.0, 4:59:59.9999999999999, 4:59:60.0, 5 * - ILLEGAL (the exception thrown explains the problem) * - 4d5"4', 4::5, 4:5:, :4:5, 4d4.5'4", -N20.5, 1.8e2d, 4:60, * 4:59:60 * * The decoding operation can also perform addition and subtraction * operations. If the string includes internal signs (i.e., not at * the beginning nor immediately after an initial hemisphere designator), * then the string is split immediately before such signs and each piece is * decoded according to the above rules and the results added; thus * S3-2.5+4.1N is parsed as the sum of S3, * -2.5, +4.1N. Any piece can include a * hemisphere designator; however, if multiple designators are given, they * must compatible; e.g., you cannot mix N and E. In addition, the * designator can appear at the beginning or end of the first piece, but * must be at the end of all subsequent pieces (a hemisphere designator is * not allowed after the initial sign). Examples of legal and illegal * combinations are * - LEGAL (these are all equivalent) * - 070:00:45, 70:01:15W+0:0.5, 70:01:15W-0:0:30W, W70:01:15+0:0:30E * - ILLEGAL (the exception thrown explains the problem) * - 70:01:15W+0:0:15N, W70:01:15+W0:0:15 * * WARNING: "Exponential" notation is not recognized. Thus * 7.0E1 is illegal, while 7.0E+1 is parsed as * (7.0E) + (+1), yielding the same result as * 8.0E. * * 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 * - U+02da ring above * - minutes: * - ' apostrophe * - U+2032 prime (′) * - U+00b4 acute accent * - U+2019 right single quote (’) * - seconds: * - " quotation mark * - U+2033 double prime (″) * - U+201d right double quote (”) * - ' ' 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 double Decode(System::String^ dms, [System::Runtime::InteropServices::Out] 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 double Decode(double d, double m, double s ) { return d + (m + s/double(60))/double(60); } /** * Convert a pair of strings to latitude and longitude. * * @param[in] dmsa first string. * @param[in] dmsb second string. * @param[out] lat latitude (degrees). * @param[out] lon longitude (degrees). * @param[in] longfirst if true assume longitude is given before latitude * in the absence of hemisphere designators (default false). * @exception GeographicErr if \e dmsa or \e dmsb is malformed. * @exception GeographicErr if \e dmsa and \e dmsb are both interpreted as * latitudes. * @exception GeographicErr if \e dmsa and \e dmsb are both interpreted as * longitudes. * @exception GeographicErr if decoded latitude is not in [−90°, * 90°]. * * 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). If an exception is thrown, \e lat and \e lon are * unchanged. **********************************************************************/ static void DecodeLatLon(System::String^ dmsa, System::String^ dmsb, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, bool longfirst ); /** * Convert a string to an angle in degrees. * * @param[in] angstr input string. * @exception GeographicErr if \e angstr is malformed. * @exception GeographicErr if \e angstr includes a hemisphere designator. * @return angle (degrees) * * No hemisphere designator is allowed and no check is done on the range of * the result. **********************************************************************/ static double DecodeAngle(System::String^ angstr); /** * Convert a string to an azimuth in degrees. * * @param[in] azistr input string. * @exception GeographicErr if \e azistr is malformed. * @exception GeographicErr if \e azistr includes a N/S designator. * @return azimuth (degrees) reduced to the range [−180°, * 180°). * * A hemisphere designator E/W can be used; the result is multiplied by * −1 if W is present. **********************************************************************/ static double DecodeAzimuth(System::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). * @exception GeographicErr if memory for the string can't be allocated. * @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, 360°), 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 System::String^ Encode(double angle, Component trailing, unsigned prec, Flag ind, char dmssep ); /** * 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). * @exception std::bad_alloc if memory for the string can't be allocated. * @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 System::String^ Encode(double angle, unsigned prec, Flag ind, char dmssep ); /** * Split angle into degrees and minutes * * @param[in] ang angle (degrees) * @param[out] d degrees (an integer returned as a double) * @param[out] m arc minutes. **********************************************************************/ static void Encode(double ang, [System::Runtime::InteropServices::Out] double% d, [System::Runtime::InteropServices::Out] double% m) { 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 double) * @param[out] m arc minutes (an integer returned as a double) * @param[out] s arc seconds. **********************************************************************/ static void Encode(double ang, [System::Runtime::InteropServices::Out] double% d, [System::Runtime::InteropServices::Out] double% m, [System::Runtime::InteropServices::Out] double% s) { d = int(ang); ang = 60 * (ang - d); m = int(ang); s = 60 * (ang - m); } }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/Ellipsoid.cpp0000644000771000077100000002143314064202371023013 0ustar ckarneyckarney/** * \file NETGeographicLib/Ellipsoid.cpp * \brief Implementation for NETGeographicLib::Ellipsoid class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/Ellipsoid.hpp" #include "Ellipsoid.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::Ellipsoid"; //***************************************************************************** Ellipsoid::!Ellipsoid(void) { if ( m_pEllipsoid != NULL ) { delete m_pEllipsoid; m_pEllipsoid = NULL; } } //***************************************************************************** Ellipsoid::Ellipsoid() { try { m_pEllipsoid = new GeographicLib::Ellipsoid( GeographicLib::Ellipsoid::WGS84() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** Ellipsoid::Ellipsoid(double a, double f) { try { m_pEllipsoid = new GeographicLib::Ellipsoid( a, f ); } catch ( std::bad_alloc err ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** double Ellipsoid::ParametricLatitude(double phi) { return m_pEllipsoid->ParametricLatitude( phi ); } //***************************************************************************** double Ellipsoid::InverseParametricLatitude(double beta) { return m_pEllipsoid->InverseParametricLatitude( beta ); } //***************************************************************************** double Ellipsoid::GeocentricLatitude(double phi) { return m_pEllipsoid->GeocentricLatitude( phi ); } //***************************************************************************** double Ellipsoid::InverseGeocentricLatitude(double theta) { return m_pEllipsoid->InverseGeocentricLatitude( theta ); } //***************************************************************************** double Ellipsoid::RectifyingLatitude(double phi) { return m_pEllipsoid->RectifyingLatitude( phi ); } //***************************************************************************** double Ellipsoid::InverseRectifyingLatitude(double mu) { return m_pEllipsoid->InverseRectifyingLatitude( mu ); } //***************************************************************************** double Ellipsoid::AuthalicLatitude(double phi) { return m_pEllipsoid->AuthalicLatitude( phi ); } //***************************************************************************** double Ellipsoid::InverseAuthalicLatitude(double xi) { return m_pEllipsoid->InverseAuthalicLatitude( xi ); } //***************************************************************************** double Ellipsoid::ConformalLatitude(double phi) { return m_pEllipsoid->ConformalLatitude( phi ); } //***************************************************************************** double Ellipsoid::InverseConformalLatitude(double chi) { return m_pEllipsoid->InverseConformalLatitude( chi ); } //***************************************************************************** double Ellipsoid::IsometricLatitude(double phi) { return m_pEllipsoid->IsometricLatitude( phi ); } //***************************************************************************** double Ellipsoid::InverseIsometricLatitude(double psi) { return m_pEllipsoid->InverseIsometricLatitude( psi ); } //***************************************************************************** double Ellipsoid::CircleRadius(double phi) { return m_pEllipsoid->CircleRadius( phi ); } //***************************************************************************** double Ellipsoid::CircleHeight(double phi) { return m_pEllipsoid->CircleHeight( phi ); } //***************************************************************************** double Ellipsoid::MeridianDistance(double phi) { return m_pEllipsoid->MeridianDistance( phi ); } //***************************************************************************** double Ellipsoid::MeridionalCurvatureRadius(double phi) { return m_pEllipsoid->MeridionalCurvatureRadius( phi ); } //***************************************************************************** double Ellipsoid::TransverseCurvatureRadius(double phi) { return m_pEllipsoid->TransverseCurvatureRadius( phi ); } //***************************************************************************** double Ellipsoid::NormalCurvatureRadius(double phi, double azi) { return m_pEllipsoid->NormalCurvatureRadius( phi, azi ); } //***************************************************************************** double Ellipsoid::SecondFlatteningToFlattening(double fp) { return GeographicLib::Ellipsoid::SecondFlatteningToFlattening( fp ); } //***************************************************************************** double Ellipsoid::FlatteningToSecondFlattening(double f) { return GeographicLib::Ellipsoid::FlatteningToSecondFlattening( f ); } //***************************************************************************** double Ellipsoid::ThirdFlatteningToFlattening(double n) { return GeographicLib::Ellipsoid::ThirdFlatteningToFlattening( n ); } //***************************************************************************** double Ellipsoid::FlatteningToThirdFlattening(double f) { return GeographicLib::Ellipsoid::FlatteningToThirdFlattening( f ); } //***************************************************************************** double Ellipsoid::EccentricitySqToFlattening(double e2) { return GeographicLib::Ellipsoid::EccentricitySqToFlattening( e2 ); } //***************************************************************************** double Ellipsoid::FlatteningToEccentricitySq(double f) { return GeographicLib::Ellipsoid::FlatteningToEccentricitySq( f ); } //***************************************************************************** double Ellipsoid::SecondEccentricitySqToFlattening(double ep2) { return GeographicLib::Ellipsoid::SecondEccentricitySqToFlattening( ep2 ); } //***************************************************************************** double Ellipsoid::FlatteningToSecondEccentricitySq(double f) { return GeographicLib::Ellipsoid::FlatteningToSecondEccentricitySq( f ); } //***************************************************************************** double Ellipsoid::ThirdEccentricitySqToFlattening(double epp2) { return GeographicLib::Ellipsoid::ThirdEccentricitySqToFlattening( epp2 ); } //***************************************************************************** double Ellipsoid::FlatteningToThirdEccentricitySq(double f) { return GeographicLib::Ellipsoid::FlatteningToThirdEccentricitySq( f ); } //***************************************************************************** double Ellipsoid::EquatorialRadius::get() { return m_pEllipsoid->EquatorialRadius(); } //***************************************************************************** double Ellipsoid::MinorRadius::get() { return m_pEllipsoid->MinorRadius(); } //***************************************************************************** double Ellipsoid::QuarterMeridian::get() { return m_pEllipsoid->QuarterMeridian(); } //***************************************************************************** double Ellipsoid::Area::get() { return m_pEllipsoid->Area(); } //***************************************************************************** double Ellipsoid::Volume::get() { return m_pEllipsoid->Volume(); } //***************************************************************************** double Ellipsoid::Flattening::get() { return m_pEllipsoid->Flattening(); } //***************************************************************************** double Ellipsoid::SecondFlattening::get() { return m_pEllipsoid->SecondFlattening(); } //***************************************************************************** double Ellipsoid::ThirdFlattening::get() { return m_pEllipsoid->ThirdFlattening(); } //***************************************************************************** double Ellipsoid::EccentricitySq::get() { return m_pEllipsoid->EccentricitySq(); } //***************************************************************************** double Ellipsoid::SecondEccentricitySq::get() { return m_pEllipsoid->SecondEccentricitySq(); } //***************************************************************************** double Ellipsoid::ThirdEccentricitySq::get() { return m_pEllipsoid->ThirdEccentricitySq(); } GeographicLib-1.52/dotnet/NETGeographicLib/Ellipsoid.h0000644000771000077100000006037614064202371022471 0ustar ckarneyckarney/** * \file NETGeographicLib/Ellipsoid.h * \brief Header for NETGeographicLib::Ellipsoid class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::Ellipsoid. * * This class allows .NET applications to access GeographicLib::Ellipsoid. * * This class returns various properties of the ellipsoid and converts * between various types of latitudes. The latitude conversions are also * possible using the various projections supported by %GeographicLib; but * Ellipsoid provides more direct access (sometimes using private functions * of the projection classes). Ellipsoid::RectifyingLatitude, * Ellipsoid::InverseRectifyingLatitude, and Ellipsoid::MeridianDistance * provide functionality which can be provided by the Geodesic class. * However Geodesic uses a series approximation (valid for abs \e f < 1/150), * whereas Ellipsoid computes these quantities using EllipticFunction which * provides accurate results even when \e f is large. Use of this class * should be limited to −3 < \e f < 3/4 (i.e., 1/4 < b/a < 4). * * C# Example: * \include example-Ellipsoid.cs * Managed C++ Example: * \include example-Ellipsoid.cpp * Visual Basic Example: * \include example-Ellipsoid.vb * * INTERFACE DIFFERENCES:
* A default constructor has been provided that assumes a WGS84 ellipsoid. * * The following functions are implemented as properties: * EquatorialRadius, MinorRadius, QuarterMeridian, Area, Volume, Flattening, * SecondFlattening, ThirdFlattening, EccentricitySq, SecondEccentricitySq, * and ThirdEccentricitySq. **********************************************************************/ public ref class Ellipsoid { private: // A pointer to the unmanaged GeographicLib::Ellipsoid GeographicLib::Ellipsoid* m_pEllipsoid; // The finalizer frees the unmanaged memory when the object is destroyed. !Ellipsoid(); public: /** \name Constructor **********************************************************************/ ///@{ /** * Constructor for a WGS84 ellipsoid **********************************************************************/ Ellipsoid(); /** * 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. * @exception GeographicErr if \e a or (1 − \e f ) \e a is not * positive. **********************************************************************/ Ellipsoid(double a, double f); ///@} /** The destructor calls the finalizer. **********************************************************************/ ~Ellipsoid() { this->!Ellipsoid(); } /** \name %Ellipsoid dimensions. **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e b the polar semi-axis (meters). **********************************************************************/ property double MinorRadius { double get(); } /** * @return \e L the distance between the equator and a pole along a * meridian (meters). For a sphere \e L = (π/2) \e a. The radius * of a sphere with the same meridian length is \e L / (π/2). **********************************************************************/ property double QuarterMeridian { double get(); } /** * @return \e A the total area of the ellipsoid (meters2). For * a sphere \e A = 4π a2. The radius of a sphere * with the same area is sqrt(\e A / (4π)). **********************************************************************/ property double Area { double get(); } /** * @return \e V the total volume of the ellipsoid (meters3). * For a sphere \e V = (4π / 3) a3. The radius of * a sphere with the same volume is cbrt(\e V / (4π/3)). **********************************************************************/ property double Volume { double get(); } ///@} /** \name %Ellipsoid shape **********************************************************************/ ///@{ /** * @return \e f = (\e a − \e b) / \e a, the flattening of the * ellipsoid. This is the value used in the constructor. This is zero, * positive, or negative for a sphere, oblate ellipsoid, or prolate * ellipsoid. **********************************************************************/ property double Flattening { double get(); } /** * @return \e f ' = (\e a − \e b) / \e b, the second flattening of * the ellipsoid. This is zero, positive, or negative for a sphere, * oblate ellipsoid, or prolate ellipsoid. **********************************************************************/ property double SecondFlattening { double get(); } /** * @return \e n = (\e a − \e b) / (\e a + \e b), the third flattening * of the ellipsoid. This is zero, positive, or negative for a sphere, * oblate ellipsoid, or prolate ellipsoid. **********************************************************************/ property double ThirdFlattening { double get(); } /** * @return e2 = (a2 − * b2) / a2, the eccentricity squared * of the ellipsoid. This is zero, positive, or negative for a sphere, * oblate ellipsoid, or prolate ellipsoid. **********************************************************************/ property double EccentricitySq { double get(); } /** * @return e' 2 = (a2 − * b2) / b2, the second eccentricity * squared of the ellipsoid. This is zero, positive, or negative for a * sphere, oblate ellipsoid, or prolate ellipsoid. **********************************************************************/ property double SecondEccentricitySq { double get(); } /** * @return e'' 2 = (a2 − * b2) / (a2 + b2), * the third eccentricity squared of the ellipsoid. This is zero, * positive, or negative for a sphere, oblate ellipsoid, or prolate * ellipsoid. **********************************************************************/ property double ThirdEccentricitySq { double get(); } ///@} /** \name Latitude conversion. **********************************************************************/ ///@{ /** * @param[in] phi the geographic latitude (degrees). * @return β the parametric latitude (degrees). * * The geographic latitude, φ, is the angle beween the equatorial * plane and a vector normal to the surface of the ellipsoid. * * The parametric latitude (also called the reduced latitude), β, * allows the cartesian coordinated of a meridian to be expressed * conveniently in parametric form as * - \e R = \e a cos β * - \e Z = \e b sin β * . * where \e a and \e b are the equatorial radius and the polar semi-axis. * For a sphere β = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * β lies in [−90°, 90°]. **********************************************************************/ double ParametricLatitude(double phi); /** * @param[in] beta the parametric latitude (degrees). * @return φ the geographic latitude (degrees). * * β must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ double InverseParametricLatitude(double beta); /** * @param[in] phi the geographic latitude (degrees). * @return θ the geocentric latitude (degrees). * * The geocentric latitude, θ, is the angle beween the equatorial * plane and a line between the center of the ellipsoid and a point on the * ellipsoid. For a sphere θ = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * θ lies in [−90°, 90°]. **********************************************************************/ double GeocentricLatitude(double phi); /** * @param[in] theta the geocentric latitude (degrees). * @return φ the geographic latitude (degrees). * * θ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ double InverseGeocentricLatitude(double theta); /** * @param[in] phi the geographic latitude (degrees). * @return μ the rectifying latitude (degrees). * * The rectifying latitude, μ, has the property that the distance along * a meridian of the ellipsoid between two points with rectifying latitudes * μ1 and μ2 is equal to * (μ2 - μ1) \e L / 90°, * where \e L = QuarterMeridian(). For a sphere μ = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * μ lies in [−90°, 90°]. **********************************************************************/ double RectifyingLatitude(double phi); /** * @param[in] mu the rectifying latitude (degrees). * @return φ the geographic latitude (degrees). * * μ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ double InverseRectifyingLatitude(double mu); /** * @param[in] phi the geographic latitude (degrees). * @return ξ the authalic latitude (degrees). * * The authalic latitude, ξ, has the property that the area of the * ellipsoid between two circles with authalic latitudes * ξ1 and ξ2 is equal to (sin * ξ2 - sin ξ1) \e A / 2, where \e A * = Area(). For a sphere ξ = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * ξ lies in [−90°, 90°]. **********************************************************************/ double AuthalicLatitude(double phi); /** * @param[in] xi the authalic latitude (degrees). * @return φ the geographic latitude (degrees). * * ξ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ double InverseAuthalicLatitude(double xi); /** * @param[in] phi the geographic latitude (degrees). * @return χ the conformal latitude (degrees). * * The conformal latitude, χ, gives the mapping of the ellipsoid to a * sphere which which is conformal (angles are preserved) and in which the * equator of the ellipsoid maps to the equator of the sphere. For a * sphere χ = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * χ lies in [−90°, 90°]. **********************************************************************/ double ConformalLatitude(double phi); /** * @param[in] chi the conformal latitude (degrees). * @return φ the geographic latitude (degrees). * * χ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ double InverseConformalLatitude(double chi); /** * @param[in] phi the geographic latitude (degrees). * @return ψ the isometric latitude (degrees). * * The isometric latitude gives the mapping of the ellipsoid to a plane * which which is conformal (angles are preserved) and in which the equator * of the ellipsoid maps to a straight line of constant scale; this mapping * defines the Mercator projection. For a sphere ψ = * sinh−1 tan φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ double IsometricLatitude(double phi); /** * @param[in] psi the isometric latitude (degrees). * @return φ the geographic latitude (degrees). * * The returned value φ lies in [−90°, 90°]. **********************************************************************/ double InverseIsometricLatitude(double psi); ///@} /** \name Other quantities. **********************************************************************/ ///@{ /** * @param[in] phi the geographic latitude (degrees). * @return \e R = \e a cos β the radius of a circle of latitude * φ (meters). \e R (π/180°) gives meters per degree * longitude measured along a circle of latitude. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ double CircleRadius(double phi); /** * @param[in] phi the geographic latitude (degrees). * @return \e Z = \e b sin β the distance of a circle of latitude * φ from the equator measured parallel to the ellipsoid axis * (meters). * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ double CircleHeight(double phi); /** * @param[in] phi the geographic latitude (degrees). * @return \e s the distance along a meridian * between the equator and a point of latitude φ (meters). \e s is * given by \e s = μ \e L / 90°, where \e L = * QuarterMeridian()). * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ double MeridianDistance(double phi); /** * @param[in] phi the geographic latitude (degrees). * @return ρ the meridional radius of curvature of the ellipsoid at * latitude φ (meters); this is the curvature of the meridian. \e * rho is given by ρ = (180°/π) d\e s / dφ, * where \e s = MeridianDistance(); thus ρ (π/180°) * gives meters per degree latitude measured along a meridian. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ double MeridionalCurvatureRadius(double phi); /** * @param[in] phi the geographic latitude (degrees). * @return ν the transverse radius of curvature of the ellipsoid at * latitude φ (meters); this is the curvature of a curve on the * ellipsoid which also lies in a plane perpendicular to the ellipsoid * and to the meridian. ν is related to \e R = CircleRadius() by \e * R = ν cos φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ double TransverseCurvatureRadius(double phi); /** * @param[in] phi the geographic latitude (degrees). * @param[in] azi the angle between the meridian and the normal section * (degrees). * @return the radius of curvature of the ellipsoid in the normal * section at latitude φ inclined at an angle \e azi to the * meridian (meters). * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ double NormalCurvatureRadius(double phi, double azi); ///@} /** \name Eccentricity conversions. **********************************************************************/ ///@{ /** * @param[in] fp = \e f ' = (\e a − \e b) / \e b, the second * flattening. * @return \e f = (\e a − \e b) / \e a, the flattening. * * \e f ' should lie in (−1, ∞). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static double SecondFlatteningToFlattening(double fp); /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return \e f ' = (\e a − \e b) / \e b, the second flattening. * * \e f should lie in (−∞, 1). * The returned value \e f ' lies in (−1, ∞). **********************************************************************/ static double FlatteningToSecondFlattening(double f); /** * @param[in] n = (\e a − \e b) / (\e a + \e b), the third * flattening. * @return \e f = (\e a − \e b) / \e a, the flattening. * * \e n should lie in (−1, 1). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static double ThirdFlatteningToFlattening(double n); /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return \e n = (\e a − \e b) / (\e a + \e b), the third * flattening. * * \e f should lie in (−∞, 1). * The returned value \e n lies in (−1, 1). **********************************************************************/ static double FlatteningToThirdFlattening(double f); /** * @param[in] e2 = e2 = (a2 − * b2) / a2, the eccentricity * squared. * @return \e f = (\e a − \e b) / \e a, the flattening. * * e2 should lie in (−∞, 1). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static double EccentricitySqToFlattening(double e2); /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return e2 = (a2 − * b2) / a2, the eccentricity * squared. * * \e f should lie in (−∞, 1). * The returned value e2 lies in (−∞, 1). **********************************************************************/ static double FlatteningToEccentricitySq(double f); /** * @param[in] ep2 = e' 2 = (a2 − * b2) / b2, the second eccentricity * squared. * @return \e f = (\e a − \e b) / \e a, the flattening. * * e' 2 should lie in (−1, ∞). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static double SecondEccentricitySqToFlattening(double ep2); /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return e' 2 = (a2 − * b2) / b2, the second eccentricity * squared. * * \e f should lie in (−∞, 1). * The returned value e' 2 lies in (−1, ∞). **********************************************************************/ static double FlatteningToSecondEccentricitySq(double f); /** * @param[in] epp2 = e'' 2 = (a2 * − b2) / (a2 + * b2), the third eccentricity squared. * @return \e f = (\e a − \e b) / \e a, the flattening. * * e'' 2 should lie in (−1, 1). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static double ThirdEccentricitySqToFlattening(double epp2); /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return e'' 2 = (a2 − * b2) / (a2 + b2), * the third eccentricity squared. * * \e f should lie in (−∞, 1). * The returned value e'' 2 lies in (−1, 1). **********************************************************************/ static double FlatteningToThirdEccentricitySq(double f); }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/EllipticFunction.cpp0000644000771000077100000002272414064202371024346 0ustar ckarneyckarney/** * \file NETGeographicLib/EllipticFunction.cpp * \brief Implementation for NETGeographicLib::EllipticFunction class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/EllipticFunction.hpp" #include "EllipticFunction.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for the GeographicLib::EllipticFunction."; //***************************************************************************** EllipticFunction::EllipticFunction(double k2, double alpha2) { try { m_pEllipticFunction = new GeographicLib::EllipticFunction( k2, alpha2 ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** EllipticFunction::EllipticFunction(double k2, double alpha2, double kp2, double alphap2) { try { m_pEllipticFunction = new GeographicLib::EllipticFunction( k2, alpha2, kp2, alphap2 ); } catch ( std::bad_alloc err ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** EllipticFunction::!EllipticFunction() { if ( m_pEllipticFunction != NULL ) { delete m_pEllipticFunction; m_pEllipticFunction = NULL; } } //***************************************************************************** void EllipticFunction::Reset(double k2, double alpha2 ) { m_pEllipticFunction->Reset( k2, alpha2 ); } //***************************************************************************** void EllipticFunction::Reset(double k2, double alpha2, double kp2, double alphap2) { m_pEllipticFunction->Reset( k2, alpha2, kp2, alphap2 ); } //***************************************************************************** double EllipticFunction::K() { return m_pEllipticFunction->K(); } //***************************************************************************** double EllipticFunction::E() { return m_pEllipticFunction->E(); } //***************************************************************************** double EllipticFunction::D() { return m_pEllipticFunction->D(); } //***************************************************************************** double EllipticFunction::KE() { return m_pEllipticFunction->KE(); } //***************************************************************************** double EllipticFunction::Pi() { return m_pEllipticFunction->Pi(); } //***************************************************************************** double EllipticFunction::G() { return m_pEllipticFunction->G(); } //***************************************************************************** double EllipticFunction::H() { return m_pEllipticFunction->H(); } //***************************************************************************** double EllipticFunction::F(double phi) { return m_pEllipticFunction->F( phi ); } //***************************************************************************** double EllipticFunction::E(double phi) { return m_pEllipticFunction->E( phi ); } //***************************************************************************** double EllipticFunction::Ed(double ang) { return m_pEllipticFunction->Ed(ang); } //***************************************************************************** double EllipticFunction::Einv(double x) { return m_pEllipticFunction->Einv(x); } //***************************************************************************** double EllipticFunction::Pi(double phi) { return m_pEllipticFunction->Pi(phi); } //***************************************************************************** double EllipticFunction::D(double phi) { return m_pEllipticFunction->D(phi); } //***************************************************************************** double EllipticFunction::G(double phi) { return m_pEllipticFunction->G(phi); } //***************************************************************************** double EllipticFunction::H(double phi) { return m_pEllipticFunction->H(phi); } //***************************************************************************** double EllipticFunction::F(double sn, double cn, double dn) { return m_pEllipticFunction->F( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::E(double sn, double cn, double dn) { return m_pEllipticFunction->E( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::Pi(double sn, double cn, double dn) { return m_pEllipticFunction->Pi( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::D(double sn, double cn, double dn) { return m_pEllipticFunction->D( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::G(double sn, double cn, double dn) { return m_pEllipticFunction->G( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::H(double sn, double cn, double dn) { return m_pEllipticFunction->H( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::deltaF(double sn, double cn, double dn) { return m_pEllipticFunction->deltaF( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::deltaE(double sn, double cn, double dn) { return m_pEllipticFunction->deltaE( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::deltaEinv(double stau, double ctau) { return m_pEllipticFunction->deltaEinv( stau, ctau ); } //***************************************************************************** double EllipticFunction::deltaPi(double sn, double cn, double dn) { return m_pEllipticFunction->deltaPi( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::deltaD(double sn, double cn, double dn) { return m_pEllipticFunction->deltaD( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::deltaG(double sn, double cn, double dn) { return m_pEllipticFunction->deltaG( sn, cn, dn ); } //***************************************************************************** double EllipticFunction::deltaH(double sn, double cn, double dn) { return m_pEllipticFunction->deltaH( sn, cn, dn ); } //***************************************************************************** void EllipticFunction::sncndn(double x, [System::Runtime::InteropServices::Out] double% sn, [System::Runtime::InteropServices::Out] double% cn, [System::Runtime::InteropServices::Out] double% dn) { double lsn, lcn, ldn; m_pEllipticFunction->sncndn( x, lsn, lcn, ldn ); sn = lsn; cn = lcn; dn = ldn; } //***************************************************************************** double EllipticFunction::Delta(double sn, double cn) { return m_pEllipticFunction->Delta( sn, cn ); } //***************************************************************************** double EllipticFunction::RF(double x, double y, double z) { return GeographicLib::EllipticFunction::RF( x, y, z ); } //***************************************************************************** double EllipticFunction::RF(double x, double y) { return GeographicLib::EllipticFunction::RF( x, y ); } //***************************************************************************** double EllipticFunction::RC(double x, double y) { return GeographicLib::EllipticFunction::RC( x, y ); } //***************************************************************************** double EllipticFunction::RG(double x, double y, double z) { return GeographicLib::EllipticFunction::RG( x, y, z ); } //***************************************************************************** double EllipticFunction::RG(double x, double y) { return GeographicLib::EllipticFunction::RG( x, y ); } //***************************************************************************** double EllipticFunction::RJ(double x, double y, double z, double p) { return GeographicLib::EllipticFunction::RJ( x, y, z, p ); } //***************************************************************************** double EllipticFunction::RD(double x, double y, double z) { return GeographicLib::EllipticFunction::RD( x, y, z ); } //***************************************************************************** double EllipticFunction::k2::get() { return m_pEllipticFunction->k2(); } //***************************************************************************** double EllipticFunction::kp2::get() { return m_pEllipticFunction->kp2(); } //***************************************************************************** double EllipticFunction::alpha2::get() { return m_pEllipticFunction->alpha2(); } //***************************************************************************** double EllipticFunction::alphap2::get() { return m_pEllipticFunction->alpha2(); } GeographicLib-1.52/dotnet/NETGeographicLib/EllipticFunction.h0000644000771000077100000007004314064202371024010 0ustar ckarneyckarney/** * \file NETGeographicLib/EllipticFunction.h * \brief Header for NETGeographicLib::EllipticFunction class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::EllipticFunction. * * This class allows .NET applications to access GeographicLib::EllipticFunction. * * This provides the elliptic functions and integrals needed for Ellipsoid, * GeodesicExact, and TransverseMercatorExact. Two categories of function * are provided: * - \e static functions to compute symmetric elliptic integrals * (https://dlmf.nist.gov/19.16.i) * - \e member functions to compute Legrendre's elliptic * integrals (https://dlmf.nist.gov/19.2.ii) and the * Jacobi elliptic functions (https://dlmf.nist.gov/22.2). * . * In the latter case, an object is constructed giving the modulus \e k (and * optionally the parameter α2). The modulus is always * passed as its square k2 which allows \e k to be pure * imaginary (k2 < 0). (Confusingly, Abramowitz and * Stegun call \e m = k2 the "parameter" and \e n = * α2 the "characteristic".) * * In geodesic applications, it is convenient to separate the incomplete * integrals into secular and periodic components, e.g., * \f[ * E(\phi, k) = (2 E(\phi) / \pi) [ \phi + \delta E(\phi, k) ] * \f] * where δ\e E(φ, \e k) is an odd periodic function with period * π. * * The computation of the elliptic integrals uses the algorithms given in * - B. C. Carlson, * Computation of real or * complex elliptic integrals, Numerical Algorithms 10, 13--26 (1995) * . * with the additional optimizations given in https://dlmf.nist.gov/19.36.i. * 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 https://dlmf.nist.gov/19 and https://dlmf.nist.gov/22 * * C# Example: * \include example-EllipticFunction.cs * Managed C++ Example: * \include example-EllipticFunction.cpp * Visual Basic Example: * \include example-EllipticFunction.vb * * INTERFACE DIFFERENCES:
* The k2, kp2, alpha2, and alphap2 functions are implemented as properties. **********************************************************************/ public ref class EllipticFunction { private: // a pointer to the unmanaged GeographicLib::EllipticFunction. GeographicLib::EllipticFunction* m_pEllipticFunction; // The finalizer frees the unmanaged memory. !EllipticFunction(); public: /** \name Constructor **********************************************************************/ ///@{ /** * Constructor specifying the modulus and parameter. * * @param[in] k2 the square of the modulus k2. * k2 must lie in (-∞, 1). (No checking is * done.) * @param[in] alpha2 the parameter α2. * α2 must lie in (-∞, 1). (No checking is done.) * * If only elliptic integrals of the first and second kinds are needed, * then set α2 = 0 (the default value); in this case, we * have Π(φ, 0, \e k) = \e F(φ, \e k), \e G(φ, 0, \e k) = \e * E(φ, \e k), and \e H(φ, 0, \e k) = \e F(φ, \e k) - \e * D(φ, \e k). **********************************************************************/ EllipticFunction(double k2, double alpha2 ); /** * Constructor specifying the modulus and parameter and their complements. * * @param[in] k2 the square of the modulus k2. * k2 must lie in (-∞, 1). (No checking is * done.) * @param[in] alpha2 the parameter α2. * α2 must lie in (-∞, 1). (No checking is done.) * @param[in] kp2 the complementary modulus squared k'2 = * 1 − k2. * @param[in] alphap2 the complementary parameter α'2 = 1 * − α2. * * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2 * = 1. (No checking is done that these conditions are met.) This * constructor is provided to enable accuracy to be maintained, e.g., when * \e k is very close to unity. **********************************************************************/ EllipticFunction(double k2, double alpha2, double kp2, double alphap2); /** * Destructor calls the finalizer. **********************************************************************/ ~EllipticFunction() { this->!EllipticFunction(); } /** * Reset the modulus and parameter. * * @param[in] k2 the new value of square of the modulus * k2 which must lie in (-∞, 1). (No checking is * done.) * @param[in] alpha2 the new value of parameter α2. * α2 must lie in (-∞, 1). (No checking is done.) **********************************************************************/ void Reset(double k2, double alpha2 ); /** * Reset the modulus and parameter supplying also their complements. * * @param[in] k2 the square of the modulus k2. * k2 must lie in (-∞, 1). (No checking is * done.) * @param[in] alpha2 the parameter α2. * α2 must lie in (-∞, 1). (No checking is done.) * @param[in] kp2 the complementary modulus squared k'2 = * 1 − k2. * @param[in] alphap2 the complementary parameter α'2 = 1 * − α2. * * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2 * = 1. (No checking is done that these conditions are met.) This * constructor is provided to enable accuracy to be maintained, e.g., when * is very small. **********************************************************************/ void Reset(double k2, double alpha2, double kp2, double alphap2); ///@} /** \name Inspector functions. **********************************************************************/ ///@{ /** * @return the square of the modulus k2. **********************************************************************/ property double k2 { double get(); } /** * @return the square of the complementary modulus k'2 = * 1 − k2. **********************************************************************/ property double kp2 { double get(); } /** * @return the parameter α2. **********************************************************************/ property double alpha2 { double get(); } /** * @return the complementary parameter α'2 = 1 − * α2. **********************************************************************/ property double alphap2 { double get(); } ///@} /** \name Complete elliptic integrals. **********************************************************************/ ///@{ /** * The complete integral of the first kind. * * @return \e K(\e k). * * \e K(\e k) is defined in https://dlmf.nist.gov/19.2.E4 * \f[ * K(k) = \int_0^{\pi/2} \frac1{\sqrt{1-k^2\sin^2\phi}}\,d\phi. * \f] **********************************************************************/ double K(); /** * The complete integral of the second kind. * * @return \e E(\e k) * * \e E(\e k) is defined in https://dlmf.nist.gov/19.2.E5 * \f[ * E(k) = \int_0^{\pi/2} \sqrt{1-k^2\sin^2\phi}\,d\phi. * \f] **********************************************************************/ double E(); /** * Jahnke's complete integral. * * @return \e D(\e k). * * \e D(\e k) is defined in https://dlmf.nist.gov/19.2.E6 * \f[ * D(k) = \int_0^{\pi/2} \frac{\sin^2\phi}{\sqrt{1-k^2\sin^2\phi}}\,d\phi. * \f] **********************************************************************/ double D(); /** * The difference between the complete integrals of the first and second * kinds. * * @return \e K(\e k) − \e E(\e k). **********************************************************************/ double KE(); /** * The complete integral of the third kind. * * @return Π(α2, \e k) * * Π(α2, \e k) is defined in * https://dlmf.nist.gov/19.2.E7 * \f[ * \Pi(\alpha^2, k) = \int_0^{\pi/2} * \frac1{\sqrt{1-k^2\sin^2\phi}(1 - \alpha^2\sin^2\phi_)}\,d\phi. * \f] **********************************************************************/ double Pi(); /** * Legendre's complete geodesic longitude integral. * * @return \e G(α2, \e k) * * \e G(α2, \e k) is given by * \f[ * G(\alpha^2, k) = \int_0^{\pi/2} * \frac{\sqrt{1-k^2\sin^2\phi}}{1 - \alpha^2\sin^2\phi}\,d\phi. * \f] **********************************************************************/ double G(); /** * Cayley's complete geodesic longitude difference integral. * * @return \e H(α2, \e k) * * \e H(α2, \e k) is given by * \f[ * H(\alpha^2, k) = \int_0^{\pi/2} * \frac{\cos^2\phi}{(1-\alpha^2\sin^2\phi)\sqrt{1-k^2\sin^2\phi}} * \,d\phi. * \f] **********************************************************************/ double H(); ///@} /** \name Incomplete elliptic integrals. **********************************************************************/ ///@{ /** * The incomplete integral of the first kind. * * @param[in] phi * @return \e F(φ, \e k). * * \e F(φ, \e k) is defined in https://dlmf.nist.gov/19.2.E4 * \f[ * F(\phi, k) = \int_0^\phi \frac1{\sqrt{1-k^2\sin^2\theta}}\,d\theta. * \f] **********************************************************************/ double F(double phi); /** * The incomplete integral of the second kind. * * @param[in] phi * @return \e E(φ, \e k). * * \e E(φ, \e k) is defined in https://dlmf.nist.gov/19.2.E5 * \f[ * E(\phi, k) = \int_0^\phi \sqrt{1-k^2\sin^2\theta}\,d\theta. * \f] **********************************************************************/ double E(double phi); /** * The incomplete integral of the second kind with the argument given in * degrees. * * @param[in] ang in degrees. * @return \e E(π ang/180, \e k). **********************************************************************/ double Ed(double ang); /** * The inverse of the incomplete integral of the second kind. * * @param[in] x * @return φ = E−1(\e x, \e k); i.e., the * solution of such that \e E(φ, \e k) = \e x. **********************************************************************/ double Einv(double x); /** * The incomplete integral of the third kind. * * @param[in] phi * @return Π(φ, α2, \e k). * * Π(φ, α2, \e k) is defined in * https://dlmf.nist.gov/19.2.E7 * \f[ * \Pi(\phi, \alpha^2, k) = \int_0^\phi * \frac1{\sqrt{1-k^2\sin^2\theta}(1 - \alpha^2\sin^2\theta_)}\,d\theta. * \f] **********************************************************************/ double Pi(double phi); /** * Jahnke's incomplete elliptic integral. * * @param[in] phi * @return \e D(φ, \e k). * * \e D(φ, \e k) is defined in https://dlmf.nist.gov/19.2.E4 * \f[ * D(\phi, k) = \int_0^\phi * \frac{\sin^2\theta}{\sqrt{1-k^2\sin^2\theta}}\,d\theta. * \f] **********************************************************************/ double D(double phi); /** * Legendre's geodesic longitude integral. * * @param[in] phi * @return \e G(φ, α2, \e k). * * \e G(φ, α2, \e k) is defined by * \f[ * \begin{aligned} * G(\phi, \alpha^2, k) &= * \frac{k^2}{\alpha^2} F(\phi, k) + * \biggl(1 - \frac{k^2}{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\ * &= \int_0^\phi * \frac{\sqrt{1-k^2\sin^2\theta}}{1 - \alpha^2\sin^2\theta}\,d\theta. * \end{aligned} * \f] * * Legendre expresses the longitude of a point on the geodesic in terms of * this combination of elliptic integrals in Exercices de Calcul * Intégral, Vol. 1 (1811), p. 181, * https://books.google.com/books?id=riIOAAAAQAAJ&pg=PA181. * * See \ref geodellip for the expression for the longitude in terms of this * function. **********************************************************************/ double G(double phi); /** * Cayley's geodesic longitude difference integral. * * @param[in] phi * @return \e H(φ, α2, \e k). * * \e H(φ, α2, \e k) is defined by * \f[ * \begin{aligned} * H(\phi, \alpha^2, k) &= * \frac1{\alpha^2} F(\phi, k) + * \biggl(1 - \frac1{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\ * &= \int_0^\phi * \frac{\cos^2\theta}{(1-\alpha^2\sin^2\theta)\sqrt{1-k^2\sin^2\theta}} * \,d\theta. * \end{aligned} * \f] * * Cayley expresses the longitude difference of a point on the geodesic in * terms of this combination of elliptic integrals in Phil. Mag. 40 * (1870), p. 333, https://books.google.com/books?id=Zk0wAAAAIAAJ&pg=PA333. * * See \ref geodellip for the expression for the longitude in terms of this * function. **********************************************************************/ double H(double phi); ///@} /** \name Incomplete integrals in terms of Jacobi elliptic functions. **********************************************************************/ ///@{ /** * The incomplete integral of the first kind in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return \e F(φ, \e k) as though φ ∈ (−π, π]. **********************************************************************/ double F(double sn, double cn, double dn); /** * The incomplete integral of the second kind in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return \e E(φ, \e k) as though φ ∈ (−π, π]. **********************************************************************/ double E(double sn, double cn, double dn); /** * The incomplete integral of the third kind in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return Π(φ, α2, \e k) as though φ ∈ * (−π, π]. **********************************************************************/ double Pi(double sn, double cn, double dn); /** * Jahnke's incomplete elliptic integral in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return \e D(φ, \e k) as though φ ∈ (−π, π]. **********************************************************************/ double D(double sn, double cn, double dn); /** * Legendre's geodesic longitude integral in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return \e G(φ, α2, \e k) as though φ ∈ * (−π, π]. **********************************************************************/ double G(double sn, double cn, double dn); /** * Cayley's geodesic longitude difference integral in terms of Jacobi * elliptic functions. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return \e H(φ, α2, \e k) as though φ ∈ * (−π, π]. **********************************************************************/ double H(double sn, double cn, double dn); ///@} /** \name Periodic versions of incomplete elliptic integrals. **********************************************************************/ ///@{ /** * The periodic incomplete integral of the first kind. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return the periodic function π \e F(φ, \e k) / (2 \e K(\e k)) - * φ **********************************************************************/ double deltaF(double sn, double cn, double dn); /** * The periodic incomplete integral of the second kind. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return the periodic function π \e E(φ, \e k) / (2 \e E(\e k)) - * φ **********************************************************************/ double deltaE(double sn, double cn, double dn); /** * The periodic inverse of the incomplete integral of the second kind. * * @param[in] stau = sinτ * @param[in] ctau = sinτ * @return the periodic function E−1(τ (2 \e * E(\e k)/π), \e k) - τ **********************************************************************/ double deltaEinv(double stau, double ctau); /** * The periodic incomplete integral of the third kind. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return the periodic function π Π(φ, \e k) / (2 Π(\e k)) - * φ **********************************************************************/ double deltaPi(double sn, double cn, double dn); /** * The periodic Jahnke's incomplete elliptic integral. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return the periodic function π \e D(φ, \e k) / (2 \e D(\e k)) - * φ **********************************************************************/ double deltaD(double sn, double cn, double dn); /** * Legendre's periodic geodesic longitude integral. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return the periodic function π \e G(φ, \e k) / (2 \e G(\e k)) - * φ **********************************************************************/ double deltaG(double sn, double cn, double dn); /** * Cayley's periodic geodesic longitude difference integral. * * @param[in] sn = sinφ * @param[in] cn = cosφ * @param[in] dn = sqrt(1 − k2 * sin2φ) * @return the periodic function π \e H(φ, \e k) / (2 \e H(\e k)) - * φ **********************************************************************/ double deltaH(double sn, double cn, double dn); ///@} /** \name Elliptic functions. **********************************************************************/ ///@{ /** * The Jacobi elliptic functions. * * @param[in] x the argument. * @param[out] sn sn(\e x, \e k). * @param[out] cn cn(\e x, \e k). * @param[out] dn dn(\e x, \e k). **********************************************************************/ void sncndn(double x, [System::Runtime::InteropServices::Out] double% sn, [System::Runtime::InteropServices::Out] double% cn, [System::Runtime::InteropServices::Out] double% dn); /** * The Δ amplitude function. * * @param[in] sn sinφ * @param[in] cn cosφ * @return Δ = sqrt(1 − k2 * sin2φ) **********************************************************************/ double Delta(double sn, double cn); ///@} /** \name Symmetric elliptic integrals. **********************************************************************/ ///@{ /** * Symmetric integral of the first kind RF. * * @param[in] x * @param[in] y * @param[in] z * @return RF(\e x, \e y, \e z) * * RF is defined in https://dlmf.nist.gov/19.16.E1 * \f[ R_F(x, y, z) = \frac12 * \int_0^\infty\frac1{\sqrt{(t + x) (t + y) (t + z)}}\, dt \f] * If one of the arguments is zero, it is more efficient to call the * two-argument version of this function with the non-zero arguments. **********************************************************************/ static double RF(double x, double y, double z); /** * Complete symmetric integral of the first kind, RF with * one argument zero. * * @param[in] x * @param[in] y * @return RF(\e x, \e y, 0) **********************************************************************/ static double RF(double x, double y); /** * Degenerate symmetric integral of the first kind RC. * * @param[in] x * @param[in] y * @return RC(\e x, \e y) = RF(\e x, \e * y, \e y) * * RC is defined in https://dlmf.nist.gov/19.2.E17 * \f[ R_C(x, y) = \frac12 * \int_0^\infty\frac1{\sqrt{t + x}(t + y)}\,dt \f] **********************************************************************/ static double RC(double x, double y); /** * Symmetric integral of the second kind RG. * * @param[in] x * @param[in] y * @param[in] z * @return RG(\e x, \e y, \e z) * * RG is defined in Carlson, eq 1.5 * \f[ R_G(x, y, z) = \frac14 * \int_0^\infty[(t + x) (t + y) (t + z)]^{-1/2} * \biggl( * \frac x{t + x} + \frac y{t + y} + \frac z{t + z} * \biggr)t\,dt \f] * See also https://dlmf.nist.gov/19.16.E3. * If one of the arguments is zero, it is more efficient to call the * two-argument version of this function with the non-zero arguments. **********************************************************************/ static double RG(double x, double y, double z); /** * Complete symmetric integral of the second kind, RG * with one argument zero. * * @param[in] x * @param[in] y * @return RG(\e x, \e y, 0) **********************************************************************/ static double RG(double x, double y); /** * Symmetric integral of the third kind RJ. * * @param[in] x * @param[in] y * @param[in] z * @param[in] p * @return RJ(\e x, \e y, \e z, \e p) * * RJ is defined in https://dlmf.nist.gov/19.16.E2 * \f[ R_J(x, y, z, p) = \frac32 * \int_0^\infty[(t + x) (t + y) (t + z)]^{-1/2} (t + p)^{-1}\, dt \f] **********************************************************************/ static double RJ(double x, double y, double z, double p); /** * Degenerate symmetric integral of the third kind RD. * * @param[in] x * @param[in] y * @param[in] z * @return RD(\e x, \e y, \e z) = RJ(\e * x, \e y, \e z, \e z) * * RD is defined in https://dlmf.nist.gov/19.16.E5 * \f[ R_D(x, y, z) = \frac32 * \int_0^\infty[(t + x) (t + y)]^{-1/2} (t + z)^{-3/2}\, dt \f] **********************************************************************/ static double RD(double x, double y, double z); ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/GARS.cpp0000644000771000077100000000346114064202371021624 0ustar ckarneyckarney/** * \file NETGeographicLib/GARS.cpp * \brief Source for NETGeographicLib::GARS class * * NETGeographicLib is copyright (c) Scott Heiman (2013-2015) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/GARS.hpp" #include "GARS.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** void GARS::Forward(double lat, double lon, int prec, System::String^% gars) { try { std::string l; GeographicLib::GARS::Forward( lat, lon, prec, l ); gars = gcnew System::String( l.c_str() ); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } //***************************************************************************** void GARS::Reverse( System::String^ gars, double% lat, double% lon, int% prec, bool centerp) { try { double llat, llon; int lprec; GeographicLib::GARS::Reverse( StringConvert::ManagedToUnmanaged( gars ), llat, llon, lprec, centerp ); lat = llat; lon = llon; prec = lprec; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** double GARS::Resolution(int prec) { return GeographicLib::GARS::Resolution(prec); } //***************************************************************************** int GARS::Precision(double res) { return GeographicLib::GARS::Precision(res); } GeographicLib-1.52/dotnet/NETGeographicLib/GARS.h0000644000771000077100000001027614064202371021273 0ustar ckarneyckarney/** * \file NETGeographicLib/GARS.h * \brief Header for NETGeographicLib::GARS class * * NETGeographicLib is copyright (c) Scott Heiman (2013-2015) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET Wrapper for GeographicLib::GARS * * This class allows .NET applications to access GeographicLib::GARS. * * The Global Area Reference System is described in * - https://en.wikipedia.org/wiki/Global_Area_Reference_System * - https://earth-info.nga.mil/index.php?dir=coordsys&action=coordsys#tab_gars * . * It provides a compact string representation of a geographic area * (expressed as latitude and longitude). The classes Georef and Geohash * implement similar compact representations. * * C# Example: * \include example-GARS.cs * Managed C++ Example: * \include example-GARS.cpp * Visual Basic Example: * \include example-GARS.vb **********************************************************************/ public ref class GARS { // all memebers of this class are static so the constructor is hidden. GARS() {} public: /** * Convert from geographic coordinates to GARS. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] prec the precision of the resulting GARS. * @param[out] gars the GARS string. * @exception GeographicErr if \e lat is not in [−90°, * 90°] or if memory for \e gars can't be allocated. * * \e prec specifies the precision of \e gars as follows: * - \e prec = 0 (min), 30' precision, e.g., 006AG; * - \e prec = 1, 15' precision, e.g., 006AG3; * - \e prec = 2 (max), 5' precision, e.g., 006AG39. * * If \e lat or \e lon is NaN, then \e gars is set to "INVALID". **********************************************************************/ static void Forward(double lat, double lon, int prec, [System::Runtime::InteropServices::Out] System::String^% gars); /** * Convert from GARS to geographic coordinates. * * @param[in] gars the GARS. * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] prec the precision of \e gars. * @param[in] centerp if true (the default) return the center of the * \e gars, otherwise return the south-west corner. * @exception GeographicErr if \e gars is illegal. * * The case of the letters in \e gars is ignored. \e prec is in the range * [0, 2] and gives the precision of \e gars as follows: * - \e prec = 0 (min), 30' precision, e.g., 006AG; * - \e prec = 1, 15' precision, e.g., 006AG3; * - \e prec = 2 (max), 5' precision, e.g., 006AG39. * * If the first 3 characters of \e gars are "INV", then \e lat and \e lon * are set to NaN and \e prec is unchanged. **********************************************************************/ static void Reverse( System::String^ gars, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] int% prec, bool centerp); /** * The angular resolution of a GARS. * * @param[in] prec the precision of the GARS. * @return the latitude-longitude resolution (degrees). * * Internally, \e prec is first put in the range [0, 2]. **********************************************************************/ static double Resolution(int prec); /** * The GARS precision required to meet a given geographic resolution. * * @param[in] res the minimum of resolution in latitude and longitude * (degrees). * @return GARS precision. * * The returned length is in the range [0, 2]. **********************************************************************/ static int Precision(double res); }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/GeoCoords.cpp0000644000771000077100000002027514064202371022756 0ustar ckarneyckarney/** * \file NETGeographicLib/GeoCoords.cpp * \brief Implementation for NETGeographicLib::GeoCoords class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/GeoCoords.hpp" #include "GeoCoords.h" #include "UTMUPS.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeoCoords"; //***************************************************************************** GeoCoords::!GeoCoords(void) { if ( m_pGeoCoords != NULL ) { delete m_pGeoCoords; m_pGeoCoords = NULL; } } //***************************************************************************** GeoCoords::GeoCoords() { try { m_pGeoCoords = new GeographicLib::GeoCoords(); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** GeoCoords::GeoCoords(System::String^ s, bool centerp, bool longfirst ) { try { m_pGeoCoords = new GeographicLib::GeoCoords(StringConvert::ManagedToUnmanaged(s), centerp, longfirst); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** GeoCoords::GeoCoords(double latitude, double longitude, int zone ) { try { m_pGeoCoords = new GeographicLib::GeoCoords(latitude, longitude, zone); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** GeoCoords::GeoCoords(int zone, bool northp, double easting, double northing) { try { m_pGeoCoords = new GeographicLib::GeoCoords(zone, northp, easting, northing); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void GeoCoords::Reset( System::String^ s, bool centerp, bool longfirst ) { try { m_pGeoCoords->Reset(StringConvert::ManagedToUnmanaged(s), centerp, longfirst); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void GeoCoords::Reset(double latitude, double longitude, int zone) { try { m_pGeoCoords->Reset(latitude, longitude, zone); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void GeoCoords::Reset(int zone, bool northp, double easting, double northing) { try { m_pGeoCoords->Reset(zone, northp, easting, northing); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void GeoCoords::AltZone::set( int zone ) { try { m_pGeoCoords->SetAltZone(zone); } catch ( GeographicLib::GeographicErr err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** int GeoCoords::AltZone::get() { return m_pGeoCoords->AltZone(); } //***************************************************************************** double GeoCoords::Latitude::get() { return m_pGeoCoords->Latitude(); } //***************************************************************************** double GeoCoords::Longitude::get() { return m_pGeoCoords->Longitude(); } //***************************************************************************** double GeoCoords::Easting::get() { return m_pGeoCoords->Easting(); } //***************************************************************************** double GeoCoords::Northing::get() { return m_pGeoCoords->Northing(); } //***************************************************************************** double GeoCoords::Convergence::get() { return m_pGeoCoords->Convergence(); } //***************************************************************************** double GeoCoords::Scale::get() { return m_pGeoCoords->Scale(); } //***************************************************************************** bool GeoCoords::Northp::get() { return m_pGeoCoords->Northp(); } //***************************************************************************** char GeoCoords::Hemisphere::get() { return m_pGeoCoords->Hemisphere(); } //***************************************************************************** int GeoCoords::Zone::get() { return m_pGeoCoords->Zone(); } //***************************************************************************** double GeoCoords::AltEasting::get() { return m_pGeoCoords->AltEasting(); } //***************************************************************************** double GeoCoords::AltNorthing::get() { return m_pGeoCoords->AltNorthing(); } //***************************************************************************** double GeoCoords::AltConvergence::get() { return m_pGeoCoords->AltConvergence(); } //***************************************************************************** double GeoCoords::AltScale::get() { return m_pGeoCoords->AltScale(); } //***************************************************************************** double GeoCoords::EquatorialRadius::get() { return UTMUPS::EquatorialRadius(); } //***************************************************************************** double GeoCoords::Flattening::get() { return UTMUPS::Flattening(); } //***************************************************************************** System::String^ GeoCoords::GeoRepresentation(int prec, bool longfirst ) { return gcnew System::String( m_pGeoCoords->GeoRepresentation(prec, longfirst).c_str() ); } //***************************************************************************** System::String^ GeoCoords::DMSRepresentation(int prec, bool longfirst, char dmssep ) { return gcnew System::String( m_pGeoCoords->DMSRepresentation(prec, longfirst, dmssep).c_str() ); } //***************************************************************************** System::String^ GeoCoords::MGRSRepresentation(int prec) { return gcnew System::String( m_pGeoCoords->MGRSRepresentation(prec).c_str() ); } //***************************************************************************** System::String^ GeoCoords::UTMUPSRepresentation(int prec, bool abbrev) { return gcnew System::String( m_pGeoCoords->UTMUPSRepresentation(prec, abbrev).c_str() ); } //***************************************************************************** System::String^ GeoCoords::UTMUPSRepresentation(bool northp, int prec, bool abbrev) { return gcnew System::String( m_pGeoCoords->UTMUPSRepresentation(northp, prec, abbrev).c_str() ); } //***************************************************************************** System::String^ GeoCoords::AltMGRSRepresentation(int prec) { return gcnew System::String( m_pGeoCoords->AltMGRSRepresentation(prec).c_str() ); } //***************************************************************************** System::String^ GeoCoords::AltUTMUPSRepresentation(int prec, bool abbrev) { return gcnew System::String( m_pGeoCoords->AltUTMUPSRepresentation(prec, abbrev).c_str() ); } //***************************************************************************** System::String^ GeoCoords::AltUTMUPSRepresentation(bool northp, int prec, bool abbrev) { return gcnew System::String( m_pGeoCoords->AltUTMUPSRepresentation(northp, prec, abbrev).c_str() ); } GeographicLib-1.52/dotnet/NETGeographicLib/GeoCoords.h0000644000771000077100000005223314064202371022422 0ustar ckarneyckarney/** * \file NETGeographicLib/GeoCoords.h * \brief Header for NETGeographicLib::GeoCoords class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::GeoCoords. * * This class allows .NET applications to access GeographicLib::GeoCoords. * * 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. * * C# Example: * \include example-GeoCoords.cs * Managed C++ Example: * \include example-GeoCoords.cpp * Visual Basic Example: * \include example-GeoCoords.vb * * INTERFACE DIFFERENCES:
* The following functions are implemented as properties: EquatorialRadius, * Flattening, Latitude, Longitude, Easting, Northing, Convergence, * Scale, Northp, Hemisphere, Zone, AltZone, AltEasting, AltNorthing, * AltConvergence, and AltScale. **********************************************************************/ public ref class GeoCoords { private: // pointer to the unmanaged GeographicLib::GeoCoords GeographicLib::GeoCoords* m_pGeoCoords; // The finalizer frees unmanaged memory when the object is destroyed. !GeoCoords(); public: /** \name Initializing the GeoCoords object **********************************************************************/ ///@{ /** * The default constructor sets the coordinate as undefined. **********************************************************************/ GeoCoords(); /** * 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] longfirst governs the interpretation of geographic * coordinates (see below). * @exception GeographicErr if the \e s is malformed (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 * - 38SLC30 * - 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 longfirst = true (default is false), then * longitude precedes latitude in the absence of a hemisphere designator. * Thus (with \e longfirst = 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. Various alternative symbols for degrees, minutes, * and seconds are allowed. Alternatively, use : to separate these * components. (See DMS::Decode for details.) Thus * - 40d30'30" * - 40d30'30 * - 40°30'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°]. 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 **********************************************************************/ GeoCoords(System::String^ s, bool centerp, bool longfirst ); /** * 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. * @exception GeographicErr if \e latitude is not in [−90°, * 90°]. * @exception GeographicErr if \e zone cannot be used for this location. **********************************************************************/ GeoCoords(double latitude, double longitude, int 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). * @exception GeographicErr if \e zone, \e easting, or \e northing is * outside its allowed range. **********************************************************************/ GeoCoords(int zone, bool northp, double easting, double northing); /** * The destructor calls the finalizer. **********************************************************************/ ~GeoCoords() { this->!GeoCoords(); } /** * Reset the location from a string. See * GeoCoords(const std::string& s, bool centerp, bool longfirst). * * @param[in] s 1-element, 2-element, or 3-element string representation of * the position. * @param[in] centerp governs the interpretation of MGRS coordinates. * @param[in] longfirst governs the interpretation of geographic * coordinates. * @exception GeographicErr if the \e s is malformed. **********************************************************************/ void Reset( System::String^ s, bool centerp, bool longfirst); /** * Reset the location in terms of geographic coordinates. See * GeoCoords(double latitude, double longitude, int zone). * * @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. * @exception GeographicErr if \e latitude is not in [−90°, * 90°]. * @exception GeographicErr if \e zone cannot be used for this location. **********************************************************************/ void Reset(double latitude, double longitude, int zone ) ; /** * Reset the location in terms of UPS/UPS coordinates. See * GeoCoords(int zone, bool northp, double easting, double northing). * * @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). * @exception GeographicErr if \e zone, \e easting, or \e northing is * outside its allowed range. **********************************************************************/ void Reset(int zone, bool northp, double easting, double northing); ///@} /** \name Querying the GeoCoords object **********************************************************************/ ///@{ /** * @return latitude (degrees) **********************************************************************/ property double Latitude { double get(); } /** * @return longitude (degrees) **********************************************************************/ property double Longitude { double get(); } /** * @return easting (meters) **********************************************************************/ property double Easting { double get(); } /** * @return northing (meters) **********************************************************************/ property double Northing { double get(); } /** * @return meridian convergence (degrees) for the UTM/UPS projection. **********************************************************************/ property double Convergence { double get(); } /** * @return scale for the UTM/UPS projection. **********************************************************************/ property double Scale { double get(); } /** * @return hemisphere (false means south, true means north). **********************************************************************/ property bool Northp { bool get(); } /** * @return hemisphere letter N or S. **********************************************************************/ property char Hemisphere { char get(); } /** * @return the zone corresponding to the input (return 0 for UPS). **********************************************************************/ property int Zone { int get(); } ///@} /** \name Setting and querying the alternate zone **********************************************************************/ ///@{ /** * Gets/Sets the current alternate zone (0 = UPS). * @exception GeographicErr if \e zone cannot be used for this location. * * 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. **********************************************************************/ property int AltZone { int get(); void set( int zone ); } /** * @return easting (meters) for alternate zone. **********************************************************************/ property double AltEasting { double get(); } /** * @return northing (meters) for alternate zone. **********************************************************************/ property double AltNorthing { double get(); } /** * @return meridian convergence (degrees) for alternate zone. **********************************************************************/ property double AltConvergence { double get(); } /** * @return scale for alternate zone. **********************************************************************/ property double AltScale { double get(); } ///@} /** \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] longfirst if true give longitude first (default = false) * @exception std::bad_alloc if memory for the string can't be allocated. * @return decimal latitude/longitude string representation. * * Precision specifies accuracy of representation as follows: * - prec = −5 (min), 1° * - prec = 0, 10−5° (about 1m) * - prec = 3, 10−8° * - prec = 9 (max), 10−14° **********************************************************************/ System::String^ GeoRepresentation(int prec, bool longfirst ); /** * String representation with latitude and longitude as degrees, minutes, * seconds, and hemisphere. * * @param[in] prec precision (relative to about 1m) * @param[in] longfirst if true give longitude first (default = false) * @param[in] dmssep if non-null, use as the DMS separator character * (instead of d, ', " delimiters). * @exception std::bad_alloc if memory for the string can't be allocated. * @return DMS latitude/longitude string representation. * * Precision specifies accuracy of representation as follows: * - prec = −5 (min), 1° * - prec = −4, 0.1° * - 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" **********************************************************************/ System::String^ DMSRepresentation(int prec, bool longfirst, char dmssep ); /** * MGRS string. * * @param[in] prec precision (relative to about 1m). * @exception std::bad_alloc if memory for the string can't be allocated. * @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), 1μm **********************************************************************/ System::String^ MGRSRepresentation(int prec); /** * UTM/UPS string. * * @param[in] prec precision (relative to about 1m) * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception std::bad_alloc if memory for the string can't be allocated. * @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, 1μm * - prec = 9 (max), 1nm **********************************************************************/ System::String^ UTMUPSRepresentation(int prec, bool abbrev); /** * UTM/UPS string with hemisphere override. * * @param[in] northp hemisphere override * @param[in] prec precision (relative to about 1m) * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception GeographicErr if the hemisphere override attempts to change * UPS N to UPS S or vice versa. * @exception std::bad_alloc if memory for the string can't be allocated. * @return UTM/UPS string representation: zone designator, easting, and * northing. **********************************************************************/ System::String^ UTMUPSRepresentation(bool northp, int prec, bool abbrev); /** * MGRS string for the alternate zone. See GeoCoords::MGRSRepresentation. * * @param[in] prec precision (relative to about 1m). * @exception std::bad_alloc if memory for the string can't be allocated. * @return MGRS string. **********************************************************************/ System::String^ AltMGRSRepresentation(int prec); /** * UTM/UPS string for the alternate zone. See * GeoCoords::UTMUPSRepresentation. * * @param[in] prec precision (relative to about 1m) * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception std::bad_alloc if memory for the string can't be allocated. * @return UTM/UPS string representation: zone designator, easting, and * northing. **********************************************************************/ System::String^ AltUTMUPSRepresentation(int prec, bool abbrev); /** * UTM/UPS string for the alternate zone, with hemisphere override. * * @param[in] northp hemisphere override * @param[in] prec precision (relative to about 1m) * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception GeographicErr if the hemisphere override attempts to change * UPS n to UPS s or vice verse. * @exception std::bad_alloc if memory for the string can't be allocated. * @return UTM/UPS string representation: zone designator, easting, and * northing. **********************************************************************/ System::String^ AltUTMUPSRepresentation(bool northp, int prec, bool abbrev); ///@} /** \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.) **********************************************************************/ property double EquatorialRadius { double get(); } /** * @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.) **********************************************************************/ property double Flattening { double get(); } ///@} }; } //namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/Geocentric.cpp0000644000771000077100000001110514064202371023144 0ustar ckarneyckarney/** * \file NETGeographicLib/Geocentric.cpp * \brief Implementation for NETGeographicLib::Geocentric class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/Geocentric.hpp" #include "Geocentric.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Unable to allocate memory for a GeographicLib::Geocentric"; //***************************************************************************** Geocentric::!Geocentric() { if ( m_pGeocentric != NULL ) { delete m_pGeocentric; m_pGeocentric = NULL; } } //***************************************************************************** Geocentric::Geocentric(void) { try { m_pGeocentric = new GeographicLib::Geocentric( GeographicLib::Geocentric::WGS84() ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** Geocentric::Geocentric(double a, double f) { try { m_pGeocentric = new GeographicLib::Geocentric( a, f ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } catch (std::exception err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** Geocentric::Geocentric( const GeographicLib::Geocentric& g ) { try { m_pGeocentric = new GeographicLib::Geocentric( g ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void Geocentric::Forward(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% X, [System::Runtime::InteropServices::Out] double% Y, [System::Runtime::InteropServices::Out] double% Z) { double lX, lY, lZ; m_pGeocentric->Forward( lat, lon, h, lX, lY, lZ); X = lX; Y = lY; Z = lZ; } //***************************************************************************** void Geocentric::Forward(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% X, [System::Runtime::InteropServices::Out] double% Y, [System::Runtime::InteropServices::Out] double% Z, [System::Runtime::InteropServices::Out] array^% M) { double lX, lY, lZ; std::vector lM(9); m_pGeocentric->Forward( lat, lon, h, lX, lY, lZ, lM); X = lX; Y = lY; Z = lZ; M = gcnew array( 3, 3 ); for ( int i = 0; i < 3; i++ ) for ( int j = 0; j < 3; j++ ) M[i,j] = lM[3*i+j]; } //***************************************************************************** void Geocentric::Reverse(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h) { double llat, llon, lh; m_pGeocentric->Reverse(X, Y, Z, llat, llon, lh); lat = llat; lon = llon; h = lh; } //***************************************************************************** void Geocentric::Reverse(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h, [System::Runtime::InteropServices::Out] array^% M) { std::vector lM(9); double llat, llon, lh; m_pGeocentric->Reverse(X, Y, Z, llat, llon, lh, lM); lat = llat; lon = llon; h = lh; M = gcnew array( 3, 3 ); for ( int i = 0; i < 3; i++ ) for ( int j = 0; j < 3; j++ ) M[i,j] = lM[3*i+j]; } //***************************************************************************** System::IntPtr^ Geocentric::GetUnmanaged() { return gcnew System::IntPtr( const_cast( reinterpret_cast(m_pGeocentric) ) ); } //***************************************************************************** double Geocentric::EquatorialRadius::get() { return m_pGeocentric->EquatorialRadius(); } //***************************************************************************** double Geocentric::Flattening::get() { return m_pGeocentric->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/Geocentric.h0000644000771000077100000002435714064202371022626 0ustar ckarneyckarney/** * \file NETGeographicLib/Geocentric.h * \brief Header for NETGeographicLib::Geocentric class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::Geocentric. * * This class allows .NET applications to access GeographicLib::Geocentric. * * 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 = 90°. 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. * * C# Example: * \include example-Geocentric.cs * Managed C++ Example: * \include example-Geocentric.cpp * Visual Basic Example: * \include example-Geocentric.vb * * INTERFACE DIFFERENCES:
* A default constructor is provided that assumes WGS84 parameters. * * The EquatorialRadius and Flattening functions are implemented as properties. * * The Forward and Reverse functions return rotation matrices as 2D, * 3 × 3 arrays rather than vectors. **********************************************************************/ public ref class Geocentric { private: // pointer to the unmanaged GeographicLib::Geocentric const GeographicLib::Geocentric* m_pGeocentric; // The finalizer frees unmanaged memory when the object is destroyed. !Geocentric(); 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. * @exception GeographicErr if \e a or (1 − \e f ) \e a is not * positive. **********************************************************************/ Geocentric(double a, double f); /** * A default constructor which assumes WGS84. **********************************************************************/ Geocentric(); /** * A constructor that is initialized from an unmanaged * GeographicLib::Geocentric. For internal use only. * @param[in] g An existing GeographicLib::Geocentric. **********************************************************************/ Geocentric( const GeographicLib::Geocentric& g ); /** * The destructor calls the finalizer. **********************************************************************/ ~Geocentric() { this->!Geocentric(); } /** * 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°]. **********************************************************************/ void Forward(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% X, [System::Runtime::InteropServices::Out] double% Y, [System::Runtime::InteropServices::Out] double% Z); /** * 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 a 3 × 3 rotation matrix. * * 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(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% X, [System::Runtime::InteropServices::Out] double% Y, [System::Runtime::InteropServices::Out] double% Z, [System::Runtime::InteropServices::Out] array^% M); /** * 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(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h); /** * 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 a 3 × 3 rotation matrix. * * 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 MT ⋅ \e v0, where \e * MT is the transpose of \e M. **********************************************************************/ void Reverse(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h, [System::Runtime::InteropServices::Out] array^% M); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return a pointer to the unmanaged GeographicLib::Geocentric. **********************************************************************/ System::IntPtr^ GetUnmanaged(); /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ property double Flattening { double get(); } ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/Geodesic.cpp0000644000771000077100000005030414064202371022610 0ustar ckarneyckarney/** * \file NETGeographicLib/Geodesic.cpp * \brief Implementation for NETGeographicLib::Geodesic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include #include #include "Geodesic.h" #include "GeodesicLine.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::Geodesic"; //***************************************************************************** Geodesic::!Geodesic() { if ( m_pGeodesic != NULL ) { delete m_pGeodesic; m_pGeodesic = NULL; } } //***************************************************************************** Geodesic::Geodesic(double a, double f) { try { m_pGeodesic = new GeographicLib::Geodesic( a, f ); } catch ( std::bad_alloc err ) { throw gcnew GeographicErr( BADALLOC ); } catch ( GeographicLib::GeographicErr err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** Geodesic::Geodesic() { try { m_pGeodesic = new GeographicLib::Geodesic( GeographicLib::Geodesic::WGS84() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** double Geodesic::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, lm12, lM12, lM21, lS12; double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12, llat2, llon2, lazi2, lm12, lM12, lM21, lS12); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** double Geodesic::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double llat2, llon2; double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12, llat2, llon2 ); lat2 = llat2; lon2 = llon2; return out; } //***************************************************************************** double Geodesic::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2) { double llat2, llon2, lazi2; double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12, llat2, llon2, lazi2 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; return out; } //***************************************************************************** double Geodesic::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12) { double llat2, llon2, lazi2, lm12; double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12, llat2, llon2, lazi2, lm12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; return out; } //***************************************************************************** double Geodesic::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, lM12, lM21; double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12, llat2, llon2, lazi2, lM12, lM21); lat2 = llat2; lon2 = llon2; azi2 = lazi2; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** double Geodesic::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, lm12, lM12, lM21; double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12, llat2, llon2, lazi2, lm12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12; m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; } //***************************************************************************** void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double llat2, llon2; m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12, llat2, llon2 ); lat2 = llat2; lon2 = llon2; } //***************************************************************************** void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2) { double llat2, llon2, lazi2; m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12, llat2, llon2, lazi2 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; } //***************************************************************************** void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12) { double llat2, llon2, lazi2, ls12; m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; } //***************************************************************************** void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12) { double llat2, llon2, lazi2, ls12, lm12; m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12, lm12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; } //***************************************************************************** void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, ls12, lM12, lM21; m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; M12 = lM12; M21 = lM21; } //***************************************************************************** void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21; m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12, lm12, lM12, lM21); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; s12 = ls12; M12 = lM12; M21 = lM21; } //***************************************************************************** double Geodesic::GenDirect(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, Geodesic::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, lm12, lM12, lM21, ls12, lS12; double out = m_pGeodesic->GenDirect(lat1, lon1, azi1, arcmode, s12_a12, static_cast(outmask), llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; s12 = ls12; S12 = lS12; return out; } //***************************************************************************** double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double ls12, lazi1, lazi2, lm12, lM12, lM21, lS12; double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2, ls12, lazi1, lazi2, lm12, lM12, lM21, lS12); s12 = ls12; azi1 = lazi1; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12) { double ls12; double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2, ls12 ); s12 = ls12; return out; } //***************************************************************************** double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2) { double lazi1, lazi2; double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2, lazi1, lazi2); azi1 = lazi1; azi2 = lazi2; return out; } //***************************************************************************** double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2) { double ls12, lazi1, lazi2; double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2, ls12, lazi1, lazi2 ); azi1 = lazi1; azi2 = lazi2; s12 = ls12; return out; } //***************************************************************************** double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12) { double ls12, lazi1, lazi2, lm12; double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2, ls12, lazi1, lazi2, lm12 ); azi1 = lazi1; azi2 = lazi2; s12 = ls12; m12 = lm12; return out; } //***************************************************************************** double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double ls12, lazi1, lazi2, lM12, lM21; double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2, ls12, lazi1, lazi2, lM12, lM21 ); azi1 = lazi1; azi2 = lazi2; s12 = ls12; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double ls12, lazi1, lazi2, lm12, lM12, lM21; double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2, ls12, lazi1, lazi2, lm12, lM12, lM21 ); azi1 = lazi1; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** double Geodesic::GenInverse(double lat1, double lon1, double lat2, double lon2, Geodesic::mask outmask, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double ls12, lazi1, lazi2, lm12, lM12, lM21, lS12; double out = m_pGeodesic->GenInverse(lat1, lon1, lat2, lon2, static_cast(outmask), ls12, lazi1, lazi2, lm12, lM12, lM21, lS12); azi1 = lazi1; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** System::IntPtr^ Geodesic::GetUnmanaged() { return gcnew System::IntPtr( const_cast(reinterpret_cast(m_pGeodesic)) ); } //***************************************************************************** GeodesicLine^ Geodesic::Line(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps ) { return gcnew GeodesicLine( this, lat1, lon1, azi1, caps ); } //***************************************************************************** GeodesicLine^ Geodesic::InverseLine(double lat1, double lon1, double lat2, double lon2, NETGeographicLib::Mask caps) { return gcnew GeodesicLine(m_pGeodesic->InverseLine(lat1, lon1, lat2, lon2, static_cast(caps))); } //***************************************************************************** GeodesicLine^ Geodesic::DirectLine(double lat1, double lon1, double azi1, double s12, NETGeographicLib::Mask caps) { return gcnew GeodesicLine(m_pGeodesic->DirectLine(lat1, lon1, azi1, s12, static_cast(caps))); } //***************************************************************************** GeodesicLine^ Geodesic::ArcDirectLine(double lat1, double lon1, double azi1, double a12, NETGeographicLib::Mask caps) { return gcnew GeodesicLine(m_pGeodesic->ArcDirectLine(lat1, lon1, azi1, a12, static_cast(caps))); } //***************************************************************************** GeodesicLine^ Geodesic::GenDirectLine(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, NETGeographicLib::Mask caps) { return gcnew GeodesicLine(m_pGeodesic->GenDirectLine(lat1, lon1, azi1, arcmode, s12_a12, static_cast(caps))); } //***************************************************************************** double Geodesic::EquatorialRadius::get() { return m_pGeodesic->EquatorialRadius(); } //***************************************************************************** double Geodesic::Flattening::get() { return m_pGeodesic->Flattening(); } //***************************************************************************** double Geodesic::EllipsoidArea::get() { return m_pGeodesic->EllipsoidArea(); } GeographicLib-1.52/dotnet/NETGeographicLib/Geodesic.h0000644000771000077100000013267414064202371022270 0ustar ckarneyckarney/** * \file NETGeographicLib/Geodesic.h * \brief Header for NETGeographicLib::Geodesic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once #include "NETGeographicLib.h" namespace NETGeographicLib { ref class GeodesicLine; /** * \brief .NET wrapper for GeographicLib::Geodesic. * * This class allows .NET applications to access GeographicLib::Geodesic. * * 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.) In the figure below, latitude if * labeled φ, longitude λ (with λ12 = * λ2 − λ1), and azimuth α. * * spheroidal triangle * * 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 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 provided by * Geodesic::ArcDirect. An arc length in excess of 180° 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 * 90°. * * 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 second point is displaced \e m12 \e dazi1 in * the direction \e azi2 + 90°. 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. The area between the geodesic from point 1 to point 2 and * the equation is represented by \e S12; it is the area, measured * counter-clockwise, of the geodesic quadrilateral with corners * (lat1,lon1), (0,lon1), (0,lon2), and * (lat2,lon2). It can be used to compute the area of any * 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. If points 1, 2, and 3 all lie on a single geodesic, * then the following rules hold: * - \e s13 = \e s12 + \e s23 * - \e a13 = \e a12 + \e a23 * - \e S13 = \e S12 + \e S23 * - \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 shortest distance returned by the solution of the inverse problem is * (obviously) uniquely defined. However, in a few special cases there are * multiple azimuths which yield the same shortest distance. Here is a * catalog of those cases: * - \e lat1 = −\e lat2 (with neither point at a pole). If \e azi1 = * \e azi2, the geodesic is unique. Otherwise there are two geodesics and * the second one is obtained by setting [\e azi1, \e azi2] → [\e * azi2, \e azi1], [\e M12, \e M21] → [\e M21, \e M12], \e S12 → * −\e S12. (This occurs when the longitude difference is near * ±180° for oblate ellipsoids.) * - \e lon2 = \e lon1 ± 180° (with neither point at a pole). If * \e azi1 = 0° or ±180°, the geodesic is unique. Otherwise * there are two geodesics and the second one is obtained by setting [\e * azi1, \e azi2] → [−\e azi1, −\e azi2], \e S12 → * −\e S12. (This occurs when \e lat2 is near −\e lat1 for * prolate ellipsoids.) * - Points 1 and 2 at opposite poles. There are infinitely many geodesics * which can be generated by setting [\e azi1, \e azi2] → [\e azi1, \e * azi2] + [\e d, −\e d], for arbitrary \e d. (For spheres, this * prescription applies when points 1 and 2 are antipodal.) * - \e s12 = 0 (coincident points). There are infinitely many geodesics * which can be generated by setting [\e azi1, \e azi2] → * [\e azi1, \e azi2] + [\e d, \e d], for arbitrary \e d. * * The calculations are accurate to better than 15 nm (15 nanometers) for the * WGS84 ellipsoid. See Sec. 9 of * arXiv:1102.1215v1 for * details. The algorithms used by this class are based on series expansions * using the flattening \e f as a small parameter. These are only accurate * for |f| < 0.02; however reasonably accurate results will be * obtained for |f| < 0.2. Here is a table of the approximate * maximum error (expressed as a distance) for an ellipsoid with the same * equatorial radius as the WGS84 ellipsoid and different values of the * flattening.
   *     |f|      error
   *     0.01     25 nm
   *     0.02     30 nm
   *     0.05     10 um
   *     0.1     1.5 mm
   *     0.2     300 mm
   * 
* For very eccentric ellipsoids, use GeodesicExact instead. * * The algorithms are described in * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * geod-addenda.html. * . * For more information on geodesics see \ref geodesic. * * C# Example: * \include example-Geodesic.cs * Managed C++ Example: * \include example-Geodesic.cpp * Visual Basic Example: * \include example-Geodesic.vb * * INTERFACE DIFFERENCES:
* A default constructor has been provided that assumes WGS84 parameters. * * The EquatorialRadius, Flattening, and EllipsoidArea functions are * implemented as properties. * * The GenDirect, GenInverse, and Line functions accept the * "capabilities mask" as a NETGeographicLib::Mask rather than an * unsigned. **********************************************************************/ public ref class Geodesic { private: // The pointer to the unmanaged GeographicLib::Geodesic. const GeographicLib::Geodesic* m_pGeodesic; // Frees the unmanaged memory when this object is destroyed. !Geodesic(); 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 class 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 | unsigned(captype::CAP_NONE), /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8 | unsigned(captype::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 | unsigned(captype::CAP_NONE), /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10 | unsigned(captype::CAP_C1), /** * Allow distance \e s12 to be used as input in the direct geodesic * problem. * @hideinitializer **********************************************************************/ DISTANCE_IN = 1U<<11 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C1p), /** * Calculate reduced length \e m12. * @hideinitializer **********************************************************************/ REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C2), /** * Calculate geodesic scales \e M12 and \e M21. * @hideinitializer **********************************************************************/ GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C2), /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14 | unsigned(captype::CAP_C4), /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, /** * All capabilities, calculate everything. (LONG_UNROLL is not * included in this mask.) * @hideinitializer **********************************************************************/ ALL = unsigned(captype::OUT_ALL)| unsigned(captype::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. * @exception GeographicErr if \e a or (1 − \e f ) \e a is not * positive. **********************************************************************/ Geodesic(double a, double f); /** * Constructor for the WGS84 ellipsoid. **********************************************************************/ Geodesic(); ///@} /** * \brief the destructor calls the finalizer. **********************************************************************/ ~Geodesic() { this->!Geodesic(); } /** \name Direct geodesic problem specified in terms of distance. **********************************************************************/ ///@{ /** * Solve the direct geodesic problem where the length of the geodesic * is specified 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 * negative. * @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°]. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) * * 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. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for Geodesic::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * See the documentation for Geodesic::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for Geodesic::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for Geodesic::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for Geodesic::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \name Direct geodesic problem specified in terms of arc length. **********************************************************************/ ///@{ /** * Solve the direct geodesic problem where the length of the geodesic * is specified 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 negative. * @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°]. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) * * The following functions are overloaded versions of Geodesic::Direct * which omit some of the output parameters. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12); /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for Geodesic::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \name General version of the direct geodesic solution. **********************************************************************/ ///@{ /** * The general direct geodesic problem. 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 \e * s12_a12. * @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 negative. * @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; * - \e outmask |= Geodesic::ALL for all of the above; * - \e outmask |= Geodesic::LONG_UNROLL to unroll \e lon2 instead of * wrapping it into the range [−180°, 180°). * . * 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. * * With the LONG_UNROLL bit set, the quantity \e lon2 − \e lon1 * indicates how many times and in what sense the geodesic encircles * the ellipsoid. **********************************************************************/ double GenDirect(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, Geodesic::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); ///@} /** \name Inverse geodesic problem. **********************************************************************/ ///@{ /** * Solve the inverse geodesic problem. * * @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°]. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. * * The solution to the inverse problem is found using Newton's method. If * this fails to converge (this is very unlikely in geodetic applications * but does occur for very eccentric ellipsoids), then the bisection method * is used to refine the solution. * * 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. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for Geodesic::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12); /** * See the documentation for Geodesic::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for Geodesic::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for Geodesic::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for Geodesic::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for Geodesic::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \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; * - \e outmask |= Geodesic::ALL for all of the above. * . * The arc length is always computed and returned as the function value. **********************************************************************/ double GenInverse(double lat1, double lon1, double lat2, double lon2, Geodesic::mask outmask, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); ///@} /** \name Interface to GeodesicLine. **********************************************************************/ ///@{ /** * Set up to compute several points on a single 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 NETGeographicLib::Mask values * specifying the capabilities the GeodesicLine object should possess, * i.e., which quantities can be returned in calls to * GeodesicLine::Position. * @return a GeodesicLine object. * * \e lat1 should be in the range [−90°, 90°]. * * The NETGeographicLib::Mask values are * - \e caps |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2; this is * added automatically; * - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2; * - \e caps |= NETGeographicLib::Mask::AZIMUTH for the azimuth \e azi2; this is * added automatically; * - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12; * - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e m12; * - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e M12 * and \e M21; * - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12; * - \e caps |= NETGeographicLib::Mask::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; * - \e caps |= NETGeographicLib::Mask::ALL for all of the above. * . * * If the point is at a pole, the azimuth is defined by keeping \e lon1 * fixed, writing \e lat1 = ±(90 − ε), and taking the * limit ε → 0+. **********************************************************************/ GeodesicLine^ Line(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps ); /** * Define a GeodesicLine in terms of the inverse geodesic problem. * * @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] 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 * GeodesicLine::Position. * @return a GeodesicLine object. * * This function sets point 3 of the GeodesicLine to correspond to point 2 * of the inverse geodesic problem. * * \e lat1 and \e lat2 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLine^ InverseLine(double lat1, double lon1, double lat2, double lon2, NETGeographicLib::Mask caps); /** * Define a GeodesicLine in terms of the direct geodesic problem specified * 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 * negative. * @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 * GeodesicLine::Position. * @return a GeodesicLine object. * * This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLine^ DirectLine(double lat1, double lon1, double azi1, double s12, NETGeographicLib::Mask caps); /** * Define a GeodesicLine in terms of the direct geodesic problem specified * 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 negative. * @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 * GeodesicLine::Position. * @return a GeodesicLine object. * * This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLine^ ArcDirectLine(double lat1, double lon1, double azi1, double a12, NETGeographicLib::Mask caps); /** * Define a GeodesicLine in terms of the direct geodesic problem specified * in terms of either distance or 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] arcmode boolean flag determining the meaning of the \e * s12_a12. * @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 negative. * @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 * GeodesicLine::Position. * @return a GeodesicLine object. * * This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLine^ GenDirectLine(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, NETGeographicLib::Mask caps); ///@} /** \name Inspector functions. **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ property double Flattening { double get(); } /** * @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. **********************************************************************/ property double EllipsoidArea { double get(); } /** * %return The unmanaged pointer to the GeographicLib::Geodesic. * * This function is for internal use only. **********************************************************************/ System::IntPtr^ GetUnmanaged(); ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/GeodesicExact.cpp0000644000771000077100000005121214064202371023574 0ustar ckarneyckarney/** * \file NETGeographicLib/GeodesicExact.cpp * \brief Implementation for NETGeographicLib::GeodesicExact class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/GeodesicExact.hpp" #include "GeographicLib/GeodesicLineExact.hpp" #include "GeodesicExact.h" #include "GeodesicLineExact.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeodesicExact"; //***************************************************************************** GeodesicExact::!GeodesicExact(void) { if ( m_pGeodesicExact != NULL ) { delete m_pGeodesicExact; m_pGeodesicExact = NULL; } } //***************************************************************************** GeodesicExact::GeodesicExact() { try { m_pGeodesicExact = new GeographicLib::GeodesicExact( GeographicLib::GeodesicExact::WGS84() ); } catch ( std::bad_alloc err ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** GeodesicExact::GeodesicExact(double a, double f) { try { m_pGeodesicExact = new GeographicLib::GeodesicExact( a, f ); } catch ( std::bad_alloc err ) { throw gcnew GeographicErr( BADALLOC ); } catch ( GeographicLib::GeographicErr err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, lm12, lM12, lM21, lS12; double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12, llat2, llon2, lazi2, lm12, lM12, lM21, lS12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double llat2, llon2; double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12, llat2, llon2 ); lat2 = llat2; lon2 = llon2; return out; } //***************************************************************************** double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2) { double llat2, llon2, lazi2; double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12, llat2, llon2, lazi2 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; return out; } //***************************************************************************** double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12) { double llat2, llon2, lazi2, lm12; double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12, llat2, llon2, lazi2, lm12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; return out; } //***************************************************************************** double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, lM12, lM21; double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12, llat2, llon2, lazi2, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, lm12, lM12, lM21; double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12, llat2, llon2, lazi2, lm12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12; m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; } //***************************************************************************** void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double llat2, llon2; m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12, llat2, llon2 ); lat2 = llat2; lon2 = llon2; } //***************************************************************************** void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2) { double llat2, llon2, lazi2; m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12, llat2, llon2, lazi2 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; } //***************************************************************************** void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12) { double llat2, llon2, lazi2, ls12; m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; } //***************************************************************************** void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12) { double llat2, llon2, lazi2, ls12, lm12; m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12, lm12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; } //***************************************************************************** void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, ls12, lM12, lM21; m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; M12 = lM12; M21 = lM21; } //***************************************************************************** void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21; m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12, llat2, llon2, lazi2, ls12, lm12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; } //***************************************************************************** double GeodesicExact::GenDirect(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, GeodesicExact::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12; double out = m_pGeodesicExact->GenDirect( lat1, lon1, azi1, arcmode, s12_a12, static_cast(outmask), llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double ls12, lazi1, lazi2, lm12, lM12, lM21, lS12; double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2, ls12, lazi1, lazi2, lm12, lM12, lM21, lS12 ); s12 = ls12; azi1 = lazi1; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12) { double ls12; double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2, ls12 ); s12 = ls12; return out; } //***************************************************************************** double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2) { double lazi1, lazi2; double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2, lazi1, lazi2 ); azi1 = lazi1; azi2 = lazi2; return out; } //***************************************************************************** double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2) { double ls12, lazi1, lazi2; double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2, ls12, lazi1, lazi2 ); s12 = ls12; azi1 = lazi1; azi2 = lazi2; return out; } //***************************************************************************** double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12) { double ls12, lazi1, lazi2, lm12; double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2, ls12, lazi1, lazi2, lm12 ); s12 = ls12; azi1 = lazi1; azi2 = lazi2; m12 = lm12; return out; } //***************************************************************************** double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double ls12, lazi1, lazi2, lM12, lM21; double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2, ls12, lazi1, lazi2, lM12, lM21 ); s12 = ls12; azi1 = lazi1; azi2 = lazi2; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double ls12, lazi1, lazi2, lm12, lM12, lM21; double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2, ls12, lazi1, lazi2, lm12, lM12, lM21 ); s12 = ls12; azi1 = lazi1; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** double GeodesicExact::GenInverse(double lat1, double lon1, double lat2, double lon2, GeodesicExact::mask outmask, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double ls12, lazi1, lazi2, lm12, lM12, lM21, lS12; double out = m_pGeodesicExact->GenInverse( lat1, lon1, lat2, lon2, static_cast(outmask), ls12, lazi1, lazi2, lm12, lM12, lM21, lS12 ); s12 = ls12; azi1 = lazi1; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** System::IntPtr^ GeodesicExact::GetUnmanaged() { return gcnew System::IntPtr( const_cast( reinterpret_cast(m_pGeodesicExact) ) ); } //***************************************************************************** GeodesicLineExact^ GeodesicExact::Line(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps ) { return gcnew GeodesicLineExact( this, lat1, lon1, azi1, caps ); } //***************************************************************************** GeodesicLineExact^ GeodesicExact::InverseLine(double lat1, double lon1, double lat2, double lon2, NETGeographicLib::Mask caps) { return gcnew GeodesicLineExact(m_pGeodesicExact->InverseLine( lat1, lon1, lat2, lon2, static_cast(caps))); } //***************************************************************************** GeodesicLineExact^ GeodesicExact::DirectLine(double lat1, double lon1, double azi1, double s12, NETGeographicLib::Mask caps) { return gcnew GeodesicLineExact(m_pGeodesicExact->DirectLine( lat1, lon1, azi1, s12, static_cast(caps))); } //***************************************************************************** GeodesicLineExact^ GeodesicExact::ArcDirectLine(double lat1, double lon1, double azi1, double a12, NETGeographicLib::Mask caps) { return gcnew GeodesicLineExact(m_pGeodesicExact->ArcDirectLine( lat1, lon1, azi1, a12, static_cast(caps))); } //***************************************************************************** GeodesicLineExact^ GeodesicExact::GenDirectLine(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, NETGeographicLib::Mask caps) { return gcnew GeodesicLineExact(m_pGeodesicExact->GenDirectLine( lat1, lon1, azi1, arcmode, s12_a12, static_cast(caps))); } //***************************************************************************** double GeodesicExact::EquatorialRadius::get() { return m_pGeodesicExact->EquatorialRadius(); } //***************************************************************************** double GeodesicExact::Flattening::get() { return m_pGeodesicExact->Flattening(); } //***************************************************************************** double GeodesicExact::EllipsoidArea::get() { return m_pGeodesicExact->EllipsoidArea(); } GeographicLib-1.52/dotnet/NETGeographicLib/GeodesicExact.h0000644000771000077100000012070714064202371023247 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/GeodesicExact.h * \brief Header for NETGeographicLib::GeodesicExact class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "NETGeographicLib.h" namespace NETGeographicLib { ref class GeodesicLineExact; /*! \brief .NET wrapper for GeographicLib::GeodesicExact. This class allows .NET applications to access GeographicLib::GeodesicExact. */ /** * \brief .NET wrapper for GeographicLib::GeodesicExact. * * This class allows .NET applications to access GeographicLib::GeodesicExact. * * The equations for geodesics on an ellipsoid can be expressed in terms of * incomplete elliptic integrals. The Geodesic class expands these integrals * in a series in the flattening \e f and this provides an accurate solution * for \e f &isin [-0.01, 0.01]. The GeodesicExact class computes the * ellitpic integrals directly and so provides a solution which is valid for * all \e f. However, in practice, its use should be limited to about \e * b/\e a ∈ [0.01, 100] or \e f ∈ [-99, 0.99]. * * For the WGS84 ellipsoid, these classes are 2--3 times \e slower than the * series solution and 2--3 times \e less \e accurate (because it's less easy * to control round-off errors with the elliptic integral formulation); i.e., * the error is about 40 nm (40 nanometers) instead of 15 nm. However the * error in the series solution scales as f7 while the * error in the elliptic integral solution depends weakly on \e f. If the * quarter meridian distance is 10000 km and the ratio \e b/\e a = 1 − * \e f is varied then the approximate maximum error (expressed as a * distance) is
   *       1 - f  error (nm)
   *       1/128     387
   *       1/64      345
   *       1/32      269
   *       1/16      210
   *       1/8       115
   *       1/4        69
   *       1/2        36
   *         1        15
   *         2        25
   *         4        96
   *         8       318
   *        16       985
   *        32      2352
   *        64      6008
   *       128     19024
   * 
* * The computation of the area in these classes is via a 30th order series. * This gives accurate results for \e b/\e a ∈ [1/2, 2]; the accuracy is * about 8 decimal digits for \e b/\e a ∈ [1/4, 4]. * * See \ref geodellip for the formulation. See the documentation on the * Geodesic class for additional information on the geodesics problems. * * C# Example: * \include example-GeodesicExact.cs * Managed C++ Example: * \include example-GeodesicExact.cpp * Visual Basic Example: * \include example-GeodesicExact.vb * * INTERFACE DIFFERENCES:
* A default constructor is provided that assumes WGS84 parameters. * * The EquatorialRadius, Flattening, and EllipsoidArea functions are * implemented as properties. * * The GenDirect, GenInverse, and Line functions accept the * "capabilities mask" as a NETGeographicLib::Mask rather than an * unsigned. **********************************************************************/ public ref class GeodesicExact { private: enum class captype { CAP_NONE = 0U, CAP_E = 1U<<0, // Skip 1U<<1 for compatibility with Geodesic (not required) CAP_D = 1U<<2, CAP_H = 1U<<3, CAP_C4 = 1U<<4, CAP_ALL = 0x1FU, CAP_MASK = CAP_ALL, OUT_ALL = 0x7F80U, OUT_MASK = 0xFF80U, // Includes LONG_UNROLL }; // pointer to the unmanaged GeographicLib::GeodesicExact. const GeographicLib::GeodesicExact* m_pGeodesicExact; // the finalizer deletes the unmanaged memory. !GeodesicExact(); public: /** * Bit masks for what calculations to do. These masks do double duty. * They signify to the GeodesicLineExact::GeodesicLineExact constructor and * to GeodesicExact::Line what capabilities should be included in the * GeodesicLineExact object. They also specify which results to return in * the general routines GeodesicExact::GenDirect and * GeodesicExact::GenInverse routines. GeodesicLineExact::mask is a * duplication of this enum. **********************************************************************/ enum class mask { /** * No capabilities, no output. * @hideinitializer **********************************************************************/ NONE = 0U, /** * Calculate latitude \e lat2. (It's not necessary to include this as a * capability to GeodesicLineExact because this is included by default.) * @hideinitializer **********************************************************************/ LATITUDE = 1U<<7 | unsigned(captype::CAP_NONE), /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8 | unsigned(captype::CAP_H), /** * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to * include this as a capability to GeodesicLineExact because this is * included by default.) * @hideinitializer **********************************************************************/ AZIMUTH = 1U<<9 | unsigned(captype::CAP_NONE), /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10 | unsigned(captype::CAP_E), /** * Allow distance \e s12 to be used as input in the direct geodesic * problem. * @hideinitializer **********************************************************************/ DISTANCE_IN = 1U<<11 | unsigned(captype::CAP_E), /** * Calculate reduced length \e m12. * @hideinitializer **********************************************************************/ REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_D), /** * Calculate geodesic scales \e M12 and \e M21. * @hideinitializer **********************************************************************/ GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_D), /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14 | unsigned(captype::CAP_C4), /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, /** * All capabilities, calculate everything. (LONG_UNROLL is not * included in this mask.) * @hideinitializer **********************************************************************/ ALL = unsigned(captype::OUT_ALL)| unsigned(captype::CAP_ALL), }; /** \name Constructor **********************************************************************/ ///@{ /** * Constructor for a WGS84 ellipsoid **********************************************************************/ GeodesicExact(); /** * 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. * @exception GeographicErr if \e a or (1 − \e f ) \e a is not * positive. **********************************************************************/ GeodesicExact(double a, double f); ///@} /** * The desstructor calls the finalizer. **********************************************************************/ ~GeodesicExact() { this->!GeodesicExact(); } /** \name Direct geodesic problem specified in terms of distance. **********************************************************************/ ///@{ /** * Perform the direct geodesic calculation where the length of the geodesic * is specified 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°];. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) * * The following functions are overloaded versions of GeodesicExact::Direct * which omit some of the output parameters. Note, however, that the arc * length is always computed and returned as the function value. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for GeodesicExact::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * See the documentation for GeodesicExact::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for GeodesicExact::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for GeodesicExact::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for GeodesicExact::Direct. **********************************************************************/ double Direct(double lat1, double lon1, double azi1, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \name Direct geodesic problem specified in terms of arc length. **********************************************************************/ ///@{ /** * Perform the direct geodesic calculation where the length of the geodesic * is specified 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°]. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) * * The following functions are overloaded versions of GeodesicExact::Direct * which omit some of the output parameters. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * See the documentation for GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12); /** * See the documentation for GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(double lat1, double lon1, double azi1, double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \name General version of the direct geodesic solution. **********************************************************************/ ///@{ /** * The general direct geodesic calculation. GeodesicExact::Direct and * GeodesicExact::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 GeodesicExact::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 GeodesicExact::mask values possible for \e outmask are * - \e outmask |= GeodesicExact::LATITUDE for the latitude \e lat2; * - \e outmask |= GeodesicExact::LONGITUDE for the latitude \e lon2; * - \e outmask |= GeodesicExact::AZIMUTH for the latitude \e azi2; * - \e outmask |= GeodesicExact::DISTANCE for the distance \e s12; * - \e outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length \e * m12; * - \e outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales \e * M12 and \e M21; * - \e outmask |= GeodesicExact::AREA for the area \e S12; * - \e outmask |= GeodesicExact::ALL for all of the above; * - \e outmask |= GeodesicExact::LONG_UNROLL to unroll \e lon2 instead of * wrapping it into the range [−180°, 180°). * . * 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 * GeodesicExact::DISTANCE and \e arcmode is false, then \e s12 = \e * s12_a12. It is not necessary to include GeodesicExact::DISTANCE_IN in * \e outmask; this is automatically included is \e arcmode is false. * * With the LONG_UNROLL bit set, the quantity \e lon2 − \e lon1 * indicates how many times and in what sense the geodesic encircles * the ellipsoid. **********************************************************************/ double GenDirect(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, GeodesicExact::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); ///@} /** \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°]. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. * * The following functions are overloaded versions of GeodesicExact::Inverse * which omit some of the output parameters. Note, however, that the arc * length is always computed and returned as the function value. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12); /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \name General version of inverse geodesic solution. **********************************************************************/ ///@{ /** * The general inverse geodesic calculation. GeodesicExact::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 GeodesicExact::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 GeodesicExact::mask values possible for \e outmask are * - \e outmask |= GeodesicExact::DISTANCE for the distance \e s12; * - \e outmask |= GeodesicExact::AZIMUTH for the latitude \e azi2; * - \e outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length \e * m12; * - \e outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales \e * M12 and \e M21; * - \e outmask |= GeodesicExact::AREA for the area \e S12; * - \e outmask |= GeodesicExact::ALL for all of the above. * . * The arc length is always computed and returned as the function value. **********************************************************************/ double GenInverse(double lat1, double lon1, double lat2, double lon2, GeodesicExact::mask outmask, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi1, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); ///@} /** \name Interface to GeodesicLineExact. **********************************************************************/ ///@{ /** * Set up to compute several points on a single 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 NETGeographicLib::Mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * \e lat1 should be in the range [−90°, 90°]. * * The GeodesicExact::mask values are * - \e caps |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2; this is * added automatically; * - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2; * - \e caps |= NETGeographicLib::Mask::AZIMUTH for the azimuth \e azi2; this is * added automatically; * - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12; * - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e m12; * - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e M12 * and \e M21; * - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12; * - \e caps |= NETGeographicLib::Mask::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; * - \e caps |= GeodesicExact::ALL for all of the above. * . * The default value of \e caps is GeodesicExact::ALL which turns on all * the capabilities. * * If the point is at a pole, the azimuth is defined by keeping \e lon1 * fixed, writing \e lat1 = ±(90 − ε), and taking the * limit ε → 0+. **********************************************************************/ GeodesicLineExact^ Line(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps ); /** * Define a GeodesicLineExact in terms of the inverse geodesic problem. * * @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] caps bitor'ed combination of GeodesicExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * This function sets point 3 of the GeodesicLineExact to correspond to * point 2 of the inverse geodesic problem. * * \e lat1 and \e lat2 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLineExact^ InverseLine(double lat1, double lon1, double lat2, double lon2, NETGeographicLib::Mask caps ); /** * Define a GeodesicLineExact in terms of the direct geodesic problem * specified 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 * negative. * @param[in] caps bitor'ed combination of GeodesicExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * This function sets point 3 of the GeodesicLineExact to correspond to * point 2 of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLineExact^ DirectLine(double lat1, double lon1, double azi1, double s12, NETGeographicLib::Mask caps); /** * Define a GeodesicLineExact in terms of the direct geodesic problem * specified 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 negative. * @param[in] caps bitor'ed combination of GeodesicExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * This function sets point 3 of the GeodesicLineExact to correspond to * point 2 of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLineExact^ ArcDirectLine(double lat1, double lon1, double azi1, double a12, NETGeographicLib::Mask caps); /** * Define a GeodesicLineExact in terms of the direct geodesic problem * specified in terms of either distance or 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] arcmode boolean flag determining the meaning of the \e * s12_a12. * @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 negative. * @param[in] caps bitor'ed combination of GeodesicExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * This function sets point 3 of the GeodesicLineExact to correspond to * point 2 of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLineExact^ GenDirectLine(double lat1, double lon1, double azi1, bool arcmode, double s12_a12, NETGeographicLib::Mask caps); ///@} /** \name Inspector functions. **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ property double Flattening { double get(); } /** * @return total area of ellipsoid in meters2. The area of a * polygon encircling a pole can be found by adding * GeodesicExact::EllipsoidArea()/2 to the sum of \e S12 for each side of * the polygon. **********************************************************************/ property double EllipsoidArea { double get(); } ///@} /** * @return A pointer to the unmanaged GeographicLib::GeodesicExact. * * This function is for internal use only. **********************************************************************/ System::IntPtr^ GetUnmanaged(); }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/GeodesicLine.cpp0000644000771000077100000003434314064202371023425 0ustar ckarneyckarney/** * \file NETGeographicLib/GeodesicLine.cpp * \brief Implementation for NETGeographicLib::GeodesicLine class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/GeodesicLine.hpp" #include "Geodesic.h" #include "GeodesicLine.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeodesicLine"; //***************************************************************************** GeodesicLine::!GeodesicLine(void) { if ( m_pGeodesicLine != NULL ) { delete m_pGeodesicLine; m_pGeodesicLine = NULL; } } //***************************************************************************** GeodesicLine::GeodesicLine( Geodesic^ g, double lat1, double lon1, double azi1, NETGeographicLib::Mask caps ) { try { const GeographicLib::Geodesic* pGeodesic = reinterpret_cast( g->GetUnmanaged()->ToPointer() ); m_pGeodesicLine = new GeographicLib::GeodesicLine( *pGeodesic, lat1, lon1, azi1, static_cast(caps) ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** GeodesicLine::GeodesicLine(const GeographicLib::GeodesicLine& gl) { try { m_pGeodesicLine = new GeographicLib::GeodesicLine(gl); } catch (std::bad_alloc) { throw gcnew GeographicErr(BADALLOC); } } //***************************************************************************** GeodesicLine::GeodesicLine(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps) { try { m_pGeodesicLine = new GeographicLib::GeodesicLine( GeographicLib::Geodesic::WGS84(), lat1, lon1, azi1, static_cast(caps) ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** double GeodesicLine::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, lm12, lM12, lM21, lS12; double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2, lm12, lM12, lM21, lS12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** double GeodesicLine::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double llat2, llon2; double out = m_pGeodesicLine->Position( s12, llat2, llon2); lat2 = llat2; lon2 = llon2; return out; } //***************************************************************************** double GeodesicLine::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2) { double llat2, llon2, lazi2; double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; return out; } //***************************************************************************** double GeodesicLine::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12) { double llat2, llon2, lazi2, lm12; double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2, lm12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; return out; } //***************************************************************************** double GeodesicLine::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, lM12, lM21; double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** double GeodesicLine::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, lm12, lM12, lM21; double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2, lm12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** void GeodesicLine::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12; m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; } //***************************************************************************** void GeodesicLine::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double llat2, llon2; m_pGeodesicLine->ArcPosition( a12, llat2, llon2 ); lat2 = llat2; lon2 = llon2; } //***************************************************************************** void GeodesicLine::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2) { double llat2, llon2, lazi2; m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; } //***************************************************************************** void GeodesicLine::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12) { double llat2, llon2, lazi2, ls12; m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2, ls12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; } //***************************************************************************** void GeodesicLine::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12) { double llat2, llon2, lazi2, ls12, lm12; m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2, ls12, lm12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; } //***************************************************************************** void GeodesicLine::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, ls12, lM12, lM21; m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2, ls12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; M12 = lM12; M21 = lM21; } //***************************************************************************** void GeodesicLine::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21; m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2, ls12, lm12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; } //***************************************************************************** double GeodesicLine::GenPosition(bool arcmode, double s12_a12, GeodesicLine::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12; double out = m_pGeodesicLine->GenPosition( arcmode, s12_a12, static_cast(outmask), llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** double GeodesicLine::Latitude::get() { return m_pGeodesicLine->Latitude(); } //***************************************************************************** double GeodesicLine::Longitude::get() { return m_pGeodesicLine->Longitude(); } //***************************************************************************** double GeodesicLine::Azimuth::get() { return m_pGeodesicLine->Azimuth(); } //***************************************************************************** double GeodesicLine::EquatorialAzimuth::get() { return m_pGeodesicLine->EquatorialAzimuth(); } //***************************************************************************** double GeodesicLine::EquatorialArc::get() { return m_pGeodesicLine->EquatorialArc(); } //***************************************************************************** double GeodesicLine::EquatorialRadius::get() { return m_pGeodesicLine->EquatorialRadius(); } //***************************************************************************** double GeodesicLine::Flattening::get() { return m_pGeodesicLine->Flattening(); } //***************************************************************************** double GeodesicLine::Distance::get() { return m_pGeodesicLine->Distance(); } //***************************************************************************** double GeodesicLine::Arc::get() { return m_pGeodesicLine->Arc(); } //***************************************************************************** NETGeographicLib::Mask GeodesicLine::Capabilities() { return static_cast(m_pGeodesicLine->Capabilities()); } //***************************************************************************** bool GeodesicLine::Capabilities(GeodesicLine::mask testcaps) { return m_pGeodesicLine->Capabilities( static_cast(testcaps) ); } //***************************************************************************** void GeodesicLine::SetDistance(double s13) { m_pGeodesicLine->SetDistance(s13); } //***************************************************************************** void GeodesicLine::SetArc(double a13) { m_pGeodesicLine->SetArc(a13); } //***************************************************************************** void GeodesicLine::GenSetDistance(bool arcmode, double s13_a13) { m_pGeodesicLine->GenSetDistance(arcmode, s13_a13); } //***************************************************************************** void GeodesicLine::AzimuthSinCos(double% sazi1, double% cazi1) { double x1, x2; m_pGeodesicLine->Azimuth(x1, x2); sazi1 = x1; cazi1 = x2; } //***************************************************************************** void GeodesicLine::EquatorialAzimuthSinCos(double% sazi0, double% cazi0) { double x1, x2; m_pGeodesicLine->EquatorialAzimuth(x1, x2); sazi0 = x1; cazi0 = x2; } //***************************************************************************** double GeodesicLine::GenDistance(bool arcmode) { return m_pGeodesicLine->GenDistance(arcmode); } GeographicLib-1.52/dotnet/NETGeographicLib/GeodesicLine.h0000644000771000077100000007572114064202371023077 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/GeodesicLine.h * \brief Header for NETGeographicLib::GeodesicLine class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "NETGeographicLib.h" namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::GeodesicLine. * * This class allows .NET applications to access GeographicLib::GeodesicLine. * * 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 used by this class are based on series expansions * using the flattening \e f as a small parameter. These are only accurate * for |f| < 0.02; however reasonably accurate results will be * obtained for |f| < 0.2. For very eccentric ellipsoids, use * GeodesicLineExact instead. * * The algorithms are described in * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * geod-addenda.html. * . * For more information on geodesics see \ref geodesic. * * C# Example: * \include example-GeodesicLine.cs * Managed C++ Example: * \include example-GeodesicLine.cpp * Visual Basic Example: * \include example-GeodesicLine.vb * * INTERFACE DIFFERENCES:
* A constructor has been provided which assumes WGS84 parameters. * * The following functions are implemented as properties: * Latitude, Longitude, Azimuth, EquatorialAzimuth, EquatorialArc, * EquatorialRadius, Distance, Arc, and Flattening. * * The constructors, Capabilities, and GenPosition functions accept the * "capabilities mask" as a NETGeographicLib::Mask rather than an * unsigned. The Capabilities function returns a NETGeographicLib::Mask * rather than an unsigned. * * The overloaded Azimuth and EquatorialAzimuth functions that return * the sin and cosine terms have been renamed AzimuthSinCos and * EquatorialAzimuthSinCos, repectively. **********************************************************************/ public ref class GeodesicLine { private: // pointer to the unmanaged GeographicLib::GeodesicLine. GeographicLib::GeodesicLine* m_pGeodesicLine; // The finalizer frees the unmanaged memory when this object is destroyed. !GeodesicLine(void); 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 class 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 | unsigned(captype::CAP_NONE), /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8 | unsigned(captype::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 | unsigned(captype::CAP_NONE), /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10 | unsigned(captype::CAP_C1), /** * Allow distance \e s12 to be used as input in the direct geodesic * problem. * @hideinitializer **********************************************************************/ DISTANCE_IN = 1U<<11 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C1p), /** * Calculate reduced length \e m12. * @hideinitializer **********************************************************************/ REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C2), /** * Calculate geodesic scales \e M12 and \e M21. * @hideinitializer **********************************************************************/ GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C2), /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14 | unsigned(captype::CAP_C4), /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, /** * All capabilities, calculate everything. (LONG_UNROLL is not * included in this mask.) * @hideinitializer **********************************************************************/ ALL = unsigned(captype::OUT_ALL)| unsigned(captype::CAP_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 NETGeographicLib::Mask values * specifying the capabilities the GeodesicLine object should possess, * i.e., which quantities can be returned in calls to * GeodesicLine::Position. * * \e lat1 should be in the range [−90°, 90°]. * * The NETGeographicLib::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; * - \e caps |= GeodesicLine::ALL for all of the above. * . * The default value of \e caps is GeodesicLine::ALL. * * If the point is at a pole, the azimuth is defined by keeping \e lon1 * fixed, writing \e lat1 = ±(90° − ε), and taking * the limit ε → 0+. **********************************************************************/ GeodesicLine( Geodesic^ g, double lat1, double lon1, double azi1, NETGeographicLib::Mask caps ); /** * A constructor which assumes the WGS84 ellipsoid. **********************************************************************/ GeodesicLine(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps); /** * A constructoe that accepts a reference to an unmanages GeodesicLin. * FOR INTERNAL USE ONLY **********************************************************************/ GeodesicLine(const GeographicLib::GeodesicLine& gl); ///@} /** * The destructor calls the finalizer. **********************************************************************/ ~GeodesicLine() { this->!GeodesicLine(); } /** \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 * negative. * @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. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for GeodesicLine::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * See the documentation for GeodesicLine::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for GeodesicLine::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for GeodesicLine::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for GeodesicLine::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \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 negative. * @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 |= * NETGeographicLib::Mask::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 |= * NETGeographicLib::Mask::DISTANCE. * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLine object was constructed with \e caps |= * NETGeographicLib::Mask::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLine object was constructed * with \e caps |= NETGeographicLib::Mask::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLine object was constructed * with \e caps |= NETGeographicLib::Mask::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLine object was constructed with \e caps |= * NETGeographicLib::Mask::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(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12); /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for GeodesicLine::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \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 negative. * @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; * - \e outmask |= GeodesicLine::ALL for all of the above; * - \e outmask |= GeodesicLine::LONG_UNROLL to unroll \e lon2 instead of * wrapping it into 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. Note, however, that the arc length is always computed and * returned as the function value. * * With the LONG_UNROLL bit set, the quantity \e lon2 − \e lon1 * indicates how many times and in what sense the geodesic encircles * the ellipsoid. **********************************************************************/ double GenPosition(bool arcmode, double s12_a12, GeodesicLine::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); ///@} /** \name Setting point 3 **********************************************************************/ ///@{ /** * Specify position of point 3 in terms of distance. * * @param[in] s13 the distance from point 1 to point 3 (meters); it * can be negative. * * This is only useful if the GeodesicLine object has been constructed * with \e caps |= GeodesicLine::DISTANCE_IN. **********************************************************************/ void SetDistance(double s13); /** * Specify position of point 3 in terms of arc length. * * @param[in] a13 the arc length from point 1 to point 3 (degrees); it * can be negative. * * The distance \e s13 is only set if the GeodesicLine object has been * constructed with \e caps |= GeodesicLine::DISTANCE. **********************************************************************/ void SetArc(double a13); /** * Specify position of point 3 in terms of either distance or arc length. * * @param[in] arcmode boolean flag determining the meaning of the second * parameter; if \e arcmode is false, then the GeodesicLine object must * have been constructed with \e caps |= GeodesicLine::DISTANCE_IN. * @param[in] s13_a13 if \e arcmode is false, this is the distance from * point 1 to point 3 (meters); otherwise it is the arc length from * point 1 to point 3 (degrees); it can be negative. **********************************************************************/ void GenSetDistance(bool arcmode, double s13_a13); ///@} /** \name Trigonometric accessor functions **********************************************************************/ ///@{ /** * The sine and cosine of \e azi1. * * @param[out] sazi1 the sine of \e azi1. * @param[out] cazi1 the cosine of \e azi1. **********************************************************************/ void AzimuthSinCos([System::Runtime::InteropServices::Out] double% sazi1, [System::Runtime::InteropServices::Out] double% cazi1); /** * The sine and cosine of \e azi0. * * @param[out] sazi0 the sine of \e azi0. * @param[out] cazi0 the cosine of \e azi0. **********************************************************************/ void EquatorialAzimuthSinCos( [System::Runtime::InteropServices::Out] double% sazi0, [System::Runtime::InteropServices::Out] double% cazi0); /** * The distance or arc length to point 3. * * @param[in] arcmode boolean flag determining the meaning of returned * value. * @return \e s13 if \e arcmode is false; \e a13 if \e arcmode is true. **********************************************************************/ double GenDistance(bool arcmode); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e lat1 the latitude of point 1 (degrees). **********************************************************************/ property double Latitude { double get(); } /** * @return \e lon1 the longitude of point 1 (degrees). **********************************************************************/ property double Longitude { double get(); } /** * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1. **********************************************************************/ property double Azimuth { double get(); } /** * @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses * the equator in a northward direction. **********************************************************************/ property double EquatorialAzimuth { double get(); } /** * @return \e a1 the arc length (degrees) between the northward equatorial * crossing and point 1. **********************************************************************/ property double EquatorialArc { double get(); } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ property double Flattening { double get(); } /** * @return \e s13, the distance to point 3 (meters). **********************************************************************/ property double Distance { double get(); } /** * @return \e a13, the arc length to point 3 (degrees). **********************************************************************/ property double Arc { double get(); } /** * @return \e caps the computational capabilities that this object was * constructed with. LATITUDE and AZIMUTH are always included. **********************************************************************/ NETGeographicLib::Mask Capabilities(); /** * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values. * @return true if the GeodesicLine object has all these capabilities. **********************************************************************/ bool Capabilities(GeodesicLine::mask testcaps); ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/GeodesicLineExact.cpp0000644000771000077100000003511014064202371024403 0ustar ckarneyckarney/** * \file NETGeographicLib/GeodesicLineExact.cpp * \brief Implementation for NETGeographicLib::GeodesicLineExact class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/GeodesicLineExact.hpp" #include "GeodesicLineExact.h" #include "GeodesicExact.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeodesicLineExact"; //***************************************************************************** GeodesicLineExact::!GeodesicLineExact(void) { if ( m_pGeodesicLineExact != NULL ) { delete m_pGeodesicLineExact; m_pGeodesicLineExact = NULL; } } //***************************************************************************** GeodesicLineExact::GeodesicLineExact(GeodesicExact^ g, double lat1, double lon1, double azi1, NETGeographicLib::Mask caps ) { try { const GeographicLib::GeodesicExact* pGeodesicExact= reinterpret_cast( g->GetUnmanaged()->ToPointer() ); m_pGeodesicLineExact = new GeographicLib::GeodesicLineExact( *pGeodesicExact, lat1, lon1, azi1, static_cast(caps) ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** GeodesicLineExact::GeodesicLineExact( const GeographicLib::GeodesicLineExact& gle) { try { m_pGeodesicLineExact = new GeographicLib::GeodesicLineExact(gle); } catch (std::bad_alloc) { throw gcnew GeographicErr(BADALLOC); } } //***************************************************************************** GeodesicLineExact::GeodesicLineExact(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps) { try { m_pGeodesicLineExact = new GeographicLib::GeodesicLineExact( GeographicLib::GeodesicExact::WGS84(), lat1, lon1, azi1, static_cast(caps) ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** double GeodesicLineExact::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, lm12, lM12, lM21, lS12; double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2, lm12, lM12, lM21, lS12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** double GeodesicLineExact::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double llat2, llon2; double out = m_pGeodesicLineExact->Position( s12, llat2, llon2); lat2 = llat2; lon2 = llon2; return out; } //***************************************************************************** double GeodesicLineExact::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2) { double llat2, llon2, lazi2; double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2); lat2 = llat2; lon2 = llon2; azi2 = lazi2; return out; } //***************************************************************************** double GeodesicLineExact::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12) { double llat2, llon2, lazi2, lm12; double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2, lm12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; return out; } //***************************************************************************** double GeodesicLineExact::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, lM12, lM21; double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** double GeodesicLineExact::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, lm12, lM12, lM21; double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2, lm12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; m12 = lm12; M12 = lM12; M21 = lM21; return out; } //***************************************************************************** void GeodesicLineExact::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12; m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; } //***************************************************************************** void GeodesicLineExact::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double llat2, llon2; m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2 ); lat2 = llat2; lon2 = llon2; } //***************************************************************************** void GeodesicLineExact::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2) { double llat2, llon2, lazi2; m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; } //***************************************************************************** void GeodesicLineExact::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12) { double llat2, llon2, lazi2, ls12; m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; } //***************************************************************************** void GeodesicLineExact::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12) { double llat2, llon2, lazi2, ls12, lm12; m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12, lm12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; } //***************************************************************************** void GeodesicLineExact::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, ls12, lM12, lM21; m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; M12 = lM12; M21 = lM21; } //***************************************************************************** void GeodesicLineExact::ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21; m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12, lm12, lM12, lM21 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; } //***************************************************************************** double GeodesicLineExact::GenPosition(bool arcmode, double s12_a12, GeodesicLineExact::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12) { double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12; double out = m_pGeodesicLineExact->GenPosition( arcmode, s12_a12, static_cast(outmask), llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 ); lat2 = llat2; lon2 = llon2; azi2 = lazi2; s12 = ls12; m12 = lm12; M12 = lM12; M21 = lM21; S12 = lS12; return out; } //***************************************************************************** double GeodesicLineExact::Latitude::get() { return m_pGeodesicLineExact->Latitude(); } //***************************************************************************** double GeodesicLineExact::Longitude::get() { return m_pGeodesicLineExact->Longitude(); } //***************************************************************************** double GeodesicLineExact::Azimuth::get() { return m_pGeodesicLineExact->Azimuth(); } //***************************************************************************** double GeodesicLineExact::EquatorialAzimuth::get() { return m_pGeodesicLineExact->EquatorialAzimuth(); } //***************************************************************************** double GeodesicLineExact::EquatorialArc::get() { return m_pGeodesicLineExact->EquatorialArc(); } //***************************************************************************** double GeodesicLineExact::EquatorialRadius::get() { return m_pGeodesicLineExact->EquatorialRadius(); } //***************************************************************************** double GeodesicLineExact::Flattening::get() { return m_pGeodesicLineExact->Flattening(); } //***************************************************************************** double GeodesicLineExact::Distance::get() { return m_pGeodesicLineExact->Distance(); } //***************************************************************************** double GeodesicLineExact::Arc::get() { return m_pGeodesicLineExact->Arc(); } //***************************************************************************** NETGeographicLib::Mask GeodesicLineExact::Capabilities() { return static_cast(m_pGeodesicLineExact->Capabilities()); } //***************************************************************************** bool GeodesicLineExact::Capabilities(NETGeographicLib::Mask testcaps) { return m_pGeodesicLineExact->Capabilities(static_cast(testcaps)); } //***************************************************************************** void GeodesicLineExact::SetDistance(double s13) { m_pGeodesicLineExact->SetDistance(s13); } //***************************************************************************** void GeodesicLineExact::SetArc(double a13) { m_pGeodesicLineExact->SetArc(a13); } //***************************************************************************** void GeodesicLineExact::GenSetDistance(bool arcmode, double s13_a13) { m_pGeodesicLineExact->GenSetDistance(arcmode, s13_a13); } //***************************************************************************** void GeodesicLineExact::AzimuthSinCos(double% sazi1, double% cazi1) { double x1, x2; m_pGeodesicLineExact->Azimuth(x1, x2); sazi1 = x1; cazi1 = x2; } //***************************************************************************** void GeodesicLineExact::EquatorialAzimuthSinCos(double% sazi0, double% cazi0) { double x1, x2; m_pGeodesicLineExact->EquatorialAzimuth(x1, x2); sazi0 = x1; cazi0 = x2; } //***************************************************************************** double GeodesicLineExact::GenDistance(bool arcmode) { return m_pGeodesicLineExact->GenDistance(arcmode); } GeographicLib-1.52/dotnet/NETGeographicLib/GeodesicLineExact.h0000644000771000077100000007543014064202371024061 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/GeodesicLineExact.h * \brief Header for NETGeographicLib::GeodesicLineExact class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "NETGeographicLib.h" namespace NETGeographicLib { ref class GeodesicExact; /** * \brief .NET wrapper for GeographicLib::GeodesicLineExact. * * This class allows .NET applications to access GeographicLib::GeodesicLineExact. * * GeodesicLineExact facilitates the determination of a series of points on a * single geodesic. This is a companion to the GeodesicExact class. For * additional information on this class see the documentation on the * GeodesicLine class. * * C# Example: * \include example-GeodesicLineExact.cs * Managed C++ Example: * \include example-GeodesicLineExact.cpp * Visual Basic Example: * \include example-GeodesicLineExact.vb * * INTERFACE DIFFERENCES:
* A constructor has been provided that assumes WGS84 parameters. * * The following functions are implemented as properties: * Latitude, Longitude, Azimuth, EquatorialAzimuth, EquatorialArc, * EquatorialRadius, Distance, Arc, and Flattening. * * The constructors, GenPosition, and Capabilities functions accept the * "capabilities mask" as a NETGeographicLib::Mask rather than an * unsigned. The Capabilities function returns a NETGeographicLib::Mask * rather than an unsigned. * * The overloaded Azimuth and EquatorialAzimuth functions that return * the sin and cosine terms have been renamed AzimuthSinCos and * EquatorialAzimuthSinCos, repectively. **********************************************************************/ public ref class GeodesicLineExact { private: enum class captype { CAP_NONE = 0U, CAP_E = 1U<<0, // Skip 1U<<1 for compatibility with Geodesic (not required) CAP_D = 1U<<2, CAP_H = 1U<<3, CAP_C4 = 1U<<4, CAP_ALL = 0x1FU, CAP_MASK = CAP_ALL, OUT_ALL = 0x7F80U, OUT_MASK = 0xFF80U, // Includes LONG_UNROLL }; // a pointer to the GeographicLib::GeodesicLineExact. GeographicLib::GeodesicLineExact* m_pGeodesicLineExact; // the finalizer frees the unmanaged memory when the object is destroyed. !GeodesicLineExact(void); public: /** * Bit masks for what calculations to do. These masks do double duty. * They signify to the GeodesicLineExact::GeodesicLineExact constructor and * to GeodesicExact::Line what capabilities should be included in the * GeodesicLineExact object. They also specify which results to return in * the general routines GeodesicExact::GenDirect and * GeodesicExact::GenInverse routines. GeodesicLineExact::mask is a * duplication of this enum. **********************************************************************/ enum class mask { /** * No capabilities, no output. * @hideinitializer **********************************************************************/ NONE = 0U, /** * Calculate latitude \e lat2. (It's not necessary to include this as a * capability to GeodesicLineExact because this is included by default.) * @hideinitializer **********************************************************************/ LATITUDE = 1U<<7 | unsigned(captype::CAP_NONE), /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8 | unsigned(captype::CAP_H), /** * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to * include this as a capability to GeodesicLineExact because this is * included by default.) * @hideinitializer **********************************************************************/ AZIMUTH = 1U<<9 | unsigned(captype::CAP_NONE), /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10 | unsigned(captype::CAP_E), /** * Allow distance \e s12 to be used as input in the direct geodesic * problem. * @hideinitializer **********************************************************************/ DISTANCE_IN = 1U<<11 | unsigned(captype::CAP_E), /** * Calculate reduced length \e m12. * @hideinitializer **********************************************************************/ REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_D), /** * Calculate geodesic scales \e M12 and \e M21. * @hideinitializer **********************************************************************/ GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_D), /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14 | unsigned(captype::CAP_C4), /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, /** * All capabilities, calculate everything. (LONG_UNROLL is not * included in this mask.) * @hideinitializer **********************************************************************/ ALL = unsigned(captype::OUT_ALL)| unsigned(captype::CAP_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 GeodesicExact object used to compute the necessary * information about the GeodesicLineExact. * @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 NETGeographicLib::Mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLine::Position. * * \e lat1 should be in the range [−90°, 90°]. * * The NETGeographicLib::Mask values are * - \e caps |= GeodesicLineExact::LATITUDE for the latitude \e lat2; this * is added automatically; * - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2; * - \e caps |= NETGeographicLib::Mask::AZIMUTH for the latitude \e azi2; this is * added automatically; * - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12; * - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e m12; * - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e * M12 and \e M21; * - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12; * - \e caps |= NETGeographicLib::Mask::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; * - \e caps |= NETGeographicLib::Mask::ALL for all of the above. * . * * If the point is at a pole, the azimuth is defined by keeping \e lon1 * fixed, writing \e lat1 = ±(90° − ε), and taking * the limit ε → 0+. **********************************************************************/ GeodesicLineExact(GeodesicExact^ g, double lat1, double lon1, double azi1, NETGeographicLib::Mask caps ); /** * A default constructor which assumes the WGS84 ellipsoid. See * constructor comments for details. **********************************************************************/ GeodesicLineExact(double lat1, double lon1, double azi1, NETGeographicLib::Mask caps); /** * This constructor accepts a reference to an unmanaged * GeodesicLineExact. * FOR INTERNAL USE ONLY. **********************************************************************/ GeodesicLineExact(const GeographicLib::GeodesicLineExact& gle); ///@} /** * The destructor calls the finalizer **********************************************************************/ ~GeodesicLineExact() { this->!GeodesicLineExact(); } /** \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 * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::LONGITUDE. * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::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 GeodesicLineExact object \e must have been constructed with \e caps * |= GeodesicLineExact::DISTANCE_IN; otherwise Math::NaN() is returned and * no parameters are set. Requesting a value which the GeodesicLineExact * object is not capable of computing is not an error; the corresponding * argument will not be altered. * * The following functions are overloaded versions of * GeodesicLineExact::Position which omit some of the output parameters. * Note, however, that the arc length is always computed and returned as * the function value. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ double Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \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 * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::LONGITUDE. * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] s12 distance between point 1 and point 2 (meters); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::DISTANCE. * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::AREA. * * The values of \e lon2 and \e azi2 returned are in the range * [−180°, 180°). * * Requesting a value which the GeodesicLineExact object is not capable of * computing is not an error; the corresponding argument will not be * altered. * * The following functions are overloaded versions of * GeodesicLineExact::ArcPosition which omit some of the output parameters. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2); /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12); /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12); /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21); ///@} /** \name The general position function. **********************************************************************/ ///@{ /** * The general position function. GeodesicLineExact::Position and * GeodesicLineExact::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 GeodesicLineExact object must * have been constructed with \e caps |= GeodesicLineExact::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 GeodesicLineExact::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 * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::LONGITUDE. * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] s12 distance between point 1 and point 2 (meters); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::DISTANCE. * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::AREA. * @return \e a12 arc length of between point 1 and point 2 (degrees). * * The GeodesicLineExact::mask values possible for \e outmask are * - \e outmask |= GeodesicLineExact::LATITUDE for the latitude \e lat2; * - \e outmask |= GeodesicLineExact::LONGITUDE for the latitude \e lon2; * - \e outmask |= GeodesicLineExact::AZIMUTH for the latitude \e azi2; * - \e outmask |= GeodesicLineExact::DISTANCE for the distance \e s12; * - \e outmask |= GeodesicLineExact::REDUCEDLENGTH for the reduced length * \e m12; * - \e outmask |= GeodesicLineExact::GEODESICSCALE for the geodesic scales * \e M12 and \e M21; * - \e outmask |= GeodesicLineExact::AREA for the area \e S12; * - \e outmask |= GeodesicLineExact::ALL for all of the above; * - \e outmask |= GeodesicLineExact::LONG_UNROLL to unroll \e lon2 instead * of wrapping it into the range [−180°, 180°). * . * Requesting a value which the GeodesicLineExact 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. * * With the LONG_UNROLL bit set, the quantity \e lon2 − \e lon1 * indicates how many times and in what sense the geodesic encircles * the ellipsoid. **********************************************************************/ double GenPosition(bool arcmode, double s12_a12, GeodesicLineExact::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% azi2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% m12, [System::Runtime::InteropServices::Out] double% M12, [System::Runtime::InteropServices::Out] double% M21, [System::Runtime::InteropServices::Out] double% S12); ///@} /** \name Setting point 3 **********************************************************************/ ///@{ /** * Specify position of point 3 in terms of distance. * * @param[in] s13 the distance from point 1 to point 3 (meters); it * can be negative. * * This is only useful if the GeodesicLineExact object has been constructed * with \e caps |= GeodesicLineExact::DISTANCE_IN. **********************************************************************/ void SetDistance(double s13); /** * Specify position of point 3 in terms of arc length. * * @param[in] a13 the arc length from point 1 to point 3 (degrees); it * can be negative. * * The distance \e s13 is only set if the GeodesicLineExact object has been * constructed with \e caps |= GeodesicLineExact::DISTANCE. **********************************************************************/ void SetArc(double a13); /** * Specify position of point 3 in terms of either distance or arc length. * * @param[in] arcmode boolean flag determining the meaning of the second * parameter; if \e arcmode is false, then the GeodesicLineExact object * must have been constructed with \e caps |= * GeodesicLineExact::DISTANCE_IN. * @param[in] s13_a13 if \e arcmode is false, this is the distance from * point 1 to point 3 (meters); otherwise it is the arc length from * point 1 to point 3 (degrees); it can be negative. **********************************************************************/ void GenSetDistance(bool arcmode, double s13_a13); /** * The distance or arc length to point 3. * * @param[in] arcmode boolean flag determining the meaning of returned * value. * @return \e s13 if \e arcmode is false; \e a13 if \e arcmode is true. **********************************************************************/ double GenDistance(bool arcmode); ///@} /** \name Trigonometric accessor functions **********************************************************************/ ///@{ /** * The sine and cosine of \e azi1. * * @param[out] sazi1 the sine of \e azi1. * @param[out] cazi1 the cosine of \e azi1. **********************************************************************/ void AzimuthSinCos( [System::Runtime::InteropServices::Out] double% sazi1, [System::Runtime::InteropServices::Out] double% cazi1); /** * The sine and cosine of \e azi0. * * @param[out] sazi0 the sine of \e azi0. * @param[out] cazi0 the cosine of \e azi0. **********************************************************************/ void EquatorialAzimuthSinCos( [System::Runtime::InteropServices::Out] double% sazi0, [System::Runtime::InteropServices::Out] double% cazi0); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e lat1 the latitude of point 1 (degrees). **********************************************************************/ property double Latitude { double get(); } /** * @return \e lon1 the longitude of point 1 (degrees). **********************************************************************/ property double Longitude { double get(); } /** * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1. **********************************************************************/ property double Azimuth { double get(); } /** * @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses * the equator in a northward direction. **********************************************************************/ property double EquatorialAzimuth { double get(); } /** * @return \e a1 the arc length (degrees) between the northward equatorial * crossing and point 1. **********************************************************************/ property double EquatorialArc { double get(); } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the GeodesicExact object used in the * constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the GeodesicExact object used in the constructor. **********************************************************************/ property double Flattening { double get(); } /** * @return \e s13, the distance to point 3 (meters). **********************************************************************/ property double Distance { double get(); } /** * @return \e a13, the arc length to point 3 (degrees). **********************************************************************/ property double Arc { double get(); } /** * @return \e caps the computational capabilities that this object was * constructed with. LATITUDE and AZIMUTH are always included. **********************************************************************/ NETGeographicLib::Mask Capabilities(); /** * @param[in] testcaps a set of bitor'ed GeodesicLineExact::mask values. * @return true if the GeodesicLineExact object has all these capabilities. **********************************************************************/ bool Capabilities(NETGeographicLib::Mask testcaps); ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/Geohash.cpp0000644000771000077100000000511014064202371022437 0ustar ckarneyckarney/** * \file NETGeographicLib/Geohash.cpp * \brief Implementation for NETGeographicLib::Geohash class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/Geohash.hpp" #include "Geohash.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** void Geohash::Forward(double lat, double lon, int len, System::String^% geohash) { try { std::string l; GeographicLib::Geohash::Forward( lat, lon, len, l ); geohash = gcnew System::String( l.c_str() ); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } //***************************************************************************** void Geohash::Reverse(System::String^ geohash, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] int% len, bool centerp ) { try { double llat, llon; int llen; GeographicLib::Geohash::Reverse( StringConvert::ManagedToUnmanaged( geohash ), llat, llon, llen, centerp ); lat = llat; lon = llon; len = llen; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** double Geohash::LatitudeResolution(int len) { return GeographicLib::Geohash::LatitudeResolution( len ); } //***************************************************************************** double Geohash::LongitudeResolution(int len) { return GeographicLib::Geohash::LongitudeResolution( len ); } //***************************************************************************** int Geohash::GeohashLength(double res) { return GeographicLib::Geohash::GeohashLength( res ); } //***************************************************************************** int Geohash::GeohashLength(double latres, double lonres) { return GeographicLib::Geohash::GeohashLength( latres, lonres ); } //***************************************************************************** int Geohash::DecimalPrecision(int len) { return GeographicLib::Geohash::DecimalPrecision( len ); } GeographicLib-1.52/dotnet/NETGeographicLib/Geohash.h0000644000771000077100000001310414064202371022106 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/Geohash.h * \brief Header for NETGeographicLib::Geohash class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::Geohash. * * Geohashes are described in * - https://en.wikipedia.org/wiki/Geohash * - http://geohash.org/ (this link is broken as of 2012-12-11) * . * They provide a compact string representation of a particular geographic * location (expressed as latitude and longitude), with the property that if * trailing characters are dropped from the string the geographic location * remains nearby. * * C# Example: * \include example-Geohash.cs * Managed C++ Example: * \include example-Geohash.cpp * Visual Basic Example: * \include example-Geohash.vb **********************************************************************/ public ref class Geohash { private: // hide the constructor since all members of this class are static. Geohash() {} public: /** * Convert from geographic coordinates to a geohash. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] len the length of the resulting geohash. * @param[out] geohash the geohash. * @exception GeographicErr if \e lat is not in [−90°, * 90°]. * @exception std::bad_alloc if memory for \e geohash can't be allocated. * * Internally, \e len is first put in the range [0, 18]. * * If \e lat or \e lon is NaN, the returned geohash is "nan". **********************************************************************/ static void Forward(double lat, double lon, int len, [System::Runtime::InteropServices::Out] System::String^% geohash); /** * Convert from a geohash to geographic coordinates. * * @param[in] geohash the geohash. * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] len the length of the geohash. * @param[in] centerp if true (the default) return the center of the * geohash location, otherwise return the south-west corner. * @exception GeographicErr if \e geohash contains illegal characters. * * Only the first 18 characters for \e geohash are considered. The case of * the letters in \e geohash is ignored. * * If the first three characters in \e geohash are "nan", then \e lat and * \e lon are set to NaN. **********************************************************************/ static void Reverse(System::String^ geohash, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] int% len, bool centerp); /** * The latitude resolution of a geohash. * * @param[in] len the length of the geohash. * @return the latitude resolution (degrees). * * Internally, \e len is first put in the range [0, 18]. **********************************************************************/ static double LatitudeResolution(int len); /** * The longitude resolution of a geohash. * * @param[in] len the length of the geohash. * @return the longitude resolution (degrees). * * Internally, \e len is first put in the range [0, 18]. **********************************************************************/ static double LongitudeResolution(int len); /** * The geohash length required to meet a given geographic resolution. * * @param[in] res the minimum of resolution in latitude and longitude * (degrees). * @return geohash length. * * The returned length is in the range [0, 18]. **********************************************************************/ static int GeohashLength(double res); /** * The geohash length required to meet a given geographic resolution. * * @param[in] latres the resolution in latitude (degrees). * @param[in] lonres the resolution in longitude (degrees). * @return geohash length. * * The returned length is in the range [0, 18]. **********************************************************************/ static int GeohashLength(double latres, double lonres); /** * The decimal geographic precision required to match a given geohash * length. This is the number of digits needed after decimal point in a * decimal degrees representation. * * @param[in] len the length of the geohash. * @return the decimal precision (may be negative). * * Internally, \e len is first put in the range [0, 18]. The returned * decimal precision is in the range [−2, 12]. **********************************************************************/ static int DecimalPrecision(int len); }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/Geoid.cpp0000644000771000077100000001500114064202371022110 0ustar ckarneyckarney/** * \file NETGeographicLib/Geoid.cpp * \brief Implementation for NETGeographicLib::Geoid class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/Geoid.hpp" #include "Geoid.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** Geoid::!Geoid(void) { if ( m_pGeoid != NULL ) { delete m_pGeoid; m_pGeoid = NULL; } } //***************************************************************************** Geoid::Geoid(System::String^ name, System::String^ path, bool cubic, bool threadsafe) { if ( name == nullptr ) throw gcnew GeographicErr("name cannot be a null pointer."); if ( path == nullptr ) throw gcnew GeographicErr("path cannot be a null pointer."); try { m_pGeoid = new GeographicLib::Geoid( StringConvert::ManagedToUnmanaged( name ), StringConvert::ManagedToUnmanaged( path ), cubic, threadsafe ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::Geoid" ); } catch ( const GeographicLib::GeographicErr& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void Geoid::CacheArea(double south, double west, double north, double east) { try { m_pGeoid->CacheArea( south, west, north, east ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void Geoid::CacheAll() { try { m_pGeoid->CacheAll(); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void Geoid::CacheClear() { m_pGeoid->CacheClear(); } //***************************************************************************** double Geoid::Height(double lat, double lon) { try { return m_pGeoid->operator()( lat, lon ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** double Geoid::ConvertHeight(double lat, double lon, double h, ConvertFlag d) { try { return m_pGeoid->ConvertHeight( lat, lon, h, static_cast(d) ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** System::String^ Geoid::DefaultGeoidPath() { try { return StringConvert::UnmanagedToManaged( GeographicLib::Geoid::DefaultGeoidPath() ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** System::String^ Geoid::DefaultGeoidName() { try { return StringConvert::UnmanagedToManaged( GeographicLib::Geoid::DefaultGeoidName() ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** System::String^ Geoid::Description::get() { return StringConvert::UnmanagedToManaged(m_pGeoid->Description()); } //***************************************************************************** System::String^ Geoid::DateTime::get() { return StringConvert::UnmanagedToManaged(m_pGeoid->DateTime()); } //***************************************************************************** System::String^ Geoid::GeoidFile::get() { return StringConvert::UnmanagedToManaged(m_pGeoid->GeoidFile()); } //***************************************************************************** System::String^ Geoid::GeoidName::get() { return StringConvert::UnmanagedToManaged(m_pGeoid->GeoidName()); } //***************************************************************************** System::String^ Geoid::GeoidDirectory::get() { return StringConvert::UnmanagedToManaged(m_pGeoid->GeoidDirectory()); } //***************************************************************************** System::String^ Geoid::Interpolation::get() { return StringConvert::UnmanagedToManaged(m_pGeoid->Interpolation()); } //***************************************************************************** double Geoid::MaxError::get() { return m_pGeoid->MaxError(); } //***************************************************************************** double Geoid::RMSError::get() { return m_pGeoid->RMSError(); } //***************************************************************************** double Geoid::Offset::get() { return m_pGeoid->Offset(); } //***************************************************************************** double Geoid::Scale::get() { return m_pGeoid->Scale(); } //***************************************************************************** bool Geoid::ThreadSafe::get() { return m_pGeoid->ThreadSafe(); } //***************************************************************************** bool Geoid::Cache::get() { return m_pGeoid->Cache(); } //***************************************************************************** double Geoid::CacheWest::get() { return m_pGeoid->CacheWest(); } //***************************************************************************** double Geoid::CacheEast::get() { return m_pGeoid->CacheEast(); } //***************************************************************************** double Geoid::CacheNorth::get() { return m_pGeoid->CacheNorth(); } //***************************************************************************** double Geoid::CacheSouth::get() { return m_pGeoid->CacheSouth(); } //***************************************************************************** double Geoid::EquatorialRadius::get() { return m_pGeoid->EquatorialRadius(); } //***************************************************************************** double Geoid::Flattening::get() { return m_pGeoid->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/Geoid.h0000644000771000077100000003734514064202371021574 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/Geoid.h * \brief Header for NETGeographicLib::Geoid class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::Geoid. * * This class allows .NET applications to access GeographicLib::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: * https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm84 * - EGM96: * https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm96 * - EGM2008: * https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_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. * * The geoid height, \e N, can be used to convert a height above the * ellipsoid, \e h, to the corresponding height above the geoid (roughly the * height above mean sea level), \e H, using the relations * *    \e h = \e N + \e H; *   \e H = −\e N + \e h. * * 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. * * 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. * * C# Example: * \include example-Geoid.cs * Managed C++ Example: * \include example-Geoid.cpp * Visual Basic Example: * \include example-Geoid.vb * * INTERFACE DIFFERENCES:
* The () operator has been replaced with Height method. * * The following functions are implemented as properties: * Description, DateTime, GeoidFile, GeoidName, GeoidDirectory, * Interpolation, MaxError, RMSError, Offset, Scale, ThreadSafe, * Cache, CacheWest, CacheEast, CacheNorth, CacheSouth, EquatorialRadius, * and Flattening. **********************************************************************/ public ref class Geoid { private: // a pointer to the unmanaged GeographicLib::Geoid. const GeographicLib::Geoid* m_pGeoid; // the finalizer frees hthe unmanaged memory when the object is destroyed. !Geoid(void); public: /** * Flags indicating conversions between heights above the geoid and heights * above the ellipsoid. **********************************************************************/ enum class 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 * @exception GeographicErr if the data file cannot be found, is * unreadable, or is corrupt. * @exception GeographicErr if \e threadsafe is true but the memory * necessary for caching the data can't be allocated. * * 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(). If the \e * threadsafe parameter is true, the data set is read into memory, the data * file is closed, and single-cell caching is turned off; this results in a * Geoid object which \e is thread safe. **********************************************************************/ Geoid(System::String^ name, System::String^ path, bool cubic, bool threadsafe); /** * The destructor calls the finalizer. **********************************************************************/ ~Geoid() { this->!Geoid(); } /** * 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. * @exception GeographicErr if the memory necessary for caching the data * can't be allocated (in this case, you will have no cache and can try * again with a smaller area). * @exception GeographicErr if there's a problem reading the data. * @exception GeographicErr if this is called on a threadsafe Geoid. * * 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 360° to its value. \e south and \e north should be in * the range [−90°, 90°]. **********************************************************************/ void CacheArea(double south, double west, double north, double east); /** * Cache all the data. * * @exception GeographicErr if the memory necessary for caching the data * can't be allocated (in this case, you will have no cache and can try * again with a smaller area). * @exception GeographicErr if there's a problem reading the data. * @exception GeographicErr if this is called on a threadsafe Geoid. * * 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. **********************************************************************/ void CacheAll(); /** * Clear the cache. This never throws an error. (This does nothing with a * thread safe Geoid.) **********************************************************************/ void CacheClear(); ///@} /** \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). * @exception GeographicErr if there's a problem reading the data; this * never happens if (\e lat, \e lon) is within a successfully cached area. * @return geoid height (meters). * * The latitude should be in [−90°, 90°]. **********************************************************************/ double Height(double lat, double lon); /** * 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. * @exception GeographicErr if there's a problem reading the data; this * never happens if (\e lat, \e lon) is within a successfully cached area. * @return converted height (meters). **********************************************************************/ double ConvertHeight(double lat, double lon, double h, ConvertFlag d); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return geoid description, if available, in the data file; if * absent, return "NONE". **********************************************************************/ property System::String^ Description { System::String^ get(); } /** * @return date of the data file; if absent, return "UNKNOWN". **********************************************************************/ property System::String^ DateTime { System::String^ get(); } /** * @return full file name used to load the geoid data. **********************************************************************/ property System::String^ GeoidFile { System::String^ get(); } /** * @return "name" used to load the geoid data (from the first argument of * the constructor). **********************************************************************/ property System::String^ GeoidName { System::String^ get(); } /** * @return directory used to load the geoid data. **********************************************************************/ property System::String^ GeoidDirectory { System::String^ get(); } /** * @return interpolation method ("cubic" or "bilinear"). **********************************************************************/ property System::String^ Interpolation { System::String^ get(); } /** * @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. **********************************************************************/ property double MaxError { double get(); } /** * @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. **********************************************************************/ property double RMSError { double get(); } /** * @return offset (meters). * * This in used in converting from the pixel values in the data file to * geoid heights. **********************************************************************/ property double Offset { double get(); } /** * @return scale (meters). * * This in used in converting from the pixel values in the data file to * geoid heights. **********************************************************************/ property double Scale { double get(); } /** * @return true if the object is constructed to be thread safe. **********************************************************************/ property bool ThreadSafe { bool get(); } /** * @return true if a data cache is active. **********************************************************************/ property bool Cache { bool get(); } /** * @return west edge of the cached area; the cache includes this edge. **********************************************************************/ property double CacheWest { double get(); } /** * @return east edge of the cached area; the cache excludes this edge. **********************************************************************/ property double CacheEast { double get(); } /** * @return north edge of the cached area; the cache includes this edge. **********************************************************************/ property double CacheNorth { double get(); } /** * @return south edge of the cached area; the cache excludes this edge * unless it's the south pole. **********************************************************************/ property double CacheSouth { double get(); } /** * @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.) **********************************************************************/ property double EquatorialRadius { double get(); } /** * @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.) **********************************************************************/ property double Flattening { double get(); } ///@} /** * @return the default path for geoid data files. * * This is the value of the environment variable * GEOGRAPHICLIB_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:/ProgramData/GeographicLib/geoids on Windows systems). **********************************************************************/ static System::String^ DefaultGeoidPath(); /** * @return the default name for the geoid. * * This is the value of the environment variable * GEOGRAPHICLIB_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 System::String^ DefaultGeoidName(); }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/Georef.cpp0000644000771000077100000000352114064202371022274 0ustar ckarneyckarney/** * \file NETGeographicLib/Georef.cpp * \brief Source for NETGeographicLib::Georef class * * NETGeographicLib is copyright (c) Scott Heiman (2013-2015) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/Georef.hpp" #include "Georef.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** void Georef::Forward(double lat, double lon, int prec, System::String^% georef) { try { std::string l; GeographicLib::Georef::Forward( lat, lon, prec, l ); georef = gcnew System::String( l.c_str() ); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } } //***************************************************************************** void Georef::Reverse( System::String^ georef, double% lat, double% lon, int% prec, bool centerp) { try { double llat, llon; int lprec; GeographicLib::Georef::Reverse( StringConvert::ManagedToUnmanaged( georef ), llat, llon, lprec, centerp ); lat = llat; lon = llon; prec = lprec; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** double Georef::Resolution(int prec) { return GeographicLib::Georef::Resolution(prec); } //***************************************************************************** int Georef::Precision(double res) { return GeographicLib::Georef::Precision(res); } GeographicLib-1.52/dotnet/NETGeographicLib/Georef.h0000644000771000077100000001065214064202371021744 0ustar ckarneyckarney/** * \file NETGeographicLib/Georef.h * \brief Header for NETGeographicLib::Georef class * * NETGeographicLib is copyright (c) Scott Heiman (2013-2015) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::Georef. * * The World Geographic Reference System is described in * - https://en.wikipedia.org/wiki/Georef * - https://web.archive.org/web/20161214054445/http://earth-info.nga.mil/GandG/coordsys/grids/georef.pdf * . * It provides a compact string representation of a geographic area * (expressed as latitude and longitude). The classes GARS and Geohash * implement similar compact representations. * * C# Example: * \include example-Georef.cs * Managed C++ Example: * \include example-Georef.cpp * Visual Basic Example: * \include example-Georef.vb **********************************************************************/ public ref class Georef { private: // hide the constructor since all members of this class are static. Georef() {} public: /** * Convert from geographic coordinates to georef. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] prec the precision of the resulting georef. * @param[out] georef the georef string. * @exception GeographicErr if \e lat is not in [−90°, * 90°] or if memory for \e georef can't be allocated. * * \e prec specifies the precision of \e georef as follows: * - \e prec = −1 (min), 15° * - \e prec = 0, 1° * - \e prec = 1, converted to \e prec = 2 * - \e prec = 2, 1' * - \e prec = 3, 0.1' * - \e prec = 4, 0.01' * - \e prec = 5, 0.001' * - … * - \e prec = 11 (max), 10−9' * * If \e lat or \e lon is NaN, then \e georef is set to "INVALID". **********************************************************************/ static void Forward(double lat, double lon, int prec, [System::Runtime::InteropServices::Out] System::String^% georef); /** * Convert from Georef to geographic coordinates. * * @param[in] georef the Georef. * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] prec the precision of \e georef. * @param[in] centerp if true (the default) return the center * \e georef, otherwise return the south-west corner. * @exception GeographicErr if \e georef is illegal. * * The case of the letters in \e georef is ignored. \e prec is in the * range [−1, 11] and gives the precision of \e georef as follows: * - \e prec = −1 (min), 15° * - \e prec = 0, 1° * - \e prec = 1, not returned * - \e prec = 2, 1' * - \e prec = 3, 0.1' * - \e prec = 4, 0.01' * - \e prec = 5, 0.001' * - … * - \e prec = 11 (max), 10−9' * * If the first 3 characters of \e georef are "INV", then \e lat and \e lon * are set to NaN and \e prec is unchanged. **********************************************************************/ static void Reverse( System::String^ georef, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] int% prec, bool centerp ); /** * The angular resolution of a Georef. * * @param[in] prec the precision of the Georef. * @return the latitude-longitude resolution (degrees). * * Internally, \e prec is first put in the range [−1, 11]. **********************************************************************/ static double Resolution(int prec); /** * The Georef precision required to meet a given geographic resolution. * * @param[in] res the minimum of resolution in latitude and longitude * (degrees). * @return Georef precision. * * The returned length is in the range [0, 11]. **********************************************************************/ static int Precision(double res); }; } GeographicLib-1.52/dotnet/NETGeographicLib/Gnomonic.cpp0000644000771000077100000000756014064202371022645 0ustar ckarneyckarney/** * \file NETGeographicLib/Gnomonic.cpp * \brief Implementation for NETGeographicLib::Gnomonic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/Gnomonic.hpp" #include "Gnomonic.h" #include "Geodesic.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::Gnomonic"; //***************************************************************************** Gnomonic::!Gnomonic(void) { if ( m_pGnomonic != NULL ) { delete m_pGnomonic; m_pGnomonic = NULL; } } //***************************************************************************** Gnomonic::Gnomonic( Geodesic^ earth ) { try { const GeographicLib::Geodesic* pGeodesic = reinterpret_cast( earth->GetUnmanaged()->ToPointer() ); m_pGnomonic = new GeographicLib::Gnomonic( *pGeodesic ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** Gnomonic::Gnomonic() { try { m_pGnomonic = new GeographicLib::Gnomonic( GeographicLib::Geodesic::WGS84() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void Gnomonic::Forward(double lat0, double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk) { double lx, ly, lazi, lrk; m_pGnomonic->Forward( lat0, lon0, lat, lon, lx, ly, lazi, lrk ); x = lx; y = ly; azi = lazi; rk = lrk; } //***************************************************************************** void Gnomonic::Reverse(double lat0, double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk) { double llat, llon, lazi, lrk; m_pGnomonic->Reverse( lat0, lon0, x, y, llat, llon, lazi, lrk ); lat = llat; lon = llon; azi = lazi; rk = lrk; } //***************************************************************************** void Gnomonic::Forward(double lat0, double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y) { double lx, ly; m_pGnomonic->Forward( lat0, lon0, lat, lon, lx, ly ); x = lx; y = ly; } //***************************************************************************** void Gnomonic::Reverse(double lat0, double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon; m_pGnomonic->Reverse( lat0, lon0, x, y, llat, llon ); lat = llat; lon = llon; } //***************************************************************************** double Gnomonic::EquatorialRadius::get() { return m_pGnomonic->EquatorialRadius(); } //***************************************************************************** double Gnomonic::Flattening::get() { return m_pGnomonic->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/Gnomonic.h0000644000771000077100000002572014064202371022310 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/Gnomonic.h * \brief Header for NETGeographicLib::Gnomonic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class Geodesic; /** * \brief .NET wrapper for GeographicLib::Gnomonic. * * This class allows .NET applications to access GeographicLib::Gnomonic. * * %Gnomonic projection centered at an arbitrary position \e C on the * ellipsoid. This projection is derived in Section 8 of * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * geod-addenda.html. * . * 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 ρ = m12/\e M12; finally \e x = ρ sin \e azi1; \e * y = ρ 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, ρ 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 45°, when endpoints are a distance \e r away, and when their * azimuths from the center are ± 45° or ± 135°. * 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. * * C# Example: * \include example-Gnomonic.cs * Managed C++ Example: * \include example-Gnomonic.cpp * Visual Basic Example: * \include example-Gnomonic.vb * * INTERFACE DIFFERENCES:
* A default constructor has been provided that assumes WGS84 parameters. * * The EquatorialRadius and Flattening functions are implemented as properties. **********************************************************************/ public ref class Gnomonic { private: // the pointer to the unmanaged GeographicLib::Gnomonic. const GeographicLib::Gnomonic* m_pGnomonic; // The finalizer frees the unmanaged memory when the object is destroyed. !Gnomonic(void); public: /** * Constructor for Gnomonic. * * @param[in] earth the Geodesic object to use for geodesic calculations. **********************************************************************/ Gnomonic( Geodesic^ earth ); /** * The default constructor assumes a WGS84 ellipsoid.. **********************************************************************/ Gnomonic(); /** * The destructor calls the finalizer **********************************************************************/ ~Gnomonic() { this->!Gnomonic(); } /** * 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°]. * 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(double lat0, double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk); /** * 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°]. \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(double lat0, double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% azi, [System::Runtime::InteropServices::Out] double% rk); /** * Gnomonic::Forward without returning the azimuth and scale. **********************************************************************/ void Forward(double lat0, double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y); /** * Gnomonic::Reverse without returning the azimuth and scale. **********************************************************************/ void Reverse(double lat0, double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); /** \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. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ property double Flattening { double get(); } ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/GravityCircle.cpp0000644000771000077100000001402414064202371023634 0ustar ckarneyckarney/** * \file NETGeographicLib/GravityCircle.cpp * \brief Implementation for NETGeographicLib::GravityCircle class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/GravityCircle.hpp" #include "GravityModel.h" #include "GravityCircle.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** GravityCircle::!GravityCircle(void) { if ( m_pGravityCircle != NULL ) { delete m_pGravityCircle; m_pGravityCircle = NULL; } } //***************************************************************************** GravityCircle::GravityCircle( const GeographicLib::GravityCircle& gc ) { try { m_pGravityCircle = new GeographicLib::GravityCircle(gc); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::GravityCircle" ); } } //***************************************************************************** double GravityCircle::Gravity(double lon, [System::Runtime::InteropServices::Out] double% gx, [System::Runtime::InteropServices::Out] double% gy, [System::Runtime::InteropServices::Out] double% gz) { double lgx, lgy, lgz; double out = m_pGravityCircle->Gravity( lon, lgx, lgy, lgz ); gx = lgx; gy = lgy; gz = lgz; return out; } //***************************************************************************** double GravityCircle::Disturbance(double lon, [System::Runtime::InteropServices::Out] double% deltax, [System::Runtime::InteropServices::Out] double% deltay, [System::Runtime::InteropServices::Out] double% deltaz) { double ldeltax, ldeltay, ldeltaz; double out = m_pGravityCircle->Disturbance( lon, ldeltax, ldeltay, ldeltaz ); deltax = ldeltax; deltay = ldeltay; deltaz = ldeltaz; return out; } //***************************************************************************** double GravityCircle::GeoidHeight(double lon) { return m_pGravityCircle->GeoidHeight( lon ); } //***************************************************************************** void GravityCircle::SphericalAnomaly(double lon, [System::Runtime::InteropServices::Out] double% Dg01, [System::Runtime::InteropServices::Out] double% xi, [System::Runtime::InteropServices::Out] double% eta) { double lDg01, lxi, leta; m_pGravityCircle->SphericalAnomaly( lon, lDg01, lxi, leta ); Dg01 = lDg01; xi = lxi; eta = leta; } //***************************************************************************** double GravityCircle::W(double lon, [System::Runtime::InteropServices::Out] double% gX, [System::Runtime::InteropServices::Out] double% gY, [System::Runtime::InteropServices::Out] double% gZ) { double lgx, lgy, lgz; double out = m_pGravityCircle->W( lon, lgx, lgy, lgz ); gX = lgx; gY = lgy; gZ = lgz; return out; } //***************************************************************************** double GravityCircle::V(double lon, [System::Runtime::InteropServices::Out] double% GX, [System::Runtime::InteropServices::Out] double% GY, [System::Runtime::InteropServices::Out] double% GZ) { double lgx, lgy, lgz; double out = m_pGravityCircle->V( lon, lgx, lgy, lgz ); GX = lgx; GY = lgy; GZ = lgz; return out; } //***************************************************************************** double GravityCircle::T(double lon, [System::Runtime::InteropServices::Out] double% deltaX, [System::Runtime::InteropServices::Out] double% deltaY, [System::Runtime::InteropServices::Out] double% deltaZ) { double lgx, lgy, lgz; double out = m_pGravityCircle->T( lon, lgx, lgy, lgz ); deltaX = lgx; deltaY = lgy; deltaZ = lgz; return out; } //***************************************************************************** double GravityCircle::T(double lon) { return m_pGravityCircle->T( lon ); } //***************************************************************************** double GravityCircle::EquatorialRadius::get() { if ( m_pGravityCircle->Init() ) return m_pGravityCircle->EquatorialRadius(); throw gcnew GeographicErr("GravityCircle::EquatorialRadius failed because the GravityCircle is not initialized."); } //***************************************************************************** double GravityCircle::Flattening::get() { if ( m_pGravityCircle->Init() ) return m_pGravityCircle->Flattening(); throw gcnew GeographicErr("GravityCircle::Flattening failed because the GravityCircle is not initialized."); } //***************************************************************************** double GravityCircle::Latitude::get() { if ( m_pGravityCircle->Init() ) return m_pGravityCircle->Latitude(); throw gcnew GeographicErr("GravityCircle::Latitude failed because the GravityCircle is not initialized."); } //***************************************************************************** double GravityCircle::Height::get() { if ( m_pGravityCircle->Init() ) return m_pGravityCircle->Height(); throw gcnew GeographicErr("GravityCircle::Height failed because the GravityCircle is not initialized."); } //***************************************************************************** bool GravityCircle::Init::get() { return m_pGravityCircle->Init(); } //***************************************************************************** GravityModel::Mask GravityCircle::Capabilities() { return static_cast(m_pGravityCircle->Capabilities()); } //***************************************************************************** bool GravityCircle::Capabilities(GravityModel::Mask testcaps) { return m_pGravityCircle->Capabilities( (unsigned int)testcaps ); } GeographicLib-1.52/dotnet/NETGeographicLib/GravityCircle.h0000644000771000077100000002730314064202371023305 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/GravityCircle.h * \brief Header for NETGeographicLib::GravityCircle class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::GravityCircle. * * This class allows .NET applications to access GeographicLib::GravityCircle. * * Evaluate the earth's gravity field on a circle of constant height and * latitude. This uses a CircularEngine 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. * * C# Example: * \include example-GravityCircle.cs * Managed C++ Example: * \include example-GravityCircle.cpp * Visual Basic Example: * \include example-GravityCircle.vb * * INTERFACE DIFFERENCES:
* The following functions are implemented as properties: * Init, EquatorialRadius, Flattening, Latitude, and Height. * * The Capabilities functions accept and return the "capabilities mask" * as a NETGeographicLib::GravityModel::Mask rather than an unsigned. **********************************************************************/ public ref class GravityCircle { private: // the pointer to the unmanaged GeographicLib::GravityCircle. const GeographicLib::GravityCircle* m_pGravityCircle; // the finalizer frees the unmanaged memory when the object is destroyed. !GravityCircle(void); public: /** * A constructor that is initialized from an unmanaged * GeographicLib::GravityCircle. For internal use only. Developers * should use GravityModel::Circle to create a GavityCircle object. **********************************************************************/ GravityCircle( const GeographicLib::GravityCircle& gc ); /** * The destructor calls the finalizer. **********************************************************************/ ~GravityCircle() { this->!GravityCircle(); } /** \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. **********************************************************************/ double Gravity(double lon, [System::Runtime::InteropServices::Out] double% gx, [System::Runtime::InteropServices::Out] double% gy, [System::Runtime::InteropServices::Out] double% gz); /** * 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. **********************************************************************/ double Disturbance(double lon, [System::Runtime::InteropServices::Out] double% deltax, [System::Runtime::InteropServices::Out] double% deltay, [System::Runtime::InteropServices::Out] double% deltaz); /** * 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. **********************************************************************/ double GeoidHeight(double lon); /** * 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(double lon, [System::Runtime::InteropServices::Out] double% Dg01, [System::Runtime::InteropServices::Out] double% xi, [System::Runtime::InteropServices::Out] double% eta); /** * 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 + Φ the sum of the gravitational and * centrifugal potentials (m2 s−2). **********************************************************************/ double W(double lon, [System::Runtime::InteropServices::Out] double% gX, [System::Runtime::InteropServices::Out] double% gY, [System::Runtime::InteropServices::Out] double% 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 - Φ the gravitational potential * (m2 s−2). **********************************************************************/ double V(double lon, [System::Runtime::InteropServices::Out] double% GX, [System::Runtime::InteropServices::Out] double% GY, [System::Runtime::InteropServices::Out] double% 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). **********************************************************************/ double T(double lon, [System::Runtime::InteropServices::Out] double% deltaX, [System::Runtime::InteropServices::Out] double% deltaY, [System::Runtime::InteropServices::Out] double% deltaZ); /** * 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). **********************************************************************/ double T(double lon); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ property bool Init { bool get(); } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the GravityModel object used in the * constructor. * This property throws an exception if the GravityCircles has not * been initialized. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the GravityModel object used in the constructor. * This property throws an exception if the GravityCircles has not * been initialized. **********************************************************************/ property double Flattening { double get(); } /** * @return the latitude of the circle (degrees). * This property throws an exception if the GravityCircles has not * been initialized. **********************************************************************/ property double Latitude { double get(); } /** * @return the height of the circle (meters). * This property throws an exception if the GravityCircles has not * been initialized. **********************************************************************/ property double Height { double get(); } /** * @return \e caps the computational capabilities that this object was * constructed with. **********************************************************************/ GravityModel::Mask Capabilities(); /** * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values. * @return true if the GeodesicLine object has all these capabilities. **********************************************************************/ bool Capabilities(GravityModel::Mask testcaps); ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/GravityModel.cpp0000644000771000077100000002175114064202371023500 0ustar ckarneyckarney/** * \file NETGeographicLib/GravityModel.cpp * \brief Implementation for NETGeographicLib::GravityModel class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/GravityModel.hpp" #include "GravityModel.h" #include "GeographicLib/GravityCircle.hpp" #include "GravityCircle.h" #include "NormalGravity.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** GravityModel::!GravityModel(void) { if ( m_pGravityModel != NULL ) { delete m_pGravityModel; m_pGravityModel = NULL; } } //***************************************************************************** GravityModel::GravityModel(System::String^ name, System::String^ path) { if ( name == nullptr ) throw gcnew GeographicErr("name cannot be a null pointer."); if ( path == nullptr ) throw gcnew GeographicErr("path cannot be a null pointer."); try { m_pGravityModel = new GeographicLib::GravityModel( StringConvert::ManagedToUnmanaged( name ), StringConvert::ManagedToUnmanaged( path )); } catch ( std::bad_alloc err ) { throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::GravityModel" ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** double GravityModel::Gravity(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% gx, [System::Runtime::InteropServices::Out] double% gy, [System::Runtime::InteropServices::Out] double% gz) { double lgx, lgy, lgz; double out = m_pGravityModel->Gravity( lat, lon, h, lgx, lgy, lgz ); gx = lgx; gy = lgy; gz = lgz; return out; } //***************************************************************************** double GravityModel::Disturbance(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% deltax, [System::Runtime::InteropServices::Out] double% deltay, [System::Runtime::InteropServices::Out] double% deltaz) { double lgx, lgy, lgz; double out = m_pGravityModel->Disturbance( lat, lon, h, lgx, lgy, lgz ); deltax = lgx; deltay = lgy; deltaz = lgz; return out; } //***************************************************************************** double GravityModel::GeoidHeight(double lat, double lon) { return m_pGravityModel->GeoidHeight( lat, lon ); } //***************************************************************************** void GravityModel::SphericalAnomaly(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% Dg01, [System::Runtime::InteropServices::Out] double% xi, [System::Runtime::InteropServices::Out] double% eta) { double lgx, lgy, lgz; m_pGravityModel->SphericalAnomaly( lat, lon, h, lgx, lgy, lgz ); Dg01 = lgx; xi = lgy; eta = lgz; } //***************************************************************************** double GravityModel::W(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% gX, [System::Runtime::InteropServices::Out] double% gY, [System::Runtime::InteropServices::Out] double% gZ) { double lgx, lgy, lgz; double out = m_pGravityModel->W( X, Y, Z, lgx, lgy, lgz ); gX = lgx; gY = lgy; gZ = lgz; return out; } //***************************************************************************** double GravityModel::V(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% GX, [System::Runtime::InteropServices::Out] double% GY, [System::Runtime::InteropServices::Out] double% GZ) { double lgx, lgy, lgz; double out = m_pGravityModel->V( X, Y, Z, lgx, lgy, lgz ); GX = lgx; GY = lgy; GZ = lgz; return out; } //***************************************************************************** double GravityModel::T(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% deltaX, [System::Runtime::InteropServices::Out] double% deltaY, [System::Runtime::InteropServices::Out] double% deltaZ) { double lgx, lgy, lgz; double out = m_pGravityModel->T( X, Y, Z, lgx, lgy, lgz ); deltaX = lgx; deltaY = lgy; deltaZ = lgz; return out; } //***************************************************************************** double GravityModel::T(double X, double Y, double Z) { return m_pGravityModel->T( X, Y, Z ); } //***************************************************************************** double GravityModel::U(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% gammaX, [System::Runtime::InteropServices::Out] double% gammaY, [System::Runtime::InteropServices::Out] double% gammaZ) { double lgx, lgy, lgz; double out = m_pGravityModel->U( X, Y, Z, lgx, lgy, lgz ); gammaX = lgx; gammaY = lgy; gammaZ = lgz; return out; } //***************************************************************************** double GravityModel::Phi(double X, double Y, [System::Runtime::InteropServices::Out] double% fX, [System::Runtime::InteropServices::Out] double% fY) { double lgx, lgy; double out = m_pGravityModel->Phi( X, Y, lgx, lgy ); fX = lgx; fY = lgy; return out; } //***************************************************************************** GravityCircle^ GravityModel::Circle(double lat, double h, Mask caps ) { try { return gcnew GravityCircle( m_pGravityModel->Circle( lat, h, (unsigned)caps ) ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** System::String^ GravityModel::Description::get() { return StringConvert::UnmanagedToManaged( m_pGravityModel->Description() ); } //***************************************************************************** System::String^ GravityModel::DateTime::get() { return StringConvert::UnmanagedToManaged( m_pGravityModel->DateTime() ); } //***************************************************************************** System::String^ GravityModel::GravityFile::get() { return StringConvert::UnmanagedToManaged( m_pGravityModel->GravityFile() ); } //***************************************************************************** System::String^ GravityModel::GravityModelName::get() { return StringConvert::UnmanagedToManaged( m_pGravityModel->GravityModelName() ); } //***************************************************************************** System::String^ GravityModel::GravityModelDirectory::get() { return StringConvert::UnmanagedToManaged( m_pGravityModel->GravityModelDirectory() ); } //***************************************************************************** System::String^ GravityModel::DefaultGravityPath() { try { return StringConvert::UnmanagedToManaged( GeographicLib::GravityModel::DefaultGravityPath() ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** System::String^ GravityModel::DefaultGravityName() { try { return StringConvert::UnmanagedToManaged( GeographicLib::GravityModel::DefaultGravityName() ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** NormalGravity^ GravityModel::ReferenceEllipsoid() { return gcnew NormalGravity( m_pGravityModel->ReferenceEllipsoid() ); } //***************************************************************************** double GravityModel::EquatorialRadius::get() { return m_pGravityModel->EquatorialRadius(); } //***************************************************************************** double GravityModel::MassConstant::get() { return m_pGravityModel->MassConstant(); } //***************************************************************************** double GravityModel::ReferenceMassConstant::get() { return m_pGravityModel->ReferenceMassConstant(); } //***************************************************************************** double GravityModel::AngularVelocity::get() { return m_pGravityModel->AngularVelocity(); } //***************************************************************************** double GravityModel::Flattening::get() { return m_pGravityModel->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/GravityModel.h0000644000771000077100000006074314064202371023151 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/GravityModel.h * \brief Header for NETGeographicLib::GravityModel class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class GravityCircle; ref class NormalGravity; /** * \brief .NET wrapper for GeographicLib::GravityModel. * * This class allows .NET applications to access GeographicLib::GravityModel. * * 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; * - Φ = rotational potential; * - \e W = \e V + Φ = \e T + \e U = total potential; * - V0 = normal gravitation potential; * - \e U = V0 + Φ = total normal potential; * - \e T = \e W − \e U = \e V − V0 = anomalous * or disturbing potential; * - g = ∇\e W = γ + δ; * - f = ∇Φ; * - Γ = ∇V0; * - γ = ∇\e U; * - δ = ∇\e T = gravity disturbance vector * = gPγP; * - δ\e g = gravity disturbance = \e gP − * γP; * - Δg = gravity anomaly vector = gP * − γQ; here the line \e PQ is * perpendicular to ellipsoid and the potential at \e P equals the normal * potential at \e Q; * - Δ\e g = gravity anomaly = \e gP − * γQ; * - (ξ, η) deflection of the vertical, the difference in * directions of gP and * γQ, ξ = NS, η = 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). * * C# Example: * \include example-GravityModel.cs * Managed C++ Example: * \include example-GravityModel.cpp * Visual Basic Example: * \include example-GravityModel.vb * * INTERFACE DIFFERENCES:
* The following functions are implemented as properties: * Description, DateTime, GravityFile, GravityModelName, * GravityModelDirectory, EquatorialRadius, MassConstant, * ReferenceMassConstant, AngularVelocity, and Flattening. * * The Circle function accepts the "capabilities mask" as a * NETGeographicLib::GravityModel::Mask rather than an unsigned. **********************************************************************/ public ref class GravityModel { private: // pointer to the unmanaged GeographicLib::GravityModel. const GeographicLib::GravityModel* m_pGravityModel; // the finalizer frees the unmanaged memory when the object is destroyed. !GravityModel(void); enum class CapType { CAP_NONE = 0U, CAP_G = 1U<<0, // implies potentials W and V CAP_T = 1U<<1, CAP_DELTA = 1U<<2 | CapType::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 class Mask { /** * No capabilities. * @hideinitializer **********************************************************************/ NONE = 0U, /** * Allow calls to GravityCircle::Gravity, GravityCircle::W, and * GravityCircle::V. * @hideinitializer **********************************************************************/ GRAVITY = CapType::CAP_G, /** * Allow calls to GravityCircle::Disturbance and GravityCircle::T. * @hideinitializer **********************************************************************/ DISTURBANCE = CapType::CAP_DELTA, /** * Allow calls to GravityCircle::T(double lon) (i.e., computing the * disturbing potential and not the gravity disturbance vector). * @hideinitializer **********************************************************************/ DISTURBING_POTENTIAL = CapType::CAP_T, /** * Allow calls to GravityCircle::SphericalAnomaly. * @hideinitializer **********************************************************************/ SPHERICAL_ANOMALY = CapType::CAP_DELTA | CapType::CAP_GAMMA, /** * Allow calls to GravityCircle::GeoidHeight. * @hideinitializer **********************************************************************/ GEOID_HEIGHT = CapType::CAP_T | CapType::CAP_C | CapType::CAP_GAMMA0, /** * All capabilities. * @hideinitializer **********************************************************************/ ALL = CapType::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. * @exception GeographicErr if the data file cannot be found, is * unreadable, or is corrupt. * @exception std::bad_alloc if the memory necessary for storing the model * can't be allocated. * * 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 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"). **********************************************************************/ GravityModel(System::String^ name, System::String^ path); ///@} /** * The destructor calls the finalizer. **********************************************************************/ ~GravityModel() { this->!GravityModel(); } /** \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. **********************************************************************/ double Gravity(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% gx, [System::Runtime::InteropServices::Out] double% gy, [System::Runtime::InteropServices::Out] double% gz); /** * 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. **********************************************************************/ double Disturbance(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% deltax, [System::Runtime::InteropServices::Out] double% deltay, [System::Runtime::InteropServices::Out] double% deltaz); /** * 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. **********************************************************************/ double GeoidHeight(double lat, double lon); /** * 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(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% Dg01, [System::Runtime::InteropServices::Out] double% xi, [System::Runtime::InteropServices::Out] double% eta); ///@} /** \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 + Φ the sum of the gravitational and * centrifugal potentials (m2 s−2). * * This calls NormalGravity::U for ReferenceEllipsoid(). **********************************************************************/ double W(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% gX, [System::Runtime::InteropServices::Out] double% gY, [System::Runtime::InteropServices::Out] double% gZ); /** * 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 - Φ the gravitational potential * (m2 s−2). **********************************************************************/ double V(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% GX, [System::Runtime::InteropServices::Out] double% GY, [System::Runtime::InteropServices::Out] double% GZ); /** * 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). **********************************************************************/ double T(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% deltaX, [System::Runtime::InteropServices::Out] double% deltaY, [System::Runtime::InteropServices::Out] double% deltaZ); /** * 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). **********************************************************************/ double T(double X, double Y, double Z); /** * 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 + Φ the sum of the * normal gravitational and centrifugal potentials * (m2 s−2). * * This calls NormalGravity::U for ReferenceEllipsoid(). **********************************************************************/ double U(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% gammaX, [System::Runtime::InteropServices::Out] double% gammaY, [System::Runtime::InteropServices::Out] double% 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 Φ the centrifugal potential (m2 * s−2). * * This calls NormalGravity::Phi for ReferenceEllipsoid(). **********************************************************************/ double Phi(double X, double Y, [System::Runtime::InteropServices::Out] double% fX, [System::Runtime::InteropServices::Out] double% 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. * @exception std::bad_alloc if the memory necessary for creating a * GravityCircle can't be allocated. * @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(double lat, double h, Mask caps ); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return the NormalGravity object for the reference ellipsoid. **********************************************************************/ NormalGravity^ ReferenceEllipsoid(); /** * @return the description of the gravity model, if available, in the data * file; if absent, return "NONE". **********************************************************************/ property System::String^ Description { System::String^ get(); } /** * @return date of the model; if absent, return "UNKNOWN". **********************************************************************/ property System::String^ DateTime { System::String^ get(); } /** * @return full file name used to load the gravity model. **********************************************************************/ property System::String^ GravityFile { System::String^ get(); } /** * @return "name" used to load the gravity model (from the first argument * of the constructor, but this may be overridden by the model file). **********************************************************************/ property System::String^ GravityModelName { System::String^ get(); } /** * @return directory used to load the gravity model. **********************************************************************/ property System::String^ GravityModelDirectory { System::String^ get(); } /** * @return \e a the equatorial radius of the ellipsoid (meters). **********************************************************************/ property double EquatorialRadius { double get(); } /** * @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). **********************************************************************/ property double MassConstant { double get(); } /** * @return \e GM the mass constant of the ReferenceEllipsoid() * (m3 s−2). **********************************************************************/ property double ReferenceMassConstant { double get(); } /** * @return ω the angular velocity of the model and the * ReferenceEllipsoid() (rad s−1). **********************************************************************/ property double AngularVelocity { double get(); } /** * @return \e f the flattening of the ellipsoid. **********************************************************************/ property double Flattening { double get(); } ///@} /** * @return the default path for gravity model data files. * * This is the value of the environment variable GEOGRAPHICLIB_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:/ProgramData/GeographicLib/gravity on Windows systems). **********************************************************************/ static System::String^ DefaultGravityPath(); /** * @return the default name for the gravity model. * * This is the value of the environment variable GEOGRAPHICLIB_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 System::String^ DefaultGravityName(); }; } //namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/LambertConformalConic.cpp0000644000771000077100000001404514064202371025273 0ustar ckarneyckarney/** * \file NETGeographicLib/LambertConformalConic.cpp * \brief Implementation for NETGeographicLib::LambertConformalConic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/LambertConformalConic.hpp" #include "LambertConformalConic.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocte memory for a GeographicLib::LambertConformalConic"; //***************************************************************************** LambertConformalConic::!LambertConformalConic(void) { if ( m_pLambertConformalConic != NULL ) { delete m_pLambertConformalConic; m_pLambertConformalConic = NULL; } } //***************************************************************************** LambertConformalConic::LambertConformalConic(double a, double f, double stdlat, double k0) { try { m_pLambertConformalConic = new GeographicLib::LambertConformalConic( a, f, stdlat, k0 ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** LambertConformalConic::LambertConformalConic(double a, double f, double stdlat1, double stdlat2, double k1) { try { m_pLambertConformalConic = new GeographicLib::LambertConformalConic( a, f, stdlat1, stdlat2, k1 ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** LambertConformalConic::LambertConformalConic(double a, double f, double sinlat1, double coslat1, double sinlat2, double coslat2, double k1) { try { m_pLambertConformalConic = new GeographicLib::LambertConformalConic( a, f, sinlat1, coslat1, sinlat2, coslat2, k1 ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** LambertConformalConic::LambertConformalConic() { try { m_pLambertConformalConic = new GeographicLib::LambertConformalConic( GeographicLib::LambertConformalConic::Mercator() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void LambertConformalConic::SetScale(double lat, double k) { try { m_pLambertConformalConic->SetScale( lat, k ); } catch ( std::exception err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void LambertConformalConic::Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double lx, ly, lgamma, lk; m_pLambertConformalConic->Forward( lon0, lat, lon, lx, ly, lgamma, lk ); x = lx; y = ly; gamma = lgamma; k = lk; } //***************************************************************************** void LambertConformalConic::Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double llat, llon, lgamma, lk; m_pLambertConformalConic->Reverse( lon0, x, y, llat, llon, lgamma, lk ); lat = llat; lon = llon; gamma = lgamma; k = lk; } //***************************************************************************** void LambertConformalConic::Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y) { double lx, ly; m_pLambertConformalConic->Forward( lon0, lat, lon, lx, ly ); x = lx; y = ly; } //***************************************************************************** void LambertConformalConic::Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon; m_pLambertConformalConic->Reverse( lon0, x, y, llat, llon ); lat = llat; lon = llon; } //***************************************************************************** double LambertConformalConic::EquatorialRadius::get() { return m_pLambertConformalConic->EquatorialRadius(); } //***************************************************************************** double LambertConformalConic::Flattening::get() { return m_pLambertConformalConic->Flattening(); } //***************************************************************************** double LambertConformalConic::OriginLatitude::get() { return m_pLambertConformalConic->OriginLatitude(); } //***************************************************************************** double LambertConformalConic::CentralScale::get() { return m_pLambertConformalConic->CentralScale(); } GeographicLib-1.52/dotnet/NETGeographicLib/LambertConformalConic.h0000644000771000077100000003167714064202371024752 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/LambertConformalConic.h * \brief Header for NETGeographicLib::LambertConformalConic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::LambertConformalConic. * * This class allows .NET applications to access GeographicLib::LambertConformalConic. * * 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: * C# Example: * \include example-LambertConformalConic.cs * Managed C++ Example: * \include example-LambertConformalConic.cpp * Visual Basic Example: * \include example-LambertConformalConic.vb * * INTERFACE DIFFERENCES:
* A default constructor has been provided that assumes a Mercator * projection. * * The EquatorialRadius, Flattening, OriginLatitude, and CentralScale * functions are implemented as properties. **********************************************************************/ public ref class LambertConformalConic { private: // Pointer to the unmanaged GeographicLib::LambertConformalConic. GeographicLib::LambertConformalConic* m_pLambertConformalConic; // the finalizer frres the unmanaged memory when the object is destroyed. !LambertConformalConic(void); 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. * @param[in] stdlat standard parallel (degrees), the circle of tangency. * @param[in] k0 scale on the standard parallel. * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k0 is * not positive. * @exception GeographicErr if \e stdlat is not in [−90°, * 90°]. **********************************************************************/ LambertConformalConic(double a, double f, double stdlat, double 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. * @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees). * @param[in] k1 scale on the standard parallels. * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k1 is * not positive. * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * [−90°, 90°], or if either \e stdlat1 or \e * stdlat2 is a pole and \e stdlat1 is not equal \e stdlat2. **********************************************************************/ LambertConformalConic(double a, double f, double stdlat1, double stdlat2, double 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. * @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. * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k1 is * not positive. * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * [−90°, 90°], or if either \e stdlat1 or \e * stdlat2 is a pole and \e stdlat1 is not equal \e stdlat2. * * 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) ≤ 160° and max(abs(\e lat1), abs(\e lat2)) ≤ 90 * − min(0.0002, 2.2 × 10−6(180 − \e * dlat), 6 × 10−8 dlat2) (in * degrees), then the error in the latitude of origin is less than 4.5 * × 10−14d and the relative error in the scale is * less than 7 × 10−15. **********************************************************************/ LambertConformalConic(double a, double f, double sinlat1, double coslat1, double sinlat2, double coslat2, double k1); /** * The default constructor assumes a Mercator projection. **********************************************************************/ LambertConformalConic(); /** * The destructor calls the finalizer. **********************************************************************/ ~LambertConformalConic() { this->!LambertConformalConic(); } /** * Set the scale for the projection. * * @param[in] lat (degrees). * @param[in] k scale at latitude \e lat (default 1). * @exception GeographicErr \e k is not positive. * @exception GeographicErr if \e lat is not in [−90°, * 90°]. **********************************************************************/ void SetScale(double lat, double k); /** * 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°]. 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(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * 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. 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(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * LambertConformalConic::Forward without returning the convergence and * scale. **********************************************************************/ void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y); /** * LambertConformalConic::Reverse without returning the convergence and * scale. **********************************************************************/ void Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ property double Flattening { double get(); } /** * @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. **********************************************************************/ property double OriginLatitude { double get(); } /** * @return central scale for the projection. This is the scale on the * latitude of origin. **********************************************************************/ property double CentralScale { double get(); } ///@} }; } //namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/LocalCartesian.cpp0000644000771000077100000001362414064202371023756 0ustar ckarneyckarney/** * \file NETGeographicLib/LocalCartesian.cpp * \brief Implementation for NETGeographicLib::LocalCartesian class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/LocalCartesian.hpp" #include "LocalCartesian.h" #include "Geocentric.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::LocalCartesian"; //***************************************************************************** LocalCartesian::!LocalCartesian(void) { if ( m_pLocalCartesian != NULL ) { delete m_pLocalCartesian; m_pLocalCartesian = NULL; } } //***************************************************************************** LocalCartesian::LocalCartesian(double lat0, double lon0, double h0, Geocentric^ earth ) { try { const GeographicLib::Geocentric* pGeocentric = reinterpret_cast( earth->GetUnmanaged()->ToPointer() ); m_pLocalCartesian = new GeographicLib::LocalCartesian( lat0, lon0, h0, *pGeocentric ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** LocalCartesian::LocalCartesian(double lat0, double lon0, double h0 ) { try { m_pLocalCartesian = new GeographicLib::LocalCartesian( lat0, lon0, h0, GeographicLib::Geocentric::WGS84() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** LocalCartesian::LocalCartesian(Geocentric^ earth) { try { const GeographicLib::Geocentric* pGeocentric = reinterpret_cast( earth->GetUnmanaged()->ToPointer() ); m_pLocalCartesian = new GeographicLib::LocalCartesian( *pGeocentric ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** LocalCartesian::LocalCartesian() { try { m_pLocalCartesian = new GeographicLib::LocalCartesian( GeographicLib::Geocentric::WGS84() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void LocalCartesian::Reset(double lat0, double lon0, double h0 ) { m_pLocalCartesian->Reset( lat0, lon0, h0 ); } //***************************************************************************** void LocalCartesian::Forward(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% z) { double lx, ly, lz; m_pLocalCartesian->Forward( lat, lon, h, lx, ly, lz ); x = lx; y = ly; z = lz; } //***************************************************************************** void LocalCartesian::Forward(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% z, [System::Runtime::InteropServices::Out] array^% M) { double lx, ly, lz; std::vector lM(9); m_pLocalCartesian->Forward( lat, lon, h, lx, ly, lz, lM ); x = lx; y = ly; z = lz; M = gcnew array(3,3); for ( int i = 0; i < 3; i++ ) for ( int j = 0; j < 3; j++ ) M[i,j] = lM[3*i+j]; } //***************************************************************************** void LocalCartesian::Reverse(double x, double y, double z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h) { double llat, llon, lh; m_pLocalCartesian->Reverse( x, y, z, llat, llon, lh ); lat = llat; lon = llon; h = lh; } //***************************************************************************** void LocalCartesian::Reverse(double x, double y, double z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h, [System::Runtime::InteropServices::Out] array^% M) { double llat, llon, lh; std::vector lM(9); m_pLocalCartesian->Reverse( x, y, z, llat, llon, lh, lM ); lat = llat; lon = llon; h = lh; M = gcnew array(3,3); for ( int i = 0; i < 3; i++ ) for ( int j = 0; j < 3; j++ ) M[i,j] = lM[3*i+j]; } //***************************************************************************** double LocalCartesian::LatitudeOrigin::get() { return m_pLocalCartesian->LatitudeOrigin(); } //***************************************************************************** double LocalCartesian::LongitudeOrigin::get() { return m_pLocalCartesian->LongitudeOrigin(); } //***************************************************************************** double LocalCartesian::HeightOrigin::get() { return m_pLocalCartesian->HeightOrigin(); } //***************************************************************************** double LocalCartesian::EquatorialRadius::get() { return m_pLocalCartesian->EquatorialRadius(); } //***************************************************************************** double LocalCartesian::Flattening::get() { return m_pLocalCartesian->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/LocalCartesian.h0000644000771000077100000002553714064202371023431 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/LocalCartesian.h * \brief Header for NETGeographicLib::LocalCartesian class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class Geocentric; /** * \brief .NET wrapper for GeographicLib::LocalCartesian. * * This class allows .NET applications to access GeographicLib::LocalCartesian. * * 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. * * C# Example: * \include example-LocalCartesian.cs * Managed C++ Example: * \include example-LocalCartesian.cpp * Visual Basic Example: * \include example-LocalCartesian.vb * * INTERFACE DIFFERENCES:
* Constructors have been provided that assume WGS84 parameters. * * The following functions are implemented as properties: * LatitudeOrigin, LongitudeOrigin, HeightOrigin, EquatorialRadius, * and Flattening. * * The rotation matrices returned by the Forward and Reverse functions * are 2D, 3 × 3 arrays rather than vectors. **********************************************************************/ public ref class LocalCartesian { private: // the pointer to the GeographicLib::LocalCartesian. GeographicLib::LocalCartesian* m_pLocalCartesian; // the finalizer frees the unmanaged memory when the object is destroyed. !LocalCartesian(void); 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. * * \e lat0 should be in the range [−90°, 90°]. **********************************************************************/ LocalCartesian(double lat0, double lon0, double h0, Geocentric^ earth ); /** * Constructor setting the origin and assuming a WGS84 ellipsoid. * * @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. * * \e lat0 should be in the range [−90°, 90°]. **********************************************************************/ LocalCartesian(double lat0, double lon0, double h0 ); /** * Constructor that uses the provided ellipsoid. * * @param[in] earth Geocentric object for the transformation; default * Geocentric::WGS84. * * Sets \e lat0 = 0, \e lon0 = 0, \e h0 = 0. **********************************************************************/ LocalCartesian(Geocentric^ earth); /** * The default constructor assumes the WGS84 ellipsoid. * * Sets \e lat0 = 0, \e lon0 = 0, \e h0 = 0. **********************************************************************/ LocalCartesian(); /** * The destructor calls the finalizer. **********************************************************************/ ~LocalCartesian() { this->!LocalCartesian(); } /** * 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. * * \e lat0 should be in the range [−90°, 90°]. **********************************************************************/ void Reset(double lat0, double lon0, double h0 ); /** * 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°]. **********************************************************************/ void Forward(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% z); /** * 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 a 3 × 3 rotation matrix. * * \e lat should be in the range [−90°, 90°]. * * 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(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% z, [System::Runtime::InteropServices::Out] array^% M); /** * 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(double x, double y, double z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h); /** * 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 a 3 × 3 rotation matrix. * * 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 MT ⋅ \e v0, where \e * MT is the transpose of \e M. **********************************************************************/ void Reverse(double x, double y, double z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h, [System::Runtime::InteropServices::Out] array^% M); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return latitude of the origin (degrees). **********************************************************************/ property double LatitudeOrigin { double get(); } /** * @return longitude of the origin (degrees). **********************************************************************/ property double LongitudeOrigin { double get(); } /** * @return height of the origin (meters). **********************************************************************/ property double HeightOrigin { double get(); } /** * @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. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geocentric object used in the constructor. **********************************************************************/ property double Flattening { double get(); } ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/MGRS.cpp0000644000771000077100000000540714064202371021642 0ustar ckarneyckarney/** * \file NETGeographicLib/MGRS.cpp * \brief Implementation for NETGeographicLib::MGRS class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/MGRS.hpp" #include "MGRS.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** void MGRS::Forward(int zone, bool northp, double x, double y, int prec, [System::Runtime::InteropServices::Out] System::String^% mgrs) { try { std::string lmgrs; GeographicLib::MGRS::Forward( zone, northp, x, y, prec, lmgrs ); mgrs = gcnew System::String( lmgrs.c_str() ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void MGRS::Forward(int zone, bool northp, double x, double y, double lat, int prec, System::String^% mgrs) { try { std::string lmgrs; GeographicLib::MGRS::Forward( zone, northp, x, y, lat, prec, lmgrs ); mgrs = gcnew System::String( lmgrs.c_str() ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void MGRS::Reverse(System::String^ mgrs, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] int% prec, bool centerp ) { try { double lx, ly; int lzone, lprec; bool lnorthp; GeographicLib::MGRS::Reverse( StringConvert::ManagedToUnmanaged( mgrs ), lzone, lnorthp, lx, ly, lprec, centerp ); x = lx; y = ly; zone = lzone; prec = lprec; northp = lnorthp; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** double MGRS::EquatorialRadius() { return GeographicLib::UTMUPS::EquatorialRadius(); } //***************************************************************************** double MGRS::Flattening() { return GeographicLib::UTMUPS::Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/MGRS.h0000644000771000077100000003113414064202371021303 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/MGRS.h * \brief Header for NETGeographicLib::MGRS class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::MGRS. * * This class allows .NET applications to access GeographicLib::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. * * C# Example: * \include example-MGRS.cs * Managed C++ Example: * \include example-MGRS.cpp * Visual Basic Example: * \include example-MGRS.vb * **********************************************************************/ public ref class MGRS { private: // Hide the constructor since all members are static. MGRS(void) {} 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. * @exception GeographicErr if \e zone, \e x, or \e y is outside its * allowed range. * @exception GeographicErr if the memory for the MGRS string can't be * allocated. * * \e prec specifies the precision of the MGRS string as follows: * - prec = −1 (min), only the grid zone is returned * - 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 μm * * 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 prec = −1, then the "grid zone designation", e.g., 18T, is * returned. This consists of the UTM zone number (absent for UPS) and the * first letter of the MGRS string which labels the latitude band for UTM * and the hemisphere for UPS. * * 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, double x, double y, int prec, [System::Runtime::InteropServices::Out] System::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. * @exception GeographicErr if \e zone, \e x, or \e y is outside its * allowed range. * @exception GeographicErr if \e lat is inconsistent with the given UTM * coordinates. * @exception std::bad_alloc if the memory for \e mgrs can't be allocated. * * 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, double x, double y, double lat, int prec, [System::Runtime::InteropServices::Out] System::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. * @exception GeographicErr if \e mgrs is illegal. * * 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 a "grid zone designation" (for example, 18T or A) is given, then some * suitable (but essentially arbitrary) point within that grid zone is * returned. The main utility of the conversion is to allow \e zone and \e * northp to be determined. In this case, the \e centerp parameter is * ignored and \e prec is set to −1. * * If the first 3 characters of \e mgrs are "INV", then \e x and \e y are * set to NaN, \e zone is set to UTMUPS::INVALID, and \e prec is set to * −2. * * If an exception is thrown, then the arguments are unchanged. **********************************************************************/ static void Reverse(System::String^ mgrs, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] int% prec, bool centerp ); /** \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 double EquatorialRadius(); /** * @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 double Flattening(); ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/MagneticCircle.cpp0000644000771000077100000000774214064202371023747 0ustar ckarneyckarney/** * \file NETGeographicLib/MagneticCircle.cpp * \brief Implementation for NETGeographicLib::MagneticCircle class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/MagneticCircle.hpp" #include "MagneticCircle.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** MagneticCircle::!MagneticCircle(void) { if ( m_pMagneticCircle != NULL ) { delete m_pMagneticCircle; m_pMagneticCircle = NULL; } } //***************************************************************************** MagneticCircle::MagneticCircle( const GeographicLib::MagneticCircle& c ) { try { m_pMagneticCircle = new GeographicLib::MagneticCircle( c ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::MagneticCircle" ); } } //***************************************************************************** void MagneticCircle::Field(double lon, [System::Runtime::InteropServices::Out] double% Bx, [System::Runtime::InteropServices::Out] double% By, [System::Runtime::InteropServices::Out] double% Bz) { double lx, ly, lz; m_pMagneticCircle->operator()( lon, lx, ly, lz ); Bx = lx; By = ly; Bz = lz; } //***************************************************************************** void MagneticCircle::Field(double lon, [System::Runtime::InteropServices::Out] double% Bx, [System::Runtime::InteropServices::Out] double% By, [System::Runtime::InteropServices::Out] double% Bz, [System::Runtime::InteropServices::Out] double% Bxt, [System::Runtime::InteropServices::Out] double% Byt, [System::Runtime::InteropServices::Out] double% Bzt) { double lx, ly, lz, lxt, lyt, lzt; m_pMagneticCircle->operator()( lon, lx, ly, lz, lxt, lyt, lzt ); Bx = lx; By = ly; Bz = lz; Bxt = lxt; Byt = lyt; Bzt = lzt; } //***************************************************************************** double MagneticCircle::EquatorialRadius::get() { if ( m_pMagneticCircle->Init() ) return m_pMagneticCircle->EquatorialRadius(); throw gcnew GeographicErr("MagneticCircle::EquatorialRadius failed because the MagneticCircle is not initialized."); } //***************************************************************************** double MagneticCircle::Flattening::get() { if ( m_pMagneticCircle->Init() ) return m_pMagneticCircle->Flattening(); throw gcnew GeographicErr("MagneticCircle::Flattening failed because the MagneticCircle is not initialized."); } //***************************************************************************** double MagneticCircle::Latitude::get() { if ( m_pMagneticCircle->Init() ) return m_pMagneticCircle->Latitude(); throw gcnew GeographicErr("MagneticCircle::Latitude failed because the MagneticCircle is not initialized."); } //***************************************************************************** double MagneticCircle::Height::get() { if ( m_pMagneticCircle->Init() ) return m_pMagneticCircle->Height(); throw gcnew GeographicErr("MagneticCircle::Height failed because the MagneticCircle is not initialized."); } //***************************************************************************** double MagneticCircle::Time::get() { if ( m_pMagneticCircle->Init() ) return m_pMagneticCircle->Height(); throw gcnew GeographicErr("MagneticCircle::Height failed because the MagneticCircle is not initialized."); } //***************************************************************************** bool MagneticCircle::Init::get() { return m_pMagneticCircle->Init(); } GeographicLib-1.52/dotnet/NETGeographicLib/MagneticCircle.h0000644000771000077100000001505714064202371023412 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/MagneticCircle.h * \brief Header for NETGeographicLib::MagneticCircle class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::MagneticCircle. * * This class allows .NET applications to access GeographicLib::MagneticCircle. * * Evaluate the earth's magnetic field on a circle of constant height and * latitude. This uses a CircularEngine 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 for internal use only.) * * C# Example: * \include example-MagneticCircle.cs * Managed C++ Example: * \include example-MagneticCircle.cpp * Visual Basic Example: * \include example-MagneticCircle.vb * * INTERFACE DIFFERENCES:
* The () operator has been replaced with Field. * * The following functions are implemented as properties: * Init, EquatorialRadius, Flattening, Latitude, Height, and Time. **********************************************************************/ public ref class MagneticCircle { private: // pointer to the unmanaged GeographicLib::MagneticCircle. const GeographicLib::MagneticCircle* m_pMagneticCircle; // the finalizer frees the unmanaged memory when the object is destroyed. !MagneticCircle(void); public: /** * %brief A constructor that is initialized from an unmanaged * GeographicLib::MagneticCircle. This is for internal use only. * * Developers should use MagneticModel::Circle to create a * MagneticCircle. **********************************************************************/ MagneticCircle( const GeographicLib::MagneticCircle& c ); /** * %brief The destructor calls the finalizer. **********************************************************************/ ~MagneticCircle() { this->!MagneticCircle(); } /** \name Compute the magnetic field **********************************************************************/ ///@{ /** * %brief 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 Field(double lon, [System::Runtime::InteropServices::Out] double% Bx, [System::Runtime::InteropServices::Out] double% By, [System::Runtime::InteropServices::Out] double% Bz); /** * 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 Field(double lon, [System::Runtime::InteropServices::Out] double% Bx, [System::Runtime::InteropServices::Out] double% By, [System::Runtime::InteropServices::Out] double% Bz, [System::Runtime::InteropServices::Out] double% Bxt, [System::Runtime::InteropServices::Out] double% Byt, [System::Runtime::InteropServices::Out] double% Bzt); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ property bool Init { bool get(); } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the MagneticModel object used in the * constructor. This property throws a GeographicErr exception if * the object is not initialized. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the MagneticModel object used in the constructor. * This property throws a GeographicErr exception if the object is * not initialized. **********************************************************************/ property double Flattening { double get(); } /** * @return the latitude of the circle (degrees). * This property throws a GeographicErr exception if the object is * not initialized. **********************************************************************/ property double Latitude { double get(); } /** * @return the height of the circle (meters). * This property throws a GeographicErr exception if the object is * not initialized. **********************************************************************/ property double Height { double get(); } /** * @return the time (fractional years). * This property throws a GeographicErr exception if the object is * not initialized. **********************************************************************/ property double Time { double get(); } ///@} }; } //namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/MagneticModel.cpp0000644000771000077100000002107614064202371023602 0ustar ckarneyckarney/** * \file NETGeographicLib/MagneticModel.cpp * \brief Implementation for NETGeographicLib::MagneticModel class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/MagneticModel.hpp" #include "MagneticModel.h" #include "GeographicLib/MagneticCircle.hpp" #include "MagneticCircle.h" #include "Geocentric.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::MagneticModel"; //***************************************************************************** MagneticModel::!MagneticModel(void) { if ( m_pMagneticModel != NULL ) { delete m_pMagneticModel; m_pMagneticModel = NULL; } } //***************************************************************************** MagneticModel::MagneticModel(System::String^ name, System::String^ path, Geocentric^ earth) { if ( name == nullptr ) throw gcnew GeographicErr("name cannot be a null pointer."); if ( path == nullptr ) throw gcnew GeographicErr("path cannot be a null pointer."); if ( earth == nullptr ) throw gcnew GeographicErr("earth cannot be a null pointer."); try { const GeographicLib::Geocentric* pGeocentric = reinterpret_cast( earth->GetUnmanaged()->ToPointer() ); m_pMagneticModel = new GeographicLib::MagneticModel( StringConvert::ManagedToUnmanaged( name ), StringConvert::ManagedToUnmanaged( path ), *pGeocentric ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch (const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** MagneticModel::MagneticModel(System::String^ name, System::String^ path) { if ( name == nullptr ) throw gcnew GeographicErr("name cannot be a null pointer."); if ( path == nullptr ) throw gcnew GeographicErr("path cannot be a null pointer."); try { m_pMagneticModel = new GeographicLib::MagneticModel( StringConvert::ManagedToUnmanaged( name ), StringConvert::ManagedToUnmanaged( path ), GeographicLib::Geocentric::WGS84() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch (const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void MagneticModel::Field(double t, double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% Bx, [System::Runtime::InteropServices::Out] double% By, [System::Runtime::InteropServices::Out] double% Bz) { double lx, ly, lz; m_pMagneticModel->operator()( t, lat, lon, h, lx, ly, lz ); Bx = lx; By = ly; Bz = lz; } //***************************************************************************** void MagneticModel::Field(double t, double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% Bx, [System::Runtime::InteropServices::Out] double% By, [System::Runtime::InteropServices::Out] double% Bz, [System::Runtime::InteropServices::Out] double% Bxt, [System::Runtime::InteropServices::Out] double% Byt, [System::Runtime::InteropServices::Out] double% Bzt) { double lx, ly, lz, lxt, lyt, lzt; m_pMagneticModel->operator()( t, lat, lon, h, lx, ly, lz, lxt, lyt, lzt ); Bx = lx; By = ly; Bz = lz; Bxt = lxt; Byt = lyt; Bzt = lzt; } //***************************************************************************** MagneticCircle^ MagneticModel::Circle(double t, double lat, double h) { try { return gcnew MagneticCircle( m_pMagneticModel->Circle( t, lat, h ) ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr("Failed to allocate memory for a MagneticCircle in MagneticModel::Circle"); } } //***************************************************************************** void MagneticModel::FieldComponents(double Bx, double By, double Bz, [System::Runtime::InteropServices::Out] double% H, [System::Runtime::InteropServices::Out] double% F, [System::Runtime::InteropServices::Out] double% D, [System::Runtime::InteropServices::Out] double% I) { double lh, lf, ld, li; GeographicLib::MagneticModel::FieldComponents(Bx, By, Bz, lh, lf, ld, li); H = lh; F = lf; D = ld; I = li; } //***************************************************************************** void MagneticModel::FieldComponents(double Bx, double By, double Bz, double Bxt, double Byt, double Bzt, [System::Runtime::InteropServices::Out] double% H, [System::Runtime::InteropServices::Out] double% F, [System::Runtime::InteropServices::Out] double% D, [System::Runtime::InteropServices::Out] double% I, [System::Runtime::InteropServices::Out] double% Ht, [System::Runtime::InteropServices::Out] double% Ft, [System::Runtime::InteropServices::Out] double% Dt, [System::Runtime::InteropServices::Out] double% It) { double lh, lf, ld, li, lht, lft, ldt, lit; GeographicLib::MagneticModel::FieldComponents(Bx, By, Bz, Bxt, Byt, Bzt, lh, lf, ld, li, lht, lft, ldt, lit); H = lh; F = lf; D = ld; I = li; Ht = lht; Ft = lft; Dt = ldt; It = lit; } //***************************************************************************** System::String^ MagneticModel::Description::get() { return StringConvert::UnmanagedToManaged( m_pMagneticModel->Description() ); } //***************************************************************************** System::String^ MagneticModel::DateTime::get() { return StringConvert::UnmanagedToManaged( m_pMagneticModel->DateTime() ); } //***************************************************************************** System::String^ MagneticModel::MagneticFile::get() { return StringConvert::UnmanagedToManaged( m_pMagneticModel->MagneticFile() ); } //***************************************************************************** System::String^ MagneticModel::MagneticModelName::get() { return StringConvert::UnmanagedToManaged( m_pMagneticModel->MagneticModelName() ); } //***************************************************************************** System::String^ MagneticModel::MagneticModelDirectory::get() { return StringConvert::UnmanagedToManaged( m_pMagneticModel->MagneticModelDirectory() ); } //***************************************************************************** System::String^ MagneticModel::DefaultMagneticPath() { return StringConvert::UnmanagedToManaged( GeographicLib::MagneticModel::DefaultMagneticPath() ); } //***************************************************************************** System::String^ MagneticModel::DefaultMagneticName() { return StringConvert::UnmanagedToManaged( GeographicLib::MagneticModel::DefaultMagneticName() ); } //***************************************************************************** double MagneticModel::MinHeight::get() { return m_pMagneticModel->MinHeight(); } //***************************************************************************** double MagneticModel::MaxHeight::get() { return m_pMagneticModel->MaxHeight(); } //***************************************************************************** double MagneticModel::MinTime::get() { return m_pMagneticModel->MinTime(); } //***************************************************************************** double MagneticModel::MaxTime::get() { return m_pMagneticModel->MaxTime(); } //***************************************************************************** double MagneticModel::EquatorialRadius::get() { return m_pMagneticModel->EquatorialRadius(); } //***************************************************************************** double MagneticModel::Flattening::get() { return m_pMagneticModel->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/MagneticModel.h0000644000771000077100000004435114064202371023250 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/MagneticModel.h * \brief Header for NETGeographicLib::MagneticModel class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class MagneticCircle; ref class Geocentric; /** * \brief .NET wrapper for GeographicLib::MagneticModel. * * This class allows .NET applications to access GeographicLib::MagneticModel. * * 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 * - WMM2015 (deprecated): * - http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml * - http://ngdc.noaa.gov/geomag/WMM/data/WMM2015/WMM2015COF.zip * - WMM2015v2: * - http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml * - http://ngdc.noaa.gov/geomag/WMM/data/WMM2015/WMM2015v2COF.zip * - WMM2020: * - http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml * - http://ngdc.noaa.gov/geomag/WMM/data/WMM2020/WMM2020COF.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 * * C# Example: * \include example-MagneticModel.cs * Managed C++ Example: * \include example-MagneticModel.cpp * Visual Basic Example: * \include example-MagneticModel.vb * * INTERFACE DIFFERENCES:
* The () operator has been replaced with Field. * * The following functions are implemented as properties: * Description, DateTime, MagneticFile, MagneticModelName, * MagneticModelDirectory, MinHeight, MaxHeight, MinTime, MaxTime, * EquatorialRadius, and Flattening. **********************************************************************/ public ref class MagneticModel { private: // The pointer to the unmanaged GeographicLib::MagneticModel. const GeographicLib::MagneticModel* m_pMagneticModel; // The finalizer frees the unmanaged memory when the object is destroyed. !MagneticModel(void); 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. * @exception GeographicErr if the data file cannot be found, is * unreadable, or is corrupt. * @exception std::bad_alloc if the memory necessary for storing the model * can't be allocated. * * 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 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 specifies an ellipsoid to * allow geodetic coordinates to the transformed into the spherical * coordinates used in the spherical harmonic sum. **********************************************************************/ MagneticModel(System::String^ name, System::String^ path, Geocentric^ earth); /** * Construct a magnetic model that assumes the WGS84 ellipsoid. * * @param[in] name the name of the model. * @param[in] path (optional) directory for data file. * @exception GeographicErr if the data file cannot be found, is * unreadable, or is corrupt. * @exception GeographicErr if the memory necessary for storing the model * can't be allocated. * * 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 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 specifies an ellipsoid to * allow geodetic coordinates to the transformed into the spherical * coordinates used in the spherical harmonic sum. **********************************************************************/ MagneticModel(System::String^ name, System::String^ path); ///@} /** * The destructor calls the finalizer. **********************************************************************/ ~MagneticModel() { this->!MagneticModel(); } /** \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 Field(double t, double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% Bx, [System::Runtime::InteropServices::Out] double% By, [System::Runtime::InteropServices::Out] double% Bz); /** * 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 Field(double t, double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% Bx, [System::Runtime::InteropServices::Out] double% By, [System::Runtime::InteropServices::Out] double% Bz, [System::Runtime::InteropServices::Out] double% Bxt, [System::Runtime::InteropServices::Out] double% Byt, [System::Runtime::InteropServices::Out] double% 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). * @exception std::bad_alloc if the memory necessary for creating a * MagneticCircle can't be allocated. * @return a MagneticCircle object whose MagneticCircle::Field(double * 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(double t, double lat, double h); /** * 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(double Bx, double By, double Bz, [System::Runtime::InteropServices::Out] double% H, [System::Runtime::InteropServices::Out] double% F, [System::Runtime::InteropServices::Out] double% D, [System::Runtime::InteropServices::Out] double% I); /** * 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(double Bx, double By, double Bz, double Bxt, double Byt, double Bzt, [System::Runtime::InteropServices::Out] double% H, [System::Runtime::InteropServices::Out] double% F, [System::Runtime::InteropServices::Out] double% D, [System::Runtime::InteropServices::Out] double% I, [System::Runtime::InteropServices::Out] double% Ht, [System::Runtime::InteropServices::Out] double% Ft, [System::Runtime::InteropServices::Out] double% Dt, [System::Runtime::InteropServices::Out] double% It); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return the description of the magnetic model, if available, from the * Description file in the data file; if absent, return "NONE". **********************************************************************/ property System::String^ Description { System::String^ get(); } /** * @return date of the model, if available, from the ReleaseDate field in * the data file; if absent, return "UNKNOWN". **********************************************************************/ property System::String^ DateTime { System::String^ get(); } /** * @return full file name used to load the magnetic model. **********************************************************************/ property System::String^ MagneticFile { System::String^ get(); } /** * @return "name" used to load the magnetic model (from the first argument * of the constructor, but this may be overridden by the model file). **********************************************************************/ property System::String^ MagneticModelName { System::String^ get(); } /** * @return directory used to load the magnetic model. **********************************************************************/ property System::String^ MagneticModelDirectory { System::String^ get(); } /** * @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::Field() or * MagneticModel::Circle. **********************************************************************/ property double MinHeight { double get(); } /** * @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::Field() or * MagneticModel::Circle. **********************************************************************/ property double MaxHeight { double get(); } /** * @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::Field() or * MagneticModel::Circle. **********************************************************************/ property double MinTime { double get(); } /** * @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::Field() or * MagneticModel::Circle. **********************************************************************/ property double MaxTime { double get(); } /** * @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. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geocentric object used in the constructor. **********************************************************************/ property double Flattening { double get(); } ///@} /** * @return the default path for magnetic model data files. * * This is the value of the environment variable * GEOGRAPHICLIB_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:/ProgramData/GeographicLib/magnetic on Windows systems). **********************************************************************/ static System::String^ DefaultMagneticPath(); /** * @return the default name for the magnetic model. * * This is the value of the environment variable * GEOGRAPHICLIB_MAGNETIC_NAME, if set, otherwise, it is "wmm2020". * 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 System::String^ DefaultMagneticName(); }; } //namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/NETGeographicLib.cpp0000644000771000077100000000354414064202371024140 0ustar ckarneyckarney/** * \file NETGeographicLib/NETGeographicLib.cpp * \brief Implementation for NETGeographicLib Utility functions. * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/Config.h" #include "GeographicLib/Utility.hpp" #include "NETGeographicLib.h" using namespace System::Runtime::InteropServices; using namespace NETGeographicLib; //***************************************************************************** std::string StringConvert::ManagedToUnmanaged( System::String^ s ) { System::IntPtr buffer = Marshal::StringToHGlobalAnsi(s); std::string output( reinterpret_cast(buffer.ToPointer()) ); Marshal::FreeHGlobal(buffer); return output; } //***************************************************************************** System::String^ VersionInfo::GetString() { return gcnew System::String(GEOGRAPHICLIB_VERSION_STRING); } //***************************************************************************** int VersionInfo::MajorVersion() { return GEOGRAPHICLIB_VERSION_MAJOR; } //***************************************************************************** int VersionInfo::MinorVersion() { return GEOGRAPHICLIB_VERSION_MINOR; } //***************************************************************************** int VersionInfo::Patch() { return GEOGRAPHICLIB_VERSION_PATCH; } //***************************************************************************** double Utility::FractionalYear( System::String^ s ) { return GeographicLib::Utility::fractionalyear( StringConvert::ManagedToUnmanaged( s ) ); } GeographicLib-1.52/dotnet/NETGeographicLib/NETGeographicLib.h0000644000771000077100000003036614064202371023607 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/NETGeographicLib.h * \brief Header for NETGeographicLib::NETGeographicLib objects * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include using namespace System; namespace NETGeographicLib { enum class 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, CAP_MASK = CAP_ALL, OUT_ALL = 0x7F80U, OUT_MASK = 0xFF80U, }; /** * 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. **********************************************************************/ public enum class 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 | unsigned(captype::CAP_NONE), /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8 | unsigned(captype::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 | unsigned(captype::CAP_NONE), /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10 | unsigned(captype::CAP_C1), /** * Allow distance \e s12 to be used as input in the direct geodesic * problem. * @hideinitializer **********************************************************************/ DISTANCE_IN = 1U<<11 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C1p), /** * Calculate reduced length \e m12. * @hideinitializer **********************************************************************/ REDUCEDLENGTH = 1U<<12 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C2), /** * Calculate geodesic scales \e M12 and \e M21. * @hideinitializer **********************************************************************/ GEODESICSCALE = 1U<<13 | unsigned(captype::CAP_C1) | unsigned(captype::CAP_C2), /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14 | unsigned(captype::CAP_C4), /** * Do not wrap the \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, /** * All capabilities, calculate everything. * @hideinitializer **********************************************************************/ ALL = unsigned(captype::OUT_ALL) | unsigned(captype::CAP_ALL), }; /** * @brief The version information. **********************************************************************/ public ref class VersionInfo { private: VersionInfo() {} public: /** * @return The version string. *******************************************************************/ static System::String^ GetString(); /** * @return The major version. *******************************************************************/ static int MajorVersion(); /** * @return The minor version. *******************************************************************/ static int MinorVersion(); /** * @return The patch number. *******************************************************************/ static int Patch(); }; /** * @brief Exception class for NETGeographicLib **********************************************************************/ public ref class GeographicErr : public System::Exception { public: /** * @brief Creates an exception using an unmanaged string. * @param[in] msg The error string. ******************************************************************/ GeographicErr( const char* msg ) : System::Exception( gcnew System::String( msg ) ) {} /** * @brief Creates an exception using a managed string. * @param[in] msg The error string. ******************************************************************/ GeographicErr( System::String^ msg ) : System::Exception( msg ) {} }; ref class StringConvert { StringConvert() {} public: static std::string ManagedToUnmanaged( System::String^ s ); static System::String^ UnmanagedToManaged( const std::string& s ) { return gcnew System::String( s.c_str() ); } }; /** * @brief Physical constants * * References:
* http://www.orekit.org/static/apidocs/org/orekit/utils/Constants.html
* A COMPENDIUM OF EARTH CONSTANTS RELEVANT TO AUSTRALIAN GEODETIC SCIENCE
* http://espace.library.curtin.edu.au/R?func=dbin-jump-full&local_base=gen01-era02&object_id=146669 **********************************************************************/ public ref class Constants { private: Constants() {} public: /** * @brief WGS72 Parameters **********************************************************************/ ref class WGS72 { private: WGS72() {} // The equatorial radius in meters. static const double m_EquatorialRadius = 6378135.0; // The flattening of the ellipsoid static const double m_Flattening = 1.0 / 298.26; // The gravitational constant in meters3/second2. static const double m_GravitationalConstant = 3.986008e+14; // The spin rate of the Earth in radians/second. static const double m_EarthRate = 7.292115147e-5; // dynamical form factor static const double m_J2 = 1.0826158e-3; public: //! The equatorial radius in meters. static property double EquatorialRadius { double get() { return m_EquatorialRadius; } } //! The flattening of the ellipsoid static property double Flattening { double get() { return m_Flattening; } } //! The gravitational constant in meters3/second2. static property double GravitationalConstant { double get() { return m_GravitationalConstant; } } //! The spin rate of the Earth in radians/second. static property double EarthRate { double get() { return m_EarthRate; } } //! The dynamical form factor (J2). static property double J2 { double get() { return m_J2; } } }; /** * @brief WGS84 Parameters **********************************************************************/ ref class WGS84 { private: WGS84() {} // The equatorial radius in meters. static const double m_EquatorialRadius = 6378137.0; // The flattening of the ellipsoid static const double m_Flattening = 1.0 / 298.257223563; // The gravitational constant in meters3/second2. // I have also seen references that set this value to 3.986004418e+14. // The following value is used to maintain consistency with GeographicLib. static const double m_GravitationalConstant = 3.986005e+14; // The spin rate of the Earth in radians/second. static const double m_EarthRate = 7.292115e-5; // dynamical form factor static const double m_J2 = 1.08263e-3; public: //! The equatorial radius in meters. static property double EquatorialRadius { double get() { return m_EquatorialRadius; } } //! The flattening of the ellipsoid static property double Flattening { double get() { return m_Flattening; } } //! The gravitational constant in meters3/second2. static property double GravitationalConstant { double get() { return m_GravitationalConstant; } } //! The spin rate of the Earth in radians/second. static property double EarthRate { double get() { return m_EarthRate; } } //! The dynamical form factor (J2). static property double J2 { double get() { return m_J2; } } }; /** * @brief GRS80 Parameters **********************************************************************/ ref class GRS80 { private: GRS80() {} // The equatorial radius in meters. static const double m_EquatorialRadius = 6378137.0; // The flattening of the ellipsoid static const double m_Flattening = 1.0 / 298.257222100882711; // The gravitational constant in meters3/second2. static const double m_GravitationalConstant = 3.986005e+14; // The spin rate of the Earth in radians/second. static const double m_EarthRate = 7.292115e-5; // dynamical form factor static const double m_J2 = 1.08263e-3; public: //! The equatorial radius in meters. static property double EquatorialRadius { double get() { return m_EquatorialRadius; } } //! The flattening of the ellipsoid static property double Flattening { double get() { return m_Flattening; } } //! The gravitational constant in meters3/second2. static property double GravitationalConstant { double get() { return m_GravitationalConstant; } } //! The spin rate of the Earth in radians/second. static property double EarthRate { double get() { return m_EarthRate; } } //! The dynamical form factor (J2). static property double J2 { double get() { return m_J2; } } }; }; /** * @brief Utility library. * * This class only exposes the GeographicLib::Utility::fractionalyear * function. **********************************************************************/ public ref class Utility { private: // hide the constructor since all members of this class are static Utility() {} public: /** * Convert a string representing a date to a fractional year. * * @param[in] s the string to be converted. * @exception GeographicErr if \e s can't be interpreted as a date. * @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. **********************************************************************/ static double FractionalYear( System::String^ s ); }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/NormalGravity.cpp0000644000771000077100000001527514064202371023674 0ustar ckarneyckarney/** * \file NETGeographicLib/NormalGravity.cpp * \brief Implementation for NETGeographicLib::NormalGravity class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/NormalGravity.hpp" #include "NormalGravity.h" #include "Geocentric.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::NormalGravity"; //***************************************************************************** NormalGravity::!NormalGravity(void) { if ( m_pNormalGravity != NULL ) { delete m_pNormalGravity; m_pNormalGravity = NULL; } } //***************************************************************************** NormalGravity::NormalGravity(double a, double GM, double omega, double f_J2, bool geometricp) { try { m_pNormalGravity = new GeographicLib::NormalGravity( a, GM, omega, f_J2, geometricp ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** NormalGravity::NormalGravity(StandardModels model) { try { m_pNormalGravity = model == StandardModels::WGS84 ? new GeographicLib::NormalGravity( GeographicLib::NormalGravity::WGS84() ) : new GeographicLib::NormalGravity( GeographicLib::NormalGravity::GRS80() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** NormalGravity::NormalGravity( const GeographicLib::NormalGravity& g) { try { m_pNormalGravity = new GeographicLib::NormalGravity( g ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** double NormalGravity::SurfaceGravity(double lat) { return m_pNormalGravity->SurfaceGravity( lat ); } //***************************************************************************** double NormalGravity::Gravity(double lat, double h, [System::Runtime::InteropServices::Out] double% gammay, [System::Runtime::InteropServices::Out] double% gammaz) { double ly, lz; double out = m_pNormalGravity->Gravity( lat, h, ly, lz ); gammay = ly; gammaz = lz; return out; } //***************************************************************************** double NormalGravity::U(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% gammaX, [System::Runtime::InteropServices::Out] double% gammaY, [System::Runtime::InteropServices::Out] double% gammaZ) { double lx, ly, lz; double out = m_pNormalGravity->U( X, Y, Z, lx, ly, lz ); gammaX = lx; gammaY = ly; gammaZ = lz; return out; } //***************************************************************************** double NormalGravity::V0(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% GammaX, [System::Runtime::InteropServices::Out] double% GammaY, [System::Runtime::InteropServices::Out] double% GammaZ) { double lx, ly, lz; double out = m_pNormalGravity->V0( X, Y, Z, lx, ly, lz ); GammaX = lx; GammaY = ly; GammaZ = lz; return out; } //***************************************************************************** double NormalGravity::Phi(double X, double Y, [System::Runtime::InteropServices::Out] double% fX, [System::Runtime::InteropServices::Out] double% fY) { double lx, ly; double out = m_pNormalGravity->Phi( X, Y, lx, ly ); fX = lx; fY = ly; return out; } //***************************************************************************** Geocentric^ NormalGravity::Earth() { return gcnew Geocentric( m_pNormalGravity->Earth() ); } //***************************************************************************** double NormalGravity::EquatorialRadius::get() { return m_pNormalGravity->EquatorialRadius(); } //***************************************************************************** double NormalGravity::MassConstant::get() { return m_pNormalGravity->MassConstant(); } //***************************************************************************** double NormalGravity::DynamicalFormFactor(int n) { return m_pNormalGravity->DynamicalFormFactor(n); } //***************************************************************************** double NormalGravity::AngularVelocity::get() { return m_pNormalGravity->AngularVelocity(); } //***************************************************************************** double NormalGravity::Flattening::get() { return m_pNormalGravity->Flattening(); } //***************************************************************************** double NormalGravity::EquatorialGravity::get() { return m_pNormalGravity->EquatorialGravity(); } //***************************************************************************** double NormalGravity::PolarGravity::get() { return m_pNormalGravity->PolarGravity(); } //***************************************************************************** double NormalGravity::GravityFlattening::get() { return m_pNormalGravity->GravityFlattening(); } //***************************************************************************** double NormalGravity::SurfacePotential::get() { return m_pNormalGravity->SurfacePotential(); } //***************************************************************************** NormalGravity^ NormalGravity::WGS84() { return gcnew NormalGravity( StandardModels::WGS84 ); } //***************************************************************************** NormalGravity^ NormalGravity::GRS80() { return gcnew NormalGravity( StandardModels::GRS80 ); } //***************************************************************************** double NormalGravity::J2ToFlattening(double a, double GM, double omega, double J2) { return GeographicLib::NormalGravity::J2ToFlattening( a, GM, omega, J2); } //***************************************************************************** double NormalGravity::FlatteningToJ2(double a, double GM, double omega, double f) { return GeographicLib::NormalGravity::FlatteningToJ2( a, GM, omega, f); } GeographicLib-1.52/dotnet/NETGeographicLib/NormalGravity.h0000644000771000077100000004277414064202371023345 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/NormalGravity.h * \brief Header for NETGeographicLib::NormalGravity class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class Geocentric; /** * \brief .NET wrapper for GeographicLib::NormalGravity. * * This class allows .NET applications to access GeographicLib::NormalGravity. * * "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; * - Φ, the rotational contribution to the normal potential; * - \e U = V0 + Φ, the total * potential; * - Γ = ∇V0, the acceleration due to * mass of the earth; * - f = ∇Φ, the centrifugal acceleration; * - γ = ∇\e U = Γ + 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. Geodesy 54(3), 395-405 * (1980) https://doi.org/10.1007/BF02521480 * * C# Example: * \include example-NormalGravity.cs * Managed C++ Example: * \include example-NormalGravity.cpp * Visual Basic Example: * \include example-NormalGravity.vb * * INTERFACE DIFFERENCES:
* A constructor has been provided for creating standard WGS84 and GRS80 * gravity models. * * The following functions are implemented as properties: * EquatorialRadius, MassConstant, AngularVelocity, Flattening, * EquatorialGravity, PolarGravity, GravityFlattening, SurfacePotential. **********************************************************************/ public ref class NormalGravity { private: // a pointer to the unmanaged GeographicLib::NormalGravity. const GeographicLib::NormalGravity* m_pNormalGravity; // the finalizer frees the unmanaged memory when the object is destroyed. !NormalGravity(void); public: //! The enumerated standard gravity models. enum class StandardModels { WGS84, //!< WGS84 gravity model. GRS80 //!< GRS80 gravity model. }; /** \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_J2 either the flattening of the ellipsoid \e f or the * the dynamical form factor \e J2. * @param[out] geometricp if true, then \e f_J2 denotes the * flattening, else it denotes the dynamical form factor \e J2. * @exception if \e a is not positive or if the other parameters do not * obey the restrictions given below. * * The shape of the ellipsoid can be given in one of two ways: * - geometrically (\e geomtricp = true), 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. The parameters should * obey \e a > 0, \e f < 1. There are no restrictions on \e GM or * \e omega, in particular, \e GM need not be positive. * - physically (\e geometricp = false), 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. The * parameters should obey \e a > 0, \e GM > 0 and \e J2 < 1/3 * − (omega2a3/GM) * 8/(45π). There is no restriction on \e omega. **********************************************************************/ NormalGravity(double a, double GM, double omega, double f_J2, bool geometricp); /** * A constructor for creating standard gravity models.. * @param[in] model Specifies the desired model. **********************************************************************/ NormalGravity(StandardModels model); /** * A constructor that accepts a GeographicLib::NormalGravity. * For internal use only. * @param g An existing GeographicLib::NormalGravity. **********************************************************************/ NormalGravity( const GeographicLib::NormalGravity& g); ///@} /** * The destructor calls the finalizer. **********************************************************************/ ~NormalGravity() { this->!NormalGravity(); } /** \name Compute the gravity **********************************************************************/ ///@{ /** * Evaluate the gravity on the surface of the ellipsoid. * * @param[in] lat the geographic latitude (degrees). * @return γ 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. **********************************************************************/ double SurfaceGravity(double lat); /** * 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. **********************************************************************/ double Gravity(double lat, double h, [System::Runtime::InteropServices::Out] double% gammay, [System::Runtime::InteropServices::Out] double% gammaz); /** * 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 + Φ the sum of the * gravitational and centrifugal potentials * (m2 s−2). * * The acceleration given by γ = ∇\e U = * ∇V0 + ∇Φ = Γ + f. **********************************************************************/ double U(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% gammaX, [System::Runtime::InteropServices::Out] double% gammaY, [System::Runtime::InteropServices::Out] double% gammaZ); /** * 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. **********************************************************************/ double V0(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% GammaX, [System::Runtime::InteropServices::Out] double% GammaY, [System::Runtime::InteropServices::Out] double% 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 Φ the centrifugal potential (m2 * s−2). * * Φ is independent of \e Z, thus \e fZ = 0. This function * NormalGravity::U sums the results of NormalGravity::V0 and * NormalGravity::Phi. **********************************************************************/ double Phi(double X, double Y, [System::Runtime::InteropServices::Out] double% fX, [System::Runtime::InteropServices::Out] double% fY); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e GM the mass constant of the ellipsoid * (m3 s−2). This is the value used in the * constructor. **********************************************************************/ property double MassConstant { double get(); } /** * @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 n 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). **********************************************************************/ double DynamicalFormFactor(int n); /** * @return ω the angular velocity of the ellipsoid (rad * s−1). This is the value used in the constructor. **********************************************************************/ property double AngularVelocity { double get(); } /** * @return f the flattening of the ellipsoid (\e a − \e b)/\e * a. **********************************************************************/ property double Flattening { double get(); } /** * @return γe the normal gravity at equator (m * s−2). **********************************************************************/ property double EquatorialGravity { double get(); } /** * @return γp the normal gravity at poles (m * s−2). **********************************************************************/ property double PolarGravity { double get(); } /** * @return f* the gravity flattening (γp − * γe) / γe. **********************************************************************/ property double GravityFlattening { double get(); } /** * @return U0 the constant normal potential for the * surface of the ellipsoid (m2 s−2). **********************************************************************/ property double SurfacePotential { double get(); } /** * @return the Geocentric object used by this instance. **********************************************************************/ Geocentric^ Earth(); ///@} /** * A global instantiation of NormalGravity for the WGS84 ellipsoid. **********************************************************************/ static NormalGravity^ WGS84(); /** * A global instantiation of NormalGravity for the GRS80 ellipsoid. **********************************************************************/ static NormalGravity^ GRS80(); /** * Compute the flattening from the dynamical form factor. * * @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] J2 the dynamical form factor. * @return \e f the flattening of the ellipsoid. **********************************************************************/ static double J2ToFlattening(double a, double GM, double omega, double J2); /** * Compute the dynamical form factor from the flattening. * * @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. * @return \e J2 the dynamical form factor. **********************************************************************/ static double FlatteningToJ2(double a, double GM, double omega, double f); }; } //namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/OSGB.cpp0000644000771000077100000001140214064202371021614 0ustar ckarneyckarney/** * \file NETGeographicLib/OSGB.cpp * \brief Implementation for NETGeographicLib::OSGB class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/OSGB.hpp" #include "OSGB.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** void OSGB::Forward(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double lx, ly, lgamma, lk; GeographicLib::OSGB::Forward( lat, lon, lx, ly, lgamma, lk ); x = lx; y = ly; gamma = lgamma; k = lk; } //***************************************************************************** void OSGB::Reverse(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double llat, llon, lgamma, lk; GeographicLib::OSGB::Reverse( x, y, llat, llon, lgamma, lk ); lat = llat; lon = llon; gamma = lgamma; k = lk; } //***************************************************************************** void OSGB::Forward(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y) { double lx, ly; GeographicLib::OSGB::Forward( lat, lon, lx, ly ); x = lx; y = ly; } //***************************************************************************** void OSGB::Reverse(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon; GeographicLib::OSGB::Reverse( x, y, llat, llon ); lat = llat; lon = llon; } //***************************************************************************** void OSGB::GridReference(double x, double y, int prec, [System::Runtime::InteropServices::Out] System::String^% gridref) { try { std::string lgridref; GeographicLib::OSGB::GridReference( x, y, prec, lgridref ); gridref = gcnew System::String( lgridref.c_str() ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Memory allocation error in OSGB::GridReference" ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void OSGB::GridReference(System::String^ gridref, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] int% prec, bool centerp ) { try { double lx, ly; int lprec; GeographicLib::OSGB::GridReference( StringConvert::ManagedToUnmanaged( gridref ), lx, ly, lprec, centerp ); x = lx; y = ly; prec = lprec; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** double OSGB::EquatorialRadius() { return GeographicLib::OSGB::EquatorialRadius(); } //***************************************************************************** double OSGB::Flattening() { return GeographicLib::OSGB::Flattening(); } //***************************************************************************** double OSGB::CentralScale() { return GeographicLib::OSGB::CentralScale(); } //***************************************************************************** double OSGB::OriginLatitude() { return GeographicLib::OSGB::OriginLatitude(); } //***************************************************************************** double OSGB::OriginLongitude() { return GeographicLib::OSGB::OriginLongitude(); } //***************************************************************************** double OSGB::FalseNorthing() { return GeographicLib::OSGB::FalseNorthing(); } //***************************************************************************** double OSGB::FalseEasting() { return GeographicLib::OSGB::FalseEasting(); } GeographicLib-1.52/dotnet/NETGeographicLib/OSGB.h0000644000771000077100000002154414064202371021271 0ustar ckarneyckarney/** * \file NETGeographicLib/OSGB.h * \brief Header for NETGeographicLib::OSGB class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #pragma once namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::OSGB. * * This class allows .NET applications to access GeographicLib::OSGB. * * 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 the 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). * * C# Example: * \include example-OSGB.cs * Managed C++ Example: * \include example-OSGB.cpp * Visual Basic Example: * \include example-OSGB.vb **********************************************************************/ public ref class OSGB { private: // hide the constructor since all member are static OSGB(void) {} 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°]. **********************************************************************/ static void Forward(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * 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(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * OSGB::Forward without returning the convergence and scale. **********************************************************************/ static void Forward(double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y); /** * OSGB::Reverse without returning the convergence and scale. **********************************************************************/ static void Reverse(double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); /** * 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. * @exception GeographicErr if \e prec, \e x, or \e y is outside its * allowed range. * @exception std::bad_alloc if the memory for \e gridref can't be * allocatied. * * \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), 1μm * * The easting must be in the range [−1000 km, 1500 km) and the * northing must be in the range [−500 km, 2000 km). These bounds * are consistent with rules for the letter designations for the grid * system. * * If \e x or \e y is NaN, the returned grid reference is "INVALID". **********************************************************************/ static void GridReference(double x, double y, int prec, [System::Runtime::InteropServices::Out] System::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. * @exception GeographicErr if \e gridref is illegal. * * The grid reference must be of the form: two letters (not including I) * followed by an even number of digits (up to 22). * * If the first 2 characters of \e gridref are "IN", then \e x and \e y are * set to NaN and \e prec is set to −2. **********************************************************************/ static void GridReference(System::String^ gridref, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] int% prec, bool centerp ); /** \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 = * 109.48401603−10 m. (The Airy 1830 value is returned * because the OSGB projection is based on this ellipsoid.) **********************************************************************/ static double EquatorialRadius(); /** * @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 double Flattening(); /** * @return \e k0 central scale for the OSGB projection (0.9996012717). **********************************************************************/ static double CentralScale(); /** * @return latitude of the origin for the OSGB projection (49 degrees). **********************************************************************/ static double OriginLatitude(); /** * @return longitude of the origin for the OSGB projection (−2 * degrees). **********************************************************************/ static double OriginLongitude(); /** * @return false northing the OSGB projection (−100000 meters). **********************************************************************/ static double FalseNorthing(); /** * @return false easting the OSGB projection (400000 meters). **********************************************************************/ static double FalseEasting(); ///@} }; } // GeographicLib-1.52/dotnet/NETGeographicLib/PolarStereographic.cpp0000644000771000077100000001105114064202371024657 0ustar ckarneyckarney/** * \file NETGeographicLib/PolarStereographic.cpp * \brief Implementation for NETGeographicLib::PolarStereographic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/PolarStereographic.hpp" #include "PolarStereographic.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::PolarStereographic"; //***************************************************************************** PolarStereographic::!PolarStereographic(void) { if ( m_pPolarStereographic != NULL ) { delete m_pPolarStereographic; m_pPolarStereographic = NULL; } } //***************************************************************************** PolarStereographic::PolarStereographic(double a, double f, double k0) { try { m_pPolarStereographic = new GeographicLib::PolarStereographic( a, f, k0 ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** PolarStereographic::PolarStereographic() { try { m_pPolarStereographic = new GeographicLib::PolarStereographic( GeographicLib::PolarStereographic::UPS() ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void PolarStereographic::SetScale(double lat, double k) { try { m_pPolarStereographic->SetScale( lat, k ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void PolarStereographic::Forward(bool northp, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double lx, ly, lgamma, lk; m_pPolarStereographic->Forward( northp, lat, lon, lx, ly, lgamma, lk ); x = lx; y = ly; gamma = lgamma; k = lk; } //***************************************************************************** void PolarStereographic::Reverse(bool northp, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double llat, llon, lgamma, lk; m_pPolarStereographic->Reverse( northp, x, y, llat, llon, lgamma, lk ); lat = llat; lon = llon; gamma = lgamma; k = lk; } //***************************************************************************** void PolarStereographic::Forward(bool northp, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y) { double lx, ly; m_pPolarStereographic->Forward( northp, lat, lon, lx, ly ); x = lx; y = ly; } //***************************************************************************** void PolarStereographic::Reverse(bool northp, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon; m_pPolarStereographic->Reverse( northp, x, y, llat, llon ); lat = llat; lon = llon; } //***************************************************************************** double PolarStereographic::EquatorialRadius::get() { return m_pPolarStereographic->EquatorialRadius(); } //***************************************************************************** double PolarStereographic::Flattening::get() { return m_pPolarStereographic->Flattening(); } //***************************************************************************** double PolarStereographic::CentralScale::get() { return m_pPolarStereographic->CentralScale(); } GeographicLib-1.52/dotnet/NETGeographicLib/PolarStereographic.h0000644000771000077100000001713114064202371024331 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/PolarStereographic.h * \brief Header for NETGeographicLib::PolarStereographic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /*! \brief .NET wrapper for GeographicLib::PolarStereographic. This class allows .NET applications to access GeographicLib::PolarStereographic. */ /** * \brief .NET wrapper for GeographicLib::PolarStereographic. * * This class allows .NET applications to access GeographicLib::PolarStereographic. * * 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. * * C# Example: * \include example-PolarStereographic.cs * Managed C++ Example: * \include example-PolarStereographic.cpp * Visual Basic Example: * \include example-PolarStereographic.vb * * INTERFACE DIFFERENCES:
* A default constructor is provided that assumes WGS84 parameters and * a UPS scale factor. * * The EquatorialRadius, Flattening, and CentralScale functions are * implemented as properties. **********************************************************************/ public ref class PolarStereographic { private: // pointer to the unmanaged GeographicLib::PolarStereographic GeographicLib::PolarStereographic* m_pPolarStereographic; // the finalizer frees the unmanaged memory when the object is destroyed. !PolarStereographic(void); 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. * @param[in] k0 central scale factor. * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k0 is * not positive. **********************************************************************/ PolarStereographic(double a, double f, double k0); /** * An instantiation of PolarStereographic with the WGS84 ellipsoid * and the UPS scale factor. **********************************************************************/ PolarStereographic(); /** * The destructor calls the finalizer. **********************************************************************/ ~PolarStereographic() { this->!PolarStereographic(); } /** * Set the scale for the projection. * * @param[in] lat (degrees) assuming \e northp = true. * @param[in] k scale at latitude \e lat * @exception GeographicErr \e k is not positive. * @exception GeographicErr if \e lat is not in (−90°, * 90°] or this object was created with the default constructor. **********************************************************************/ void SetScale(double lat, double k); /** * 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. **********************************************************************/ void Forward(bool northp, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * 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, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * PolarStereographic::Forward without returning the convergence and scale. **********************************************************************/ void Forward(bool northp, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y); /** * PolarStereographic::Reverse without returning the convergence and scale. **********************************************************************/ void Reverse(bool northp, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ property double Flattening { double get(); } /** * 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. **********************************************************************/ property double CentralScale { double get(); } ///@} }; } //namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/PolygonArea.cpp0000644000771000077100000002764714064202371023324 0ustar ckarneyckarney/** * \file NETGeographicLib/PolygonArea.cpp * \brief Implementation for NETGeographicLib::PolygonArea class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/PolygonArea.hpp" #include "PolygonArea.h" #include "Geodesic.h" #include "GeodesicExact.h" #include "Rhumb.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::PolygonArea"; //***************************************************************************** PolygonArea::!PolygonArea(void) { if ( m_pPolygonArea != NULL ) { delete m_pPolygonArea; m_pPolygonArea = NULL; } } //***************************************************************************** PolygonArea::PolygonArea(Geodesic^ earth, bool polyline ) { try { const GeographicLib::Geodesic* pGeodesic = reinterpret_cast( earth->GetUnmanaged()->ToPointer() ); m_pPolygonArea = new GeographicLib::PolygonArea( *pGeodesic, polyline ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** PolygonArea::PolygonArea(const bool polyline ) { try { m_pPolygonArea = new GeographicLib::PolygonArea( GeographicLib::Geodesic::WGS84(), polyline ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void PolygonArea::Clear() { m_pPolygonArea->Clear(); } //***************************************************************************** void PolygonArea::AddPoint(double lat, double lon) { m_pPolygonArea->AddPoint( lat, lon ); } //***************************************************************************** void PolygonArea::AddEdge(double azi, double s) { m_pPolygonArea->AddEdge( azi, s ); } //***************************************************************************** unsigned PolygonArea::Compute(bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) { double lperimeter, larea; unsigned out = m_pPolygonArea->Compute( reverse, sign, lperimeter, larea ); perimeter = lperimeter; area = larea; return out; } //***************************************************************************** unsigned PolygonArea::TestPoint(double lat, double lon, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) { double lperimeter, larea; unsigned out = m_pPolygonArea->TestPoint( lat, lon, reverse, sign, lperimeter, larea ); perimeter = lperimeter; area = larea; return out; } //***************************************************************************** unsigned PolygonArea::TestEdge(double azi, double s, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) { double lperimeter, larea; unsigned out = m_pPolygonArea->TestEdge( azi, s, reverse, sign, lperimeter, larea ); perimeter = lperimeter; area = larea; return out; } //***************************************************************************** void PolygonArea::CurrentPoint( [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon; m_pPolygonArea->CurrentPoint( llat, llon ); lat = llat; lon = llon; } //***************************************************************************** double PolygonArea::EquatorialRadius::get() { return m_pPolygonArea->EquatorialRadius(); } //***************************************************************************** double PolygonArea::Flattening::get() { return m_pPolygonArea->Flattening(); } //***************************************************************************** // PolygonAreaExact //***************************************************************************** PolygonAreaExact::!PolygonAreaExact(void) { if ( m_pPolygonArea != NULL ) { delete m_pPolygonArea; m_pPolygonArea = NULL; } } //***************************************************************************** PolygonAreaExact::PolygonAreaExact(GeodesicExact^ earth, bool polyline ) { try { const GeographicLib::GeodesicExact* pGeodesic = reinterpret_cast( earth->GetUnmanaged()->ToPointer() ); m_pPolygonArea = new GeographicLib::PolygonAreaExact( *pGeodesic, polyline ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** PolygonAreaExact::PolygonAreaExact(const bool polyline ) { try { m_pPolygonArea = new GeographicLib::PolygonAreaExact( GeographicLib::GeodesicExact::WGS84(), polyline ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void PolygonAreaExact::Clear() { m_pPolygonArea->Clear(); } //***************************************************************************** void PolygonAreaExact::AddPoint(double lat, double lon) { m_pPolygonArea->AddPoint( lat, lon ); } //***************************************************************************** void PolygonAreaExact::AddEdge(double azi, double s) { m_pPolygonArea->AddEdge( azi, s ); } //***************************************************************************** unsigned PolygonAreaExact::Compute(bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) { double lperimeter, larea; unsigned out = m_pPolygonArea->Compute( reverse, sign, lperimeter, larea ); perimeter = lperimeter; area = larea; return out; } //***************************************************************************** unsigned PolygonAreaExact::TestPoint(double lat, double lon, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) { double lperimeter, larea; unsigned out = m_pPolygonArea->TestPoint( lat, lon, reverse, sign, lperimeter, larea ); perimeter = lperimeter; area = larea; return out; } //***************************************************************************** unsigned PolygonAreaExact::TestEdge(double azi, double s, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) { double lperimeter, larea; unsigned out = m_pPolygonArea->TestEdge( azi, s, reverse, sign, lperimeter, larea ); perimeter = lperimeter; area = larea; return out; } //***************************************************************************** void PolygonAreaExact::CurrentPoint( [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon; m_pPolygonArea->CurrentPoint( llat, llon ); lat = llat; lon = llon; } //***************************************************************************** double PolygonAreaExact::EquatorialRadius::get() { return m_pPolygonArea->EquatorialRadius(); } //***************************************************************************** double PolygonAreaExact::Flattening::get() { return m_pPolygonArea->Flattening(); } //***************************************************************************** // PolygonAreaRhumb //***************************************************************************** PolygonAreaRhumb::!PolygonAreaRhumb(void) { if ( m_pPolygonArea != NULL ) { delete m_pPolygonArea; m_pPolygonArea = NULL; } } //***************************************************************************** PolygonAreaRhumb::PolygonAreaRhumb(Rhumb^ earth, bool polyline ) { try { const GeographicLib::Rhumb* pGeodesic = reinterpret_cast( earth->GetUnmanaged()->ToPointer() ); m_pPolygonArea = new GeographicLib::PolygonAreaRhumb( *pGeodesic, polyline ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** PolygonAreaRhumb::PolygonAreaRhumb(const bool polyline ) { try { m_pPolygonArea = new GeographicLib::PolygonAreaRhumb( GeographicLib::Rhumb::WGS84(), polyline ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void PolygonAreaRhumb::Clear() { m_pPolygonArea->Clear(); } //***************************************************************************** void PolygonAreaRhumb::AddPoint(double lat, double lon) { m_pPolygonArea->AddPoint( lat, lon ); } //***************************************************************************** void PolygonAreaRhumb::AddEdge(double azi, double s) { m_pPolygonArea->AddEdge( azi, s ); } //***************************************************************************** unsigned PolygonAreaRhumb::Compute(bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) { double lperimeter, larea; unsigned out = m_pPolygonArea->Compute( reverse, sign, lperimeter, larea ); perimeter = lperimeter; area = larea; return out; } //***************************************************************************** unsigned PolygonAreaRhumb::TestPoint(double lat, double lon, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) { double lperimeter, larea; unsigned out = m_pPolygonArea->TestPoint( lat, lon, reverse, sign, lperimeter, larea ); perimeter = lperimeter; area = larea; return out; } //***************************************************************************** unsigned PolygonAreaRhumb::TestEdge(double azi, double s, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area) { double lperimeter, larea; unsigned out = m_pPolygonArea->TestEdge( azi, s, reverse, sign, lperimeter, larea ); perimeter = lperimeter; area = larea; return out; } //***************************************************************************** void PolygonAreaRhumb::CurrentPoint( [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon; m_pPolygonArea->CurrentPoint( llat, llon ); lat = llat; lon = llon; } //***************************************************************************** double PolygonAreaRhumb::EquatorialRadius::get() { return m_pPolygonArea->EquatorialRadius(); } //***************************************************************************** double PolygonAreaRhumb::Flattening::get() { return m_pPolygonArea->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/PolygonArea.h0000644000771000077100000006421414064202371022760 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/PolygonArea.h * \brief Header for NETGeographicLib::PolygonArea class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class Geodesic; /** * \brief .NET wrapper for GeographicLib::PolygonArea and PolygonAreaExact. * * This class allows .NET applications to access GeographicLib::PolygonArea. * * This computes the area of a geodesic polygon using the method given * Section 6 of * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * geod-addenda.html. * * 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. * * C# Example: * \include example-PolygonArea.cs * Managed C++ Example: * \include example-PolygonArea.cpp * Visual Basic Example: * \include example-PolygonArea.vb * * INTERFACE DIFFERENCES:
* The EquatorialRadius and Flattening functions are implemented as properties. **********************************************************************/ public ref class PolygonArea { private: // a pointer to the unmanaged GeographicLib::PolygonArea GeographicLib::PolygonArea* m_pPolygonArea; // the finalize frees the unmanaged memory when the object is destroyed. !PolygonArea(void); public: /** * Constructor for PolygonArea. * * @param[in] earth the Geodesic object to use for geodesic calculations. * @param[in] polyline if true that treat the points as defining a polyline * instead of a polygon. **********************************************************************/ PolygonArea(Geodesic^ earth, bool polyline ); /** * Constructor for PolygonArea that assumes a WGS84 ellipsoid. * * @param[in] polyline if true that treat the points as defining a polyline * instead of a polygon. **********************************************************************/ PolygonArea(const bool polyline ); /** * The destructor calls the finalizer. **********************************************************************/ ~PolygonArea() { this->!PolygonArea(); } /** * Clear PolygonArea, allowing a new polygon to be started. **********************************************************************/ void Clear(); /** * Add a point to the polygon or polyline. * * @param[in] lat the latitude of the point (degrees). * @param[in] lon the longitude of the point (degrees). * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ void AddPoint(double lat, double lon); /** * Add an edge to the polygon or polyline. * * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to next point (meters). * * This does nothing if no points have been added yet. Use * PolygonArea::CurrentPoint to determine the position of the new * vertex. **********************************************************************/ void AddEdge(double azi, double s); /** * 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 (meters2); only set * if \e polyline is false in the constructor. * @return the number of points. **********************************************************************/ unsigned Compute(bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area); /** * 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 PolygonArea::AddPoint and PolygonArea::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 * (meters2); only set if polyline is false in the * constructor. * @return the number of points. * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ unsigned TestPoint(double lat, double lon, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area); /** * Return the results assuming a tentative final test point is added via an * azimuth and distance; 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 PolygonArea::AddEdge and * PolygonArea::Compute are used. * * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to final test point (meters). * @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 * (meters2); only set if polyline is false in the * constructor. * @return the number of points. **********************************************************************/ unsigned TestEdge(double azi, double s, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area); /** \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. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ property double Flattening { double get(); } /** * Report the previous vertex added to the polygon or polyline. * * @param[out] lat the latitude of the point (degrees). * @param[out] lon the longitude of the point (degrees). * * If no points have been added, then NaNs are returned. Otherwise, \e lon * will be in the range [−180°, 180°). **********************************************************************/ void CurrentPoint([System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); ///@} }; //************************************************************************* // PolygonAreaExact //************************************************************************* ref class GeodesicExact; public ref class PolygonAreaExact { private: // a pointer to the unmanaged GeographicLib::PolygonArea GeographicLib::PolygonAreaExact* m_pPolygonArea; // the finalize frees the unmanaged memory when the object is destroyed. !PolygonAreaExact(void); public: /** * Constructor for PolygonArea. * * @param[in] earth the Geodesic object to use for geodesic calculations. * @param[in] polyline if true that treat the points as defining a polyline * instead of a polygon. **********************************************************************/ PolygonAreaExact(GeodesicExact^ earth, bool polyline ); /** * Constructor for PolygonArea that assumes a WGS84 ellipsoid. * * @param[in] polyline if true that treat the points as defining a polyline * instead of a polygon. **********************************************************************/ PolygonAreaExact(const bool polyline ); /** * The destructor calls the finalizer. **********************************************************************/ ~PolygonAreaExact() { this->!PolygonAreaExact(); } /** * Clear PolygonArea, allowing a new polygon to be started. **********************************************************************/ void Clear(); /** * Add a point to the polygon or polyline. * * @param[in] lat the latitude of the point (degrees). * @param[in] lon the longitude of the point (degrees). * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ void AddPoint(double lat, double lon); /** * Add an edge to the polygon or polyline. * * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to next point (meters). * * This does nothing if no points have been added yet. Use * PolygonArea::CurrentPoint to determine the position of the new * vertex. **********************************************************************/ void AddEdge(double azi, double s); /** * 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 (meters2); only set * if \e polyline is false in the constructor. * @return the number of points. **********************************************************************/ unsigned Compute(bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area); /** * 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 PolygonArea::AddPoint and PolygonArea::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 * (meters2); only set if polyline is false in the * constructor. * @return the number of points. * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ unsigned TestPoint(double lat, double lon, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area); /** * Return the results assuming a tentative final test point is added via an * azimuth and distance; 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 PolygonArea::AddEdge and * PolygonArea::Compute are used. * * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to final test point (meters). * @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 * (meters2); only set if polyline is false in the * constructor. * @return the number of points. **********************************************************************/ unsigned TestEdge(double azi, double s, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area); /** \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. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ property double Flattening { double get(); } /** * Report the previous vertex added to the polygon or polyline. * * @param[out] lat the latitude of the point (degrees). * @param[out] lon the longitude of the point (degrees). * * If no points have been added, then NaNs are returned. Otherwise, \e lon * will be in the range [−180°, 180°). **********************************************************************/ void CurrentPoint([System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); ///@} }; //************************************************************************* // PolygonAreaRhumb //************************************************************************* ref class Rhumb; public ref class PolygonAreaRhumb { private: // a pointer to the unmanaged GeographicLib::PolygonArea GeographicLib::PolygonAreaRhumb* m_pPolygonArea; // the finalize frees the unmanaged memory when the object is destroyed. !PolygonAreaRhumb(void); public: /** * Constructor for PolygonArea. * * @param[in] earth the Geodesic object to use for geodesic calculations. * @param[in] polyline if true that treat the points as defining a polyline * instead of a polygon. **********************************************************************/ PolygonAreaRhumb(Rhumb^ earth, bool polyline ); /** * Constructor for PolygonArea that assumes a WGS84 ellipsoid. * * @param[in] polyline if true that treat the points as defining a polyline * instead of a polygon. **********************************************************************/ PolygonAreaRhumb(const bool polyline ); /** * The destructor calls the finalizer. **********************************************************************/ ~PolygonAreaRhumb() { this->!PolygonAreaRhumb(); } /** * Clear PolygonArea, allowing a new polygon to be started. **********************************************************************/ void Clear(); /** * Add a point to the polygon or polyline. * * @param[in] lat the latitude of the point (degrees). * @param[in] lon the longitude of the point (degrees). * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ void AddPoint(double lat, double lon); /** * Add an edge to the polygon or polyline. * * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to next point (meters). * * This does nothing if no points have been added yet. Use * PolygonArea::CurrentPoint to determine the position of the new * vertex. **********************************************************************/ void AddEdge(double azi, double s); /** * 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 (meters2); only set * if \e polyline is false in the constructor. * @return the number of points. **********************************************************************/ unsigned Compute(bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area); /** * 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 PolygonArea::AddPoint and PolygonArea::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 * (meters2); only set if polyline is false in the * constructor. * @return the number of points. * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ unsigned TestPoint(double lat, double lon, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area); /** * Return the results assuming a tentative final test point is added via an * azimuth and distance; 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 PolygonArea::AddEdge and * PolygonArea::Compute are used. * * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to final test point (meters). * @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 * (meters2); only set if polyline is false in the * constructor. * @return the number of points. **********************************************************************/ unsigned TestEdge(double azi, double s, bool reverse, bool sign, [System::Runtime::InteropServices::Out] double% perimeter, [System::Runtime::InteropServices::Out] double% area); /** \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. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ property double Flattening { double get(); } /** * Report the previous vertex added to the polygon or polyline. * * @param[out] lat the latitude of the point (degrees). * @param[out] lon the longitude of the point (degrees). * * If no points have been added, then NaNs are returned. Otherwise, \e lon * will be in the range [−180°, 180°). **********************************************************************/ void CurrentPoint([System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/ReadMe.txt0000644000771000077100000000304114064202371022254 0ustar ckarneyckarney======================================================================== DYNAMIC LINK LIBRARY : NETGeographic Project Overview ======================================================================== AppWizard has created this NETGeographic DLL for you. This file contains a summary of what you will find in each of the files that make up your NETGeographic application. NETGeographic.vcxproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and information about the platforms, configurations, and project features selected with the Application Wizard. NETGeographic.vcxproj.filters This is the filters file for VC++ projects generated using an Application Wizard. It contains information about the association between the files in your project and the filters. This association is used in the IDE to show grouping of files with similar extensions under a specific node (for e.g. ".cpp" files are associated with the "Source Files" filter). NETGeographic.cpp This is the main DLL source file. NETGeographic.h This file contains a class declaration. AssemblyInfo.cpp Contains custom attributes for modifying assembly metadata. ///////////////////////////////////////////////////////////////////////////// Other notes: AppWizard uses "TODO:" to indicate parts of the source code you should add to or customize. ///////////////////////////////////////////////////////////////////////////// GeographicLib-1.52/dotnet/NETGeographicLib/Rhumb.cpp0000644000771000077100000002007514064202371022145 0ustar ckarneyckarney/** * \file NETGeographicLib/Rhumb.cpp * \brief Implementation for NETGeographicLib::Rhumb and NETGeographicLib::RhumbLine class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/Rhumb.hpp" #include "Rhumb.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** Rhumb::!Rhumb(void) { if ( m_pRhumb != NULL ) { delete m_pRhumb; m_pRhumb = NULL; } } //***************************************************************************** Rhumb::Rhumb(double a, double f, bool exact) { try { m_pRhumb = new GeographicLib::Rhumb( a, f, exact ); } catch ( GeographicLib::GeographicErr& err ) { throw gcnew GeographicErr( err.what() ); } catch ( std::bad_alloc ) { throw gcnew System::Exception("Failed to allocate memory for a Rhumb."); } } //***************************************************************************** void Rhumb::Direct(double lat1, double lon1, double azi12, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12) { double ilat2, ilon2, iS12; m_pRhumb->Direct( lat1, lon1, azi12, s12, ilat2, ilon2, iS12 ); lat2 = ilat2; lon2 = ilon2; S12 = iS12; } //***************************************************************************** void Rhumb::Direct(double lat1, double lon1, double azi12, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double ilat2, ilon2; m_pRhumb->Direct( lat1, lon1, azi12, s12, ilat2, ilon2 ); lat2 = ilat2; lon2 = ilon2; } //***************************************************************************** void Rhumb::GenDirect(double lat1, double lon1, double azi12, double s12, Rhumb::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12) { double ilat2, ilon2, iS12; unsigned int iMask = (unsigned int)outmask; m_pRhumb->GenDirect( lat1, lon1, azi12, s12, iMask, ilat2, ilon2, iS12 ); lat2 = ilat2; lon2 = ilon2; S12 = iS12; } //***************************************************************************** void Rhumb::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12, [System::Runtime::InteropServices::Out] double% S12) { double is12, iazi12, iS12; m_pRhumb->Inverse( lat1, lon1, lat2, lon2, is12, iazi12, iS12 ); s12 = is12; azi12 = iazi12; S12 = iS12; } //***************************************************************************** void Rhumb::Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12) { double is12, iazi12; m_pRhumb->Inverse( lat1, lon1, lat2, lon2, is12, iazi12 ); s12 = is12; azi12 = iazi12; } //***************************************************************************** void Rhumb::GenInverse(double lat1, double lon1, double lat2, double lon2, Rhumb::mask outmask, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12, [System::Runtime::InteropServices::Out] double% S12) { double is12, iazi12, iS12; unsigned int iMask = (unsigned int)outmask; m_pRhumb->GenInverse( lat1, lon1, lat2, lon2, iMask, is12, iazi12, iS12 ); s12 = is12; azi12 = iazi12; S12 = iS12; } //***************************************************************************** RhumbLine^ Rhumb::Line(double lat1, double lon1, double azi12) { return gcnew RhumbLine( new GeographicLib::RhumbLine(m_pRhumb->Line( lat1, lon1, azi12 )) ); } //***************************************************************************** double Rhumb::EquatorialRadius::get() { return m_pRhumb->EquatorialRadius(); } //***************************************************************************** double Rhumb::Flattening::get() { return m_pRhumb->Flattening(); } //***************************************************************************** double Rhumb::EllipsoidArea::get() { return m_pRhumb->EllipsoidArea(); } //***************************************************************************** Rhumb^ Rhumb::WGS84() { return gcnew Rhumb( GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f(), false ); } //***************************************************************************** System::IntPtr^ Rhumb::GetUnmanaged() { return gcnew System::IntPtr( const_cast(reinterpret_cast(m_pRhumb)) ); } //***************************************************************************** // RhumbLine functions //***************************************************************************** RhumbLine::!RhumbLine(void) { if ( m_pRhumbLine != NULL ) { delete m_pRhumbLine; m_pRhumbLine = NULL; } } //***************************************************************************** RhumbLine::RhumbLine( GeographicLib::RhumbLine* pRhumbLine ) { if ( pRhumbLine == NULL ) throw gcnew System::Exception("Invalid pointer in RhumbLine constructor."); m_pRhumbLine = pRhumbLine; } //***************************************************************************** void RhumbLine::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12) { double ilat2, ilon2, iS12; m_pRhumbLine->Position( s12, ilat2, ilon2, iS12); lat2 = ilat2; lon2 = ilon2; S12 = iS12; } //***************************************************************************** void RhumbLine::Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2) { double ilat2, ilon2; m_pRhumbLine->Position( s12, ilat2, ilon2 ); lat2 = ilat2; lon2 = ilon2; } //***************************************************************************** void RhumbLine::GenPosition(double s12, RhumbLine::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12) { double ilat2, ilon2, iS12; unsigned int iMask = (unsigned int)outmask; m_pRhumbLine->GenPosition( s12, iMask, ilat2, ilon2, iS12); lat2 = ilat2; lon2 = ilon2; S12 = iS12; } //***************************************************************************** double RhumbLine::Latitude::get() { return m_pRhumbLine->Latitude(); } //***************************************************************************** double RhumbLine::Longitude::get() { return m_pRhumbLine->Longitude(); } //***************************************************************************** double RhumbLine::Azimuth::get() { return m_pRhumbLine->Azimuth(); } //***************************************************************************** double RhumbLine::EquatorialRadius::get() { return m_pRhumbLine->EquatorialRadius(); } //***************************************************************************** double RhumbLine::Flattening::get() { return m_pRhumbLine->Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/Rhumb.h0000644000771000077100000005746014064202371021622 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/Rhumb.h * \brief Header for NETGeographicLib::Rhumb and NETGeographicLib::RhumbLine classes * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class RhumbLine; /** * \brief .NET wrapper for GeographicLib::Rhumb. * * This class allows .NET applications to access GeographicLib::Rhumb. * * Solve of the direct and inverse rhumb problems. * * The path of constant azimuth between two points on a ellipsoid at (\e * lat1, \e lon1) and (\e lat2, \e lon2) is called the rhumb line (also * called the loxodrome). Its length is \e s12 and its azimuth is \e azi12. * (The azimuth is the heading measured clockwise from north.) * * Given \e lat1, \e lon1, \e azi12, and \e s12, we can determine \e lat2, * and \e lon2. This is the \e direct rhumb problem and its solution is * given by the function Rhumb::Direct. * * Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi12 * and \e s12. This is the \e inverse rhumb problem, whose solution is given * by Rhumb::Inverse. This finds the shortest such rhumb line, i.e., the one * that wraps no more than half way around the earth. If the end points are * on opposite meridians, there are two shortest rhumb lines and the * east-going one is chosen. * * These routines also optionally calculate the area under the rhumb line, \e * S12. This is the area, measured counter-clockwise, of the rhumb line * quadrilateral with corners (lat1,lon1), (0,lon1), * (0,lon2), and (lat2,lon2). * * Note that rhumb lines may be appreciably longer (up to 50%) than the * corresponding Geodesic. For example the distance between London Heathrow * and Tokyo Narita via the rhumb line is 11400 km which is 18% longer than * the geodesic distance 9600 km. * * For more information on rhumb lines see \ref rhumb. * * For more information on rhumb lines see \ref rhumb. * * C# Example: * \include example-Rhumb.cs * Managed C++ Example: * \include example-Rhumb.cpp * Visual Basic Example: * \include example-Rhumb.vb * * INTERFACE DIFFERENCES:
* The EquatorialRadius and Flattening functions are implemented as properties. **********************************************************************/ public ref class Rhumb { private: // pointer to the unmanaged Rhumb object GeographicLib::Rhumb* m_pRhumb; // The finalizer destroys m_pRhumb when this object is destroyed. !Rhumb(void); public: /** * Bit masks for what calculations to do. They specify which results to * return in the general routines Rhumb::GenDirect and Rhumb::GenInverse * routines. RhumbLine::mask is a duplication of this enum. **********************************************************************/ enum class mask { /** * No output. * @hideinitializer **********************************************************************/ NONE = 0U, /** * Calculate latitude \e lat2. * @hideinitializer **********************************************************************/ LATITUDE = 1U<<7, /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8, /** * Calculate azimuth \e azi12. * @hideinitializer **********************************************************************/ AZIMUTH = 1U<<9, /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10, /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14, /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, /** * Calculate everything. (LONG_UNROLL is not included in this mask.) * @hideinitializer **********************************************************************/ ALL = 0x7F80U, }; /** * 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. * @param[in] exact if true (the default) use an addition theorem for * elliptic integrals to compute divided differences; otherwise use * series expansion (accurate for |f| < 0.01). * @exception GeographicErr if \e a or (1 − \e f) \e a is not * positive. * * See \ref rhumb, for a detailed description of the \e exact parameter. **********************************************************************/ Rhumb(double a, double f, bool exact); /** * \brief The destructor calls the finalizer. **********************************************************************/ ~Rhumb() { this->!Rhumb(); } /** * Solve the direct rhumb problem returning also the area. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi12 azimuth of the rhumb line (degrees). * @param[in] s12 distance between point 1 and point 2 (meters); it can be * negative. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees). * @param[out] S12 area under the rhumb line (meters2). * * \e lat1 should be in the range [−90°, 90°]. The value of * \e lon2 returned is in the range [−180°, 180°). * * If point 1 is a pole, the cosine of its latitude is taken to be * 1/ε2 (where ε is 2-52). This * position, which is extremely close to the actual pole, allows the * calculation to be carried out in finite terms. If \e s12 is large * enough that the rhumb line crosses a pole, the longitude of point 2 * is indeterminate (a NaN is returned for \e lon2 and \e S12). **********************************************************************/ void Direct(double lat1, double lon1, double azi12, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12); /** * Solve the direct rhumb problem without the area. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi12 azimuth of the rhumb line (degrees). * @param[in] s12 distance between point 1 and point 2 (meters); it can be * negative. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees). * * \e lat1 should be in the range [−90°, 90°]. The values of * \e lon2 and \e azi2 returned are in the range [−180°, * 180°). * * If point 1 is a pole, the cosine of its latitude is taken to be * 1/ε2 (where ε is 2-52). This * position, which is extremely close to the actual pole, allows the * calculation to be carried out in finite terms. If \e s12 is large * enough that the rhumb line crosses a pole, the longitude of point 2 * is indeterminate (a NaN is returned for \e lon2). **********************************************************************/ void Direct(double lat1, double lon1, double azi12, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * The general direct rhumb problem. Rhumb::Direct 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] azi12 azimuth of the rhumb line (degrees). * @param[in] s12 distance between point 1 and point 2 (meters); it can be * negative. * @param[in] outmask a bitor'ed combination of Rhumb::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] S12 area under the rhumb line (meters2). * * The Rhumb::mask values possible for \e outmask are * - \e outmask |= Rhumb.LATITUDE for the latitude \e lat2; * - \e outmask |= Rhumb.LONGITUDE for the latitude \e lon2; * - \e outmask |= Rhumb.AREA for the area \e S12; * - \e outmask |= Rhumb:.ALL for all of the above; * - \e outmask |= Rhumb.LONG_UNROLL to unroll \e lon2 instead of * wrapping it into the range [−180°, 180°). * . * With the LONG_UNROLL bit set, the quantity \e lon2 − \e lon1 * indicates how many times the rhumb line wrapped around the ellipsoid. **********************************************************************/ void GenDirect(double lat1, double lon1, double azi12, double s12, Rhumb::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12); /** * Solve the inverse rhumb problem returning also the area. * * @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 rhumb distance between point 1 and point 2 (meters). * @param[out] azi12 azimuth of the rhumb line (degrees). * @param[out] S12 area under the rhumb line (meters2). * * The shortest rhumb line is found. If the end points are on opposite * meridians, there are two shortest rhumb lines and the east-going one is * chosen. \e lat1 and \e lat2 should be in the range [−90°, * 90°]. The value of \e azi12 returned is in the range * [−180°, 180°). * * If either point is a pole, the cosine of its latitude is taken to be * 1/ε2 (where ε is 2-52). This * position, which is extremely close to the actual pole, allows the * calculation to be carried out in finite terms. **********************************************************************/ void Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12, [System::Runtime::InteropServices::Out] double% S12); /** * Solve the inverse rhumb problem without the area. * * @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 rhumb distance between point 1 and point 2 (meters). * @param[out] azi12 azimuth of the rhumb line (degrees). * * The shortest rhumb line is found. \e lat1 and \e lat2 should be in the * range [−90°, 90°]. The value of \e azi12 returned is in * the range [−180°, 180°). * * If either point is a pole, the cosine of its latitude is taken to be * 1/ε2 (where ε is 2-52). This * position, which is extremely close to the actual pole, allows the * calculation to be carried out in finite terms. **********************************************************************/ void Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12); /** * The general inverse rhumb problem. Rhumb::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 Rhumb::mask values * specifying which of the following parameters should be set. * @param[out] s12 rhumb distance between point 1 and point 2 (meters). * @param[out] azi12 azimuth of the rhumb line (degrees). * @param[out] S12 area under the rhumb line (meters2). * * The Rhumb::mask values possible for \e outmask are * - \e outmask |= Rhumb::DISTANCE for the latitude \e s12; * - \e outmask |= Rhumb::AZIMUTH for the latitude \e azi12; * - \e outmask |= Rhumb::AREA for the area \e S12; * - \e outmask |= Rhumb::ALL for all of the above; **********************************************************************/ void GenInverse(double lat1, double lon1, double lat2, double lon2, Rhumb::mask outmask, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12, [System::Runtime::InteropServices::Out] double% S12); /** * Set up to compute several points on a single rhumb line. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi12 azimuth of the rhumb line (degrees). * @return a RhumbLine object. * * \e lat1 should be in the range [−90°, 90°]. * * If point 1 is a pole, the cosine of its latitude is taken to be * 1/ε2 (where ε is 2-52). This * position, which is extremely close to the actual pole, allows the * calculation to be carried out in finite terms. **********************************************************************/ RhumbLine^ Line(double lat1, double lon1, double azi12); /** \name Inspector functions. **********************************************************************/ ///@{ /** * @return the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ property double Flattening { double get(); } /** * @return the area of the ellipsoid. **********************************************************************/ property double EllipsoidArea { double get(); } /** * %return The unmanaged pointer to the GeographicLib::Geodesic. * * This function is for internal use only. **********************************************************************/ System::IntPtr^ GetUnmanaged(); /** * A global instantiation of Rhumb with the parameters for the WGS84 * ellipsoid. **********************************************************************/ static Rhumb^ WGS84(); }; /** * \brief .NET wrapper for GeographicLib::RhumbLine. * * This class allows .NET applications to access GeographicLib::RhumbLine. * * Find a sequence of points on a single rhumb line. * * RhumbLine facilitates the determination of a series of points on a single * rhumb line. The starting point (\e lat1, \e lon1) and the azimuth \e * azi12 are specified in the call to Rhumb::Line which returns a RhumbLine * object. RhumbLine.Position returns the location of point 2 a distance \e * s12 along the rhumb line. * There is no public constructor for this class. (Use Rhumb::Line to create * an instance.) The Rhumb object used to create a RhumbLine must stay in * scope as long as the RhumbLine. * **********************************************************************/ public ref class RhumbLine { private: // pointer to the unmanaged RhumbLine object. GeographicLib::RhumbLine* m_pRhumbLine; // The finalizer destroys m_pRhumbLine when this object is destroyed. !RhumbLine(void); public: enum class mask { /** * No output. * @hideinitializer **********************************************************************/ NONE = 0, //NETGeographicLib::Rhumb::NONE, /** * Calculate latitude \e lat2. * @hideinitializer **********************************************************************/ LATITUDE = 1U<<7, //Rhumb::LATITUDE, /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8, //Rhumb::LONGITUDE, /** * Calculate azimuth \e azi12. * @hideinitializer **********************************************************************/ AZIMUTH = 1U<<9, //Rhumb::AZIMUTH, /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10, //Rhumb::DISTANCE, /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14, //Rhumb::AREA, /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, //Rhumb::LONG_UNROLL, /** * Calculate everything. (LONG_UNROLL is not included in this mask.) * @hideinitializer **********************************************************************/ ALL = 0x7F80U, //Rhumb::ALL, }; /** * \brief Constructor. * * For internal use only. Developers should not call this constructor * directly. Use the Rhumb::Line function to create RhumbLine objects. **********************************************************************/ RhumbLine( GeographicLib::RhumbLine* pRhumbLine ); /** * \brief The destructor calls the finalizer. **********************************************************************/ ~RhumbLine() { this->!RhumbLine(); } /** * Compute the position of point 2 which is a distance \e s12 (meters) from * point 1. The area is also computed. * * @param[in] s12 distance between point 1 and point 2 (meters); it can be * negative. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees). * @param[out] S12 area under the rhumb line (meters2). * * The value of \e lon2 returned is in the range [−180°, * 180°). * * If \e s12 is large enough that the rhumb line crosses a pole, the * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 and * \e S12). **********************************************************************/ void Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12); /** * 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 * negative. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees). * * The values of \e lon2 and \e azi2 returned are in the range * [−180°, 180°). * * If \e s12 is large enough that the rhumb line crosses a pole, the * longitude of point 2 is indeterminate (a NaN is returned for \e lon2). **********************************************************************/ void Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2); /** * The general position routine. RhumbLine::Position is defined in term so * this function. * * @param[in] s12 distance between point 1 and point 2 (meters); it can be * negative. * @param[in] outmask a bitor'ed combination of RhumbLine::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] S12 area under the rhumb line (meters2). * * The RhumbLine::mask values possible for \e outmask are * - \e outmask |= RhumbLine::LATITUDE for the latitude \e lat2; * - \e outmask |= RhumbLine::LONGITUDE for the latitude \e lon2; * - \e outmask |= RhumbLine::AREA for the area \e S12; * - \e outmask |= RhumbLine::ALL for all of the above; * - \e outmask |= RhumbLine::LONG_UNROLL to unroll \e lon2 instead of * wrapping it into the range [−180°, 180°). * . * With the LONG_UNROLL bit set, the quantity \e lon2 − \e lon1 * indicates how many times and in what sense the rhumb line encircles the * ellipsoid. * * If \e s12 is large enough that the rhumb line crosses a pole, the * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 and * \e S12). **********************************************************************/ void GenPosition(double s12, RhumbLine::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return the latitude of point 1 (degrees). **********************************************************************/ property double Latitude { double get(); } /** * @return the longitude of point 1 (degrees). **********************************************************************/ property double Longitude { double get(); } /** * @return the azimuth of the rhumb line (degrees). **********************************************************************/ property double Azimuth { double get(); } /** * @return the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Rhumb object used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return the flattening of the ellipsoid. This is the value * inherited from the Rhumb object used in the constructor. **********************************************************************/ property double Flattening { double get(); } }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/SphericalCoefficients.cpp0000644000771000077100000000217414064202371025324 0ustar ckarneyckarney/** * \file NETGeographicLib/SphericalCoefficients.cpp * \brief Implementation for NETGeographicLib::SphericalCoefficients class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/SphericalEngine.hpp" #include "SphericalCoefficients.h" using namespace NETGeographicLib; //***************************************************************************** SphericalCoefficients::SphericalCoefficients(const GeographicLib::SphericalEngine::coeff& c) { m_N = c.N(); m_nmx = c.nmx(); m_mmx = c.mmx(); int csize = Csize( c.nmx(), c.mmx() ); int ssize = Ssize( c.nmx(), c.mmx() ); int offset = csize - ssize; m_C = gcnew array( csize ); m_S = gcnew array( ssize ); for ( int i = 0; i < csize; i++ ) m_C[i] = c.Cv(i); for ( int i = 0; i < ssize; i++ ) m_S[i] = c.Sv(i+offset); } GeographicLib-1.52/dotnet/NETGeographicLib/SphericalCoefficients.h0000644000771000077100000001327014064202371024770 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/SphericalCoefficients.h * \brief Header for NETGeographicLib::SphericalCoefficients class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /*! \brief .NET wrapper for GeographicLib::SphericalEngine::coeff. This class allows .NET applications to access GeographicLib::SphericalEngine::coeff. The SphericalHarmonic classes provide accessor functions that allow you to examine the coefficients. These accessor functions export a GeographicLib::SphericalEngine::coeff object. The GeographicLib::SphericalEngine class is not implemented in NETGeographicLib. SphericalCoefficients is provided as a substitute for GeographicLib::SphericalEngine::coeff allowing you to examine the coefficients in .NET applications. Use SphericalHarmonic::Coefficients, SphericalHarmonic1::Coefficient*, or SphericalHarmonic2::Coefficient* to obtain an instance of this class. INTERFACE DIFFERENCES:
This class does not implement readcoeffs. */ public ref class SphericalCoefficients { private: // The cosine coefficients. array^ m_C; // size = Csize(m_nmx,m_mmx) // The sine coefficients array^ m_S; // size = Ssize(m_nmx,m_mmx) // The dimension of the coefficients int m_N; int m_nmx; int m_mmx; public: /*! \brief Constructor. \param[in] c A reference to a GeographicLib::SphericalEngine::coeff object. This constructor is for internal use only. Developers should not create an instance of SphericalCoefficients. Use SphericalHarmonic::Coefficients, SphericalHarmonic1::Coefficient*, or SphericalHarmonic2::Coefficient* to obtain an instance of this class. */ SphericalCoefficients( const GeographicLib::SphericalEngine::coeff& c ); /** * @return \e N the degree giving storage layout for \e C and \e S. **********************************************************************/ property int N { int get() { return m_N; } } /** * @return \e nmx the maximum degree to be used. **********************************************************************/ property int nmx { int get() { return m_nmx; } } /** * @return \e mmx the maximum order to be used. **********************************************************************/ property int mmx { int get() { return m_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. **********************************************************************/ int index(int n, int m) { return m * 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. **********************************************************************/ double Cv(int k) { return m_C[k]; } /** * An element of \e S. * * @param[in] k the one-dimensional index. * @return the value of the \e S coefficient. **********************************************************************/ double Sv(int k) { return m_S[k - (m_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. **********************************************************************/ double Cv(int k, int n, int m, double f) { return m > m_mmx || n > m_nmx ? 0 : m_C[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. **********************************************************************/ double Sv(int k, int n, int m, double f) { return m > m_mmx || n > m_nmx ? 0 : m_S[k - (m_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 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 int Ssize(int N, int M) { return Csize(N, M) - (N + 1); } }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/SphericalHarmonic.cpp0000644000771000077100000000765114064202371024470 0ustar ckarneyckarney/** * \file NETGeographicLib/SphericalHarmonic.cpp * \brief Implementation for NETGeographicLib::SphericalHarmonic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/SphericalHarmonic.hpp" #include "SphericalHarmonic.h" #include "CircularEngine.h" #include "SphericalCoefficients.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::SphericalHarmonic"; //***************************************************************************** SphericalHarmonic::!SphericalHarmonic(void) { if ( m_pSphericalHarmonic != NULL ) { delete m_pSphericalHarmonic; m_pSphericalHarmonic = NULL; } if ( m_C != NULL ) { delete m_C; m_C = NULL; } if ( m_S != NULL ) { delete m_S; m_S = NULL; } } //***************************************************************************** SphericalHarmonic::SphericalHarmonic(array^ C, array^ S, int N, double a, Normalization norm ) { try { m_C = new std::vector(); m_S = new std::vector(); for each ( double x in C ) m_C->push_back(x); for each ( double x in S ) m_S->push_back(x); m_pSphericalHarmonic = new GeographicLib::SphericalHarmonic( *m_C, *m_S, N, a, static_cast(norm) ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } catch ( System::Exception^ sxpt ) { throw gcnew GeographicErr( sxpt->Message ); } } //***************************************************************************** SphericalHarmonic::SphericalHarmonic(array^ C, array^ S, int N, int nmx, int mmx, double a, Normalization norm) { try { m_C = new std::vector(); m_S = new std::vector(); for each ( double x in C ) m_C->push_back(x); for each ( double x in S ) m_S->push_back(x); m_pSphericalHarmonic = new GeographicLib::SphericalHarmonic( *m_C, *m_S, N, nmx, mmx, a, static_cast(norm) ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& xcpt ) { throw gcnew GeographicErr( xcpt.what() ); } catch ( System::Exception^ sxpt ) { throw gcnew GeographicErr( sxpt->Message ); } } //***************************************************************************** double SphericalHarmonic::HarmonicSum(double x, double y, double z) { return m_pSphericalHarmonic->operator()( x, y, z ); } //***************************************************************************** double SphericalHarmonic::HarmonicSum(double x, double y, double z, double% gradx, double% grady, double% gradz) { double lx, ly, lz; double out = m_pSphericalHarmonic->operator()( x, y, z, lx, ly, lz ); gradx = lx; grady = ly; gradz = lz; return out; } //***************************************************************************** CircularEngine^ SphericalHarmonic::Circle(double p, double z, bool gradp) { return gcnew CircularEngine( m_pSphericalHarmonic->Circle( p, z, gradp ) ); } //***************************************************************************** SphericalCoefficients^ SphericalHarmonic::Coefficients() { return gcnew SphericalCoefficients( m_pSphericalHarmonic->Coefficients() ); } GeographicLib-1.52/dotnet/NETGeographicLib/SphericalHarmonic.h0000644000771000077100000003170714064202371024134 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/SphericalHarmonic.h * \brief Header for NETGeographicLib::SphericalHarmonic class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class CircularEngine; ref class SphericalCoefficients; /** * \brief .NET wrapper for GeographicLib::SphericalHarmonic. * * This class allows .NET applications to access GeographicLib::SphericalHarmonic. * * 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, * - θ = atan2(\e p, \e z) = the spherical \e colatitude, * - λ = 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 GeographicLib::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. Geodesy 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). * * C# Example: * \include example-SphericalHarmonic.cs * Managed C++ Example: * \include example-SphericalHarmonic.cpp * Visual Basic Example: * \include example-SphericalHarmonic.vb * * INTERFACE DIFFERENCES:
* This class replaces the GeographicLib::SphericalHarmonic::operator() with * HarmonicSum. * * Coefficients returns a SphericalCoefficients object. * * The Normalization parameter in the constructors is passed in as an * enumeration rather than an unsigned. **********************************************************************/ public ref class SphericalHarmonic { private: // a pointer to the unmanaged GeographicLib::SphericalHarmonic const GeographicLib::SphericalHarmonic* m_pSphericalHarmonic; // the finalizer frees the unmanaged memory when the object is destroyed. !SphericalHarmonic(); // local containers for the cosine and sine coefficients. The // GeographicLib::SphericalEngine::coeffs class uses a // std::vector::iterator to access these vectors. std::vector *m_C, *m_S; public: /** * Supported normalizations for the associated Legendre polynomials. **********************************************************************/ enum class 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) https://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θ) * cos(mλ) and * Pnmfull(cosθ) * sin(mλ) over the sphere is 1. * * @hideinitializer **********************************************************************/ FULL = GeographicLib::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) https://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θ) * cos(mλ) and * Pnmschmidt(cosθ) * sin(mλ) over the sphere is 1/(2\e n + 1). * * @hideinitializer **********************************************************************/ SCHMIDT = GeographicLib::SphericalEngine::SCHMIDT, }; /** * 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. * @exception GeographicErr if \e N does not satisfy \e N ≥ −1. * @exception GeographicErr if \e C or \e S is not big enough to hold the * coefficients. * * 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(array^ C, array^ S, int N, double a, Normalization norm ); /** * 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. * @exception GeographicErr if \e N, \e nmx, and \e mmx do not satisfy * \e N ≥ \e nmx ≥ \e mmx ≥ −1. * @exception GeographicErr if \e C or \e S is not big enough to hold the * coefficients. * * 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(array^ C, array^ S, int N, int nmx, int mmx, double a, Normalization norm); /** * The destructor calls the finalizer **********************************************************************/ ~SphericalHarmonic() { this->!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. **********************************************************************/ double HarmonicSum(double x, double y, double z); /** * 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. **********************************************************************/ double HarmonicSum(double x, double y, double z, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% gradz); /** * 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. * @exception std::bad_alloc if the memory for the CircularEngine can't be * allocated. * @return the CircularEngine object. * * SphericalHarmonic::operator()() exchanges the order of the sums in the * definition, i.e., ∑n = 0..Nm = 0..n * becomes ∑m = 0..Nn = 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). **********************************************************************/ CircularEngine^ Circle(double p, double z, bool gradp); /** * @return the zeroth SphericalCoefficients object. **********************************************************************/ SphericalCoefficients^ Coefficients(); }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/SphericalHarmonic1.cpp0000644000771000077100000001417114064202371024544 0ustar ckarneyckarney/** * \file NETGeographicLib/SphericalHarmonic1.cpp * \brief Implementation for NETGeographicLib::SphericalHarmonic1 class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/SphericalHarmonic1.hpp" #include "SphericalHarmonic1.h" #include "CircularEngine.h" #include "SphericalCoefficients.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::SphericalHarmonic1"; //***************************************************************************** SphericalHarmonic1::!SphericalHarmonic1(void) { if ( m_pSphericalHarmonic1 != NULL ) { delete m_pSphericalHarmonic1; m_pSphericalHarmonic1 = NULL; } if ( m_C != NULL ) { for ( int i = 0; i < m_numCoeffVectors; i++ ) if ( m_C[i] != NULL ) delete m_C[i]; delete [] m_C; m_C = NULL; } if ( m_S != NULL ) { for ( int i = 0; i < m_numCoeffVectors; i++ ) if ( m_S[i] != NULL ) delete m_S[i]; delete [] m_S; m_S = NULL; } } //***************************************************************************** SphericalHarmonic1::SphericalHarmonic1( array^ C, array^ S, int N, array^ C1, array^ S1, int N1, double a, Normalization norm ) { try { m_C = new std::vector*[m_numCoeffVectors]; for ( int i = 0; i < m_numCoeffVectors; i++ ) m_C[i] = new std::vector(); m_S = new std::vector*[m_numCoeffVectors]; for ( int i = 0; i < m_numCoeffVectors; i++ ) m_S[i] = new std::vector(); for each ( double x in C ) m_C[0]->push_back( x ); for each ( double x in S ) m_S[0]->push_back( x ); for each ( double x in C1 ) m_C[1]->push_back( x ); for each ( double x in S1 ) m_S[1]->push_back( x ); m_pSphericalHarmonic1 = new GeographicLib::SphericalHarmonic1( *m_C[0], *m_S[0], N, *m_C[1], *m_S[1], N1, a, (unsigned)norm ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } catch ( System::Exception^ sxpt ) { throw gcnew GeographicErr( sxpt->Message ); } } //***************************************************************************** SphericalHarmonic1::SphericalHarmonic1( array^ C, array^ S, int N, int nmx, int mmx, array^ C1, array^ S1, int N1, int nmx1, int mmx1, double a, Normalization norm ) { try { m_C = new std::vector*[m_numCoeffVectors]; for ( int i = 0; i < m_numCoeffVectors; i++ ) m_C[i] = new std::vector(); m_S = new std::vector*[m_numCoeffVectors]; for ( int i = 0; i < m_numCoeffVectors; i++ ) m_S[i] = new std::vector(); for each ( double x in C ) m_C[0]->push_back( x ); for each ( double x in S ) m_S[0]->push_back( x ); for each ( double x in C1 ) m_C[1]->push_back( x ); for each ( double x in S1 ) m_S[1]->push_back( x ); m_pSphericalHarmonic1 = new GeographicLib::SphericalHarmonic1( *m_C[0], *m_S[0], N, nmx, mmx, *m_C[1], *m_S[1], N1, nmx1, mmx1, a, (unsigned)norm ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } catch ( System::Exception^ sxpt ) { throw gcnew GeographicErr( sxpt->Message ); } } //***************************************************************************** double SphericalHarmonic1::HarmonicSum(double tau, double x, double y, double z) { return m_pSphericalHarmonic1->operator()( tau, x, y, z ); } //***************************************************************************** double SphericalHarmonic1::HarmonicSum(double tau, double x, double y, double z, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% gradz) { double lgradx, lgrady, lgradz; double out = m_pSphericalHarmonic1->operator()( tau, x, y, z, lgradx, lgrady, lgradz ); gradx = lgradx; grady = lgrady; gradz = lgradz; return out; } //***************************************************************************** CircularEngine^ SphericalHarmonic1::Circle(double tau, double p, double z, bool gradp) { try { return gcnew CircularEngine( m_pSphericalHarmonic1->Circle( tau, p, z, gradp ) ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Failed to allocate memory for a CircularEngine in SphericalHarmonic1::Circle" ); } } //***************************************************************************** SphericalCoefficients^ SphericalHarmonic1::Coefficients() { return gcnew SphericalCoefficients( m_pSphericalHarmonic1->Coefficients() ); } //***************************************************************************** SphericalCoefficients^ SphericalHarmonic1::Coefficients1() { return gcnew SphericalCoefficients( m_pSphericalHarmonic1->Coefficients1() ); } GeographicLib-1.52/dotnet/NETGeographicLib/SphericalHarmonic1.h0000644000771000077100000002520514064202371024211 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/SphericalHarmonic1.h * \brief Header for NETGeographicLib::SphericalHarmonic1 class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class SphericalCoefficients; ref class CircularEngine; /** * \brief .NET wrapper for GeographicLib::SphericalHarmonic1. * * This class allows .NET applications to access GeographicLib::SphericalHarmonic1. * * This class 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). * * C# Example: * \include example-SphericalHarmonic1.cs * Managed C++ Example: * \include example-SphericalHarmonic1.cpp * Visual Basic Example: * \include example-SphericalHarmonic1.vb * * INTERFACE DIFFERENCES:
* This class replaces the () operator with HarmonicSum(). * * Coefficients returns a SphericalCoefficients object. **********************************************************************/ public ref class SphericalHarmonic1 { private: // pointer to the unmanaged GeographicLib::SphericalHarmonic1. const GeographicLib::SphericalHarmonic1* m_pSphericalHarmonic1; // the finalizer destroys the unmanaged memory when the object is destroyed. !SphericalHarmonic1(void); // the number of coefficient vectors. static const int m_numCoeffVectors = 2; // local containers for the cosine and sine coefficients. The // GeographicLib::SphericalEngine::coeffs class uses a // std::vector::iterator to access these vectors. std::vector **m_C, **m_S; public: /** * Supported normalizations for associate Legendre polynomials. **********************************************************************/ enum class Normalization { /** * Fully normalized associated Legendre polynomials. See * SphericalHarmonic::FULL for documentation. * * @hideinitializer **********************************************************************/ FULL = GeographicLib::SphericalEngine::FULL, /** * Schmidt semi-normalized associated Legendre polynomials. See * SphericalHarmonic::SCHMIDT for documentation. * * @hideinitializer **********************************************************************/ SCHMIDT = GeographicLib::SphericalEngine::SCHMIDT, }; /** * 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. * @exception GeographicErr if \e N and \e N1 do not satisfy \e N ≥ * \e N1 ≥ −1. * @exception GeographicErr if any of the vectors of coefficients is not * large enough. * * See SphericalHarmonic for the way the coefficients should be stored. * * 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(array^ C, array^ S, int N, array^ C1, array^ S1, int N1, double a, Normalization norm ); /** * 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. * @exception GeographicErr if the parameters do not satisfy \e N ≥ \e * nmx ≥ \e mmx ≥ −1; \e N1 ≥ \e nmx1 ≥ \e mmx1 ≥ * −1; \e N ≥ \e N1; \e nmx ≥ \e nmx1; \e mmx ≥ \e mmx1. * @exception GeographicErr if any of the vectors of coefficients is not * large enough. * * 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(array^ C, array^ S, int N, int nmx, int mmx, array^ C1, array^ S1, int N1, int nmx1, int mmx1, double a, Normalization norm ); /** * The destructor calls the finalizer. **********************************************************************/ ~SphericalHarmonic1() { this->!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. **********************************************************************/ double HarmonicSum(double tau, double x, double y, double z); /** * 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. **********************************************************************/ double HarmonicSum(double tau, double x, double y, double z, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% gradz); /** * 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. * @exception std::bad_alloc if the memory for the CircularEngine can't be * allocated. * @return the CircularEngine object. * * SphericalHarmonic1::operator()() exchanges the order of the sums in the * definition, i.e., ∑n = 0..Nm = 0..n * becomes ∑m = 0..Nn = 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). * * See SphericalHarmonic::Circle for an example of its use. **********************************************************************/ CircularEngine^ Circle(double tau, double p, double z, bool gradp); /** * @return the zeroth SphericalCoefficients object. **********************************************************************/ SphericalCoefficients^ Coefficients(); /** * @return the first SphericalCoefficients object. **********************************************************************/ SphericalCoefficients^ Coefficients1(); }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/SphericalHarmonic2.cpp0000644000771000077100000001602414064202371024544 0ustar ckarneyckarney/** * \file NETGeographicLib/SphericalHarmonic2.cpp * \brief Implementation for NETGeographicLib::SphericalHarmonic2 class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/SphericalHarmonic2.hpp" #include "SphericalHarmonic2.h" #include "CircularEngine.h" #include "SphericalCoefficients.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::SphericalHarmonic2"; //***************************************************************************** SphericalHarmonic2::!SphericalHarmonic2(void) { if ( m_pSphericalHarmonic2 != NULL ) { delete m_pSphericalHarmonic2; m_pSphericalHarmonic2 = NULL; } if ( m_C != NULL ) { for ( int i = 0; i < m_numCoeffVectors; i++ ) if ( m_C[i] != NULL ) delete m_C[i]; delete [] m_C; m_C = NULL; } if ( m_S != NULL ) { for ( int i = 0; i < m_numCoeffVectors; i++ ) if ( m_S[i] != NULL ) delete m_S[i]; delete [] m_S; m_S = NULL; } } //***************************************************************************** SphericalHarmonic2::SphericalHarmonic2(array^ C, array^ S, int N, array^ C1, array^ S1, int N1, array^ C2, array^ S2, int N2, double a, Normalization norm ) { try { m_C = new std::vector*[m_numCoeffVectors]; for ( int i = 0; i < m_numCoeffVectors; i++ ) m_C[i] = new std::vector(); m_S = new std::vector*[m_numCoeffVectors]; for ( int i = 0; i < m_numCoeffVectors; i++ ) m_S[i] = new std::vector(); for each ( double x in C ) m_C[0]->push_back( x ); for each ( double x in S ) m_S[0]->push_back( x ); for each ( double x in C1 ) m_C[1]->push_back( x ); for each ( double x in S1 ) m_S[1]->push_back( x ); for each ( double x in C2 ) m_C[2]->push_back( x ); for each ( double x in S2 ) m_S[2]->push_back( x ); m_pSphericalHarmonic2 = new GeographicLib::SphericalHarmonic2( *m_C[0], *m_S[0], N, *m_C[1], *m_S[1], N1, *m_C[2], *m_S[2], N2, a, (unsigned)norm); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } catch ( System::Exception^ sxpt ) { throw gcnew GeographicErr( sxpt->Message ); } } //***************************************************************************** SphericalHarmonic2::SphericalHarmonic2(array^ C, array^ S, int N, int nmx, int mmx, array^ C1, array^ S1, int N1, int nmx1, int mmx1, array^ C2, array^ S2, int N2, int nmx2, int mmx2, double a, Normalization norm ) { try { m_C = new std::vector*[m_numCoeffVectors]; for ( int i = 0; i < m_numCoeffVectors; i++ ) m_C[i] = new std::vector(); m_S = new std::vector*[m_numCoeffVectors]; for ( int i = 0; i < m_numCoeffVectors; i++ ) m_S[i] = new std::vector(); for each ( double x in C ) m_C[0]->push_back( x ); for each ( double x in S ) m_S[0]->push_back( x ); for each ( double x in C1 ) m_C[1]->push_back( x ); for each ( double x in S1 ) m_S[1]->push_back( x ); for each ( double x in C2 ) m_C[2]->push_back( x ); for each ( double x in S2 ) m_S[2]->push_back( x ); m_pSphericalHarmonic2 = new GeographicLib::SphericalHarmonic2( *m_C[0], *m_S[0], N, nmx, mmx, *m_C[1], *m_S[1], N1, nmx1, mmx1, *m_C[2], *m_S[2], N2, nmx2, mmx2, a, (unsigned)norm ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } catch ( System::Exception^ sxpt ) { throw gcnew GeographicErr( sxpt->Message ); } } //***************************************************************************** double SphericalHarmonic2::HarmonicSum(double tau1, double tau2, double x, double y, double z) { return m_pSphericalHarmonic2->operator()( tau1, tau2, x, y, z ); } //***************************************************************************** double SphericalHarmonic2::HarmonicSum(double tau1, double tau2, double x, double y, double z, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% gradz) { double lgradx, lgrady, lgradz; double out = m_pSphericalHarmonic2->operator()( tau1, tau2, x, y, z, lgradx, lgrady, lgradz ); gradx = lgradx; grady = lgrady; gradz = lgradz; return out; } //***************************************************************************** CircularEngine^ SphericalHarmonic2::Circle(double tau1, double tau2, double p, double z, bool gradp) { try { return gcnew CircularEngine( m_pSphericalHarmonic2->Circle( tau1, tau2, p, z, gradp ) ); } catch ( std::bad_alloc ) { throw gcnew GeographicErr( "Memory allocation error in SphericalHarmonic2::Circle" ); } } //***************************************************************************** SphericalCoefficients^ SphericalHarmonic2::Coefficients() { return gcnew SphericalCoefficients( m_pSphericalHarmonic2->Coefficients() ); } //***************************************************************************** SphericalCoefficients^ SphericalHarmonic2::Coefficients1() { return gcnew SphericalCoefficients( m_pSphericalHarmonic2->Coefficients1() ); } //***************************************************************************** SphericalCoefficients^ SphericalHarmonic2::Coefficients2() { return gcnew SphericalCoefficients( m_pSphericalHarmonic2->Coefficients2() ); } GeographicLib-1.52/dotnet/NETGeographicLib/SphericalHarmonic2.h0000644000771000077100000003053414064202371024213 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/SphericalHarmonic2.h * \brief Header for NETGeographicLib::SphericalHarmonic2 class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { ref class CircularEngine; ref class SphericalCoefficients; /** * \brief .NET wrapper for GeographicLib::SphericalHarmonic2. * * This class allows .NET applications to access GeographicLib::SphericalHarmonic2. * * This class 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). * * C# Example: * \include example-SphericalHarmonic2.cs * Managed C++ Example: * \include example-SphericalHarmonic2.cpp * Visual Basic Example: * \include example-SphericalHarmonic2.vb * * INTERFACE DIFFERENCES:
* This class replaces the () operator with HarmonicSum(). * * Coefficients, Coefficients1, and Coefficients2 return a SphericalCoefficients * object. **********************************************************************/ public ref class SphericalHarmonic2 { private: // pointer to the unmanaged GeographicLib::SphericalHarmonic2 const GeographicLib::SphericalHarmonic2* m_pSphericalHarmonic2; // the finalizer destroys the unmanaged memory when the object is destroyed. !SphericalHarmonic2(void); // the number of coefficient vectors. static const int m_numCoeffVectors = 3; // local containers for the cosine and sine coefficients. The // GeographicLib::SphericalEngine::coeffs class uses a // std::vector::iterator to access these vectors. std::vector **m_C, **m_S; public: /** * Supported normalizations for associate Legendre polynomials. **********************************************************************/ enum class Normalization { /** * Fully normalized associated Legendre polynomials. See * SphericalHarmonic::FULL for documentation. * * @hideinitializer **********************************************************************/ FULL = GeographicLib::SphericalEngine::FULL, /** * Schmidt semi-normalized associated Legendre polynomials. See * SphericalHarmonic::SCHMIDT for documentation. * * @hideinitializer **********************************************************************/ SCHMIDT = GeographicLib::SphericalEngine::SCHMIDT }; /** * 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. * @exception GeographicErr if \e N and \e N1 do not satisfy \e N ≥ * \e N1 ≥ −1, and similarly for \e N2. * @exception GeographicErr if any of the vectors of coefficients is not * large enough. * * 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(array^ C, array^ S, int N, array^ C1, array^ S1, int N1, array^ C2, array^ S2, int N2, double a, Normalization norm ); /** * 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. * @exception GeographicErr if the parameters do not satisfy \e N ≥ \e * nmx ≥ \e mmx ≥ −1; \e N1 ≥ \e nmx1 ≥ \e mmx1 ≥ * −1; \e N ≥ \e N1; \e nmx ≥ \e nmx1; \e mmx ≥ \e mmx1; * and similarly for \e N2, \e nmx2, and \e mmx2. * @exception GeographicErr if any of the vectors of coefficients is not * large enough. * * 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(array^ C, array^ S, int N, int nmx, int mmx, array^ C1, array^ S1, int N1, int nmx1, int mmx1, array^ C2, array^ S2, int N2, int nmx2, int mmx2, double a, Normalization norm ); /** * The destructor calls the finalizer. **********************************************************************/ ~SphericalHarmonic2() { this->!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. **********************************************************************/ double HarmonicSum(double tau1, double tau2, double x, double y, double z); /** * 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. **********************************************************************/ double HarmonicSum(double tau1, double tau2, double x, double y, double z, [System::Runtime::InteropServices::Out] double% gradx, [System::Runtime::InteropServices::Out] double% grady, [System::Runtime::InteropServices::Out] double% gradz); /** * 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. * @exception std::bad_alloc if the memory for the CircularEngine can't be * allocated. * @return the CircularEngine object. * * SphericalHarmonic2::operator()() exchanges the order of the sums in the * definition, i.e., ∑n = 0..Nm = 0..n * becomes ∑m = 0..Nn = 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). * * See SphericalHarmonic::Circle for an example of its use. **********************************************************************/ CircularEngine^ Circle(double tau1, double tau2, double p, double z, bool gradp); /** * @return the zeroth SphericalCoefficients object. **********************************************************************/ SphericalCoefficients^ Coefficients(); /** * @return the first SphericalCoefficients object. **********************************************************************/ SphericalCoefficients^ Coefficients1(); /** * @return the second SphericalCoefficients object. **********************************************************************/ SphericalCoefficients^ Coefficients2(); }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/TransverseMercator.cpp0000644000771000077100000001031014064202371024710 0ustar ckarneyckarney/** * \file NETGeographicLib/TransverseMercator.cpp * \brief Implementation for NETGeographicLib::TransverseMercator class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/TransverseMercator.hpp" #include "TransverseMercator.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::TransverseMercator"; //***************************************************************************** TransverseMercator::!TransverseMercator(void) { if ( m_pTransverseMercator != NULL ) { delete m_pTransverseMercator; m_pTransverseMercator = NULL; } } //***************************************************************************** TransverseMercator::TransverseMercator(double a, double f, double k0) { try { m_pTransverseMercator = new GeographicLib::TransverseMercator( a, f, k0 ); } catch (std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } catch (std::exception err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** TransverseMercator::TransverseMercator() { try { m_pTransverseMercator = new GeographicLib::TransverseMercator( GeographicLib::TransverseMercator::UTM() ); } catch (std::bad_alloc ) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void TransverseMercator::Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double lx, ly, lgamma, lk; m_pTransverseMercator->Forward( lon0, lat, lon, lx, ly, lgamma, lk ); x = lx; y = ly; gamma = lgamma; k = lk; } //***************************************************************************** void TransverseMercator::Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double llat, llon, lgamma, lk; m_pTransverseMercator->Reverse( lon0, x, y, llat, llon, lgamma, lk ); lat = llat; lon = llon; gamma = lgamma; k = lk; } //***************************************************************************** void TransverseMercator::Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y) { double lx, ly; m_pTransverseMercator->Forward( lon0, lat, lon, lx, ly ); x = lx; y = ly; } //***************************************************************************** void TransverseMercator::Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon; m_pTransverseMercator->Reverse( lon0, x, y, llat, llon ); lat = llat; lon = llon; } //***************************************************************************** double TransverseMercator::EquatorialRadius::get() { return m_pTransverseMercator->EquatorialRadius(); } //***************************************************************************** double TransverseMercator::Flattening::get() { return m_pTransverseMercator->Flattening(); } //***************************************************************************** double TransverseMercator::CentralScale::get() { return m_pTransverseMercator->CentralScale(); } GeographicLib-1.52/dotnet/NETGeographicLib/TransverseMercator.h0000644000771000077100000002134014064202371024362 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/TransverseMercator.h * \brief Header for NETGeographicLib::TransverseMercator class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::TransverseMercator. * * This class allows .NET applications to access GeographicLib::TransverseMercator. * * 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 2 * × 10−15" and the relative error in the scale * is 6 − 10−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 GeographicLib::TransverseMercator.cpp for more information on the * implementation. * * See \ref transversemercator for a discussion of this projection. * * C# Example: * \include example-TransverseMercator.cs * Managed C++ Example: * \include example-TransverseMercator.cpp * Visual Basic Example: * \include example-TransverseMercator.vb * * INTERFACE DIFFERENCES:
* A default constructor is provided that assumes WGS84 parameters and * a UTM scale factor. * * The EquatorialRadius, Flattening, and CentralScale functions are * implemented as properties. **********************************************************************/ public ref class TransverseMercator { private: // pointer to the unmanaged GeographicLib::TransverseMercator. const GeographicLib::TransverseMercator* m_pTransverseMercator; // the finalizer frees the unmanaged memory when the object is destroyed. !TransverseMercator(void); 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. * @param[in] k0 central scale factor. * @exception GeographicErr if \e a, (1 − \e f ) \e a, or \e k0 is * not positive. **********************************************************************/ TransverseMercator(double a, double f, double k0); /** * The default constructor assumes a WGS84 ellipsoid and a UTM scale * factor. **********************************************************************/ TransverseMercator(); /** * The destructor calls the finalizer. **********************************************************************/ ~TransverseMercator() { this->!TransverseMercator(); } /** * 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°]. **********************************************************************/ void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * 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. The value of \e lon returned * is in the range [−180°, 180°). **********************************************************************/ void Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * TransverseMercator::Forward without returning the convergence and scale. **********************************************************************/ void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y); /** * TransverseMercator::Reverse without returning the convergence and scale. **********************************************************************/ void Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ property double Flattening { double get(); } /** * @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. **********************************************************************/ property double CentralScale { double get(); } ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/TransverseMercatorExact.cpp0000644000771000077100000001077314064202371025712 0ustar ckarneyckarney/** * \file NETGeographicLib/TransverseMercatorExact.cpp * \brief Implementation for NETGeographicLib::TransverseMercatorExact class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/TransverseMercatorExact.hpp" #include "TransverseMercatorExact.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; const char BADALLOC[] = "Unable to allocate memory for a GeographicLib::TransverseMercatorExact"; //***************************************************************************** TransverseMercatorExact::!TransverseMercatorExact(void) { if ( m_pTransverseMercatorExact != NULL ) { delete m_pTransverseMercatorExact; m_pTransverseMercatorExact = NULL; } } //***************************************************************************** TransverseMercatorExact::TransverseMercatorExact(double a, double f, double k0, bool extendp) { try { m_pTransverseMercatorExact = new GeographicLib::TransverseMercatorExact( a, f, k0, extendp ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } catch ( std::exception err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** TransverseMercatorExact::TransverseMercatorExact() { try { m_pTransverseMercatorExact = new GeographicLib::TransverseMercatorExact( GeographicLib::TransverseMercatorExact::UTM() ); } catch (std::bad_alloc) { throw gcnew GeographicErr( BADALLOC ); } } //***************************************************************************** void TransverseMercatorExact::Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double lx, ly, lgamma, lk; m_pTransverseMercatorExact->Forward( lon0, lat, lon, lx, ly, lgamma, lk ); x = lx; y = ly; gamma = lgamma; k = lk; } //***************************************************************************** void TransverseMercatorExact::Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k) { double llat, llon, lgamma, lk; m_pTransverseMercatorExact->Reverse( lon0, x, y, llat, llon, lgamma, lk ); lat = llat; lon = llon; gamma = lgamma; k = lk; } //***************************************************************************** void TransverseMercatorExact::Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y) { double lx, ly; m_pTransverseMercatorExact->Forward( lon0, lat, lon, lx, ly ); x = lx; y = ly; } //***************************************************************************** void TransverseMercatorExact::Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon) { double llat, llon; m_pTransverseMercatorExact->Reverse( lon0, x, y, llat, llon ); lat = llat; lon = llon; } //***************************************************************************** double TransverseMercatorExact::EquatorialRadius::get() { return m_pTransverseMercatorExact->EquatorialRadius(); } //***************************************************************************** double TransverseMercatorExact::Flattening::get() { return m_pTransverseMercatorExact->Flattening(); } //***************************************************************************** double TransverseMercatorExact::CentralScale::get() { return m_pTransverseMercatorExact->CentralScale(); } GeographicLib-1.52/dotnet/NETGeographicLib/TransverseMercatorExact.h0000644000771000077100000002701014064202371025347 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/TransverseMercatorExact.h * \brief Header for NETGeographicLib::TransverseMercatorExact class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::TransverseMercatorExact. * * This class allows .NET applications to access GeographicLib::TransverseMercatorExact. * * 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 2 × 10−15", * the relative error in the scale is 7 × 10−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 GeographicLib::TransverseMercatorExact.cpp for more information on the * implementation. * * See \ref transversemercator for a discussion of this projection. * * C# Example: * \include example-TransverseMercatorExact.cs * Managed C++ Example: * \include example-TransverseMercatorExact.cpp * Visual Basic Example: * \include example-TransverseMercatorExact.vb * * INTERFACE DIFFERENCES:
* A default constructor is provided that assumes WGS84 parameters and * a UTM scale factor. * * The EquatorialRadius, Flattening, and CentralScale functions are * implemented as properties. **********************************************************************/ public ref class TransverseMercatorExact { private: // a pointer to the unmanaged GeographicLib::TransverseMercatorExact. GeographicLib::TransverseMercatorExact* m_pTransverseMercatorExact; // the finalizer frees the unmanaged memory when the object is destroyed. !TransverseMercatorExact(void); public: /** * Constructor for a ellipsoid with * * @param[in] a equatorial radius (meters). * @param[in] f flattening of ellipsoid. * @param[in] k0 central scale factor. * @param[in] extendp use extended domain. * @exception GeographicErr if \e a, \e f, or \e k0 is not positive. * * 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 \e x > 18381 km, \e 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°, \e lon = 88°. * * 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, ∞) and * y/(\e k0 \e a) in [0, E(e2)] * - x/(\e k0 \e a) in [K(1 − e2) − * E(1 − e2), ∞) and y/(\e k0 \e * a) in (−∞, 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::epsilon(). However, TransverseMercator treats the * sphere exactly. **********************************************************************/ TransverseMercatorExact(double a, double f, double k0, bool extendp ); /** * The default constructor assumes a WGS84 ellipsoid and a UTM scale * factor. **********************************************************************/ TransverseMercatorExact(); /** * The destructor calls the finalizer. **********************************************************************/ ~TransverseMercatorExact() { this->!TransverseMercatorExact(); } /** * 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°]. **********************************************************************/ void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * 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. The value of \e lon returned * is in the range [−180°, 180°). **********************************************************************/ void Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k); /** * TransverseMercatorExact::Forward without returning the convergence and * scale. **********************************************************************/ void Forward(double lon0, double lat, double lon, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y); /** * TransverseMercatorExact::Reverse without returning the convergence and * scale. **********************************************************************/ void Reverse(double lon0, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ property double EquatorialRadius { double get(); } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ property double Flattening { double get(); } /** * @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. **********************************************************************/ property double CentralScale { double get(); } ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/UTMUPS.cpp0000644000771000077100000001630514064202371022126 0ustar ckarneyckarney/** * \file NETGeographicLib/UTMUPS.cpp * \brief Implementation for NETGeographicLib::UTMUPS class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include "stdafx.h" #include "GeographicLib/UTMUPS.hpp" #include "UTMUPS.h" #include "NETGeographicLib.h" using namespace NETGeographicLib; //***************************************************************************** int UTMUPS::StandardZone(double lat, double lon, int setzone) { try { return GeographicLib::UTMUPS::StandardZone( lat, lon, setzone ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void UTMUPS::Forward(double lat, double lon, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k, int setzone, bool mgrslimits) { try { int lzone; bool lnorthp; double lx, ly, lgamma, lk; GeographicLib::UTMUPS::Forward(lat, lon, lzone, lnorthp, lx, ly, lgamma, lk, setzone, mgrslimits); zone = lzone; northp = lnorthp; x = lx; y = ly; gamma = lgamma; k = lk; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void UTMUPS::Reverse(int zone, bool northp, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k, bool mgrslimits) { try { double llat, llon, lgamma, lk; GeographicLib::UTMUPS::Reverse( zone, northp, x, y, llat, llon, lgamma, lk, mgrslimits ); lat = llat; lon = llon; gamma = lgamma; k = lk; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void UTMUPS::Forward(double lat, double lon, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, int setzone, bool mgrslimits ) { try { double gamma, k, lx, ly; bool lnorthp; int lzone; GeographicLib::UTMUPS::Forward(lat, lon, lzone, lnorthp, lx, ly, gamma, k, setzone, mgrslimits); x = lx; y = ly; zone = lzone; northp = lnorthp; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void UTMUPS::Reverse(int zone, bool northp, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, bool mgrslimits) { try { double gamma, k, llat, llon; GeographicLib::UTMUPS::Reverse(zone, northp, x, y, llat, llon, gamma, k, mgrslimits); lat = llat; lon = llon; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void UTMUPS::Transfer(int zonein, bool northpin, double xin, double yin, int zoneout, bool northpout, [System::Runtime::InteropServices::Out] double% xout, [System::Runtime::InteropServices::Out] double% yout, [System::Runtime::InteropServices::Out] int% zone) { try { int lzone; double lxout, lyout; GeographicLib::UTMUPS::Transfer(zonein, northpin, xin, yin, zoneout, northpout, lxout, lyout, lzone); xout = lxout; yout = lyout; zone = lzone; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void UTMUPS::DecodeZone(System::String^ zonestr, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp) { try { std::string zoneIn = StringConvert::ManagedToUnmanaged( zonestr ); int lzone; bool lnorthp; GeographicLib::UTMUPS::DecodeZone( zoneIn, lzone, lnorthp ); zone = lzone; northp = lnorthp; } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** System::String^ UTMUPS::EncodeZone(int zone, bool northp, bool abbrev) { try { return StringConvert::UnmanagedToManaged( GeographicLib::UTMUPS::EncodeZone( zone, northp, abbrev ) ); } catch ( const std::exception& err ) { throw gcnew GeographicErr( err.what() ); } } //***************************************************************************** void UTMUPS::DecodeEPSG(int epsg, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp) { int lzone; bool lnorthp; GeographicLib::UTMUPS::DecodeEPSG( epsg, lzone, lnorthp ); zone = lzone; northp = lnorthp; } //***************************************************************************** int UTMUPS::EncodeEPSG(int zone, bool northp) { return GeographicLib::UTMUPS::EncodeEPSG( zone, northp ); } //**************************************************************************** double UTMUPS::UTMShift() { return GeographicLib::UTMUPS::UTMShift(); } //**************************************************************************** double UTMUPS::EquatorialRadius() { return GeographicLib::UTMUPS::EquatorialRadius(); } //**************************************************************************** double UTMUPS::Flattening() { return GeographicLib::UTMUPS::Flattening(); } GeographicLib-1.52/dotnet/NETGeographicLib/UTMUPS.h0000644000771000077100000005061514064202371021575 0ustar ckarneyckarney#pragma once /** * \file NETGeographicLib/UTMUPS.h * \brief Header for NETGeographicLib::UTMUPS class * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ namespace NETGeographicLib { /** * \brief .NET wrapper for GeographicLib::UTMUPS. * * This class allows .NET applications to access GeographicLib::UTMUPS. * * 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. * * C# Example: * \include example-UTMUPS.cs * Managed C++ Example: * \include example-UTMUPS.cpp * Visual Basic Example: * \include example-UTMUPS.vb * **********************************************************************/ public ref class UTMUPS { private: // hide the constructor since all members of the class are static. UTMUPS() {} 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 class 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 (use ZoneSpec.STANDARD as default). If * omitted, use the standard rules for picking the zone. If \e setzone * is given then use that zone if it is non-negative, otherwise apply the * rules given in UTMUPS::zonespec. * @exception GeographicErr if \e setzone is outside the range * [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZONE] = [−4, 60]. * * This is exact. **********************************************************************/ static int StandardZone(double lat, double lon, int setzone); /** * 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 (use ZoneSpec.STANDARD as default). * @param[in] mgrslimits if true enforce the stricter MGRS limits on the * coordinates (default = false). * @exception GeographicErr if \e lat is not in [−90°, * 90°]. * @exception GeographicErr if the resulting \e x or \e y is out of allowed * range (see Reverse); in this case, these arguments are unchanged. * * If \e setzone is omitted, use the standard rules for picking the zone. * If \e setzone is given then use that zone if it is non-negative, * otherwise apply the rules given in UTMUPS::zonespec. The accuracy of * the conversion is about 5nm. * * The northing \e y jumps by UTMUPS::UTMShift() when crossing the equator * in the southerly direction. Sometimes it is useful to remove this * discontinuity in \e y by extending the "northern" hemisphere using * UTMUPS::Transfer: * \code double lat = -1, lon = 123; int zone; bool northp; double x, y, gamma, k; GeographicLib::UTMUPS::Forward(lat, lon, zone, northp, x, y, gamma, k); GeographicLib::UTMUPS::Transfer(zone, northp, x, y, zone, true, x, y, zone); northp = true; \endcode **********************************************************************/ static void Forward(double lat, double lon, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k, int setzone, bool mgrslimits); /** * 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). * @exception GeographicErr if \e zone, \e x, or \e y is out of allowed * range; this this 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, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% gamma, [System::Runtime::InteropServices::Out] double% k, bool mgrslimits); /** * UTMUPS::Forward without returning convergence and scale. **********************************************************************/ static void Forward(double lat, double lon, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp, [System::Runtime::InteropServices::Out] double% x, [System::Runtime::InteropServices::Out] double% y, int setzone, bool mgrslimits ); /** * UTMUPS::Reverse without returning convergence and scale. **********************************************************************/ static void Reverse(int zone, bool northp, double x, double y, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, bool mgrslimits); /** * Transfer UTM/UPS coordinated from one zone to another. * * @param[in] zonein the UTM zone for \e xin and \e yin (or zero for UPS). * @param[in] northpin hemisphere for \e xin and \e yin (true means north, * false means south). * @param[in] xin easting of point (meters) in \e zonein. * @param[in] yin northing of point (meters) in \e zonein. * @param[in] zoneout the requested UTM zone for \e xout and \e yout (or * zero for UPS). * @param[in] northpout hemisphere for \e xout output and \e yout. * @param[out] xout easting of point (meters) in \e zoneout. * @param[out] yout northing of point (meters) in \e zoneout. * @param[out] zone the actual UTM zone for \e xout and \e yout (or zero * for UPS); this equals \e zoneout if \e zoneout ≥ 0. * @exception GeographicErr if \e zonein is out of range (see below). * @exception GeographicErr if \e zoneout is out of range (see below). * @exception GeographicErr if \e xin or \e yin fall outside their allowed * ranges (see UTMUPS::Reverse). * @exception GeographicErr if \e xout or \e yout fall outside their * allowed ranges (see UTMUPS::Reverse). * * \e zonein must be in the range [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0, * 60] with \e zonein = UTMUPS::UPS, 0, indicating UPS. \e zonein may * also be UTMUPS::INVALID. * * \e zoneout must be in the range [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZONE] * = [-4, 60]. If \e zoneout < UTMUPS::MINZONE then the rules give in * the documentation of UTMUPS::zonespec are applied, and \e zone is set to * the actual zone used for output. * * (\e xout, \e yout) can overlap with (\e xin, \e yin). **********************************************************************/ static void Transfer(int zonein, bool northpin, double xin, double yin, int zoneout, bool northpout, [System::Runtime::InteropServices::Out] double% xout, [System::Runtime::InteropServices::Out] double% yout, [System::Runtime::InteropServices::Out] int% zone); /** * 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). * @exception GeographicErr if \e zonestr is malformed. * * 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 (or "north" or "south" spelled out). For UPS, * it consists just of the hemisphere letter (or the spelled out * hemisphere). 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° ≤ \e lat < 40°. n, 01s, 2n, 38s, * south, 3north are legal. 0n, 001s, +3n, 61n, 38P are illegal. INV is a * special value for which the returned value of \e is UTMUPS::INVALID. **********************************************************************/ static void DecodeZone(System::String^ zonestr, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp); /** * Encode a UTM/UPS zone string. * * @param[in] zone the UTM zone (zero means UPS). * @param[in] northp hemisphere (true means north, false means south). * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception GeographicErr if \e zone is out of range (see below). * @exception std::bad_alloc if memoy for the string can't be allocated. * @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 System::String^ EncodeZone(int zone, bool northp, bool abbrev); /** * Decode EPSG. * * @param[in] epsg the EPSG code. * @param[out] zone the UTM zone (zero means UPS). * @param[out] northp hemisphere (true means north, false means south). * * EPSG (European Petroleum Survery Group) codes are a way to refer to many * different projections. DecodeEPSG decodes those refering to UTM or UPS * projections for the WGS84 ellipsoid. If the code does not refer to one * of these projections, \e zone is set to UTMUPS::INVALID. See * http://spatialreference.org/ref/epsg/ **********************************************************************/ static void DecodeEPSG(int epsg, [System::Runtime::InteropServices::Out] int% zone, [System::Runtime::InteropServices::Out] bool% northp); /** * Encode zone as EPSG. * * @param[in] zone the UTM zone (zero means UPS). * @param[in] northp hemisphere (true means north, false means south). * @return EPSG code (or -1 if \e zone is not in the range * [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0, 60]) * * Convert \e zone and \e northp to the corresponding EPSG (European * Petroleum Survery Group) codes **********************************************************************/ static int EncodeEPSG(int zone, bool northp); /** * @return shift (meters) necessary to align N and S halves of a UTM zone * (107). **********************************************************************/ static double UTMShift(); /** \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 double EquatorialRadius(); /** * @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 double Flattening(); ///@} }; } // namespace NETGeographicLib GeographicLib-1.52/dotnet/NETGeographicLib/stdafx.cpp0000644000771000077100000000031414064202371022353 0ustar ckarneyckarney// stdafx.cpp : source file that includes just the standard includes // NETGeographic.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" GeographicLib-1.52/dotnet/NETGeographicLib/stdafx.h0000644000771000077100000000025314064202371022022 0ustar ckarneyckarney// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, // but are changed infrequently #pragma once GeographicLib-1.52/dotnet/Projections/AccumPanel.Designer.cs0000644000771000077100000002041014064202371023704 0ustar ckarneyckarneynamespace Projections { partial class AccumPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.m_inputTextBox = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.m_accumTtextBox = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.m_equalsCheckBox = new System.Windows.Forms.CheckBox(); this.m_testTextBox = new System.Windows.Forms.TextBox(); this.m_lessThanCheckBox = new System.Windows.Forms.CheckBox(); this.m_greaterTanCheckBox = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(4, 8); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(31, 13); this.label1.TabIndex = 0; this.label1.Text = "Input"; // // m_inputTextBox // this.m_inputTextBox.Location = new System.Drawing.Point(109, 4); this.m_inputTextBox.Name = "m_inputTextBox"; this.m_inputTextBox.Size = new System.Drawing.Size(202, 20); this.m_inputTextBox.TabIndex = 1; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(4, 35); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(99, 13); this.label2.TabIndex = 2; this.label2.Text = "Accumulated Value"; // // m_accumTtextBox // this.m_accumTtextBox.Location = new System.Drawing.Point(109, 31); this.m_accumTtextBox.Name = "m_accumTtextBox"; this.m_accumTtextBox.ReadOnly = true; this.m_accumTtextBox.Size = new System.Drawing.Size(202, 20); this.m_accumTtextBox.TabIndex = 3; // // button1 // this.button1.Location = new System.Drawing.Point(317, 3); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 4; this.button1.Text = "Add"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnAdd); // // button2 // this.button2.Location = new System.Drawing.Point(7, 64); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 5; this.button2.Text = "Reset"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnReset); // // button3 // this.button3.Location = new System.Drawing.Point(318, 30); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 6; this.button3.Text = "Multiply"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.OnMultiply); // // button4 // this.button4.Location = new System.Drawing.Point(405, 32); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(75, 23); this.button4.TabIndex = 7; this.button4.Text = "Test"; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.OnTest); // // m_equalsCheckBox // this.m_equalsCheckBox.AutoSize = true; this.m_equalsCheckBox.Location = new System.Drawing.Point(405, 69); this.m_equalsCheckBox.Name = "m_equalsCheckBox"; this.m_equalsCheckBox.Size = new System.Drawing.Size(58, 17); this.m_equalsCheckBox.TabIndex = 8; this.m_equalsCheckBox.Text = "Equals"; this.m_equalsCheckBox.UseVisualStyleBackColor = true; // // m_testTextBox // this.m_testTextBox.Location = new System.Drawing.Point(405, 4); this.m_testTextBox.Name = "m_testTextBox"; this.m_testTextBox.Size = new System.Drawing.Size(139, 20); this.m_testTextBox.TabIndex = 10; // // m_lessThanCheckBox // this.m_lessThanCheckBox.AutoSize = true; this.m_lessThanCheckBox.Location = new System.Drawing.Point(405, 93); this.m_lessThanCheckBox.Name = "m_lessThanCheckBox"; this.m_lessThanCheckBox.Size = new System.Drawing.Size(76, 17); this.m_lessThanCheckBox.TabIndex = 11; this.m_lessThanCheckBox.Text = "Less Than"; this.m_lessThanCheckBox.UseVisualStyleBackColor = true; // // m_greaterTanCheckBox // this.m_greaterTanCheckBox.AutoSize = true; this.m_greaterTanCheckBox.Location = new System.Drawing.Point(405, 117); this.m_greaterTanCheckBox.Name = "m_greaterTanCheckBox"; this.m_greaterTanCheckBox.Size = new System.Drawing.Size(86, 17); this.m_greaterTanCheckBox.TabIndex = 12; this.m_greaterTanCheckBox.Text = "GreaterThan"; this.m_greaterTanCheckBox.UseVisualStyleBackColor = true; // // AccumPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.m_greaterTanCheckBox); this.Controls.Add(this.m_lessThanCheckBox); this.Controls.Add(this.m_testTextBox); this.Controls.Add(this.m_equalsCheckBox); this.Controls.Add(this.button4); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.m_accumTtextBox); this.Controls.Add(this.label2); this.Controls.Add(this.m_inputTextBox); this.Controls.Add(this.label1); this.Name = "AccumPanel"; this.Size = new System.Drawing.Size(969, 353); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox m_inputTextBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox m_accumTtextBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.CheckBox m_equalsCheckBox; private System.Windows.Forms.TextBox m_testTextBox; private System.Windows.Forms.CheckBox m_lessThanCheckBox; private System.Windows.Forms.CheckBox m_greaterTanCheckBox; } } GeographicLib-1.52/dotnet/Projections/AccumPanel.cs0000644000771000077100000000470314064202371022154 0ustar ckarneyckarney/** * \file NETGeographicLib\AccumPanel.cs * \brief NETGeographicLib.Accumulator example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class AccumPanel : UserControl { Accumulator m_accum = new Accumulator(); public AccumPanel() { InitializeComponent(); OnReset(null, null); } private void OnAdd(object sender, EventArgs e) { try { double a = Double.Parse(m_inputTextBox.Text); m_accum.Sum(a); m_accumTtextBox.Text = m_accum.Result().ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnMultiply(object sender, EventArgs e) { try { int a = Int32.Parse(m_inputTextBox.Text); m_accum.Multiply(a); m_accumTtextBox.Text = m_accum.Result().ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnReset(object sender, EventArgs e) { m_accum.Assign(0.0); m_accumTtextBox.Text = m_accum.Result().ToString(); } private void OnTest(object sender, EventArgs e) { try { double test = Double.Parse(m_testTextBox.Text); m_equalsCheckBox.Checked = m_accum == test; m_lessThanCheckBox.Checked = m_accum < test; m_greaterTanCheckBox.Checked = m_accum > test; } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } GeographicLib-1.52/dotnet/Projections/AccumPanel.resx0000644000771000077100000001316314064202371022530 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 GeographicLib-1.52/dotnet/Projections/AlbersPanel.Designer.cs0000644000771000077100000006374514064202371024106 0ustar ckarneyckarneynamespace Projections { partial class AlbersPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_setButton = new System.Windows.Forms.Button(); this.m_flatteningTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.m_equatorialRadiusTextBox = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.m_originLatitudeTextBox = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.m_centralScaleTextBox = new System.Windows.Forms.TextBox(); this.m_toolTip = new System.Windows.Forms.ToolTip(this.components); this.m_constructorComboBox = new System.Windows.Forms.ComboBox(); this.m_azimuthalScaleTextBox = new System.Windows.Forms.TextBox(); this.m_functionComboBox = new System.Windows.Forms.ComboBox(); this.m_convertButton = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.m_scaleLabel = new System.Windows.Forms.Label(); this.m_stdLatLabel = new System.Windows.Forms.Label(); this.m_stdLat2Label = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.m_sinLat2Label = new System.Windows.Forms.Label(); this.m_cosLat2Label = new System.Windows.Forms.Label(); this.m_KTextBox = new System.Windows.Forms.TextBox(); this.m_stdLat1TextBox = new System.Windows.Forms.TextBox(); this.m_stdLat2TextBox = new System.Windows.Forms.TextBox(); this.m_sinLat2TextBox = new System.Windows.Forms.TextBox(); this.m_cosLat2TextBox = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.m_lon0TextBox = new System.Windows.Forms.TextBox(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.m_xTextBox = new System.Windows.Forms.TextBox(); this.m_yTextBox = new System.Windows.Forms.TextBox(); this.m_gammaTextBox = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.m_projectionComboBox = new System.Windows.Forms.ComboBox(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.m_setButton); this.groupBox1.Controls.Add(this.m_flatteningTextBox); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.m_equatorialRadiusTextBox); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(146, 140); this.groupBox1.TabIndex = 6; this.groupBox1.TabStop = false; this.groupBox1.Text = "Ellipsoid Parameters"; // // m_setButton // this.m_setButton.Location = new System.Drawing.Point(12, 109); this.m_setButton.Name = "m_setButton"; this.m_setButton.Size = new System.Drawing.Size(75, 23); this.m_setButton.TabIndex = 4; this.m_setButton.Text = "Set"; this.m_toolTip.SetToolTip(this.m_setButton, "Set constructor inputs"); this.m_setButton.UseVisualStyleBackColor = true; this.m_setButton.Click += new System.EventHandler(this.OnSet); // // m_flatteningTextBox // this.m_flatteningTextBox.Location = new System.Drawing.Point(12, 83); this.m_flatteningTextBox.Name = "m_flatteningTextBox"; this.m_flatteningTextBox.Size = new System.Drawing.Size(125, 20); this.m_flatteningTextBox.TabIndex = 3; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(109, 13); this.label1.TabIndex = 0; this.label1.Text = "Equatorial Radius (meters)"; // // m_equatorialRadiusTextBox // this.m_equatorialRadiusTextBox.Location = new System.Drawing.Point(12, 42); this.m_equatorialRadiusTextBox.Name = "m_equatorialRadiusTextBox"; this.m_equatorialRadiusTextBox.Size = new System.Drawing.Size(125, 20); this.m_equatorialRadiusTextBox.TabIndex = 2; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 66); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 13); this.label2.TabIndex = 1; this.label2.Text = "Flattening"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(165, 11); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(122, 13); this.label3.TabIndex = 7; this.label3.Text = "Origin Latitude (degrees)"; // // m_originLatitudeTextBox // this.m_originLatitudeTextBox.Location = new System.Drawing.Point(319, 7); this.m_originLatitudeTextBox.Name = "m_originLatitudeTextBox"; this.m_originLatitudeTextBox.ReadOnly = true; this.m_originLatitudeTextBox.Size = new System.Drawing.Size(115, 20); this.m_originLatitudeTextBox.TabIndex = 8; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(165, 38); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(70, 13); this.label4.TabIndex = 9; this.label4.Text = "Central Scale"; // // m_centralScaleTextBox // this.m_centralScaleTextBox.Location = new System.Drawing.Point(319, 34); this.m_centralScaleTextBox.Name = "m_centralScaleTextBox"; this.m_centralScaleTextBox.ReadOnly = true; this.m_centralScaleTextBox.Size = new System.Drawing.Size(115, 20); this.m_centralScaleTextBox.TabIndex = 10; // // m_constructorComboBox // this.m_constructorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_constructorComboBox.FormattingEnabled = true; this.m_constructorComboBox.Location = new System.Drawing.Point(10, 170); this.m_constructorComboBox.Name = "m_constructorComboBox"; this.m_constructorComboBox.Size = new System.Drawing.Size(139, 21); this.m_constructorComboBox.TabIndex = 18; this.m_toolTip.SetToolTip(this.m_constructorComboBox, "Select constructor type"); this.m_constructorComboBox.SelectedIndexChanged += new System.EventHandler(this.OnConstructorChanged); // // m_azimuthalScaleTextBox // this.m_azimuthalScaleTextBox.Location = new System.Drawing.Point(580, 169); this.m_azimuthalScaleTextBox.Name = "m_azimuthalScaleTextBox"; this.m_azimuthalScaleTextBox.ReadOnly = true; this.m_azimuthalScaleTextBox.Size = new System.Drawing.Size(109, 20); this.m_azimuthalScaleTextBox.TabIndex = 36; this.m_toolTip.SetToolTip(this.m_azimuthalScaleTextBox, "Verifies interfaces"); this.m_azimuthalScaleTextBox.Click += new System.EventHandler(this.OnValidate); // // m_functionComboBox // this.m_functionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_functionComboBox.FormattingEnabled = true; this.m_functionComboBox.Items.AddRange(new object[] { "Forward", "Reverse"}); this.m_functionComboBox.Location = new System.Drawing.Point(697, 34); this.m_functionComboBox.Name = "m_functionComboBox"; this.m_functionComboBox.Size = new System.Drawing.Size(75, 21); this.m_functionComboBox.TabIndex = 38; this.m_toolTip.SetToolTip(this.m_functionComboBox, "Select function"); this.m_functionComboBox.SelectedIndexChanged += new System.EventHandler(this.OnFunction); // // m_convertButton // this.m_convertButton.Location = new System.Drawing.Point(697, 114); this.m_convertButton.Name = "m_convertButton"; this.m_convertButton.Size = new System.Drawing.Size(75, 23); this.m_convertButton.TabIndex = 39; this.m_convertButton.Text = "Convert"; this.m_toolTip.SetToolTip(this.m_convertButton, "Executes the selected Function using the selected Projection"); this.m_convertButton.UseVisualStyleBackColor = true; this.m_convertButton.Click += new System.EventHandler(this.OnConvert); // // button2 // this.button2.Location = new System.Drawing.Point(700, 168); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 40; this.button2.Text = "Validate"; this.m_toolTip.SetToolTip(this.button2, "Verifies interfaces"); this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnValidate); // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(443, 38); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(92, 13); this.label5.TabIndex = 11; this.label5.Text = "Latitude (degrees)"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(443, 65); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(101, 13); this.label6.TabIndex = 12; this.label6.Text = "Longitude (degrees)"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(443, 92); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(54, 13); this.label7.TabIndex = 13; this.label7.Text = "X (meters)"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(443, 119); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(54, 13); this.label8.TabIndex = 14; this.label8.Text = "Y (meters)"; // // m_scaleLabel // this.m_scaleLabel.AutoSize = true; this.m_scaleLabel.Location = new System.Drawing.Point(165, 65); this.m_scaleLabel.Name = "m_scaleLabel"; this.m_scaleLabel.Size = new System.Drawing.Size(50, 13); this.m_scaleLabel.TabIndex = 15; this.m_scaleLabel.Text = "Scale (K)"; // // m_stdLatLabel // this.m_stdLatLabel.AutoSize = true; this.m_stdLatLabel.Location = new System.Drawing.Point(165, 92); this.m_stdLatLabel.Name = "m_stdLatLabel"; this.m_stdLatLabel.Size = new System.Drawing.Size(147, 13); this.m_stdLatLabel.TabIndex = 16; this.m_stdLatLabel.Text = "Standard Latitude 1 (degrees)"; // // m_stdLat2Label // this.m_stdLat2Label.AutoSize = true; this.m_stdLat2Label.Location = new System.Drawing.Point(165, 119); this.m_stdLat2Label.Name = "m_stdLat2Label"; this.m_stdLat2Label.Size = new System.Drawing.Size(147, 13); this.m_stdLat2Label.TabIndex = 17; this.m_stdLat2Label.Text = "Standard Latitude 2 (degrees)"; // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(9, 150); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(61, 13); this.label12.TabIndex = 19; this.label12.Text = "Constructor"; // // m_sinLat2Label // this.m_sinLat2Label.AutoSize = true; this.m_sinLat2Label.Location = new System.Drawing.Point(165, 146); this.m_sinLat2Label.Name = "m_sinLat2Label"; this.m_sinLat2Label.Size = new System.Drawing.Size(49, 13); this.m_sinLat2Label.TabIndex = 20; this.m_sinLat2Label.Text = "Sin(Lat2)"; // // m_cosLat2Label // this.m_cosLat2Label.AutoSize = true; this.m_cosLat2Label.Location = new System.Drawing.Point(165, 173); this.m_cosLat2Label.Name = "m_cosLat2Label"; this.m_cosLat2Label.Size = new System.Drawing.Size(52, 13); this.m_cosLat2Label.TabIndex = 21; this.m_cosLat2Label.Text = "Cos(Lat2)"; // // m_KTextBox // this.m_KTextBox.Location = new System.Drawing.Point(319, 61); this.m_KTextBox.Name = "m_KTextBox"; this.m_KTextBox.Size = new System.Drawing.Size(115, 20); this.m_KTextBox.TabIndex = 22; // // m_stdLat1TextBox // this.m_stdLat1TextBox.Location = new System.Drawing.Point(319, 88); this.m_stdLat1TextBox.Name = "m_stdLat1TextBox"; this.m_stdLat1TextBox.Size = new System.Drawing.Size(115, 20); this.m_stdLat1TextBox.TabIndex = 23; // // m_stdLat2TextBox // this.m_stdLat2TextBox.Location = new System.Drawing.Point(319, 115); this.m_stdLat2TextBox.Name = "m_stdLat2TextBox"; this.m_stdLat2TextBox.Size = new System.Drawing.Size(115, 20); this.m_stdLat2TextBox.TabIndex = 24; // // m_sinLat2TextBox // this.m_sinLat2TextBox.Location = new System.Drawing.Point(319, 142); this.m_sinLat2TextBox.Name = "m_sinLat2TextBox"; this.m_sinLat2TextBox.Size = new System.Drawing.Size(115, 20); this.m_sinLat2TextBox.TabIndex = 25; // // m_cosLat2TextBox // this.m_cosLat2TextBox.Location = new System.Drawing.Point(319, 169); this.m_cosLat2TextBox.Name = "m_cosLat2TextBox"; this.m_cosLat2TextBox.Size = new System.Drawing.Size(115, 20); this.m_cosLat2TextBox.TabIndex = 26; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(443, 11); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(131, 13); this.label9.TabIndex = 27; this.label9.Text = "Origin Longitude (degrees)"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(443, 146); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(90, 13); this.label10.TabIndex = 28; this.label10.Text = "Gamma (degrees)"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(443, 173); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(82, 13); this.label11.TabIndex = 29; this.label11.Text = "Azimuthal Scale"; // // m_lon0TextBox // this.m_lon0TextBox.Location = new System.Drawing.Point(580, 7); this.m_lon0TextBox.Name = "m_lon0TextBox"; this.m_lon0TextBox.Size = new System.Drawing.Size(109, 20); this.m_lon0TextBox.TabIndex = 30; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(580, 34); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(109, 20); this.m_latitudeTextBox.TabIndex = 31; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(580, 61); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(109, 20); this.m_longitudeTextBox.TabIndex = 32; // // m_xTextBox // this.m_xTextBox.Location = new System.Drawing.Point(580, 88); this.m_xTextBox.Name = "m_xTextBox"; this.m_xTextBox.Size = new System.Drawing.Size(109, 20); this.m_xTextBox.TabIndex = 33; // // m_yTextBox // this.m_yTextBox.Location = new System.Drawing.Point(580, 115); this.m_yTextBox.Name = "m_yTextBox"; this.m_yTextBox.Size = new System.Drawing.Size(109, 20); this.m_yTextBox.TabIndex = 34; // // m_gammaTextBox // this.m_gammaTextBox.Location = new System.Drawing.Point(580, 142); this.m_gammaTextBox.Name = "m_gammaTextBox"; this.m_gammaTextBox.ReadOnly = true; this.m_gammaTextBox.Size = new System.Drawing.Size(109, 20); this.m_gammaTextBox.TabIndex = 35; // // label13 // this.label13.AutoSize = true; this.label13.Location = new System.Drawing.Point(697, 11); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(48, 13); this.label13.TabIndex = 37; this.label13.Text = "Function"; // // label14 // this.label14.AutoSize = true; this.label14.Location = new System.Drawing.Point(697, 65); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(54, 13); this.label14.TabIndex = 41; this.label14.Text = "Projection"; // // m_projectionComboBox // this.m_projectionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_projectionComboBox.FormattingEnabled = true; this.m_projectionComboBox.Items.AddRange(new object[] { "Albers Equal Area", "Lambert Conformal Conic", "Transverse Mercator", "Transverse Mercator Exact"}); this.m_projectionComboBox.Location = new System.Drawing.Point(697, 88); this.m_projectionComboBox.Name = "m_projectionComboBox"; this.m_projectionComboBox.Size = new System.Drawing.Size(134, 21); this.m_projectionComboBox.TabIndex = 42; this.m_toolTip.SetToolTip(this.m_projectionComboBox, "Projection Type"); this.m_projectionComboBox.SelectedIndexChanged += new System.EventHandler(this.OnProjection); // // AlbersPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.m_projectionComboBox); this.Controls.Add(this.label14); this.Controls.Add(this.button2); this.Controls.Add(this.m_convertButton); this.Controls.Add(this.m_functionComboBox); this.Controls.Add(this.label13); this.Controls.Add(this.m_azimuthalScaleTextBox); this.Controls.Add(this.m_gammaTextBox); this.Controls.Add(this.m_yTextBox); this.Controls.Add(this.m_xTextBox); this.Controls.Add(this.m_longitudeTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.m_lon0TextBox); this.Controls.Add(this.label11); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.m_cosLat2TextBox); this.Controls.Add(this.m_sinLat2TextBox); this.Controls.Add(this.m_stdLat2TextBox); this.Controls.Add(this.m_stdLat1TextBox); this.Controls.Add(this.m_KTextBox); this.Controls.Add(this.m_cosLat2Label); this.Controls.Add(this.m_sinLat2Label); this.Controls.Add(this.label12); this.Controls.Add(this.m_constructorComboBox); this.Controls.Add(this.m_stdLat2Label); this.Controls.Add(this.m_stdLatLabel); this.Controls.Add(this.m_scaleLabel); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.m_centralScaleTextBox); this.Controls.Add(this.label4); this.Controls.Add(this.m_originLatitudeTextBox); this.Controls.Add(this.label3); this.Controls.Add(this.groupBox1); this.Name = "AlbersPanel"; this.Size = new System.Drawing.Size(851, 248); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button m_setButton; private System.Windows.Forms.TextBox m_flatteningTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox m_equatorialRadiusTextBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox m_originLatitudeTextBox; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox m_centralScaleTextBox; private System.Windows.Forms.ToolTip m_toolTip; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label m_scaleLabel; private System.Windows.Forms.Label m_stdLatLabel; private System.Windows.Forms.Label m_stdLat2Label; private System.Windows.Forms.ComboBox m_constructorComboBox; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label m_sinLat2Label; private System.Windows.Forms.Label m_cosLat2Label; private System.Windows.Forms.TextBox m_KTextBox; private System.Windows.Forms.TextBox m_stdLat1TextBox; private System.Windows.Forms.TextBox m_stdLat2TextBox; private System.Windows.Forms.TextBox m_sinLat2TextBox; private System.Windows.Forms.TextBox m_cosLat2TextBox; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox m_lon0TextBox; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.TextBox m_xTextBox; private System.Windows.Forms.TextBox m_yTextBox; private System.Windows.Forms.TextBox m_gammaTextBox; private System.Windows.Forms.TextBox m_azimuthalScaleTextBox; private System.Windows.Forms.Label label13; private System.Windows.Forms.ComboBox m_functionComboBox; private System.Windows.Forms.Button m_convertButton; private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label14; private System.Windows.Forms.ComboBox m_projectionComboBox; } } GeographicLib-1.52/dotnet/Projections/AlbersPanel.cs0000644000771000077100000006223714064202371022342 0ustar ckarneyckarney/** * \file NETGeographicLib\AlbersPanel.cs * \brief Example of various projections. * * NETGeographicLib.AlbersEqualArea, * NETGeographicLib.LambertConformalConic, * NETGeographicLib.TransverseMercator, * and NETGeographicLib.TransverseMercatorExact example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class AlbersPanel : UserControl { enum ProjectionTypes { AlbersEqualArea = 0, LambertConformalConic = 1, TransverseMercator = 2, TransverseMercatorExact = 3 } ProjectionTypes m_projection; AlbersEqualArea m_albers = null; LambertConformalConic m_lambert = null; TransverseMercator m_trans = null; TransverseMercatorExact m_transExact = null; public AlbersPanel() { InitializeComponent(); m_projectionComboBox.SelectedIndex = 0; // this calls OnProjection and sets it to an AlbersEqualArea m_constructorComboBox.SelectedIndex = 3; // this calls OnConstructorChanged m_majorRadiusTextBox.Text = m_albers.EquatorialRadius.ToString(); m_flatteningTextBox.Text = m_albers.Flattening.ToString(); m_centralScaleTextBox.Text = m_albers.CentralScale.ToString(); m_originLatitudeTextBox.Text = m_albers.OriginLatitude.ToString(); m_functionComboBox.SelectedIndex = 0; // this calls OnFunction } private void OnConstructorChanged(object sender, EventArgs e) { try { if (m_projectionComboBox.SelectedIndex > 1) { m_originLatitudeTextBox.ReadOnly = true; m_originLatitudeTextBox.Text = "N/A"; if (m_constructorComboBox.SelectedIndex == 0) { m_convertButton.Enabled = true; m_setButton.Enabled = false; m_majorRadiusTextBox.ReadOnly = true; m_flatteningTextBox.ReadOnly = true; m_scaleLabel.Hide(); m_KTextBox.Hide(); m_stdLatLabel.Hide(); m_stdLat1TextBox.Hide(); m_stdLat2Label.Hide(); m_stdLat2TextBox.Hide(); m_sinLat2Label.Hide(); m_sinLat2TextBox.Hide(); m_cosLat2Label.Hide(); m_cosLat2TextBox.Hide(); if (m_projection == ProjectionTypes.TransverseMercator) { m_trans = new TransverseMercator(); m_centralScaleTextBox.Text = m_trans.CentralScale.ToString(); } else { m_transExact = new TransverseMercatorExact(); m_centralScaleTextBox.Text = m_transExact.CentralScale.ToString(); } } else { m_convertButton.Enabled = false; m_setButton.Enabled = true; m_majorRadiusTextBox.ReadOnly = false; m_flatteningTextBox.ReadOnly = false; m_scaleLabel.Show(); m_KTextBox.Show(); m_stdLatLabel.Hide(); m_stdLat1TextBox.Hide(); m_stdLat2Label.Hide(); m_stdLat2TextBox.Hide(); m_sinLat2Label.Hide(); m_sinLat2TextBox.Hide(); m_cosLat2Label.Hide(); m_cosLat2TextBox.Hide(); } } else { m_originLatitudeTextBox.ReadOnly = false; switch (m_constructorComboBox.SelectedIndex) { case 0: m_convertButton.Enabled = false; m_setButton.Enabled = true; m_majorRadiusTextBox.ReadOnly = false; m_flatteningTextBox.ReadOnly = false; m_scaleLabel.Show(); m_KTextBox.Show(); m_stdLatLabel.Show(); m_stdLatLabel.Text = "Standard Latitude (degrees)"; m_stdLat1TextBox.Show(); m_stdLat2Label.Hide(); m_stdLat2TextBox.Hide(); m_sinLat2Label.Hide(); m_sinLat2TextBox.Hide(); m_cosLat2Label.Hide(); m_cosLat2TextBox.Hide(); break; case 1: m_convertButton.Enabled = false; m_setButton.Enabled = true; m_majorRadiusTextBox.ReadOnly = false; m_flatteningTextBox.ReadOnly = false; m_scaleLabel.Show(); m_KTextBox.Show(); m_stdLatLabel.Show(); m_stdLatLabel.Text = "Standard Latitude 1 (degrees)"; m_stdLat1TextBox.Show(); m_stdLat2Label.Text = "Standard Latitude 2 (degrees)"; m_stdLat2Label.Show(); m_stdLat2TextBox.Show(); m_sinLat2Label.Hide(); m_sinLat2TextBox.Hide(); m_cosLat2Label.Hide(); m_cosLat2TextBox.Hide(); break; case 2: m_convertButton.Enabled = false; m_setButton.Enabled = true; m_majorRadiusTextBox.ReadOnly = false; m_flatteningTextBox.ReadOnly = false; m_scaleLabel.Show(); m_KTextBox.Show(); m_stdLatLabel.Show(); m_stdLatLabel.Text = "Sin(Lat1)"; m_stdLat1TextBox.Show(); m_stdLat2Label.Text = "Cos(Lat1)"; m_stdLat2Label.Show(); m_stdLat2TextBox.Show(); m_sinLat2Label.Show(); m_sinLat2TextBox.Show(); m_cosLat2Label.Show(); m_cosLat2TextBox.Show(); break; default: m_convertButton.Enabled = true; m_setButton.Enabled = false; m_majorRadiusTextBox.ReadOnly = true; m_flatteningTextBox.ReadOnly = true; m_scaleLabel.Hide(); m_KTextBox.Hide(); m_stdLatLabel.Hide(); m_stdLat1TextBox.Hide(); m_stdLat2Label.Hide(); m_stdLat2TextBox.Hide(); m_sinLat2Label.Hide(); m_sinLat2TextBox.Hide(); m_cosLat2Label.Hide(); m_cosLat2TextBox.Hide(); break; } if (m_projection == ProjectionTypes.AlbersEqualArea) AlbersConstructorChanged(); } } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void AlbersConstructorChanged() { switch (m_constructorComboBox.SelectedIndex) { case 3: m_albers = new AlbersEqualArea(AlbersEqualArea.StandardTypes.CylindricalEqualArea); break; case 4: m_albers = new AlbersEqualArea(AlbersEqualArea.StandardTypes.AzimuthalEqualAreaNorth); break; case 5: m_albers = new AlbersEqualArea(AlbersEqualArea.StandardTypes.AzimuthalEqualAreaSouth); break; default: break; } if (m_constructorComboBox.SelectedIndex > 2) { m_majorRadiusTextBox.Text = m_albers.EquatorialRadius.ToString(); m_flatteningTextBox.Text = m_albers.Flattening.ToString(); m_centralScaleTextBox.Text = m_albers.CentralScale.ToString(); m_originLatitudeTextBox.Text = m_albers.OriginLatitude.ToString(); } } private void OnSet(object sender, EventArgs e) { try { switch (m_projection) { case ProjectionTypes.AlbersEqualArea: SetAlbers(); break; case ProjectionTypes.LambertConformalConic: SetLambert(); break; case ProjectionTypes.TransverseMercator: SetTransverse(); break; case ProjectionTypes.TransverseMercatorExact: SetTransverseExact(); break; } } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } m_convertButton.Enabled = true; } private void SetAlbers() { double s2, s3, s4; double a = Double.Parse(m_majorRadiusTextBox.Text); double f = Double.Parse(m_flatteningTextBox.Text); double k = Double.Parse(m_KTextBox.Text); double s1 = Double.Parse(m_stdLat1TextBox.Text); switch (m_constructorComboBox.SelectedIndex) { case 0: m_albers = new AlbersEqualArea(a, f, s1, k); break; case 1: s2 = Double.Parse(m_stdLat2TextBox.Text); m_albers = new AlbersEqualArea(a, f, s1, s2, k); break; case 2: s2 = Double.Parse(m_stdLat2TextBox.Text); s3 = Double.Parse(m_sinLat2TextBox.Text); s4 = Double.Parse(m_cosLat2TextBox.Text); m_albers = new AlbersEqualArea(a, f, s1, s2, s3, s4, k); break; default: break; } m_centralScaleTextBox.Text = m_albers.CentralScale.ToString(); m_originLatitudeTextBox.Text = m_albers.OriginLatitude.ToString(); } private void SetLambert() { double s2, s3, s4; double a = Double.Parse(m_majorRadiusTextBox.Text); double f = Double.Parse(m_flatteningTextBox.Text); double k = Double.Parse(m_KTextBox.Text); double s1 = Double.Parse(m_stdLat1TextBox.Text); switch (m_constructorComboBox.SelectedIndex) { case 0: m_lambert = new LambertConformalConic(a, f, s1, k); break; case 1: s2 = Double.Parse(m_stdLat2TextBox.Text); m_lambert = new LambertConformalConic(a, f, s1, s2, k); break; case 2: s2 = Double.Parse(m_stdLat2TextBox.Text); s3 = Double.Parse(m_sinLat2TextBox.Text); s4 = Double.Parse(m_cosLat2TextBox.Text); m_lambert = new LambertConformalConic(a, f, s1, s2, s3, s4, k); break; default: break; } m_centralScaleTextBox.Text = m_lambert.CentralScale.ToString(); m_originLatitudeTextBox.Text = m_lambert.OriginLatitude.ToString(); } private void SetTransverse() { switch (m_constructorComboBox.SelectedIndex) { case 1: double a = Double.Parse(m_majorRadiusTextBox.Text); double f = Double.Parse(m_flatteningTextBox.Text); double k = Double.Parse(m_KTextBox.Text); m_trans = new TransverseMercator(a, f, k); break; default: break; } m_centralScaleTextBox.Text = m_trans.CentralScale.ToString(); } private void SetTransverseExact() { switch (m_constructorComboBox.SelectedIndex) { case 1: double a = Double.Parse(m_majorRadiusTextBox.Text); double f = Double.Parse(m_flatteningTextBox.Text); double k = Double.Parse(m_KTextBox.Text); m_transExact = new TransverseMercatorExact(a, f, k, false); break; default: break; } m_centralScaleTextBox.Text = m_transExact.CentralScale.ToString(); } private void OnFunction(object sender, EventArgs e) { switch (m_functionComboBox.SelectedIndex) { case 0: m_latitudeTextBox.ReadOnly = m_longitudeTextBox.ReadOnly = false; m_xTextBox.ReadOnly = m_yTextBox.ReadOnly = true; break; case 1: m_latitudeTextBox.ReadOnly = m_longitudeTextBox.ReadOnly = true; m_xTextBox.ReadOnly = m_yTextBox.ReadOnly = false; break; } } private void OnConvert(object sender, EventArgs e) { try { switch (m_projection) { case ProjectionTypes.AlbersEqualArea: ConvertAlbers(); break; case ProjectionTypes.LambertConformalConic: ConvertLambert(); break; case ProjectionTypes.TransverseMercator: ConvertTransverse(); break; case ProjectionTypes.TransverseMercatorExact: ConvertTransverseExact(); break; } } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void ConvertAlbers() { double lat = 0.0, lon = 0.0, x = 0.0, y = 0.0, gamma = 0.0, k = 0.0; double lon0 = Double.Parse(m_lon0TextBox.Text); switch (m_functionComboBox.SelectedIndex) { case 0: lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); m_albers.Forward(lon0, lat, lon, out x, out y, out gamma, out k); m_xTextBox.Text = x.ToString(); m_yTextBox.Text = y.ToString(); break; case 1: x = Double.Parse(m_xTextBox.Text); y = Double.Parse(m_yTextBox.Text); m_albers.Reverse(lon0, x, y, out lat, out lon, out gamma, out k); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); break; } m_gammaTextBox.Text = gamma.ToString(); m_azimuthalScaleTextBox.Text = k.ToString(); } private void ConvertLambert() { double lat = 0.0, lon = 0.0, x = 0.0, y = 0.0, gamma = 0.0, k = 0.0; double lon0 = Double.Parse(m_lon0TextBox.Text); switch (m_functionComboBox.SelectedIndex) { case 0: lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); m_lambert.Forward(lon0, lat, lon, out x, out y, out gamma, out k); m_xTextBox.Text = x.ToString(); m_yTextBox.Text = y.ToString(); break; case 1: x = Double.Parse(m_xTextBox.Text); y = Double.Parse(m_yTextBox.Text); m_lambert.Reverse(lon0, x, y, out lat, out lon, out gamma, out k); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); break; } m_gammaTextBox.Text = gamma.ToString(); m_azimuthalScaleTextBox.Text = k.ToString(); } private void ConvertTransverse() { double lat = 0.0, lon = 0.0, x = 0.0, y = 0.0, gamma = 0.0, k = 0.0; double lon0 = Double.Parse(m_lon0TextBox.Text); switch (m_functionComboBox.SelectedIndex) { case 0: lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); m_trans.Forward(lon0, lat, lon, out x, out y, out gamma, out k); m_xTextBox.Text = x.ToString(); m_yTextBox.Text = y.ToString(); break; case 1: x = Double.Parse(m_xTextBox.Text); y = Double.Parse(m_yTextBox.Text); m_trans.Reverse(lon0, x, y, out lat, out lon, out gamma, out k); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); break; } m_gammaTextBox.Text = gamma.ToString(); m_azimuthalScaleTextBox.Text = k.ToString(); } private void ConvertTransverseExact() { double lat = 0.0, lon = 0.0, x = 0.0, y = 0.0, gamma = 0.0, k = 0.0; double lon0 = Double.Parse(m_lon0TextBox.Text); switch (m_functionComboBox.SelectedIndex) { case 0: lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); m_transExact.Forward(lon0, lat, lon, out x, out y, out gamma, out k); m_xTextBox.Text = x.ToString(); m_yTextBox.Text = y.ToString(); break; case 1: x = Double.Parse(m_xTextBox.Text); y = Double.Parse(m_yTextBox.Text); m_transExact.Reverse(lon0, x, y, out lat, out lon, out gamma, out k); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); break; } m_gammaTextBox.Text = gamma.ToString(); m_azimuthalScaleTextBox.Text = k.ToString(); } private void OnProjection(object sender, EventArgs e) { m_projection = (ProjectionTypes)m_projectionComboBox.SelectedIndex; int save = m_constructorComboBox.SelectedIndex; m_constructorComboBox.Items.Clear(); if (m_projectionComboBox.SelectedIndex > 1) // TransverseMercator or TransverseMercatorExact { m_constructorComboBox.Items.Add("Default"); m_constructorComboBox.Items.Add("Constructor #1"); } else { m_constructorComboBox.Items.Add("Constructor #1"); m_constructorComboBox.Items.Add("Constructor #2"); m_constructorComboBox.Items.Add("Constructor #3"); if (m_projection == ProjectionTypes.AlbersEqualArea) { m_constructorComboBox.Items.Add("CylindricalEqualArea"); m_constructorComboBox.Items.Add("AzimuthalEqualAreaNorth"); m_constructorComboBox.Items.Add("AzimuthalEqualAreaSouth"); } } // calls OnConstructor m_constructorComboBox.SelectedIndex = m_constructorComboBox.Items.Count > save ? save : 0; } private void OnValidate(object sender, EventArgs e) { try { const double DEG_TO_RAD = 3.1415926535897932384626433832795 / 180.0; AlbersEqualArea a = new AlbersEqualArea(AlbersEqualArea.StandardTypes.AzimuthalEqualAreaNorth); a = new AlbersEqualArea(AlbersEqualArea.StandardTypes.AzimuthalEqualAreaSouth); double radius = a.EquatorialRadius; double f = a.Flattening; a = new AlbersEqualArea(radius, f, 60.0, 1.0); a = new AlbersEqualArea(radius, f, 60.0, 70.0, 1.0); a = new AlbersEqualArea(radius, f, Math.Sin(88.0 * DEG_TO_RAD), Math.Cos(88.0 * DEG_TO_RAD), Math.Sin(89.0*DEG_TO_RAD), Math.Cos(89.0*DEG_TO_RAD), 1.0); a = new AlbersEqualArea(AlbersEqualArea.StandardTypes.CylindricalEqualArea); double lon0 = 0.0, lat = 32.0, lon = -86.0, x, y, gamma, k, x1, y1; a.Forward(lon0, lat, lon, out x, out y, out gamma, out k); a.Forward(lon0, lat, lon, out x1, out y1); if (x != x1 || y != y1) throw new Exception("Error in AlbersEqualArea.Forward"); a.Reverse(lon0, x, y, out lat, out lon, out gamma, out k); a.Reverse(lon0, x, y, out x1, out y1); if (lat != x1 || lon != y1) throw new Exception("Error in AlbersEqualArea.Reverse"); LambertConformalConic b = new LambertConformalConic(radius, f, 60.0, 1.0); b = new LambertConformalConic(radius, f, 60.0, 65.0, 1.0); b = new LambertConformalConic(radius, f, Math.Sin(88.0 * DEG_TO_RAD), Math.Cos(88.0 * DEG_TO_RAD), Math.Sin(89.0 * DEG_TO_RAD), Math.Cos(89.0 * DEG_TO_RAD), 1.0); b = new LambertConformalConic(); b.SetScale(60.0, 1.0); b.Forward(-87.0, 32.0, -86.0, out x, out y, out gamma, out k); b.Forward(-87.0, 32.0, -86.0, out x1, out y1); if (x != x1 || y != y1) throw new Exception("Error in LambertConformalConic.Forward"); b.Reverse(-87.0, x, y, out lat, out lon, out gamma, out k); b.Reverse(-87.0, x, y, out x1, out y1, out gamma, out k); if (lat != x1 || lon != y1) throw new Exception("Error in LambertConformalConic.Reverse"); TransverseMercator c = new TransverseMercator(radius, f, 1.0); c = new TransverseMercator(); c.Forward(-87.0, 32.0, -86.0, out x, out y, out gamma, out k); c.Forward(-87.0, 32.0, -86.0, out x1, out y1); if (x != x1 || y != y1) throw new Exception("Error in TransverseMercator.Forward"); c.Reverse(-87.0, x, y, out lat, out lon, out gamma, out k); c.Reverse(-87.0, x, y, out x1, out y1); if (lat != x1 || lon != y1) throw new Exception("Error in TransverseMercator.Reverse"); TransverseMercatorExact d = new TransverseMercatorExact(radius, f, 1.0, false); d = new TransverseMercatorExact(); d.Forward(-87.0, 32.0, -86.0, out x, out y, out gamma, out k); d.Forward(-87.0, 32.0, -86.0, out x1, out y1); if (x != x1 || y != y1) throw new Exception("Error in TransverseMercatorExact.Forward"); d.Reverse(-87.0, x, y, out lat, out lon, out gamma, out k); d.Reverse(-87.0, x, y, out x1, out y1); if (lat != x1 || lon != y1) throw new Exception("Error in TransverseMercatorExact.Reverse"); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } GeographicLib-1.52/dotnet/Projections/AlbersPanel.resx0000644000771000077100000001347014064202371022711 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/EllipsoidPanel.Designer.cs0000644000771000077100000005467314064202371024622 0ustar ckarneyckarneynamespace Projections { partial class EllipsoidPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.m_toolTip = new System.Windows.Forms.ToolTip(this.components); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_setButton = new System.Windows.Forms.Button(); this.m_flatteningTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.m_equatorialRadiusTextBox = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.m_minorRadiusTextBox = new System.Windows.Forms.TextBox(); this.m_quarterMeridianTextBox = new System.Windows.Forms.TextBox(); this.m_areaTextBox = new System.Windows.Forms.TextBox(); this.m_volumeTextBox = new System.Windows.Forms.TextBox(); this.m_2ndFlatTextBox = new System.Windows.Forms.TextBox(); this.m_3rdFlatTextBox = new System.Windows.Forms.TextBox(); this.m_ecc2TextBox = new System.Windows.Forms.TextBox(); this.m_2ecc2TextBox = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.m_phiTextBox = new System.Windows.Forms.TextBox(); this.label14 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.m_parametericLatTextBox = new System.Windows.Forms.TextBox(); this.m_geocentricLatTextBox = new System.Windows.Forms.TextBox(); this.m_rectifyingLatTextBox = new System.Windows.Forms.TextBox(); this.m_authalicLatTextBox = new System.Windows.Forms.TextBox(); this.m_conformalTextBox = new System.Windows.Forms.TextBox(); this.m_isometricLatTextBox = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.m_setButton); this.groupBox1.Controls.Add(this.m_flatteningTextBox); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.m_equatorialRadiusTextBox); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(146, 140); this.groupBox1.TabIndex = 7; this.groupBox1.TabStop = false; this.groupBox1.Text = "Ellipsoid Parameters"; // // m_setButton // this.m_setButton.Location = new System.Drawing.Point(12, 107); this.m_setButton.Name = "m_setButton"; this.m_setButton.Size = new System.Drawing.Size(75, 23); this.m_setButton.TabIndex = 4; this.m_setButton.Text = "Set"; this.m_toolTip.SetToolTip(this.m_setButton, "Sets ellipsoid parameters"); this.m_setButton.UseVisualStyleBackColor = true; this.m_setButton.Click += new System.EventHandler(this.OnSet); // // m_flatteningTextBox // this.m_flatteningTextBox.Location = new System.Drawing.Point(12, 83); this.m_flatteningTextBox.Name = "m_flatteningTextBox"; this.m_flatteningTextBox.Size = new System.Drawing.Size(125, 20); this.m_flatteningTextBox.TabIndex = 3; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(109, 13); this.label1.TabIndex = 0; this.label1.Text = "Equatorial Radius (meters)"; // // m_equatorialRadiusTextBox // this.m_equatorialRadiusTextBox.Location = new System.Drawing.Point(12, 42); this.m_equatorialRadiusTextBox.Name = "m_equatorialRadiusTextBox"; this.m_equatorialRadiusTextBox.Size = new System.Drawing.Size(125, 20); this.m_equatorialRadiusTextBox.TabIndex = 2; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 66); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 13); this.label2.TabIndex = 1; this.label2.Text = "Flattening"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(159, 8); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(69, 13); this.label3.TabIndex = 8; this.label3.Text = "Minor Radius"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(159, 34); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(85, 13); this.label4.TabIndex = 9; this.label4.Text = "Quarter Meridian"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(159, 60); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(29, 13); this.label5.TabIndex = 10; this.label5.Text = "Area"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(159, 86); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(42, 13); this.label6.TabIndex = 11; this.label6.Text = "Volume"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(159, 112); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(74, 13); this.label7.TabIndex = 12; this.label7.Text = "2nd Flattening"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(159, 138); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(71, 13); this.label8.TabIndex = 13; this.label8.Text = "3rd Flattening"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(159, 164); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(74, 13); this.label9.TabIndex = 14; this.label9.Text = "Eccentricity^2"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(159, 190); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(94, 13); this.label10.TabIndex = 15; this.label10.Text = "2nd eccentricity^2"; // // m_minorRadiusTextBox // this.m_minorRadiusTextBox.Location = new System.Drawing.Point(259, 4); this.m_minorRadiusTextBox.Name = "m_minorRadiusTextBox"; this.m_minorRadiusTextBox.ReadOnly = true; this.m_minorRadiusTextBox.Size = new System.Drawing.Size(134, 20); this.m_minorRadiusTextBox.TabIndex = 16; // // m_quarterMeridianTextBox // this.m_quarterMeridianTextBox.Location = new System.Drawing.Point(259, 30); this.m_quarterMeridianTextBox.Name = "m_quarterMeridianTextBox"; this.m_quarterMeridianTextBox.ReadOnly = true; this.m_quarterMeridianTextBox.Size = new System.Drawing.Size(134, 20); this.m_quarterMeridianTextBox.TabIndex = 17; // // m_areaTextBox // this.m_areaTextBox.Location = new System.Drawing.Point(259, 56); this.m_areaTextBox.Name = "m_areaTextBox"; this.m_areaTextBox.ReadOnly = true; this.m_areaTextBox.Size = new System.Drawing.Size(134, 20); this.m_areaTextBox.TabIndex = 18; // // m_volumeTextBox // this.m_volumeTextBox.Location = new System.Drawing.Point(259, 82); this.m_volumeTextBox.Name = "m_volumeTextBox"; this.m_volumeTextBox.ReadOnly = true; this.m_volumeTextBox.Size = new System.Drawing.Size(134, 20); this.m_volumeTextBox.TabIndex = 19; // // m_2ndFlatTextBox // this.m_2ndFlatTextBox.Location = new System.Drawing.Point(259, 108); this.m_2ndFlatTextBox.Name = "m_2ndFlatTextBox"; this.m_2ndFlatTextBox.ReadOnly = true; this.m_2ndFlatTextBox.Size = new System.Drawing.Size(134, 20); this.m_2ndFlatTextBox.TabIndex = 20; // // m_3rdFlatTextBox // this.m_3rdFlatTextBox.Location = new System.Drawing.Point(259, 134); this.m_3rdFlatTextBox.Name = "m_3rdFlatTextBox"; this.m_3rdFlatTextBox.ReadOnly = true; this.m_3rdFlatTextBox.Size = new System.Drawing.Size(134, 20); this.m_3rdFlatTextBox.TabIndex = 21; // // m_ecc2TextBox // this.m_ecc2TextBox.Location = new System.Drawing.Point(259, 160); this.m_ecc2TextBox.Name = "m_ecc2TextBox"; this.m_ecc2TextBox.ReadOnly = true; this.m_ecc2TextBox.Size = new System.Drawing.Size(134, 20); this.m_ecc2TextBox.TabIndex = 22; // // m_2ecc2TextBox // this.m_2ecc2TextBox.Location = new System.Drawing.Point(259, 186); this.m_2ecc2TextBox.Name = "m_2ecc2TextBox"; this.m_2ecc2TextBox.ReadOnly = true; this.m_2ecc2TextBox.Size = new System.Drawing.Size(134, 20); this.m_2ecc2TextBox.TabIndex = 23; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(402, 8); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(22, 13); this.label11.TabIndex = 24; this.label11.Text = "Phi"; // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(402, 34); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(98, 13); this.label12.TabIndex = 25; this.label12.Text = "Parametric Latitude"; // // label13 // this.label13.AutoSize = true; this.label13.Location = new System.Drawing.Point(402, 60); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(100, 13); this.label13.TabIndex = 26; this.label13.Text = "Geocentric Latitude"; // // m_phiTextBox // this.m_phiTextBox.Location = new System.Drawing.Point(512, 4); this.m_phiTextBox.Name = "m_phiTextBox"; this.m_phiTextBox.Size = new System.Drawing.Size(100, 20); this.m_phiTextBox.TabIndex = 27; // // label14 // this.label14.AutoSize = true; this.label14.Location = new System.Drawing.Point(402, 86); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(95, 13); this.label14.TabIndex = 28; this.label14.Text = "Rectifying Latitude"; // // label15 // this.label15.AutoSize = true; this.label15.Location = new System.Drawing.Point(402, 112); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(86, 13); this.label15.TabIndex = 29; this.label15.Text = "Authalic Latitude"; // // label16 // this.label16.AutoSize = true; this.label16.Location = new System.Drawing.Point(402, 138); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(95, 13); this.label16.TabIndex = 30; this.label16.Text = "Conformal Latitude"; // // label17 // this.label17.AutoSize = true; this.label17.Location = new System.Drawing.Point(402, 164); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(90, 13); this.label17.TabIndex = 31; this.label17.Text = "Isometric Latitude"; // // m_parametericLatTextBox // this.m_parametericLatTextBox.Location = new System.Drawing.Point(512, 30); this.m_parametericLatTextBox.Name = "m_parametericLatTextBox"; this.m_parametericLatTextBox.ReadOnly = true; this.m_parametericLatTextBox.Size = new System.Drawing.Size(100, 20); this.m_parametericLatTextBox.TabIndex = 32; // // m_geocentricLatTextBox // this.m_geocentricLatTextBox.Location = new System.Drawing.Point(512, 56); this.m_geocentricLatTextBox.Name = "m_geocentricLatTextBox"; this.m_geocentricLatTextBox.ReadOnly = true; this.m_geocentricLatTextBox.Size = new System.Drawing.Size(100, 20); this.m_geocentricLatTextBox.TabIndex = 33; // // m_rectifyingLatTextBox // this.m_rectifyingLatTextBox.Location = new System.Drawing.Point(512, 82); this.m_rectifyingLatTextBox.Name = "m_rectifyingLatTextBox"; this.m_rectifyingLatTextBox.ReadOnly = true; this.m_rectifyingLatTextBox.Size = new System.Drawing.Size(100, 20); this.m_rectifyingLatTextBox.TabIndex = 34; // // m_authalicLatTextBox // this.m_authalicLatTextBox.Location = new System.Drawing.Point(512, 108); this.m_authalicLatTextBox.Name = "m_authalicLatTextBox"; this.m_authalicLatTextBox.ReadOnly = true; this.m_authalicLatTextBox.Size = new System.Drawing.Size(100, 20); this.m_authalicLatTextBox.TabIndex = 35; // // m_conformalTextBox // this.m_conformalTextBox.Location = new System.Drawing.Point(512, 134); this.m_conformalTextBox.Name = "m_conformalTextBox"; this.m_conformalTextBox.ReadOnly = true; this.m_conformalTextBox.Size = new System.Drawing.Size(100, 20); this.m_conformalTextBox.TabIndex = 36; // // m_isometricLatTextBox // this.m_isometricLatTextBox.Location = new System.Drawing.Point(512, 160); this.m_isometricLatTextBox.Name = "m_isometricLatTextBox"; this.m_isometricLatTextBox.ReadOnly = true; this.m_isometricLatTextBox.Size = new System.Drawing.Size(100, 20); this.m_isometricLatTextBox.TabIndex = 37; // // button1 // this.button1.Location = new System.Drawing.Point(435, 185); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(126, 23); this.button1.TabIndex = 38; this.button1.Text = "Calculate Latitudes"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnCalculateLatitudes); // // button2 // this.button2.Location = new System.Drawing.Point(18, 150); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 39; this.button2.Text = "Validate"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnValidate); // // EllipsoidPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.m_isometricLatTextBox); this.Controls.Add(this.m_conformalTextBox); this.Controls.Add(this.m_authalicLatTextBox); this.Controls.Add(this.m_rectifyingLatTextBox); this.Controls.Add(this.m_geocentricLatTextBox); this.Controls.Add(this.m_parametericLatTextBox); this.Controls.Add(this.label17); this.Controls.Add(this.label16); this.Controls.Add(this.label15); this.Controls.Add(this.label14); this.Controls.Add(this.m_phiTextBox); this.Controls.Add(this.label13); this.Controls.Add(this.label12); this.Controls.Add(this.label11); this.Controls.Add(this.m_2ecc2TextBox); this.Controls.Add(this.m_ecc2TextBox); this.Controls.Add(this.m_3rdFlatTextBox); this.Controls.Add(this.m_2ndFlatTextBox); this.Controls.Add(this.m_volumeTextBox); this.Controls.Add(this.m_areaTextBox); this.Controls.Add(this.m_quarterMeridianTextBox); this.Controls.Add(this.m_minorRadiusTextBox); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.groupBox1); this.Name = "EllipsoidPanel"; this.Size = new System.Drawing.Size(798, 356); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.ToolTip m_toolTip; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button m_setButton; private System.Windows.Forms.TextBox m_flatteningTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox m_equatorialRadiusTextBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.TextBox m_minorRadiusTextBox; private System.Windows.Forms.TextBox m_quarterMeridianTextBox; private System.Windows.Forms.TextBox m_areaTextBox; private System.Windows.Forms.TextBox m_volumeTextBox; private System.Windows.Forms.TextBox m_2ndFlatTextBox; private System.Windows.Forms.TextBox m_3rdFlatTextBox; private System.Windows.Forms.TextBox m_ecc2TextBox; private System.Windows.Forms.TextBox m_2ecc2TextBox; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; private System.Windows.Forms.TextBox m_phiTextBox; private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label16; private System.Windows.Forms.Label label17; private System.Windows.Forms.TextBox m_parametericLatTextBox; private System.Windows.Forms.TextBox m_geocentricLatTextBox; private System.Windows.Forms.TextBox m_rectifyingLatTextBox; private System.Windows.Forms.TextBox m_authalicLatTextBox; private System.Windows.Forms.TextBox m_conformalTextBox; private System.Windows.Forms.TextBox m_isometricLatTextBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; } } GeographicLib-1.52/dotnet/Projections/EllipsoidPanel.cs0000644000771000077100000001134414064202371023047 0ustar ckarneyckarney/** * \file NETGeographicLib\EllipsoidPanel.cs * \brief NETGeographicLib.Ellipsoid example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class EllipsoidPanel : UserControl { Ellipsoid m_ell = null; public EllipsoidPanel() { InitializeComponent(); m_ell = new Ellipsoid(); m_majorRadiusTextBox.Text = m_ell.EquatorialRadius.ToString(); m_flatteningTextBox.Text = m_ell.Flattening.ToString(); m_minorRadiusTextBox.Text = m_ell.MinorRadius.ToString(); m_quarterMeridianTextBox.Text = m_ell.QuarterMeridian.ToString(); m_areaTextBox.Text = m_ell.Area.ToString(); m_volumeTextBox.Text = m_ell.Volume.ToString(); m_2ndFlatTextBox.Text = m_ell.SecondFlattening.ToString(); m_3rdFlatTextBox.Text = m_ell.ThirdFlattening.ToString(); m_ecc2TextBox.Text = m_ell.EccentricitySq.ToString(); m_2ecc2TextBox.Text = m_ell.SecondEccentricitySq.ToString(); } private void OnSet(object sender, EventArgs e) { try { double a = Double.Parse(m_majorRadiusTextBox.Text); double f = Double.Parse(m_flatteningTextBox.Text); m_ell = new Ellipsoid(a, f); m_minorRadiusTextBox.Text = m_ell.MinorRadius.ToString(); m_quarterMeridianTextBox.Text = m_ell.QuarterMeridian.ToString(); m_areaTextBox.Text = m_ell.Area.ToString(); m_volumeTextBox.Text = m_ell.Volume.ToString(); m_2ndFlatTextBox.Text = m_ell.SecondFlattening.ToString(); m_3rdFlatTextBox.Text = m_ell.ThirdFlattening.ToString(); m_ecc2TextBox.Text = m_ell.EccentricitySq.ToString(); m_2ecc2TextBox.Text = m_ell.SecondEccentricitySq.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnCalculateLatitudes(object sender, EventArgs e) { try { double phi = Double.Parse(m_phiTextBox.Text); m_parametericLatTextBox.Text = m_ell.ParametricLatitude(phi).ToString(); m_geocentricLatTextBox.Text = m_ell.GeocentricLatitude(phi).ToString(); m_rectifyingLatTextBox.Text = m_ell.RectifyingLatitude(phi).ToString(); m_authalicLatTextBox.Text = m_ell.AuthalicLatitude(phi).ToString(); m_conformalTextBox.Text = m_ell.ConformalLatitude(phi).ToString(); m_isometricLatTextBox.Text = m_ell.IsometricLatitude(phi).ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnValidate(object sender, EventArgs e) { try { Ellipsoid ee = new Ellipsoid(50000.0, .003); ee = new Ellipsoid(); ee.AuthalicLatitude(30.0); ee.CircleHeight(30.0); ee.CircleRadius(30.0); ee.ConformalLatitude(30.0); ee.GeocentricLatitude(30.0); ee.InverseAuthalicLatitude(30.0); ee.InverseConformalLatitude(30.0); ee.InverseGeocentricLatitude(30.0); ee.InverseIsometricLatitude(30.0); ee.InverseParametricLatitude(30.0); ee.InverseRectifyingLatitude(30.0); ee.IsometricLatitude(30.0); ee.MeridianDistance(30.0); ee.MeridionalCurvatureRadius(30.0); ee.NormalCurvatureRadius(30.0, 60.0); ee.ParametricLatitude(30.0); ee.RectifyingLatitude(30.0); ee.TransverseCurvatureRadius(30.0); MessageBox.Show("no errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } GeographicLib-1.52/dotnet/Projections/EllipsoidPanel.resx0000644000771000077100000001347014064202371023425 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/EllipticPanel.Designer.cs0000644000771000077100000005600114064202371024426 0ustar ckarneyckarneynamespace Projections { partial class EllipticPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.m_toolTip = new System.Windows.Forms.ToolTip(this.components); this.label4 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.m_k2TextBox = new System.Windows.Forms.TextBox(); this.m_alpha2TextBox = new System.Windows.Forms.TextBox(); this.m_kp2TextBox = new System.Windows.Forms.TextBox(); this.m_alphap2TextBox = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.m_constructorComboBox = new System.Windows.Forms.ComboBox(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.m_KtextBox = new System.Windows.Forms.TextBox(); this.m_EtextBox = new System.Windows.Forms.TextBox(); this.m_DtextBox = new System.Windows.Forms.TextBox(); this.m_KEtextBox = new System.Windows.Forms.TextBox(); this.m_PItextBox = new System.Windows.Forms.TextBox(); this.m_GtextBox = new System.Windows.Forms.TextBox(); this.m_HtextBox = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label(); this.m_phiTextBox = new System.Windows.Forms.TextBox(); this.m_EphiTextBox = new System.Windows.Forms.TextBox(); this.m_DphiTextBox = new System.Windows.Forms.TextBox(); this.m_FphiTextBox = new System.Windows.Forms.TextBox(); this.m_PiphiTextBox = new System.Windows.Forms.TextBox(); this.m_GphiTextBox = new System.Windows.Forms.TextBox(); this.m_HphiTextBox = new System.Windows.Forms.TextBox(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(9, 11); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(19, 13); this.label4.TabIndex = 0; this.label4.Text = "k2"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(9, 37); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(39, 13); this.label1.TabIndex = 1; this.label1.Text = "alpha2"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(9, 63); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(25, 13); this.label2.TabIndex = 2; this.label2.Text = "kp2"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(9, 89); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(45, 13); this.label3.TabIndex = 3; this.label3.Text = "alphap2"; // // m_k2TextBox // this.m_k2TextBox.Location = new System.Drawing.Point(76, 7); this.m_k2TextBox.Name = "m_k2TextBox"; this.m_k2TextBox.Size = new System.Drawing.Size(100, 20); this.m_k2TextBox.TabIndex = 4; // // m_alpha2TextBox // this.m_alpha2TextBox.Location = new System.Drawing.Point(76, 33); this.m_alpha2TextBox.Name = "m_alpha2TextBox"; this.m_alpha2TextBox.Size = new System.Drawing.Size(100, 20); this.m_alpha2TextBox.TabIndex = 5; // // m_kp2TextBox // this.m_kp2TextBox.Location = new System.Drawing.Point(76, 59); this.m_kp2TextBox.Name = "m_kp2TextBox"; this.m_kp2TextBox.Size = new System.Drawing.Size(100, 20); this.m_kp2TextBox.TabIndex = 6; // // m_alphap2TextBox // this.m_alphap2TextBox.Location = new System.Drawing.Point(76, 85); this.m_alphap2TextBox.Name = "m_alphap2TextBox"; this.m_alphap2TextBox.Size = new System.Drawing.Size(100, 20); this.m_alphap2TextBox.TabIndex = 7; // // button1 // this.button1.Location = new System.Drawing.Point(47, 141); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 8; this.button1.Text = "Set"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnSet); // // m_constructorComboBox // this.m_constructorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_constructorComboBox.FormattingEnabled = true; this.m_constructorComboBox.Items.AddRange(new object[] { "Constructor #1", "Constructor #2"}); this.m_constructorComboBox.Location = new System.Drawing.Point(76, 113); this.m_constructorComboBox.Name = "m_constructorComboBox"; this.m_constructorComboBox.Size = new System.Drawing.Size(100, 21); this.m_constructorComboBox.TabIndex = 9; this.m_toolTip.SetToolTip(this.m_constructorComboBox, "Selects the constructor"); this.m_constructorComboBox.SelectedIndexChanged += new System.EventHandler(this.OnConstructor); // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(9, 117); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(61, 13); this.label5.TabIndex = 10; this.label5.Text = "Constructor"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(186, 11); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(14, 13); this.label6.TabIndex = 11; this.label6.Text = "K"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(186, 37); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(14, 13); this.label7.TabIndex = 12; this.label7.Text = "E"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(186, 63); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(15, 13); this.label8.TabIndex = 13; this.label8.Text = "D"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(186, 89); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(21, 13); this.label9.TabIndex = 14; this.label9.Text = "KE"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(186, 113); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(16, 13); this.label10.TabIndex = 15; this.label10.Text = "Pi"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(186, 141); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(15, 13); this.label11.TabIndex = 16; this.label11.Text = "G"; // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(186, 168); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(15, 13); this.label12.TabIndex = 17; this.label12.Text = "H"; // // m_KtextBox // this.m_KtextBox.Location = new System.Drawing.Point(218, 7); this.m_KtextBox.Name = "m_KtextBox"; this.m_KtextBox.ReadOnly = true; this.m_KtextBox.Size = new System.Drawing.Size(100, 20); this.m_KtextBox.TabIndex = 18; // // m_EtextBox // this.m_EtextBox.Location = new System.Drawing.Point(218, 33); this.m_EtextBox.Name = "m_EtextBox"; this.m_EtextBox.ReadOnly = true; this.m_EtextBox.Size = new System.Drawing.Size(100, 20); this.m_EtextBox.TabIndex = 19; // // m_DtextBox // this.m_DtextBox.Location = new System.Drawing.Point(218, 59); this.m_DtextBox.Name = "m_DtextBox"; this.m_DtextBox.ReadOnly = true; this.m_DtextBox.Size = new System.Drawing.Size(100, 20); this.m_DtextBox.TabIndex = 20; // // m_KEtextBox // this.m_KEtextBox.Location = new System.Drawing.Point(218, 85); this.m_KEtextBox.Name = "m_KEtextBox"; this.m_KEtextBox.ReadOnly = true; this.m_KEtextBox.Size = new System.Drawing.Size(100, 20); this.m_KEtextBox.TabIndex = 21; // // m_PItextBox // this.m_PItextBox.Location = new System.Drawing.Point(218, 111); this.m_PItextBox.Name = "m_PItextBox"; this.m_PItextBox.ReadOnly = true; this.m_PItextBox.Size = new System.Drawing.Size(100, 20); this.m_PItextBox.TabIndex = 22; // // m_GtextBox // this.m_GtextBox.Location = new System.Drawing.Point(218, 137); this.m_GtextBox.Name = "m_GtextBox"; this.m_GtextBox.ReadOnly = true; this.m_GtextBox.Size = new System.Drawing.Size(100, 20); this.m_GtextBox.TabIndex = 23; // // m_HtextBox // this.m_HtextBox.Location = new System.Drawing.Point(218, 163); this.m_HtextBox.Name = "m_HtextBox"; this.m_HtextBox.ReadOnly = true; this.m_HtextBox.Size = new System.Drawing.Size(100, 20); this.m_HtextBox.TabIndex = 24; // // label13 // this.label13.AutoSize = true; this.label13.Location = new System.Drawing.Point(329, 11); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(21, 13); this.label13.TabIndex = 25; this.label13.Text = "phi"; // // label14 // this.label14.AutoSize = true; this.label14.Location = new System.Drawing.Point(329, 37); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(34, 13); this.label14.TabIndex = 26; this.label14.Text = "E(phi)"; // // label15 // this.label15.AutoSize = true; this.label15.Location = new System.Drawing.Point(329, 89); this.label15.Name = "label15"; this.label15.Size = new System.Drawing.Size(33, 13); this.label15.TabIndex = 27; this.label15.Text = "F(phi)"; // // label16 // this.label16.AutoSize = true; this.label16.Location = new System.Drawing.Point(329, 63); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(35, 13); this.label16.TabIndex = 28; this.label16.Text = "D(phi)"; // // label17 // this.label17.AutoSize = true; this.label17.Location = new System.Drawing.Point(329, 115); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(36, 13); this.label17.TabIndex = 29; this.label17.Text = "Pi(phi)"; // // label18 // this.label18.AutoSize = true; this.label18.Location = new System.Drawing.Point(329, 141); this.label18.Name = "label18"; this.label18.Size = new System.Drawing.Size(35, 13); this.label18.TabIndex = 30; this.label18.Text = "G(phi)"; // // label19 // this.label19.AutoSize = true; this.label19.Location = new System.Drawing.Point(329, 167); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(35, 13); this.label19.TabIndex = 31; this.label19.Text = "H(phi)"; // // m_phiTextBox // this.m_phiTextBox.Location = new System.Drawing.Point(371, 7); this.m_phiTextBox.Name = "m_phiTextBox"; this.m_phiTextBox.Size = new System.Drawing.Size(100, 20); this.m_phiTextBox.TabIndex = 32; // // m_EphiTextBox // this.m_EphiTextBox.Location = new System.Drawing.Point(371, 33); this.m_EphiTextBox.Name = "m_EphiTextBox"; this.m_EphiTextBox.ReadOnly = true; this.m_EphiTextBox.Size = new System.Drawing.Size(100, 20); this.m_EphiTextBox.TabIndex = 33; // // m_DphiTextBox // this.m_DphiTextBox.Location = new System.Drawing.Point(372, 59); this.m_DphiTextBox.Name = "m_DphiTextBox"; this.m_DphiTextBox.ReadOnly = true; this.m_DphiTextBox.Size = new System.Drawing.Size(100, 20); this.m_DphiTextBox.TabIndex = 34; // // m_FphiTextBox // this.m_FphiTextBox.Location = new System.Drawing.Point(371, 85); this.m_FphiTextBox.Name = "m_FphiTextBox"; this.m_FphiTextBox.ReadOnly = true; this.m_FphiTextBox.Size = new System.Drawing.Size(100, 20); this.m_FphiTextBox.TabIndex = 35; // // m_PiphiTextBox // this.m_PiphiTextBox.Location = new System.Drawing.Point(371, 111); this.m_PiphiTextBox.Name = "m_PiphiTextBox"; this.m_PiphiTextBox.ReadOnly = true; this.m_PiphiTextBox.Size = new System.Drawing.Size(100, 20); this.m_PiphiTextBox.TabIndex = 36; // // m_GphiTextBox // this.m_GphiTextBox.Location = new System.Drawing.Point(371, 137); this.m_GphiTextBox.Name = "m_GphiTextBox"; this.m_GphiTextBox.ReadOnly = true; this.m_GphiTextBox.Size = new System.Drawing.Size(100, 20); this.m_GphiTextBox.TabIndex = 37; // // m_HphiTextBox // this.m_HphiTextBox.Location = new System.Drawing.Point(371, 163); this.m_HphiTextBox.Name = "m_HphiTextBox"; this.m_HphiTextBox.ReadOnly = true; this.m_HphiTextBox.Size = new System.Drawing.Size(100, 20); this.m_HphiTextBox.TabIndex = 38; // // button2 // this.button2.Location = new System.Drawing.Point(332, 190); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(139, 23); this.button2.TabIndex = 39; this.button2.Text = "Calculate phi functions"; this.m_toolTip.SetToolTip(this.button2, "Calculate all functions that use phi as an input"); this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnComputePhi); // // button3 // this.button3.Location = new System.Drawing.Point(47, 168); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 40; this.button3.Text = "Validate"; this.m_toolTip.SetToolTip(this.button3, "Verifies Elliptic Function interfaces"); this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.OnValidate); // // EllipticPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.m_HphiTextBox); this.Controls.Add(this.m_GphiTextBox); this.Controls.Add(this.m_PiphiTextBox); this.Controls.Add(this.m_FphiTextBox); this.Controls.Add(this.m_DphiTextBox); this.Controls.Add(this.m_EphiTextBox); this.Controls.Add(this.m_phiTextBox); this.Controls.Add(this.label19); this.Controls.Add(this.label18); this.Controls.Add(this.label17); this.Controls.Add(this.label16); this.Controls.Add(this.label15); this.Controls.Add(this.label14); this.Controls.Add(this.label13); this.Controls.Add(this.m_HtextBox); this.Controls.Add(this.m_GtextBox); this.Controls.Add(this.m_PItextBox); this.Controls.Add(this.m_KEtextBox); this.Controls.Add(this.m_DtextBox); this.Controls.Add(this.m_EtextBox); this.Controls.Add(this.m_KtextBox); this.Controls.Add(this.label12); this.Controls.Add(this.label11); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.m_constructorComboBox); this.Controls.Add(this.button1); this.Controls.Add(this.m_alphap2TextBox); this.Controls.Add(this.m_kp2TextBox); this.Controls.Add(this.m_alpha2TextBox); this.Controls.Add(this.m_k2TextBox); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.label4); this.Name = "EllipticPanel"; this.Size = new System.Drawing.Size(764, 377); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.ToolTip m_toolTip; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox m_k2TextBox; private System.Windows.Forms.TextBox m_alpha2TextBox; private System.Windows.Forms.TextBox m_kp2TextBox; private System.Windows.Forms.TextBox m_alphap2TextBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.ComboBox m_constructorComboBox; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox m_KtextBox; private System.Windows.Forms.TextBox m_EtextBox; private System.Windows.Forms.TextBox m_DtextBox; private System.Windows.Forms.TextBox m_KEtextBox; private System.Windows.Forms.TextBox m_PItextBox; private System.Windows.Forms.TextBox m_GtextBox; private System.Windows.Forms.TextBox m_HtextBox; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label16; private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label18; private System.Windows.Forms.Label label19; private System.Windows.Forms.TextBox m_phiTextBox; private System.Windows.Forms.TextBox m_EphiTextBox; private System.Windows.Forms.TextBox m_DphiTextBox; private System.Windows.Forms.TextBox m_FphiTextBox; private System.Windows.Forms.TextBox m_PiphiTextBox; private System.Windows.Forms.TextBox m_GphiTextBox; private System.Windows.Forms.TextBox m_HphiTextBox; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; } } GeographicLib-1.52/dotnet/Projections/EllipticPanel.cs0000644000771000077100000001134014064202371022664 0ustar ckarneyckarney/** * \file NETGeographicLib\EllipticPanel.cs * \brief NETGeographicLib.EllipticFunction example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class EllipticPanel : UserControl { EllipticFunction m_func = null; public EllipticPanel() { InitializeComponent(); m_constructorComboBox.SelectedIndex = 0; m_k2TextBox.Text = "0.5"; m_alpha2TextBox.Text = "0.5"; OnSet(null, null); } private void OnSet(object sender, EventArgs e) { try { double k2 = Double.Parse(m_k2TextBox.Text); double alpha2 = Double.Parse(m_alpha2TextBox.Text); if (m_constructorComboBox.SelectedIndex == 0) m_func = new EllipticFunction(k2, alpha2); else { double kp2 = Double.Parse(m_kp2TextBox.Text); double alphap2 = Double.Parse(m_alphap2TextBox.Text); m_func = new EllipticFunction(k2, alpha2, kp2, alphap2); } m_KtextBox.Text = m_func.K().ToString(); m_EtextBox.Text = m_func.E().ToString(); m_DtextBox.Text = m_func.D().ToString(); m_KEtextBox.Text = m_func.KE().ToString(); m_PItextBox.Text = m_func.Pi().ToString(); m_GtextBox.Text = m_func.G().ToString(); m_HtextBox.Text = m_func.H().ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnConstructor(object sender, EventArgs e) { m_kp2TextBox.ReadOnly = m_alphap2TextBox.ReadOnly = m_constructorComboBox.SelectedIndex == 0; } private void OnComputePhi(object sender, EventArgs e) { try { double phi = Double.Parse(m_phiTextBox.Text); m_EphiTextBox.Text = m_func.E(phi).ToString(); m_FphiTextBox.Text = m_func.F(phi).ToString(); m_DphiTextBox.Text = m_func.D(phi).ToString(); m_GphiTextBox.Text = m_func.G(phi).ToString(); m_HphiTextBox.Text = m_func.H(phi).ToString(); m_PiphiTextBox.Text = m_func.Pi(phi).ToString(); } catch ( Exception xcpt ) { MessageBox.Show( xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } private void OnValidate(object sender, EventArgs e) { try { double phi = 0.8; EllipticFunction f = new EllipticFunction(0.3, 0.4, 0.7, 0.6); f.Reset(0.2, 0.3, 0.8, 0.7); f = new EllipticFunction(0.3, 0.4); f.Reset(0.2, 0.3); double cn, sn, dn; f.sncndn(0.3, out sn, out cn, out dn); f.Delta(sn, cn); f.D(); f.D(phi); f.D(sn, cn, dn); f.Pi(); f.Pi(phi); f.Pi(sn, cn, dn); f.KE(); f.K(); f.H(); f.H(phi); f.H(sn, cn, dn); f.G(); f.G(phi); f.G(sn, cn, dn); f.F(phi); f.F(sn, cn, dn); f.Einv(0.75); f.Ed(60.0); f.E(); f.E(phi); f.E(sn, cn, dn); double tau = 3.1415927 / 10.0; f.deltaEinv(Math.Sin(tau), Math.Cos(tau)); f.deltaD(sn, cn, dn); f.deltaE(sn, cn, dn); f.deltaF(sn, cn, dn); f.deltaG(sn, cn, dn); f.deltaH(sn, cn, dn); f.deltaPi(sn, cn, dn); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } GeographicLib-1.52/dotnet/Projections/EllipticPanel.resx0000644000771000077100000001347014064202371023246 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/Form1.Designer.cs0000644000771000077100000003311214064202371022663 0ustar ckarneyckarneynamespace Projections { partial class Form1 { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.m_tabControl = new System.Windows.Forms.TabControl(); this.m_geocentricTabPage = new System.Windows.Forms.TabPage(); this.m_geodesicTabPage = new System.Windows.Forms.TabPage(); this.m_localCartesianPage = new System.Windows.Forms.TabPage(); this.m_albersPage = new System.Windows.Forms.TabPage(); this.m_typeIIProjections = new System.Windows.Forms.TabPage(); this.m_typeIIIProjPage = new System.Windows.Forms.TabPage(); this.m_polarStereoPage = new System.Windows.Forms.TabPage(); this.m_sphericalPage = new System.Windows.Forms.TabPage(); this.m_ellipticPage = new System.Windows.Forms.TabPage(); this.m_ellipsoidPage = new System.Windows.Forms.TabPage(); this.m_miscPage = new System.Windows.Forms.TabPage(); this.m_geoidPage = new System.Windows.Forms.TabPage(); this.m_gravityPage = new System.Windows.Forms.TabPage(); this.m_magneticPage = new System.Windows.Forms.TabPage(); this.m_polyPage = new System.Windows.Forms.TabPage(); this.m_accumPage = new System.Windows.Forms.TabPage(); this.m_rhumbTabPage = new System.Windows.Forms.TabPage(); this.m_tabControl.SuspendLayout(); this.SuspendLayout(); // // m_tabControl // this.m_tabControl.Controls.Add(this.m_geocentricTabPage); this.m_tabControl.Controls.Add(this.m_geodesicTabPage); this.m_tabControl.Controls.Add(this.m_localCartesianPage); this.m_tabControl.Controls.Add(this.m_albersPage); this.m_tabControl.Controls.Add(this.m_typeIIProjections); this.m_tabControl.Controls.Add(this.m_typeIIIProjPage); this.m_tabControl.Controls.Add(this.m_polarStereoPage); this.m_tabControl.Controls.Add(this.m_sphericalPage); this.m_tabControl.Controls.Add(this.m_ellipticPage); this.m_tabControl.Controls.Add(this.m_ellipsoidPage); this.m_tabControl.Controls.Add(this.m_miscPage); this.m_tabControl.Controls.Add(this.m_geoidPage); this.m_tabControl.Controls.Add(this.m_gravityPage); this.m_tabControl.Controls.Add(this.m_magneticPage); this.m_tabControl.Controls.Add(this.m_polyPage); this.m_tabControl.Controls.Add(this.m_accumPage); this.m_tabControl.Controls.Add(this.m_rhumbTabPage); this.m_tabControl.Dock = System.Windows.Forms.DockStyle.Fill; this.m_tabControl.Location = new System.Drawing.Point(0, 0); this.m_tabControl.Name = "m_tabControl"; this.m_tabControl.SelectedIndex = 0; this.m_tabControl.ShowToolTips = true; this.m_tabControl.Size = new System.Drawing.Size(944, 262); this.m_tabControl.TabIndex = 0; // // m_geocentricTabPage // this.m_geocentricTabPage.Location = new System.Drawing.Point(4, 22); this.m_geocentricTabPage.Name = "m_geocentricTabPage"; this.m_geocentricTabPage.Size = new System.Drawing.Size(936, 236); this.m_geocentricTabPage.TabIndex = 1; this.m_geocentricTabPage.Text = "Geocentric"; this.m_geocentricTabPage.UseVisualStyleBackColor = true; // // m_geodesicTabPage // this.m_geodesicTabPage.Location = new System.Drawing.Point(4, 22); this.m_geodesicTabPage.Name = "m_geodesicTabPage"; this.m_geodesicTabPage.Padding = new System.Windows.Forms.Padding(3); this.m_geodesicTabPage.Size = new System.Drawing.Size(936, 236); this.m_geodesicTabPage.TabIndex = 0; this.m_geodesicTabPage.Text = "Geodesic"; this.m_geodesicTabPage.ToolTipText = "Geodesic, GeodesicExact, GeodesicLine, & GeodesicLineExact"; this.m_geodesicTabPage.UseVisualStyleBackColor = true; // // m_localCartesianPage // this.m_localCartesianPage.Location = new System.Drawing.Point(4, 22); this.m_localCartesianPage.Name = "m_localCartesianPage"; this.m_localCartesianPage.Size = new System.Drawing.Size(936, 236); this.m_localCartesianPage.TabIndex = 2; this.m_localCartesianPage.Text = "LocalCartesian"; this.m_localCartesianPage.UseVisualStyleBackColor = true; // // m_albersPage // this.m_albersPage.Location = new System.Drawing.Point(4, 22); this.m_albersPage.Name = "m_albersPage"; this.m_albersPage.Size = new System.Drawing.Size(936, 236); this.m_albersPage.TabIndex = 3; this.m_albersPage.Text = "Type I Projections"; this.m_albersPage.ToolTipText = "Albers Equal Area, Lambert Conformal Conic, Transverse Mercator, and Transverse M" + "ercator Exact Projections"; this.m_albersPage.UseVisualStyleBackColor = true; // // m_typeIIProjections // this.m_typeIIProjections.Location = new System.Drawing.Point(4, 22); this.m_typeIIProjections.Name = "m_typeIIProjections"; this.m_typeIIProjections.Size = new System.Drawing.Size(936, 236); this.m_typeIIProjections.TabIndex = 4; this.m_typeIIProjections.Text = "Type II Projections"; this.m_typeIIProjections.ToolTipText = "Azimuth Equidistant, Cassini Soldner, and Gnomonic Projections"; this.m_typeIIProjections.UseVisualStyleBackColor = true; // // m_typeIIIProjPage // this.m_typeIIIProjPage.Location = new System.Drawing.Point(4, 22); this.m_typeIIIProjPage.Name = "m_typeIIIProjPage"; this.m_typeIIIProjPage.Size = new System.Drawing.Size(936, 236); this.m_typeIIIProjPage.TabIndex = 11; this.m_typeIIIProjPage.Text = "Type III Projections"; this.m_typeIIIProjPage.ToolTipText = "MGRS/OSGB/UTMUPS"; this.m_typeIIIProjPage.UseVisualStyleBackColor = true; // // m_polarStereoPage // this.m_polarStereoPage.Location = new System.Drawing.Point(4, 22); this.m_polarStereoPage.Name = "m_polarStereoPage"; this.m_polarStereoPage.Size = new System.Drawing.Size(936, 236); this.m_polarStereoPage.TabIndex = 5; this.m_polarStereoPage.Text = "Polar Stereographic"; this.m_polarStereoPage.UseVisualStyleBackColor = true; // // m_sphericalPage // this.m_sphericalPage.Location = new System.Drawing.Point(4, 22); this.m_sphericalPage.Name = "m_sphericalPage"; this.m_sphericalPage.Size = new System.Drawing.Size(936, 236); this.m_sphericalPage.TabIndex = 6; this.m_sphericalPage.Text = "Spherical Harmonics"; this.m_sphericalPage.ToolTipText = "Spherical Harmonic, Spherical Harmonic 1, and Spherical Harmonic 2"; this.m_sphericalPage.UseVisualStyleBackColor = true; // // m_ellipticPage // this.m_ellipticPage.Location = new System.Drawing.Point(4, 22); this.m_ellipticPage.Name = "m_ellipticPage"; this.m_ellipticPage.Size = new System.Drawing.Size(936, 236); this.m_ellipticPage.TabIndex = 7; this.m_ellipticPage.Text = "Elliptic Function"; this.m_ellipticPage.UseVisualStyleBackColor = true; // // m_ellipsoidPage // this.m_ellipsoidPage.Location = new System.Drawing.Point(4, 22); this.m_ellipsoidPage.Name = "m_ellipsoidPage"; this.m_ellipsoidPage.Size = new System.Drawing.Size(936, 236); this.m_ellipsoidPage.TabIndex = 8; this.m_ellipsoidPage.Text = "Ellipsoid"; this.m_ellipsoidPage.UseVisualStyleBackColor = true; // // m_miscPage // this.m_miscPage.Location = new System.Drawing.Point(4, 22); this.m_miscPage.Name = "m_miscPage"; this.m_miscPage.Size = new System.Drawing.Size(936, 236); this.m_miscPage.TabIndex = 9; this.m_miscPage.Text = "Miscellaneous"; this.m_miscPage.ToolTipText = "DDS/Geohash"; this.m_miscPage.UseVisualStyleBackColor = true; // // m_geoidPage // this.m_geoidPage.Location = new System.Drawing.Point(4, 22); this.m_geoidPage.Name = "m_geoidPage"; this.m_geoidPage.Size = new System.Drawing.Size(936, 236); this.m_geoidPage.TabIndex = 10; this.m_geoidPage.Text = "Geoid"; this.m_geoidPage.UseVisualStyleBackColor = true; // // m_gravityPage // this.m_gravityPage.Location = new System.Drawing.Point(4, 22); this.m_gravityPage.Name = "m_gravityPage"; this.m_gravityPage.Size = new System.Drawing.Size(936, 236); this.m_gravityPage.TabIndex = 12; this.m_gravityPage.Text = "Gravity"; this.m_gravityPage.ToolTipText = "GravityModel/GravityCircle/NormalGravity"; this.m_gravityPage.UseVisualStyleBackColor = true; // // m_magneticPage // this.m_magneticPage.Location = new System.Drawing.Point(4, 22); this.m_magneticPage.Name = "m_magneticPage"; this.m_magneticPage.Size = new System.Drawing.Size(936, 236); this.m_magneticPage.TabIndex = 13; this.m_magneticPage.Text = "Magnetic"; this.m_magneticPage.ToolTipText = "MagneticModel/MagneticCircle"; this.m_magneticPage.UseVisualStyleBackColor = true; // // m_polyPage // this.m_polyPage.Location = new System.Drawing.Point(4, 22); this.m_polyPage.Name = "m_polyPage"; this.m_polyPage.Size = new System.Drawing.Size(936, 236); this.m_polyPage.TabIndex = 14; this.m_polyPage.Text = "PolygonArea"; this.m_polyPage.UseVisualStyleBackColor = true; // // m_accumPage // this.m_accumPage.Location = new System.Drawing.Point(4, 22); this.m_accumPage.Name = "m_accumPage"; this.m_accumPage.Size = new System.Drawing.Size(936, 236); this.m_accumPage.TabIndex = 15; this.m_accumPage.Text = "Accumulator"; this.m_accumPage.UseVisualStyleBackColor = true; // // m_rhumbTabPage // this.m_rhumbTabPage.Location = new System.Drawing.Point(4, 22); this.m_rhumbTabPage.Name = "m_rhumbTabPage"; this.m_rhumbTabPage.Padding = new System.Windows.Forms.Padding(3); this.m_rhumbTabPage.Size = new System.Drawing.Size(936, 236); this.m_rhumbTabPage.TabIndex = 16; this.m_rhumbTabPage.Text = "Rhumb"; this.m_rhumbTabPage.UseVisualStyleBackColor = true; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(944, 262); this.Controls.Add(this.m_tabControl); this.Name = "Form1"; this.Text = "Projections"; this.m_tabControl.ResumeLayout(false); this.ResumeLayout(false); } #endregion private System.Windows.Forms.TabControl m_tabControl; private System.Windows.Forms.TabPage m_geodesicTabPage; private System.Windows.Forms.TabPage m_geocentricTabPage; private System.Windows.Forms.TabPage m_localCartesianPage; private System.Windows.Forms.TabPage m_albersPage; private System.Windows.Forms.TabPage m_typeIIProjections; private System.Windows.Forms.TabPage m_polarStereoPage; private System.Windows.Forms.TabPage m_sphericalPage; private System.Windows.Forms.TabPage m_ellipticPage; private System.Windows.Forms.TabPage m_ellipsoidPage; private System.Windows.Forms.TabPage m_miscPage; private System.Windows.Forms.TabPage m_geoidPage; private System.Windows.Forms.TabPage m_typeIIIProjPage; private System.Windows.Forms.TabPage m_gravityPage; private System.Windows.Forms.TabPage m_magneticPage; private System.Windows.Forms.TabPage m_polyPage; private System.Windows.Forms.TabPage m_accumPage; private System.Windows.Forms.TabPage m_rhumbTabPage; } } GeographicLib-1.52/dotnet/Projections/Form1.cs0000644000771000077100000000364514064202371021134 0ustar ckarneyckarney/** * \file NETGeographicLib\Form1.cs * \brief Main Form for C# example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class Form1 : Form { public Form1() { InitializeComponent(); Text = "NETGeographicLib Demo - Version " + VersionInfo.GetString(); // set up the tab control m_geodesicTabPage.Controls.Add(new GeodesicPanel()); m_geocentricTabPage.Controls.Add(new GeocentricPanel()); m_localCartesianPage.Controls.Add(new LocalCartesianPanel()); m_albersPage.Controls.Add(new AlbersPanel()); m_typeIIProjections.Controls.Add(new ProjectionsPanel()); m_typeIIIProjPage.Controls.Add(new TypeIIIProjPanel()); m_polarStereoPage.Controls.Add(new PolarStereoPanel()); m_sphericalPage.Controls.Add(new SphericalHarmonicsPanel()); m_ellipticPage.Controls.Add(new EllipticPanel()); m_ellipsoidPage.Controls.Add(new EllipsoidPanel()); m_miscPage.Controls.Add(new MiscPanel()); m_geoidPage.Controls.Add(new GeoidPanel()); m_gravityPage.Controls.Add(new GravityPanel()); m_magneticPage.Controls.Add(new MagneticPanel()); m_polyPage.Controls.Add(new PolyPanel()); m_accumPage.Controls.Add(new AccumPanel()); m_rhumbTabPage.Controls.Add(new RhumbPanel()); } } } GeographicLib-1.52/dotnet/Projections/Form1.resx0000644000771000077100000001316314064202371021504 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 GeographicLib-1.52/dotnet/Projections/GeocentricPanel.Designer.cs0000644000771000077100000004626214064202371024753 0ustar ckarneyckarneynamespace Projections { partial class GeocentricPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.m_setButton = new System.Windows.Forms.Button(); this.m_equatorialRadiusTextBox = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_flatteningTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.m_toolTips = new System.Windows.Forms.ToolTip(this.components); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.m_altitudeTextBox = new System.Windows.Forms.TextBox(); this.m_XTextBox = new System.Windows.Forms.TextBox(); this.m_YTextBox = new System.Windows.Forms.TextBox(); this.m_ZTextBox = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.m_functionComboBox = new System.Windows.Forms.ComboBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.m_textBox00 = new System.Windows.Forms.TextBox(); this.m_textBox01 = new System.Windows.Forms.TextBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.m_textBox02 = new System.Windows.Forms.TextBox(); this.m_textBox12 = new System.Windows.Forms.TextBox(); this.m_textBox10 = new System.Windows.Forms.TextBox(); this.m_textBox11 = new System.Windows.Forms.TextBox(); this.m_textBox22 = new System.Windows.Forms.TextBox(); this.m_textBox20 = new System.Windows.Forms.TextBox(); this.m_textBox21 = new System.Windows.Forms.TextBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // m_setButton // this.m_setButton.Location = new System.Drawing.Point(12, 107); this.m_setButton.Name = "m_setButton"; this.m_setButton.Size = new System.Drawing.Size(75, 23); this.m_setButton.TabIndex = 4; this.m_setButton.Text = "Set"; this.m_toolTips.SetToolTip(this.m_setButton, "Set ellipsoid parameters"); this.m_setButton.UseVisualStyleBackColor = true; this.m_setButton.Click += new System.EventHandler(this.OnSetParameters); // // m_equatorialRadiusTextBox // this.m_equatorialRadiusTextBox.Location = new System.Drawing.Point(12, 42); this.m_equatorialRadiusTextBox.Name = "m_equatorialRadiusTextBox"; this.m_equatorialRadiusTextBox.Size = new System.Drawing.Size(125, 20); this.m_equatorialRadiusTextBox.TabIndex = 2; // // groupBox1 // this.groupBox1.Controls.Add(this.m_setButton); this.groupBox1.Controls.Add(this.m_flatteningTextBox); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.m_equatorialRadiusTextBox); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(7, 7); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(146, 140); this.groupBox1.TabIndex = 5; this.groupBox1.TabStop = false; this.groupBox1.Text = "Ellipsoid Parameters"; // // m_flatteningTextBox // this.m_flatteningTextBox.Location = new System.Drawing.Point(12, 83); this.m_flatteningTextBox.Name = "m_flatteningTextBox"; this.m_flatteningTextBox.Size = new System.Drawing.Size(125, 20); this.m_flatteningTextBox.TabIndex = 3; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(109, 13); this.label1.TabIndex = 0; this.label1.Text = "Equatorial Radius (meters)"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 66); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 13); this.label2.TabIndex = 1; this.label2.Text = "Flattening"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(166, 11); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(95, 13); this.label3.TabIndex = 6; this.label3.Text = "Latitude ( degrees)"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(166, 38); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(101, 13); this.label4.TabIndex = 7; this.label4.Text = "Longitude (degrees)"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(166, 65); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(82, 13); this.label5.TabIndex = 8; this.label5.Text = "Altitude (meters)"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(166, 92); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(54, 13); this.label6.TabIndex = 9; this.label6.Text = "X (meters)"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(166, 119); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(54, 13); this.label7.TabIndex = 10; this.label7.Text = "Y (meters)"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(166, 146); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(54, 13); this.label8.TabIndex = 11; this.label8.Text = "Z (meters)"; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(273, 7); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_latitudeTextBox.TabIndex = 12; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(273, 34); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_longitudeTextBox.TabIndex = 13; // // m_altitudeTextBox // this.m_altitudeTextBox.Location = new System.Drawing.Point(273, 61); this.m_altitudeTextBox.Name = "m_altitudeTextBox"; this.m_altitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_altitudeTextBox.TabIndex = 14; // // m_XTextBox // this.m_XTextBox.Location = new System.Drawing.Point(273, 88); this.m_XTextBox.Name = "m_XTextBox"; this.m_XTextBox.Size = new System.Drawing.Size(100, 20); this.m_XTextBox.TabIndex = 15; // // m_YTextBox // this.m_YTextBox.Location = new System.Drawing.Point(273, 115); this.m_YTextBox.Name = "m_YTextBox"; this.m_YTextBox.Size = new System.Drawing.Size(100, 20); this.m_YTextBox.TabIndex = 16; // // m_ZTextBox // this.m_ZTextBox.Location = new System.Drawing.Point(273, 142); this.m_ZTextBox.Name = "m_ZTextBox"; this.m_ZTextBox.Size = new System.Drawing.Size(100, 20); this.m_ZTextBox.TabIndex = 17; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(169, 175); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(48, 13); this.label9.TabIndex = 18; this.label9.Text = "Function"; // // m_functionComboBox // this.m_functionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_functionComboBox.FormattingEnabled = true; this.m_functionComboBox.Items.AddRange(new object[] { "Forward", "Reverse"}); this.m_functionComboBox.Location = new System.Drawing.Point(273, 171); this.m_functionComboBox.Name = "m_functionComboBox"; this.m_functionComboBox.Size = new System.Drawing.Size(100, 21); this.m_functionComboBox.TabIndex = 19; this.m_toolTips.SetToolTip(this.m_functionComboBox, "Forward/Reverse"); this.m_functionComboBox.SelectedIndexChanged += new System.EventHandler(this.OnFunctionChanged); // // button1 // this.button1.Location = new System.Drawing.Point(386, 169); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 20; this.button1.Text = "Convert"; this.m_toolTips.SetToolTip(this.button1, "Converts the coordinates using the selected Function"); this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnConvert); // // button2 // this.button2.Location = new System.Drawing.Point(7, 170); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 21; this.button2.Text = "Validate"; this.m_toolTips.SetToolTip(this.button2, "Tests Geocentric interfaces"); this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnValidate); // // m_textBox00 // this.m_textBox00.Location = new System.Drawing.Point(6, 25); this.m_textBox00.Name = "m_textBox00"; this.m_textBox00.ReadOnly = true; this.m_textBox00.Size = new System.Drawing.Size(100, 20); this.m_textBox00.TabIndex = 22; // // m_textBox01 // this.m_textBox01.Location = new System.Drawing.Point(112, 25); this.m_textBox01.Name = "m_textBox01"; this.m_textBox01.ReadOnly = true; this.m_textBox01.Size = new System.Drawing.Size(100, 20); this.m_textBox01.TabIndex = 23; // // groupBox2 // this.groupBox2.Controls.Add(this.m_textBox22); this.groupBox2.Controls.Add(this.m_textBox20); this.groupBox2.Controls.Add(this.m_textBox21); this.groupBox2.Controls.Add(this.m_textBox12); this.groupBox2.Controls.Add(this.m_textBox10); this.groupBox2.Controls.Add(this.m_textBox11); this.groupBox2.Controls.Add(this.m_textBox02); this.groupBox2.Controls.Add(this.m_textBox00); this.groupBox2.Controls.Add(this.m_textBox01); this.groupBox2.Location = new System.Drawing.Point(380, 11); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(325, 99); this.groupBox2.TabIndex = 24; this.groupBox2.TabStop = false; this.groupBox2.Text = "Rotation Matrix - ENU to ECEF"; // // m_textBox02 // this.m_textBox02.Location = new System.Drawing.Point(218, 25); this.m_textBox02.Name = "m_textBox02"; this.m_textBox02.ReadOnly = true; this.m_textBox02.Size = new System.Drawing.Size(100, 20); this.m_textBox02.TabIndex = 24; // // m_textBox12 // this.m_textBox12.Location = new System.Drawing.Point(218, 50); this.m_textBox12.Name = "m_textBox12"; this.m_textBox12.ReadOnly = true; this.m_textBox12.Size = new System.Drawing.Size(100, 20); this.m_textBox12.TabIndex = 27; // // m_textBox10 // this.m_textBox10.Location = new System.Drawing.Point(6, 50); this.m_textBox10.Name = "m_textBox10"; this.m_textBox10.ReadOnly = true; this.m_textBox10.Size = new System.Drawing.Size(100, 20); this.m_textBox10.TabIndex = 25; // // m_textBox11 // this.m_textBox11.Location = new System.Drawing.Point(112, 50); this.m_textBox11.Name = "m_textBox11"; this.m_textBox11.ReadOnly = true; this.m_textBox11.Size = new System.Drawing.Size(100, 20); this.m_textBox11.TabIndex = 26; // // m_textBox22 // this.m_textBox22.Location = new System.Drawing.Point(218, 74); this.m_textBox22.Name = "m_textBox22"; this.m_textBox22.ReadOnly = true; this.m_textBox22.Size = new System.Drawing.Size(100, 20); this.m_textBox22.TabIndex = 30; // // m_textBox20 // this.m_textBox20.Location = new System.Drawing.Point(6, 74); this.m_textBox20.Name = "m_textBox20"; this.m_textBox20.ReadOnly = true; this.m_textBox20.Size = new System.Drawing.Size(100, 20); this.m_textBox20.TabIndex = 28; // // m_textBox21 // this.m_textBox21.Location = new System.Drawing.Point(112, 74); this.m_textBox21.Name = "m_textBox21"; this.m_textBox21.ReadOnly = true; this.m_textBox21.Size = new System.Drawing.Size(100, 20); this.m_textBox21.TabIndex = 29; // // GeocentricPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.groupBox2); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.m_functionComboBox); this.Controls.Add(this.label9); this.Controls.Add(this.m_ZTextBox); this.Controls.Add(this.m_YTextBox); this.Controls.Add(this.m_XTextBox); this.Controls.Add(this.m_altitudeTextBox); this.Controls.Add(this.m_longitudeTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.groupBox1); this.Name = "GeocentricPanel"; this.Size = new System.Drawing.Size(771, 231); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button m_setButton; private System.Windows.Forms.ToolTip m_toolTips; private System.Windows.Forms.TextBox m_equatorialRadiusTextBox; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.TextBox m_flatteningTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.TextBox m_altitudeTextBox; private System.Windows.Forms.TextBox m_XTextBox; private System.Windows.Forms.TextBox m_YTextBox; private System.Windows.Forms.TextBox m_ZTextBox; private System.Windows.Forms.Label label9; private System.Windows.Forms.ComboBox m_functionComboBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.TextBox m_textBox00; private System.Windows.Forms.TextBox m_textBox01; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.TextBox m_textBox22; private System.Windows.Forms.TextBox m_textBox20; private System.Windows.Forms.TextBox m_textBox21; private System.Windows.Forms.TextBox m_textBox12; private System.Windows.Forms.TextBox m_textBox10; private System.Windows.Forms.TextBox m_textBox11; private System.Windows.Forms.TextBox m_textBox02; } } GeographicLib-1.52/dotnet/Projections/GeocentricPanel.cs0000644000771000077100000001353114064202371023205 0ustar ckarneyckarney/** * \file NETGeographicLib\GeocentricPanel.cs * \brief NETGeographicLib.Geocentric example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class GeocentricPanel : UserControl { enum Functions { Forward, Inverse }; Functions m_function = Functions.Forward; Geocentric m_geocentric = null; public GeocentricPanel() { InitializeComponent(); try { m_geocentric = new Geocentric(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } m_majorRadiusTextBox.Text = m_geocentric.EquatorialRadius.ToString(); m_flatteningTextBox.Text = m_geocentric.Flattening.ToString(); m_functionComboBox.SelectedIndex = (int)m_function; } private void OnSetParameters(object sender, EventArgs e) { try { double a = Double.Parse( m_majorRadiusTextBox.Text ); double f = Double.Parse(m_flatteningTextBox.Text); m_geocentric = new Geocentric(a, f); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Data entry error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } private void OnFunctionChanged(object sender, EventArgs e) { m_function = (Functions)m_functionComboBox.SelectedIndex; switch (m_function) { case Functions.Forward: m_latitudeTextBox.ReadOnly = m_longitudeTextBox.ReadOnly = m_altitudeTextBox.ReadOnly = false; m_XTextBox.ReadOnly = m_YTextBox.ReadOnly = m_ZTextBox.ReadOnly = true; break; case Functions.Inverse: m_latitudeTextBox.ReadOnly = m_longitudeTextBox.ReadOnly = m_altitudeTextBox.ReadOnly = true; m_XTextBox.ReadOnly = m_YTextBox.ReadOnly = m_ZTextBox.ReadOnly = false; break; } } private void OnConvert(object sender, EventArgs e) { try { double lat, lon, alt, x, y, z; double[,] rot = null; switch (m_function) { case Functions.Forward: lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); alt = Double.Parse(m_altitudeTextBox.Text); m_geocentric.Forward(lat, lon, alt, out x, out y, out z, out rot); m_XTextBox.Text = x.ToString(); m_YTextBox.Text = y.ToString(); m_ZTextBox.Text = z.ToString(); break; case Functions.Inverse: x = Double.Parse(m_XTextBox.Text); y = Double.Parse(m_YTextBox.Text); z = Double.Parse(m_ZTextBox.Text); m_geocentric.Reverse(x, y, z, out lat, out lon, out alt, out rot); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); m_altitudeTextBox.Text = alt.ToString(); break; } m_textBox00.Text = rot[0, 0].ToString(); m_textBox01.Text = rot[0, 1].ToString(); m_textBox02.Text = rot[0, 2].ToString(); m_textBox10.Text = rot[1, 0].ToString(); m_textBox11.Text = rot[1, 1].ToString(); m_textBox12.Text = rot[1, 2].ToString(); m_textBox20.Text = rot[2, 0].ToString(); m_textBox21.Text = rot[2, 1].ToString(); m_textBox22.Text = rot[2, 2].ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnValidate(object sender, EventArgs e) { try { Geocentric g = new Geocentric(); string test = g.ToString(); g = new Geocentric(g.EquatorialRadius, g.Flattening); double x, y, z, lat, lon, alt, tx, ty, tz; double[,] rot; g.Forward(32.0, -86.0, 45.0, out x, out y, out z, out rot); g.Forward(32.0, -86.0, 45.0, out tx, out ty, out tz); if (x != tx || y != ty || z != tz) throw new Exception("Error in Forward"); g.Reverse(x, y, z, out lat, out lon, out alt, out rot); g.Reverse(x, y, z, out tx, out ty, out tz); if ( lat != tx || lon != ty || alt != tz ) throw new Exception("Error in Reverse"); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error detected", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } GeographicLib-1.52/dotnet/Projections/GeocentricPanel.resx0000644000771000077100000001377714064202371023575 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 17, 17 GeographicLib-1.52/dotnet/Projections/GeodesicPanel.Designer.cs0000644000771000077100000005554214064202371024414 0ustar ckarneyckarneynamespace Projections { partial class GeodesicPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.m_equatorialRadiusTextBox = new System.Windows.Forms.TextBox(); this.m_flatteningTextBox = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_setButton = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.m_distanceRadioButton = new System.Windows.Forms.RadioButton(); this.m_arcLengthRadioButton = new System.Windows.Forms.RadioButton(); this.m_originLatitudeTextBox = new System.Windows.Forms.TextBox(); this.m_originLongitudeTextBox = new System.Windows.Forms.TextBox(); this.m_originAzimuthTextBox = new System.Windows.Forms.TextBox(); this.m_distanceTextBox = new System.Windows.Forms.TextBox(); this.m_ArcLengthTextBox = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.m12Label = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.m_finalLatitudeTextBox = new System.Windows.Forms.TextBox(); this.m_finalLongitudeTextBox = new System.Windows.Forms.TextBox(); this.m_finalAzimuthTextBox = new System.Windows.Forms.TextBox(); this.m_reducedLengthTextBox = new System.Windows.Forms.TextBox(); this.m_M12TextBox = new System.Windows.Forms.TextBox(); this.m_M21TextBox = new System.Windows.Forms.TextBox(); this.m_S12TextBox = new System.Windows.Forms.TextBox(); this.m_functionComboBox = new System.Windows.Forms.ComboBox(); this.FunctionLabel = new System.Windows.Forms.Label(); this.m_classComboBox = new System.Windows.Forms.ComboBox(); this.label12 = new System.Windows.Forms.Label(); this.m_tooltips = new System.Windows.Forms.ToolTip(this.components); this.m_validateButton = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(14, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(109, 13); this.label1.TabIndex = 0; this.label1.Text = "Equatorial Radius (meters)"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(14, 51); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 13); this.label2.TabIndex = 1; this.label2.Text = "Flattening"; // // m_equatorialRadiusTextBox // this.m_equatorialRadiusTextBox.Location = new System.Drawing.Point(129, 21); this.m_equatorialRadiusTextBox.Name = "m_equatorialRadiusTextBox"; this.m_equatorialRadiusTextBox.Size = new System.Drawing.Size(125, 20); this.m_equatorialRadiusTextBox.TabIndex = 2; // // m_flatteningTextBox // this.m_flatteningTextBox.Location = new System.Drawing.Point(129, 47); this.m_flatteningTextBox.Name = "m_flatteningTextBox"; this.m_flatteningTextBox.Size = new System.Drawing.Size(125, 20); this.m_flatteningTextBox.TabIndex = 3; // // groupBox1 // this.groupBox1.Controls.Add(this.m_setButton); this.groupBox1.Controls.Add(this.m_flatteningTextBox); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.m_equatorialRadiusTextBox); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(4, 4); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(267, 107); this.groupBox1.TabIndex = 4; this.groupBox1.TabStop = false; this.groupBox1.Text = "Ellipsoid Parameters"; // // m_setButton // this.m_setButton.Location = new System.Drawing.Point(176, 74); this.m_setButton.Name = "m_setButton"; this.m_setButton.Size = new System.Drawing.Size(75, 23); this.m_setButton.TabIndex = 4; this.m_setButton.Text = "Set"; this.m_setButton.UseVisualStyleBackColor = true; this.m_setButton.Click += new System.EventHandler(this.OnSet); // // button1 // this.button1.Location = new System.Drawing.Point(183, 143); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 5; this.button1.Text = "Execute"; this.button1.UseVisualStyleBackColor = true; this.button1.Enter += new System.EventHandler(this.OnForward); // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(279, 14); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(122, 13); this.label3.TabIndex = 6; this.label3.Text = "Origin Latitude (degrees)"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(279, 41); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(131, 13); this.label4.TabIndex = 7; this.label4.Text = "Origin Longitude (degrees)"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(279, 68); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(121, 13); this.label5.TabIndex = 8; this.label5.Text = "Origin Azimuth (degrees)"; // // m_distanceRadioButton // this.m_distanceRadioButton.AutoSize = true; this.m_distanceRadioButton.Checked = true; this.m_distanceRadioButton.Location = new System.Drawing.Point(279, 93); this.m_distanceRadioButton.Name = "m_distanceRadioButton"; this.m_distanceRadioButton.Size = new System.Drawing.Size(107, 17); this.m_distanceRadioButton.TabIndex = 9; this.m_distanceRadioButton.TabStop = true; this.m_distanceRadioButton.Text = "Distance (meters)"; this.m_distanceRadioButton.UseVisualStyleBackColor = true; this.m_distanceRadioButton.Click += new System.EventHandler(this.OnDistance); // // m_arcLengthRadioButton // this.m_arcLengthRadioButton.AutoSize = true; this.m_arcLengthRadioButton.Location = new System.Drawing.Point(279, 120); this.m_arcLengthRadioButton.Name = "m_arcLengthRadioButton"; this.m_arcLengthRadioButton.Size = new System.Drawing.Size(124, 17); this.m_arcLengthRadioButton.TabIndex = 10; this.m_arcLengthRadioButton.Text = "Arc Length (degrees)"; this.m_arcLengthRadioButton.UseVisualStyleBackColor = true; this.m_arcLengthRadioButton.Click += new System.EventHandler(this.OnArcLength); // // m_originLatitudeTextBox // this.m_originLatitudeTextBox.Location = new System.Drawing.Point(416, 10); this.m_originLatitudeTextBox.Name = "m_originLatitudeTextBox"; this.m_originLatitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_originLatitudeTextBox.TabIndex = 11; // // m_originLongitudeTextBox // this.m_originLongitudeTextBox.Location = new System.Drawing.Point(416, 37); this.m_originLongitudeTextBox.Name = "m_originLongitudeTextBox"; this.m_originLongitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_originLongitudeTextBox.TabIndex = 12; // // m_originAzimuthTextBox // this.m_originAzimuthTextBox.Location = new System.Drawing.Point(416, 64); this.m_originAzimuthTextBox.Name = "m_originAzimuthTextBox"; this.m_originAzimuthTextBox.Size = new System.Drawing.Size(100, 20); this.m_originAzimuthTextBox.TabIndex = 13; // // m_distanceTextBox // this.m_distanceTextBox.Location = new System.Drawing.Point(416, 91); this.m_distanceTextBox.Name = "m_distanceTextBox"; this.m_distanceTextBox.Size = new System.Drawing.Size(100, 20); this.m_distanceTextBox.TabIndex = 14; // // m_ArcLengthTextBox // this.m_ArcLengthTextBox.Location = new System.Drawing.Point(416, 118); this.m_ArcLengthTextBox.Name = "m_ArcLengthTextBox"; this.m_ArcLengthTextBox.ReadOnly = true; this.m_ArcLengthTextBox.Size = new System.Drawing.Size(100, 20); this.m_ArcLengthTextBox.TabIndex = 15; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(525, 14); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(117, 13); this.label6.TabIndex = 16; this.label6.Text = "Final Latitude (degrees)"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(525, 41); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(126, 13); this.label7.TabIndex = 17; this.label7.Text = "Final Longitude (degrees)"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(525, 68); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(116, 13); this.label8.TabIndex = 18; this.label8.Text = "Final Azimuth (degrees)"; // // m12Label // this.m12Label.AutoSize = true; this.m12Label.Location = new System.Drawing.Point(525, 95); this.m12Label.Name = "m12Label"; this.m12Label.Size = new System.Drawing.Size(127, 13); this.m12Label.TabIndex = 19; this.m12Label.Text = "Reduced Length (meters)"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(525, 122); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(28, 13); this.label9.TabIndex = 20; this.label9.Text = "M12"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(525, 149); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(28, 13); this.label10.TabIndex = 21; this.label10.Text = "M21"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(525, 176); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(26, 13); this.label11.TabIndex = 22; this.label11.Text = "S12"; // // m_finalLatitudeTextBox // this.m_finalLatitudeTextBox.Location = new System.Drawing.Point(660, 10); this.m_finalLatitudeTextBox.Name = "m_finalLatitudeTextBox"; this.m_finalLatitudeTextBox.ReadOnly = true; this.m_finalLatitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_finalLatitudeTextBox.TabIndex = 23; // // m_finalLongitudeTextBox // this.m_finalLongitudeTextBox.Location = new System.Drawing.Point(660, 37); this.m_finalLongitudeTextBox.Name = "m_finalLongitudeTextBox"; this.m_finalLongitudeTextBox.ReadOnly = true; this.m_finalLongitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_finalLongitudeTextBox.TabIndex = 24; // // m_finalAzimuthTextBox // this.m_finalAzimuthTextBox.Location = new System.Drawing.Point(660, 64); this.m_finalAzimuthTextBox.Name = "m_finalAzimuthTextBox"; this.m_finalAzimuthTextBox.ReadOnly = true; this.m_finalAzimuthTextBox.Size = new System.Drawing.Size(100, 20); this.m_finalAzimuthTextBox.TabIndex = 25; // // m_reducedLengthTextBox // this.m_reducedLengthTextBox.Location = new System.Drawing.Point(660, 91); this.m_reducedLengthTextBox.Name = "m_reducedLengthTextBox"; this.m_reducedLengthTextBox.ReadOnly = true; this.m_reducedLengthTextBox.Size = new System.Drawing.Size(100, 20); this.m_reducedLengthTextBox.TabIndex = 26; // // m_M12TextBox // this.m_M12TextBox.Location = new System.Drawing.Point(660, 118); this.m_M12TextBox.Name = "m_M12TextBox"; this.m_M12TextBox.ReadOnly = true; this.m_M12TextBox.Size = new System.Drawing.Size(100, 20); this.m_M12TextBox.TabIndex = 27; // // m_M21TextBox // this.m_M21TextBox.Location = new System.Drawing.Point(660, 145); this.m_M21TextBox.Name = "m_M21TextBox"; this.m_M21TextBox.ReadOnly = true; this.m_M21TextBox.Size = new System.Drawing.Size(100, 20); this.m_M21TextBox.TabIndex = 28; // // m_S12TextBox // this.m_S12TextBox.Location = new System.Drawing.Point(660, 172); this.m_S12TextBox.Name = "m_S12TextBox"; this.m_S12TextBox.ReadOnly = true; this.m_S12TextBox.Size = new System.Drawing.Size(100, 20); this.m_S12TextBox.TabIndex = 29; // // m_functionComboBox // this.m_functionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_functionComboBox.FormattingEnabled = true; this.m_functionComboBox.Items.AddRange(new object[] { "Direct", "Inverse"}); this.m_functionComboBox.Location = new System.Drawing.Point(416, 145); this.m_functionComboBox.Name = "m_functionComboBox"; this.m_functionComboBox.Size = new System.Drawing.Size(100, 21); this.m_functionComboBox.TabIndex = 30; this.m_functionComboBox.SelectedIndexChanged += new System.EventHandler(this.OnFunction); // // FunctionLabel // this.FunctionLabel.AutoSize = true; this.FunctionLabel.Location = new System.Drawing.Point(282, 149); this.FunctionLabel.Name = "FunctionLabel"; this.FunctionLabel.Size = new System.Drawing.Size(48, 13); this.FunctionLabel.TabIndex = 31; this.FunctionLabel.Text = "Function"; // // m_classComboBox // this.m_classComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_classComboBox.FormattingEnabled = true; this.m_classComboBox.Items.AddRange(new object[] { "Geodesic", "GeodesicExact", "GeodesicLine", "GeodesicLineExact"}); this.m_classComboBox.Location = new System.Drawing.Point(395, 172); this.m_classComboBox.Name = "m_classComboBox"; this.m_classComboBox.Size = new System.Drawing.Size(121, 21); this.m_classComboBox.TabIndex = 32; this.m_classComboBox.SelectedIndexChanged += new System.EventHandler(this.OnClassChanged); // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(282, 176); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(32, 13); this.label12.TabIndex = 33; this.label12.Text = "Class"; // // m_validateButton // this.m_validateButton.Location = new System.Drawing.Point(21, 143); this.m_validateButton.Name = "m_validateButton"; this.m_validateButton.Size = new System.Drawing.Size(75, 23); this.m_validateButton.TabIndex = 34; this.m_validateButton.Text = "Validate"; this.m_validateButton.UseVisualStyleBackColor = true; this.m_validateButton.Click += new System.EventHandler(this.OnValidate); // // GeodesicPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.m_validateButton); this.Controls.Add(this.label12); this.Controls.Add(this.m_classComboBox); this.Controls.Add(this.FunctionLabel); this.Controls.Add(this.m_functionComboBox); this.Controls.Add(this.m_S12TextBox); this.Controls.Add(this.m_M21TextBox); this.Controls.Add(this.m_M12TextBox); this.Controls.Add(this.m_reducedLengthTextBox); this.Controls.Add(this.m_finalAzimuthTextBox); this.Controls.Add(this.m_finalLongitudeTextBox); this.Controls.Add(this.m_finalLatitudeTextBox); this.Controls.Add(this.label11); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.m12Label); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.m_ArcLengthTextBox); this.Controls.Add(this.m_distanceTextBox); this.Controls.Add(this.m_originAzimuthTextBox); this.Controls.Add(this.m_originLongitudeTextBox); this.Controls.Add(this.m_originLatitudeTextBox); this.Controls.Add(this.m_arcLengthRadioButton); this.Controls.Add(this.m_distanceRadioButton); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.button1); this.Controls.Add(this.groupBox1); this.Name = "GeodesicPanel"; this.Size = new System.Drawing.Size(794, 220); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox m_equatorialRadiusTextBox; private System.Windows.Forms.TextBox m_flatteningTextBox; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button m_setButton; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.RadioButton m_distanceRadioButton; private System.Windows.Forms.RadioButton m_arcLengthRadioButton; private System.Windows.Forms.TextBox m_originLatitudeTextBox; private System.Windows.Forms.TextBox m_originLongitudeTextBox; private System.Windows.Forms.TextBox m_originAzimuthTextBox; private System.Windows.Forms.TextBox m_distanceTextBox; private System.Windows.Forms.TextBox m_ArcLengthTextBox; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label m12Label; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox m_finalLatitudeTextBox; private System.Windows.Forms.TextBox m_finalLongitudeTextBox; private System.Windows.Forms.TextBox m_finalAzimuthTextBox; private System.Windows.Forms.TextBox m_reducedLengthTextBox; private System.Windows.Forms.TextBox m_M12TextBox; private System.Windows.Forms.TextBox m_M21TextBox; private System.Windows.Forms.TextBox m_S12TextBox; private System.Windows.Forms.ComboBox m_functionComboBox; private System.Windows.Forms.Label FunctionLabel; private System.Windows.Forms.ComboBox m_classComboBox; private System.Windows.Forms.Label label12; private System.Windows.Forms.ToolTip m_tooltips; private System.Windows.Forms.Button m_validateButton; } } GeographicLib-1.52/dotnet/Projections/GeodesicPanel.cs0000644000771000077100000012034214064202371022644 0ustar ckarneyckarney/** * \file NETGeographicLib\GeodesicPanel.cs * \brief NETGeographicLib.Geodesic example * * NETGeographicLib.Geodesic, * NETGeographicLib.GeodesicLine, * NETGeographicLib.GeodesicExact, * NETGeographicLib.GeodesicLineExact * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class GeodesicPanel : UserControl { public string warning = "GeographicLib Error"; public string warning2 = "Data Conversion Error"; enum Function { Direct = 0, Inverse = 1 }; Function m_function = Function.Direct; enum Variable { Distance = 0, ArcLength = 2 }; Variable m_variable = Variable.Distance; enum Classes { GEODESIC = 0, GEODESICEXACT= 1, GEODESICLINE = 2, GEODESICLINEEXACT = 3 }; Classes m_class = Classes.GEODESIC; Geodesic m_geodesic = null; public GeodesicPanel() { InitializeComponent(); m_tooltips.SetToolTip(button1, "Performs the selected function with the selected class"); m_tooltips.SetToolTip(m_setButton, "Sets the ellipsoid attributes"); m_tooltips.SetToolTip(m_validateButton, "Validates Geodesic, GeodesicExact, GeodesicLine, and GeodesicLineExact interfaces"); try { m_geodesic = new Geodesic(); } catch (GeographicErr err) { MessageBox.Show(err.Message, warning, MessageBoxButtons.OK, MessageBoxIcon.Error); } m_equatorialRadiusTextBox.Text = m_geodesic.EquatorialRadius.ToString(); m_flatteningTextBox.Text = m_geodesic.Flattening.ToString(); m_functionComboBox.SelectedIndex = 0; m_classComboBox.SelectedIndex = 0; } // gets the equatorial radius and flattening and creates a new Geodesic private void OnSet(object sender, EventArgs e) { try { double radius = Double.Parse(m_equatorialRadiusTextBox.Text); double flattening = Double.Parse(m_flatteningTextBox.Text); m_geodesic = new Geodesic(radius, flattening); } catch (GeographicErr err) { MessageBox.Show(err.Message, warning, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception err2) { MessageBox.Show(err2.Message, warning2, MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Gets the input parameters and calls the appropriate function private void OnForward(object sender, EventArgs e) { double origLatitude = 0.0, origLongitude = 0.0, origAzimuth = 0.0, distance = 0.0, finalLatitude = 0.0, finalLongitude = 0.0; // get & validate inputs try { if ( m_function == Function.Direct ) { distance = Double.Parse( m_variable == Variable.Distance ? m_distanceTextBox.Text : m_ArcLengthTextBox.Text ); origAzimuth = Double.Parse( m_originAzimuthTextBox.Text ); if ( origAzimuth < -180.0 || origAzimuth > 180.0 ) { m_originAzimuthTextBox.Focus(); throw new Exception( "Range Error: -180 <= initial azimuth <= 180 degrees" ); } } else { finalLatitude = Double.Parse( m_finalLatitudeTextBox.Text ); if (finalLatitude < -90.0 || finalLatitude > 90.0) { m_finalLatitudeTextBox.Focus(); throw new Exception("Range Error: -90 <= final latitude <= 90 degrees"); } finalLongitude = Double.Parse( m_finalLongitudeTextBox.Text ); if (finalLongitude < -540.0 || finalLongitude > 540.0) { m_finalLongitudeTextBox.Focus(); throw new Exception("Range Error: -540 <= final longitude <= 540 degrees"); } } origLatitude = Double.Parse( m_originLatitudeTextBox.Text ); if (origLatitude < -90.0 || origLatitude > 90.0) { m_originLatitudeTextBox.Focus(); throw new Exception("Range Error: -90 <= initial latitude <= 90 degrees"); } origLongitude = Double.Parse(m_originLongitudeTextBox.Text); if (origLongitude < -540.0 || origLongitude > 540.0) { m_originLongitudeTextBox.Focus(); throw new Exception("Range Error: -540 <= initial longitude <= 540 degrees"); } } catch ( Exception xcpt ) { MessageBox.Show(xcpt.Message, warning2, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // excute the appropriate function. double finalAzimuth = 0.0, reducedLength = 0.0, M12 = 0.0, M21 = 0.0, S12 = 0.0, arcDistance = 0.0; int sw = (int)m_function | (int)m_variable; if (sw == 3) sw = 1; // cases 1 & 3 are identical. try { switch (m_class) { case Classes.GEODESIC: switch (sw) { case 0: // function == Direct, variable == distance m_ArcLengthTextBox.Text = m_geodesic.Direct(origLatitude, origLongitude, origAzimuth, distance, out finalLatitude, out finalLongitude, out finalAzimuth, out reducedLength, out M12, out M21, out S12).ToString(); m_finalLatitudeTextBox.Text = finalLatitude.ToString(); m_finalLongitudeTextBox.Text = finalLongitude.ToString(); break; case 1: // function == Inverse, variable == distance m_ArcLengthTextBox.Text = m_geodesic.Inverse(origLatitude, origLongitude, finalLatitude, finalLongitude, out distance, out origAzimuth, out finalAzimuth, out reducedLength, out M12, out M21, out S12).ToString(); m_distanceTextBox.Text = distance.ToString(); m_originAzimuthTextBox.Text = origAzimuth.ToString(); break; case 2: // function == Direct, variable == arc length m_geodesic.ArcDirect(origLatitude, origLongitude, origAzimuth, distance, out finalLatitude, out finalLongitude, out finalAzimuth, out arcDistance, out reducedLength, out M12, out M21, out S12); m_distanceTextBox.Text = arcDistance.ToString(); m_finalLatitudeTextBox.Text = finalLatitude.ToString(); m_finalLongitudeTextBox.Text = finalLongitude.ToString(); break; } m_finalAzimuthTextBox.Text = finalAzimuth.ToString(); m_reducedLengthTextBox.Text = reducedLength.ToString(); m_M12TextBox.Text = M12.ToString(); m_M21TextBox.Text = M21.ToString(); m_S12TextBox.Text = S12.ToString(); break; case Classes.GEODESICEXACT: GeodesicExact ge = new GeodesicExact(m_geodesic.EquatorialRadius, m_geodesic.Flattening); switch (sw) { case 0: // function == Direct, variable == distance m_ArcLengthTextBox.Text = ge.Direct(origLatitude, origLongitude, origAzimuth, distance, out finalLatitude, out finalLongitude, out finalAzimuth, out reducedLength, out M12, out M21, out S12).ToString(); m_finalLatitudeTextBox.Text = finalLatitude.ToString(); m_finalLongitudeTextBox.Text = finalLongitude.ToString(); break; case 1: // function == Inverse, variable == distance m_ArcLengthTextBox.Text = ge.Inverse(origLatitude, origLongitude, finalLatitude, finalLongitude, out distance, out origAzimuth, out finalAzimuth, out reducedLength, out M12, out M21, out S12).ToString(); m_distanceTextBox.Text = distance.ToString(); m_originAzimuthTextBox.Text = origAzimuth.ToString(); break; case 2: // function == Direct, variable == arc length ge.ArcDirect(origLatitude, origLongitude, origAzimuth, distance, out finalLatitude, out finalLongitude, out finalAzimuth, out arcDistance, out reducedLength, out M12, out M21, out S12); m_distanceTextBox.Text = arcDistance.ToString(); m_finalLatitudeTextBox.Text = finalLatitude.ToString(); m_finalLongitudeTextBox.Text = finalLongitude.ToString(); break; } m_finalAzimuthTextBox.Text = finalAzimuth.ToString(); m_reducedLengthTextBox.Text = reducedLength.ToString(); m_M12TextBox.Text = M12.ToString(); m_M21TextBox.Text = M21.ToString(); m_S12TextBox.Text = S12.ToString(); break; case Classes.GEODESICLINE: GeodesicLine gl = new GeodesicLine(m_geodesic, origLatitude, origLongitude, origAzimuth, Mask.ALL); switch (sw) { case 0: // function == Direct, variable == distance m_ArcLengthTextBox.Text = gl.Position(distance, out finalLatitude, out finalLongitude, out finalAzimuth, out reducedLength, out M12, out M21, out S12).ToString(); m_finalLatitudeTextBox.Text = finalLatitude.ToString(); m_finalLongitudeTextBox.Text = finalLongitude.ToString(); break; case 1: // function == Inverse, variable == distance throw new Exception("GeodesicLine does not have an Inverse function"); case 2: // function == Direct, variable == arc length gl.ArcPosition(distance, out finalLatitude, out finalLongitude, out finalAzimuth, out arcDistance, out reducedLength, out M12, out M21, out S12); m_distanceTextBox.Text = arcDistance.ToString(); m_finalLatitudeTextBox.Text = finalLatitude.ToString(); m_finalLongitudeTextBox.Text = finalLongitude.ToString(); break; } m_finalAzimuthTextBox.Text = finalAzimuth.ToString(); m_reducedLengthTextBox.Text = reducedLength.ToString(); m_M12TextBox.Text = M12.ToString(); m_M21TextBox.Text = M21.ToString(); m_S12TextBox.Text = S12.ToString(); break; case Classes.GEODESICLINEEXACT: GeodesicLineExact gle = new GeodesicLineExact(origLatitude, origLongitude, origAzimuth, Mask.ALL); switch (sw) { case 0: // function == Direct, variable == distance m_ArcLengthTextBox.Text = gle.Position(distance, out finalLatitude, out finalLongitude, out finalAzimuth, out reducedLength, out M12, out M21, out S12).ToString(); m_finalLatitudeTextBox.Text = finalLatitude.ToString(); m_finalLongitudeTextBox.Text = finalLongitude.ToString(); break; case 1: // function == Inverse, variable == distance throw new Exception("GeodesicLineExact does not have an Inverse function"); case 2: // function == Direct, variable == arc length gle.ArcPosition(distance, out finalLatitude, out finalLongitude, out finalAzimuth, out arcDistance, out reducedLength, out M12, out M21, out S12); m_distanceTextBox.Text = arcDistance.ToString(); m_finalLatitudeTextBox.Text = finalLatitude.ToString(); m_finalLongitudeTextBox.Text = finalLongitude.ToString(); break; } m_finalAzimuthTextBox.Text = finalAzimuth.ToString(); m_reducedLengthTextBox.Text = reducedLength.ToString(); m_M12TextBox.Text = M12.ToString(); m_M21TextBox.Text = M21.ToString(); m_S12TextBox.Text = S12.ToString(); break; } } catch (Exception err) { MessageBox.Show(err.Message, warning, MessageBoxButtons.OK, MessageBoxIcon.Error); } } // gui stuff private void OnDistance(object sender, EventArgs e) { m_distanceTextBox.ReadOnly = false; m_ArcLengthTextBox.ReadOnly = true; m_variable = Variable.Distance; } // gui stuff private void OnArcLength(object sender, EventArgs e) { m_distanceTextBox.ReadOnly = true; m_ArcLengthTextBox.ReadOnly = false; m_variable = Variable.ArcLength; } // gui stuff private void OnFunction(object sender, EventArgs e) { m_function = (Function)m_functionComboBox.SelectedIndex; switch (m_function) { case Function.Direct: m_distanceTextBox.ReadOnly = m_variable == Variable.ArcLength; m_ArcLengthTextBox.ReadOnly = m_variable == Variable.Distance; m_originAzimuthTextBox.ReadOnly = false; m_finalLatitudeTextBox.ReadOnly = true; m_finalLongitudeTextBox.ReadOnly = true; break; case Function.Inverse: m_distanceTextBox.ReadOnly = true; m_ArcLengthTextBox.ReadOnly = true; m_originAzimuthTextBox.ReadOnly = true; m_finalLatitudeTextBox.ReadOnly = false; m_finalLongitudeTextBox.ReadOnly = false; break; } } // gui stuff private void OnClassChanged(object sender, EventArgs e) { m_class = (Classes)m_classComboBox.SelectedIndex; } // a simple validation function...does not change GUI elements private void OnValidate(object sender, EventArgs e) { double finalAzimuth = 0.0, reducedLength = 0.0, M12 = 0.0, M21 = 0.0, S12 = 0.0, arcDistance = 0.0, finalLatitude = 0.0, finalLongitude = 0.0, distance = 0.0; try { Geodesic g = new Geodesic(); g = new Geodesic(g.EquatorialRadius, g.Flattening); arcDistance = g.Direct(32.0, -86.0, 45.0, 20000.0, out finalLatitude, out finalLongitude, out finalAzimuth, out reducedLength, out M12, out M21, out S12); double flat = 0.0, flon = 0.0, faz = 0.0, frd = 0.0, fm12 = 0.0, fm21 = 0.0, fs12 = 0.0, fad = 0.0; fad = g.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude) throw new Exception("Geodesic.Direct #1 failed"); fad = g.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon, out faz); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth) throw new Exception("Geodesic.Direct #2 failed"); fad = g.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon, out faz, out frd); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength) throw new Exception("Geodesic.Direct #3 failed"); fad = g.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon, out faz, out fm12, out fm21); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fm12 != M12 || fm21 != M21) throw new Exception("Geodesic.Direct #4 failed"); fad = g.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon, out faz, out frd, out fm12, out fm21); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength || fm12 != M12 || fm21 != M21) throw new Exception("Geodesic.Direct #5 failed"); double outd = 0.0; fad = g.GenDirect(32.0, -86.0, 45.0, false, 20000.0, Geodesic.mask.ALL, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21, out fs12); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength || fm12 != M12 || fm21 != M21 || outd != 20000.0 || fs12 != S12) throw new Exception("Geodesic.GenDirect (false) failed"); g.ArcDirect(32.0, -86.0, 45.0, 1.0, out finalLatitude, out finalLongitude, out finalAzimuth, out arcDistance, out reducedLength, out M12, out M21, out S12); g.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon); if (flat != finalLatitude || flon != finalLongitude) throw new Exception("Geodesic.ArcDirect #1 failed"); g.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon, out faz); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth) throw new Exception("Geodesic.ArcDirect #2 failed"); g.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon, out faz, out fad); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fad != arcDistance) throw new Exception("Geodesic.ArcDirect #3 failed"); g.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon, out faz, out fad, out frd); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fad != arcDistance || frd != reducedLength) throw new Exception("Geodesic.ArcDirect #4 failed"); g.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon, out faz, out fad, out fm12, out fm21); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fad != arcDistance || fm12 != M12 || fm21 != M21) throw new Exception("Geodesic.ArcDirect #5 failed"); fad = g.GenDirect(32.0, -86.0, 45.0, true, 1.0, Geodesic.mask.ALL, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21, out fs12); if (outd != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength || fm12 != M12 || fm21 != M21 || fs12 != S12 || fad != 1.0) throw new Exception("Geodesic.GenDirect (true) failed"); double initAzimuth = 0.0, iaz = 0.0; arcDistance = g.Inverse(32.0, -86.0, 33.0, -87.0, out distance, out initAzimuth, out finalAzimuth, out reducedLength, out M12, out M21, out S12); fad = g.Inverse(32.0, -86.0, 33.0, -87.0, out outd); if (fad != arcDistance || outd != distance) throw new Exception("Geodesic.Inverse #1 failed"); fad = g.Inverse(32.0, -86.0, 33.0, -87.0, out iaz, out faz); if (fad != arcDistance || iaz != initAzimuth || faz != finalAzimuth) throw new Exception("Geodesic.Inverse #2 failed"); fad = g.Inverse(32.0, -86.0, 33.0, -87.0, out outd, out iaz, out faz); if (fad != arcDistance || outd != distance || faz != finalAzimuth || outd != distance) throw new Exception("Geodesic.Inverse #3 failed"); fad = g.Inverse(32.0, -86.0, 33.0, -87.0, out outd, out iaz, out faz, out frd); if (fad != arcDistance || outd != distance || faz != finalAzimuth || outd != distance || frd != reducedLength) throw new Exception("Geodesic.Inverse #4 failed"); fad = g.Inverse(32.0, -86.0, 33.0, -87.0, out outd, out iaz, out faz, out fm12, out fm21 ); if (fad != arcDistance || outd != distance || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21 ) throw new Exception("Geodesic.Inverse #5 failed"); fad = g.Inverse(32.0, -86.0, 33.0, -87.0, out outd, out iaz, out faz, out frd, out fm12, out fm21); if (fad != arcDistance || outd != distance || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21 || frd != reducedLength) throw new Exception("Geodesic.Inverse #6 failed"); GeodesicLine gl = g.Line(32.0, -86.0, 45.0, Mask.ALL); gl = g.InverseLine(32.0, -86.0, 33.0, -87.0, Mask.ALL); gl = g.DirectLine(32.0, -86.0, 45.0, 10000.0, Mask.ALL); gl = g.ArcDirectLine(32.0, -86.0, 45.0, 10000.0, Mask.ALL); gl = new GeodesicLine(32.0, -86.0, 45.0, Mask.ALL); gl = new GeodesicLine(g, 32.0, -86.0, 45.0, Mask.ALL); arcDistance = gl.Position(10000.0, out finalLatitude, out finalLongitude, out finalAzimuth, out reducedLength, out M12, out M21, out S12); fad = gl.Position(10000.0, out flat, out flon); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude) throw new Exception("GeodesicLine.Position #1 failed"); fad = gl.Position(10000.0, out flat, out flon, out faz); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth) throw new Exception("GeodesicLine.Position #2 failed"); fad = gl.Position(10000.0, out flat, out flon, out faz, out frd); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength) throw new Exception("GeodesicLine.Position #3 failed"); fad = gl.Position(10000.0, out flat, out flon, out faz, out fm12, out fm21); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fm12 != M12 || fm21 != M21) throw new Exception("GeodesicLine.Position #4 failed"); fad = gl.Position(10000.0, out flat, out flon, out faz, out frd, out fm12, out fm21); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fm12 != M12 || fm21 != M21 || frd != reducedLength ) throw new Exception("GeodesicLine.Position #5 failed"); fad = gl.GenPosition(false, 10000.0, GeodesicLine.mask.ALL, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21, out fs12); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != 10000.0 || fm12 != M12 || fm21 != M21 || frd != reducedLength || fs12 != S12 ) throw new Exception("GeodesicLine.GenPosition (false) failed"); gl.ArcPosition(1.0, out finalLatitude, out finalLongitude, out finalAzimuth, out distance, out reducedLength, out M12, out M21, out S12); gl.ArcPosition(1.0, out flat, out flon); if (flat != finalLatitude || flon != finalLongitude) throw new Exception("GeodesicLine.ArcPosition #1 failed"); gl.ArcPosition(1.0, out flat, out flon, out faz); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth) throw new Exception("GeodesicLine.ArcPosition #2 failed"); gl.ArcPosition(1.0, out flat, out flon, out faz, out outd); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance) throw new Exception("GeodesicLine.ArcPosition #3 failed"); gl.ArcPosition(1.0, out flat, out flon, out faz, out outd, out frd); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance || frd != reducedLength) throw new Exception("GeodesicLine.ArcPosition #4 failed"); gl.ArcPosition(1.0, out flat, out flon, out faz, out outd, out fm12, out fm21); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21) throw new Exception("GeodesicLine.ArcPosition #5 failed"); gl.ArcPosition(1.0, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21 || frd != reducedLength) throw new Exception("GeodesicLine.ArcPosition #6 failed"); fad = gl.GenPosition(true, 1.0, GeodesicLine.mask.ALL, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21, out fs12); if (fad != 1.0 || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21 || frd != reducedLength || fs12 != S12) throw new Exception("GeodesicLine.GenPosition (false) failed"); GeodesicExact ge = new GeodesicExact(); ge = new GeodesicExact(g.EquatorialRadius, g.Flattening); arcDistance = ge.Direct(32.0, -86.0, 45.0, 20000.0, out finalLatitude, out finalLongitude, out finalAzimuth, out reducedLength, out M12, out M21, out S12); fad = ge.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude) throw new Exception("GeodesicExact.Direct #1 failed"); fad = ge.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon, out faz); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth) throw new Exception("GeodesicExact.Direct #2 failed"); fad = ge.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon, out faz, out frd); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength) throw new Exception("GeodesicExact.Direct #3 failed"); fad = ge.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon, out faz, out fm12, out fm21); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fm12 != M12 || fm21 != M21) throw new Exception("GeodesicExact.Direct #4 failed"); fad = ge.Direct(32.0, -86.0, 45.0, 20000.0, out flat, out flon, out faz, out frd, out fm12, out fm21); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength || fm12 != M12 || fm21 != M21) throw new Exception("GeodesicExact.Direct #5 failed"); fad = ge.GenDirect(32.0, -86.0, 45.0, false, 20000.0, GeodesicExact.mask.ALL, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21, out fs12); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength || fm12 != M12 || fm21 != M21 || outd != 20000.0 || fs12 != S12) throw new Exception("GeodesicExact.GenDirect (false) failed"); ge.ArcDirect(32.0, -86.0, 45.0, 1.0, out finalLatitude, out finalLongitude, out finalAzimuth, out arcDistance, out reducedLength, out M12, out M21, out S12); ge.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon); if (flat != finalLatitude || flon != finalLongitude) throw new Exception("GeodesicExact.ArcDirect #1 failed"); ge.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon, out faz); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth) throw new Exception("GeodesicExact.ArcDirect #2 failed"); ge.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon, out faz, out fad); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fad != arcDistance) throw new Exception("GeodesicExact.ArcDirect #3 failed"); ge.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon, out faz, out fad, out frd); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fad != arcDistance || frd != reducedLength) throw new Exception("GeodesicExact.ArcDirect #4 failed"); ge.ArcDirect(32.0, -86.0, 45.0, 1.0, out flat, out flon, out faz, out fad, out fm12, out fm21); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fad != arcDistance || fm12 != M12 || fm21 != M21) throw new Exception("GeodesicExact.ArcDirect #5 failed"); fad = ge.GenDirect(32.0, -86.0, 45.0, true, 1.0, GeodesicExact.mask.ALL, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21, out fs12); if (outd != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength || fm12 != M12 || fm21 != M21 || fad != 1.0 || fs12 != S12) throw new Exception("GeodesicExact.GenDirect (true) failed"); arcDistance = ge.Inverse(32.0, -86.0, 33.0, -87.0, out distance, out initAzimuth, out finalAzimuth, out reducedLength, out M12, out M21, out S12); fad = ge.Inverse(32.0, -86.0, 33.0, -87.0, out outd); if (fad != arcDistance || outd != distance) throw new Exception("GeodesicExact.Inverse #1 failed"); fad = ge.Inverse(32.0, -86.0, 33.0, -87.0, out iaz, out faz); if (fad != arcDistance || iaz != initAzimuth || faz != finalAzimuth) throw new Exception("GeodesicExact.Inverse #2 failed"); fad = ge.Inverse(32.0, -86.0, 33.0, -87.0, out outd, out iaz, out faz); if (fad != arcDistance || outd != distance || faz != finalAzimuth || outd != distance) throw new Exception("GeodesicExact.Inverse #3 failed"); fad = ge.Inverse(32.0, -86.0, 33.0, -87.0, out outd, out iaz, out faz, out frd); if (fad != arcDistance || outd != distance || faz != finalAzimuth || outd != distance || frd != reducedLength) throw new Exception("GeodesicExact.Inverse #4 failed"); fad = ge.Inverse(32.0, -86.0, 33.0, -87.0, out outd, out iaz, out faz, out fm12, out fm21); if (fad != arcDistance || outd != distance || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21) throw new Exception("GeodesicExact.Inverse #5 failed"); fad = ge.Inverse(32.0, -86.0, 33.0, -87.0, out outd, out iaz, out faz, out frd, out fm12, out fm21); if (fad != arcDistance || outd != distance || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21 || frd != reducedLength) throw new Exception("GeodesicExact.Inverse #6 failed"); GeodesicLineExact gle = ge.Line(32.0, -86.0, 45.0, Mask.ALL); gle = ge.InverseLine(32.0, -86.0, 33.0, -87.0, Mask.ALL); gle = ge.DirectLine(32.0, -86.0, 45.0, 10000.0, Mask.ALL); gle = ge.ArcDirectLine(32.0, -86.0, 45.0, 10000.0, Mask.ALL); gle = new GeodesicLineExact(32.0, -86.0, 45.0, Mask.ALL); gle = new GeodesicLineExact(ge, 32.0, -86.0, 45.0, Mask.ALL); arcDistance = gle.Position(10000.0, out finalLatitude, out finalLongitude, out finalAzimuth, out reducedLength, out M12, out M21, out S12); fad = gle.Position(10000.0, out flat, out flon); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude) throw new Exception("GeodesicLineExact.Position #1 failed"); fad = gle.Position(10000.0, out flat, out flon, out faz); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth) throw new Exception("GeodesicLineExact.Position #2 failed"); fad = gle.Position(10000.0, out flat, out flon, out faz, out frd); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || frd != reducedLength) throw new Exception("GeodesicLineExact.Position #3 failed"); fad = gle.Position(10000.0, out flat, out flon, out faz, out fm12, out fm21); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fm12 != M12 || fm21 != M21) throw new Exception("GeodesicLineExact.Position #4 failed"); fad = gle.Position(10000.0, out flat, out flon, out faz, out frd, out fm12, out fm21); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || fm12 != M12 || fm21 != M21 || frd != reducedLength) throw new Exception("GeodesicLineExact.Position #5 failed"); fad = gle.GenPosition(false, 10000.0, GeodesicLineExact.mask.ALL, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21, out fs12); if (fad != arcDistance || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != 10000.0 || fm12 != M12 || fm21 != M21 || frd != reducedLength || fs12 != S12) throw new Exception("GeodesicLineExact.GenPosition (false) failed"); gle.ArcPosition(1.0, out finalLatitude, out finalLongitude, out finalAzimuth, out distance, out reducedLength, out M12, out M21, out S12); gle.ArcPosition(1.0, out flat, out flon); if (flat != finalLatitude || flon != finalLongitude) throw new Exception("GeodesicLineExact.ArcPosition #1 failed"); gle.ArcPosition(1.0, out flat, out flon, out faz); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth) throw new Exception("GeodesicLineExact.ArcPosition #2 failed"); gle.ArcPosition(1.0, out flat, out flon, out faz, out outd); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance) throw new Exception("GeodesicLineExact.ArcPosition #3 failed"); gle.ArcPosition(1.0, out flat, out flon, out faz, out outd, out frd); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance || frd != reducedLength) throw new Exception("GeodesicLineExact.ArcPosition #4 failed"); gle.ArcPosition(1.0, out flat, out flon, out faz, out outd, out fm12, out fm21); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21) throw new Exception("GeodesicLineExact.ArcPosition #5 failed"); gle.ArcPosition(1.0, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21); if (flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21 || frd != reducedLength) throw new Exception("GeodesicLineExact.ArcPosition #6 failed"); fad = gle.GenPosition(true, 1.0, GeodesicLineExact.mask.ALL, out flat, out flon, out faz, out outd, out frd, out fm12, out fm21, out fs12); if (fad != 1.0 || flat != finalLatitude || flon != finalLongitude || faz != finalAzimuth || outd != distance || fm12 != M12 || fm21 != M21 || frd != reducedLength || fs12 != S12) throw new Exception("GeodesicLineExact.GenPosition (false) failed"); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Interface Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("No errors detected", "Interfaces OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } GeographicLib-1.52/dotnet/Projections/GeodesicPanel.resx0000644000771000077100000001347114064202371023224 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/GeoidPanel.Designer.cs0000644000771000077100000005112314064202371023710 0ustar ckarneyckarneynamespace Projections { partial class GeoidPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.label1 = new System.Windows.Forms.Label(); this.m_geoidFileNameTextBox = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.m_threadSafeCheckBox = new System.Windows.Forms.CheckBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.m_dateTimeTextBox = new System.Windows.Forms.TextBox(); this.m_descriptionTextBox = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.m_equatorialRadiusTextBox = new System.Windows.Forms.TextBox(); this.m_flatteningTtextBox = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.m_northTextBox = new System.Windows.Forms.TextBox(); this.m_southTextBox = new System.Windows.Forms.TextBox(); this.m_eastTextBox = new System.Windows.Forms.TextBox(); this.m_westTextBox = new System.Windows.Forms.TextBox(); this.m_cacheButton = new System.Windows.Forms.Button(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.m_ellipsoidTextBox = new System.Windows.Forms.TextBox(); this.m_geoidTextBox = new System.Windows.Forms.TextBox(); this.m_convertEllipsodButton = new System.Windows.Forms.Button(); this.m_convertGeoidButton = new System.Windows.Forms.Button(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.m_toolTip = new System.Windows.Forms.ToolTip(this.components); this.m_heightButton = new System.Windows.Forms.Button(); this.m_validateButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(6, 5); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(54, 13); this.label1.TabIndex = 0; this.label1.Text = "Geoid File"; // // m_geoidFileNameTextBox // this.m_geoidFileNameTextBox.Location = new System.Drawing.Point(9, 21); this.m_geoidFileNameTextBox.Name = "m_geoidFileNameTextBox"; this.m_geoidFileNameTextBox.Size = new System.Drawing.Size(388, 20); this.m_geoidFileNameTextBox.TabIndex = 1; // // button1 // this.button1.Location = new System.Drawing.Point(404, 20); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(25, 23); this.button1.TabIndex = 2; this.button1.Text = "..."; this.m_toolTip.SetToolTip(this.button1, "Select Geoid File"); this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnSelectFile); // // m_threadSafeCheckBox // this.m_threadSafeCheckBox.AutoSize = true; this.m_threadSafeCheckBox.Location = new System.Drawing.Point(9, 48); this.m_threadSafeCheckBox.Name = "m_threadSafeCheckBox"; this.m_threadSafeCheckBox.Size = new System.Drawing.Size(85, 17); this.m_threadSafeCheckBox.TabIndex = 3; this.m_threadSafeCheckBox.Text = "Thread Safe"; this.m_threadSafeCheckBox.UseVisualStyleBackColor = true; this.m_threadSafeCheckBox.CheckedChanged += new System.EventHandler(this.OnThreadSafe); // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(7, 72); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(58, 13); this.label2.TabIndex = 4; this.label2.Text = "Date/Time"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(7, 101); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(60, 13); this.label3.TabIndex = 5; this.label3.Text = "Description"; // // m_dateTimeTextBox // this.m_dateTimeTextBox.Location = new System.Drawing.Point(80, 68); this.m_dateTimeTextBox.Name = "m_dateTimeTextBox"; this.m_dateTimeTextBox.ReadOnly = true; this.m_dateTimeTextBox.Size = new System.Drawing.Size(181, 20); this.m_dateTimeTextBox.TabIndex = 6; // // m_descriptionTextBox // this.m_descriptionTextBox.Location = new System.Drawing.Point(80, 97); this.m_descriptionTextBox.Name = "m_descriptionTextBox"; this.m_descriptionTextBox.ReadOnly = true; this.m_descriptionTextBox.Size = new System.Drawing.Size(349, 20); this.m_descriptionTextBox.TabIndex = 7; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(7, 130); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(69, 13); this.label4.TabIndex = 8; this.label4.Text = "Equatorial Radius"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(7, 159); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(53, 13); this.label5.TabIndex = 9; this.label5.Text = "Flattening"; // // m_equatorialRadiusTextBox // this.m_equatorialRadiusTextBox.Location = new System.Drawing.Point(83, 126); this.m_equatorialRadiusTextBox.Name = "m_equatorialRadiusTextBox"; this.m_equatorialRadiusTextBox.ReadOnly = true; this.m_equatorialRadiusTextBox.Size = new System.Drawing.Size(126, 20); this.m_equatorialRadiusTextBox.TabIndex = 10; // // m_flatteningTtextBox // this.m_flatteningTtextBox.Location = new System.Drawing.Point(83, 155); this.m_flatteningTtextBox.Name = "m_flatteningTtextBox"; this.m_flatteningTtextBox.ReadOnly = true; this.m_flatteningTtextBox.Size = new System.Drawing.Size(126, 20); this.m_flatteningTtextBox.TabIndex = 11; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(442, 12); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(33, 13); this.label6.TabIndex = 12; this.label6.Text = "North"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(442, 38); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(35, 13); this.label7.TabIndex = 13; this.label7.Text = "South"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(442, 64); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(28, 13); this.label8.TabIndex = 14; this.label8.Text = "East"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(442, 90); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(32, 13); this.label9.TabIndex = 15; this.label9.Text = "West"; // // m_northTextBox // this.m_northTextBox.Location = new System.Drawing.Point(482, 8); this.m_northTextBox.Name = "m_northTextBox"; this.m_northTextBox.Size = new System.Drawing.Size(100, 20); this.m_northTextBox.TabIndex = 16; // // m_southTextBox // this.m_southTextBox.Location = new System.Drawing.Point(482, 34); this.m_southTextBox.Name = "m_southTextBox"; this.m_southTextBox.Size = new System.Drawing.Size(100, 20); this.m_southTextBox.TabIndex = 17; // // m_eastTextBox // this.m_eastTextBox.Location = new System.Drawing.Point(482, 60); this.m_eastTextBox.Name = "m_eastTextBox"; this.m_eastTextBox.Size = new System.Drawing.Size(100, 20); this.m_eastTextBox.TabIndex = 18; // // m_westTextBox // this.m_westTextBox.Location = new System.Drawing.Point(482, 86); this.m_westTextBox.Name = "m_westTextBox"; this.m_westTextBox.Size = new System.Drawing.Size(100, 20); this.m_westTextBox.TabIndex = 19; // // m_cacheButton // this.m_cacheButton.Location = new System.Drawing.Point(492, 113); this.m_cacheButton.Name = "m_cacheButton"; this.m_cacheButton.Size = new System.Drawing.Size(75, 23); this.m_cacheButton.TabIndex = 20; this.m_cacheButton.Text = "Cache"; this.m_toolTip.SetToolTip(this.m_cacheButton, "Cache Geoid Data"); this.m_cacheButton.UseVisualStyleBackColor = true; this.m_cacheButton.Click += new System.EventHandler(this.OnCache); // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(606, 63); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(113, 13); this.label10.TabIndex = 21; this.label10.Text = "Height Above Ellipsoid"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(754, 63); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(102, 13); this.label11.TabIndex = 22; this.label11.Text = "Height above Geoid"; // // m_ellipsoidTextBox // this.m_ellipsoidTextBox.Location = new System.Drawing.Point(596, 85); this.m_ellipsoidTextBox.Name = "m_ellipsoidTextBox"; this.m_ellipsoidTextBox.Size = new System.Drawing.Size(132, 20); this.m_ellipsoidTextBox.TabIndex = 23; // // m_geoidTextBox // this.m_geoidTextBox.Location = new System.Drawing.Point(739, 85); this.m_geoidTextBox.Name = "m_geoidTextBox"; this.m_geoidTextBox.Size = new System.Drawing.Size(132, 20); this.m_geoidTextBox.TabIndex = 24; // // m_convertEllipsodButton // this.m_convertEllipsodButton.Enabled = false; this.m_convertEllipsodButton.Location = new System.Drawing.Point(625, 109); this.m_convertEllipsodButton.Name = "m_convertEllipsodButton"; this.m_convertEllipsodButton.Size = new System.Drawing.Size(75, 23); this.m_convertEllipsodButton.TabIndex = 25; this.m_convertEllipsodButton.Text = "Convert ->"; this.m_toolTip.SetToolTip(this.m_convertEllipsodButton, "Convert Ellipsod Height to Geoid Height"); this.m_convertEllipsodButton.UseVisualStyleBackColor = true; this.m_convertEllipsodButton.Click += new System.EventHandler(this.OnConvertEllipsod); // // m_convertGeoidButton // this.m_convertGeoidButton.Enabled = false; this.m_convertGeoidButton.Location = new System.Drawing.Point(768, 109); this.m_convertGeoidButton.Name = "m_convertGeoidButton"; this.m_convertGeoidButton.Size = new System.Drawing.Size(75, 23); this.m_convertGeoidButton.TabIndex = 26; this.m_convertGeoidButton.Text = "<- Convert"; this.m_toolTip.SetToolTip(this.m_convertGeoidButton, "Convert Geoid Height to Ellipsoid Height"); this.m_convertGeoidButton.UseVisualStyleBackColor = true; this.m_convertGeoidButton.Click += new System.EventHandler(this.OnConvertGeoid); // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(593, 12); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(45, 13); this.label12.TabIndex = 27; this.label12.Text = "Latitude"; // // label13 // this.label13.AutoSize = true; this.label13.Location = new System.Drawing.Point(593, 38); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(54, 13); this.label13.TabIndex = 28; this.label13.Text = "Longitude"; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(653, 8); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_latitudeTextBox.TabIndex = 29; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(653, 34); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_longitudeTextBox.TabIndex = 30; // // m_heightButton // this.m_heightButton.Enabled = false; this.m_heightButton.Location = new System.Drawing.Point(768, 18); this.m_heightButton.Name = "m_heightButton"; this.m_heightButton.Size = new System.Drawing.Size(75, 23); this.m_heightButton.TabIndex = 31; this.m_heightButton.Text = "Height"; this.m_toolTip.SetToolTip(this.m_heightButton, "Calculate Geoid Height at Longitude/Latitude"); this.m_heightButton.UseVisualStyleBackColor = true; this.m_heightButton.Click += new System.EventHandler(this.OnHeight); // // m_validateButton // this.m_validateButton.Enabled = false; this.m_validateButton.Location = new System.Drawing.Point(638, 148); this.m_validateButton.Name = "m_validateButton"; this.m_validateButton.Size = new System.Drawing.Size(75, 23); this.m_validateButton.TabIndex = 32; this.m_validateButton.Text = "Validate"; this.m_validateButton.UseVisualStyleBackColor = true; this.m_validateButton.Click += new System.EventHandler(this.OnValidate); // // GeoidPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.m_validateButton); this.Controls.Add(this.m_heightButton); this.Controls.Add(this.m_longitudeTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.label13); this.Controls.Add(this.label12); this.Controls.Add(this.m_convertGeoidButton); this.Controls.Add(this.m_convertEllipsodButton); this.Controls.Add(this.m_geoidTextBox); this.Controls.Add(this.m_ellipsoidTextBox); this.Controls.Add(this.label11); this.Controls.Add(this.label10); this.Controls.Add(this.m_cacheButton); this.Controls.Add(this.m_westTextBox); this.Controls.Add(this.m_eastTextBox); this.Controls.Add(this.m_southTextBox); this.Controls.Add(this.m_northTextBox); this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.m_flatteningTtextBox); this.Controls.Add(this.m_equatorialRadiusTextBox); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.m_descriptionTextBox); this.Controls.Add(this.m_dateTimeTextBox); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.m_threadSafeCheckBox); this.Controls.Add(this.button1); this.Controls.Add(this.m_geoidFileNameTextBox); this.Controls.Add(this.label1); this.Name = "GeoidPanel"; this.Size = new System.Drawing.Size(1002, 273); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox m_geoidFileNameTextBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.CheckBox m_threadSafeCheckBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox m_dateTimeTextBox; private System.Windows.Forms.TextBox m_descriptionTextBox; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox m_equatorialRadiusTextBox; private System.Windows.Forms.TextBox m_flatteningTtextBox; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.TextBox m_northTextBox; private System.Windows.Forms.TextBox m_southTextBox; private System.Windows.Forms.TextBox m_eastTextBox; private System.Windows.Forms.TextBox m_westTextBox; private System.Windows.Forms.Button m_cacheButton; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox m_ellipsoidTextBox; private System.Windows.Forms.TextBox m_geoidTextBox; private System.Windows.Forms.Button m_convertEllipsodButton; private System.Windows.Forms.Button m_convertGeoidButton; private System.Windows.Forms.ToolTip m_toolTip; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.Button m_heightButton; private System.Windows.Forms.Button m_validateButton; } } GeographicLib-1.52/dotnet/Projections/GeoidPanel.cs0000644000771000077100000001406714064202371022157 0ustar ckarneyckarney/** * \file NETGeographicLib\GeoidPanel.cs * \brief NETGeographicLib.Geoid example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; using System.IO; namespace Projections { public partial class GeoidPanel : UserControl { Geoid m_geoid = null; string m_path; string m_fileName; public GeoidPanel() { InitializeComponent(); m_threadSafeCheckBox.Checked = true; } private void OnSelectFile(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Geoid File (*.pgm)|*.pgm"; dlg.DefaultExt = "pgm"; dlg.Title = "Open Geoid File"; if (dlg.ShowDialog() == DialogResult.Cancel) return; m_path = dlg.FileName.Substring(0, dlg.FileName.LastIndexOf('\\')).Replace('\\', '/'); int length = dlg.FileName.LastIndexOf('.') - dlg.FileName.LastIndexOf('\\') - 1; m_fileName = dlg.FileName.Substring(dlg.FileName.LastIndexOf('\\') + 1, length); try { m_geoid = new Geoid(m_fileName, m_path, true, m_threadSafeCheckBox.Checked); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } m_convertEllipsodButton.Enabled = m_convertGeoidButton.Enabled = m_heightButton.Enabled = m_validateButton.Enabled = true; m_geoidFileNameTextBox.Text = dlg.FileName; m_dateTimeTextBox.Text = m_geoid.DateTime; m_descriptionTextBox.Text = m_geoid.Description; m_majorRadiusTextBox.Text = m_geoid.EquatorialRadius.ToString(); m_flatteningTtextBox.Text = m_geoid.Flattening.ToString(); } private void OnThreadSafe(object sender, EventArgs e) { if (m_geoidFileNameTextBox.Text.Length > 0) { try { m_geoid = new Geoid(m_fileName, m_path, true, m_threadSafeCheckBox.Checked); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } m_cacheButton.Enabled = !m_threadSafeCheckBox.Checked; m_northTextBox.ReadOnly = m_southTextBox.ReadOnly = m_eastTextBox.ReadOnly = m_westTextBox.ReadOnly = m_threadSafeCheckBox.Checked; } private void OnCache(object sender, EventArgs e) { if (m_geoid == null) return; try { double south = Double.Parse(m_southTextBox.Text); double north = Double.Parse(m_northTextBox.Text); double west = Double.Parse(m_westTextBox.Text); double east = Double.Parse(m_eastTextBox.Text); m_geoid.CacheArea(south, west, north, east); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnConvertEllipsod(object sender, EventArgs e) { try { double lat = Double.Parse(m_latitudeTextBox.Text); double lon = Double.Parse(m_longitudeTextBox.Text); double h = Double.Parse(m_ellipsoidTextBox.Text); m_geoidTextBox.Text = m_geoid.ConvertHeight(lat, lon, h, Geoid.ConvertFlag.ELLIPSOIDTOGEOID).ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnConvertGeoid(object sender, EventArgs e) { try { double lat = Double.Parse(m_latitudeTextBox.Text); double lon = Double.Parse(m_longitudeTextBox.Text); double h = Double.Parse(m_geoidTextBox.Text); m_ellipsoidTextBox.Text = m_geoid.ConvertHeight(lat, lon, h, Geoid.ConvertFlag.GEOIDTOELLIPSOID).ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnHeight(object sender, EventArgs e) { try { double lat = Double.Parse(m_latitudeTextBox.Text); double lon = Double.Parse(m_longitudeTextBox.Text); m_ellipsoidTextBox.Text = m_geoid.Height(lat, lon).ToString(); m_geoidTextBox.Text = "0"; } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnValidate(object sender, EventArgs e) { try { Geoid g = new Geoid(m_fileName, m_path, false, false); g.CacheArea(20.0, -30.0, 30.0, -20.0); g.CacheAll(); double h2 = g.Height(32.0, -60.0); g.ConvertHeight(32.0, -60.0, 100.0, Geoid.ConvertFlag.ELLIPSOIDTOGEOID); MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } GeographicLib-1.52/dotnet/Projections/GeoidPanel.resx0000644000771000077100000001347014064202371022530 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/GravityPanel.Designer.cs0000644000771000077100000004253114064202371024311 0ustar ckarneyckarneynamespace Projections { partial class GravityPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.button1 = new System.Windows.Forms.Button(); this.m_updateButton = new System.Windows.Forms.Button(); this.m_gravityModelNameTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.m_nameTextBox = new System.Windows.Forms.TextBox(); this.m_descriptionTextBox = new System.Windows.Forms.TextBox(); this.m_dateTextBox = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.m_longitudetextBoxT = new System.Windows.Forms.TextBox(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_altitudeTextBox = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.m_accelXTextBox = new System.Windows.Forms.TextBox(); this.m_accelYTextBox = new System.Windows.Forms.TextBox(); this.m_accelZTextBox = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); this.m_geoidTextBox = new System.Windows.Forms.TextBox(); this.m_normGravButton = new System.Windows.Forms.Button(); this.m_GravityCircleButton = new System.Windows.Forms.Button(); this.m_validateButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(391, 21); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(29, 23); this.button1.TabIndex = 2; this.button1.Text = "..."; this.toolTip1.SetToolTip(this.button1, "Select gravity model file"); this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnSelectGravityModel); // // m_updateButton // this.m_updateButton.Enabled = false; this.m_updateButton.Location = new System.Drawing.Point(565, 106); this.m_updateButton.Name = "m_updateButton"; this.m_updateButton.Size = new System.Drawing.Size(75, 23); this.m_updateButton.TabIndex = 24; this.m_updateButton.Text = "Update"; this.toolTip1.SetToolTip(this.m_updateButton, "Calculate acceleration and geoid height"); this.m_updateButton.UseVisualStyleBackColor = true; this.m_updateButton.Click += new System.EventHandler(this.OnUpdate); // // m_gravityModelNameTextBox // this.m_gravityModelNameTextBox.Location = new System.Drawing.Point(7, 22); this.m_gravityModelNameTextBox.Name = "m_gravityModelNameTextBox"; this.m_gravityModelNameTextBox.Size = new System.Drawing.Size(377, 20); this.m_gravityModelNameTextBox.TabIndex = 0; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(4, 6); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(72, 13); this.label1.TabIndex = 1; this.label1.Text = "Gravity Model"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(7, 52); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(35, 13); this.label2.TabIndex = 3; this.label2.Text = "Name"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(10, 79); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(60, 13); this.label3.TabIndex = 4; this.label3.Text = "Description"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(13, 106); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(30, 13); this.label4.TabIndex = 5; this.label4.Text = "Date"; // // m_nameTextBox // this.m_nameTextBox.Location = new System.Drawing.Point(85, 48); this.m_nameTextBox.Name = "m_nameTextBox"; this.m_nameTextBox.ReadOnly = true; this.m_nameTextBox.Size = new System.Drawing.Size(299, 20); this.m_nameTextBox.TabIndex = 6; // // m_descriptionTextBox // this.m_descriptionTextBox.Location = new System.Drawing.Point(85, 75); this.m_descriptionTextBox.Name = "m_descriptionTextBox"; this.m_descriptionTextBox.ReadOnly = true; this.m_descriptionTextBox.Size = new System.Drawing.Size(299, 20); this.m_descriptionTextBox.TabIndex = 7; // // m_dateTextBox // this.m_dateTextBox.Location = new System.Drawing.Point(85, 102); this.m_dateTextBox.Name = "m_dateTextBox"; this.m_dateTextBox.ReadOnly = true; this.m_dateTextBox.Size = new System.Drawing.Size(299, 20); this.m_dateTextBox.TabIndex = 8; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(433, 32); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(101, 13); this.label5.TabIndex = 9; this.label5.Text = "Longitude (degrees)"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(433, 58); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(92, 13); this.label6.TabIndex = 10; this.label6.Text = "Latitude (degrees)"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(433, 84); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(82, 13); this.label7.TabIndex = 11; this.label7.Text = "Altitude (meters)"; // // m_longitudetextBoxT // this.m_longitudetextBoxT.Location = new System.Drawing.Point(539, 28); this.m_longitudetextBoxT.Name = "m_longitudetextBoxT"; this.m_longitudetextBoxT.Size = new System.Drawing.Size(126, 20); this.m_longitudetextBoxT.TabIndex = 12; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(539, 54); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(126, 20); this.m_latitudeTextBox.TabIndex = 13; // // m_altitudeTextBox // this.m_altitudeTextBox.Location = new System.Drawing.Point(539, 80); this.m_altitudeTextBox.Name = "m_altitudeTextBox"; this.m_altitudeTextBox.Size = new System.Drawing.Size(126, 20); this.m_altitudeTextBox.TabIndex = 14; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(670, 32); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(14, 13); this.label8.TabIndex = 15; this.label8.Text = "X"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(670, 58); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(14, 13); this.label9.TabIndex = 16; this.label9.Text = "Y"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(670, 84); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(14, 13); this.label10.TabIndex = 17; this.label10.Text = "Z"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(700, 6); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(105, 13); this.label11.TabIndex = 18; this.label11.Text = "Acceleration (m/s^2)"; // // m_accelXTextBox // this.m_accelXTextBox.Location = new System.Drawing.Point(691, 28); this.m_accelXTextBox.Name = "m_accelXTextBox"; this.m_accelXTextBox.ReadOnly = true; this.m_accelXTextBox.Size = new System.Drawing.Size(122, 20); this.m_accelXTextBox.TabIndex = 19; // // m_accelYTextBox // this.m_accelYTextBox.Location = new System.Drawing.Point(690, 54); this.m_accelYTextBox.Name = "m_accelYTextBox"; this.m_accelYTextBox.ReadOnly = true; this.m_accelYTextBox.Size = new System.Drawing.Size(122, 20); this.m_accelYTextBox.TabIndex = 20; // // m_accelZTextBox // this.m_accelZTextBox.Location = new System.Drawing.Point(691, 80); this.m_accelZTextBox.Name = "m_accelZTextBox"; this.m_accelZTextBox.ReadOnly = true; this.m_accelZTextBox.Size = new System.Drawing.Size(122, 20); this.m_accelZTextBox.TabIndex = 21; // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(709, 106); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(86, 13); this.label12.TabIndex = 22; this.label12.Text = "Geoid Height (m)"; // // m_geoidTextBox // this.m_geoidTextBox.Location = new System.Drawing.Point(691, 125); this.m_geoidTextBox.Name = "m_geoidTextBox"; this.m_geoidTextBox.ReadOnly = true; this.m_geoidTextBox.Size = new System.Drawing.Size(122, 20); this.m_geoidTextBox.TabIndex = 23; // // m_normGravButton // this.m_normGravButton.Enabled = false; this.m_normGravButton.Location = new System.Drawing.Point(544, 135); this.m_normGravButton.Name = "m_normGravButton"; this.m_normGravButton.Size = new System.Drawing.Size(117, 42); this.m_normGravButton.TabIndex = 25; this.m_normGravButton.Text = "Acceleration using NormalGravity"; this.m_normGravButton.UseVisualStyleBackColor = true; this.m_normGravButton.Click += new System.EventHandler(this.OnNormGravity); // // m_GravityCircleButton // this.m_GravityCircleButton.Enabled = false; this.m_GravityCircleButton.Location = new System.Drawing.Point(403, 135); this.m_GravityCircleButton.Name = "m_GravityCircleButton"; this.m_GravityCircleButton.Size = new System.Drawing.Size(131, 54); this.m_GravityCircleButton.TabIndex = 26; this.m_GravityCircleButton.Text = "Acceleration and geoid height using GravityCircle"; this.m_GravityCircleButton.UseVisualStyleBackColor = true; this.m_GravityCircleButton.Click += new System.EventHandler(this.OnGravityCircle); // // m_validateButton // this.m_validateButton.Enabled = false; this.m_validateButton.Location = new System.Drawing.Point(43, 145); this.m_validateButton.Name = "m_validateButton"; this.m_validateButton.Size = new System.Drawing.Size(75, 23); this.m_validateButton.TabIndex = 27; this.m_validateButton.Text = "Validate"; this.m_validateButton.UseVisualStyleBackColor = true; this.m_validateButton.Click += new System.EventHandler(this.OnValidate); // // GravityPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.m_validateButton); this.Controls.Add(this.m_GravityCircleButton); this.Controls.Add(this.m_normGravButton); this.Controls.Add(this.m_updateButton); this.Controls.Add(this.m_geoidTextBox); this.Controls.Add(this.label12); this.Controls.Add(this.m_accelZTextBox); this.Controls.Add(this.m_accelYTextBox); this.Controls.Add(this.m_accelXTextBox); this.Controls.Add(this.label11); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.m_altitudeTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.m_longitudetextBoxT); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.m_dateTextBox); this.Controls.Add(this.m_descriptionTextBox); this.Controls.Add(this.m_nameTextBox); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.m_gravityModelNameTextBox); this.Name = "GravityPanel"; this.Size = new System.Drawing.Size(1083, 403); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.TextBox m_gravityModelNameTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox m_nameTextBox; private System.Windows.Forms.TextBox m_descriptionTextBox; private System.Windows.Forms.TextBox m_dateTextBox; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox m_longitudetextBoxT; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_altitudeTextBox; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox m_accelXTextBox; private System.Windows.Forms.TextBox m_accelYTextBox; private System.Windows.Forms.TextBox m_accelZTextBox; private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox m_geoidTextBox; private System.Windows.Forms.Button m_updateButton; private System.Windows.Forms.Button m_normGravButton; private System.Windows.Forms.Button m_GravityCircleButton; private System.Windows.Forms.Button m_validateButton; } } GeographicLib-1.52/dotnet/Projections/GravityPanel.cs0000644000771000077100000001672314064202371022556 0ustar ckarneyckarney/** * \file NETGeographicLib\GravityPanel.cs * \brief NETGeographicLib.GravityModel example * * NETGeographicLib.GravityModel, * NETGeographicLib.NormalGravity, and * NETGeographicLib.GravityCircle example. * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class GravityPanel : UserControl { GravityModel m_gm = null; string m_path; string m_name; public GravityPanel() { InitializeComponent(); } private void OnSelectGravityModel(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Gravity Model (*.egm)|*.egm"; dlg.DefaultExt = "egm"; if (dlg.ShowDialog() == DialogResult.Cancel) return; m_path = dlg.FileName.Substring(0, dlg.FileName.LastIndexOf('\\')).Replace('\\', '/'); int length = dlg.FileName.LastIndexOf('.') - dlg.FileName.LastIndexOf('\\') - 1; m_name = dlg.FileName.Substring(dlg.FileName.LastIndexOf('\\') + 1, length); try { m_gm = new GravityModel(m_name, m_path); m_gravityModelNameTextBox.Text = dlg.FileName; m_nameTextBox.Text = m_gm.GravityModelName; m_descriptionTextBox.Text = m_gm.Description; m_dateTextBox.Text = m_gm.DateTime; m_updateButton.Enabled = true; m_normGravButton.Enabled = true; m_GravityCircleButton.Enabled = true; m_validateButton.Enabled = true; } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnUpdate(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; try { double lon = Double.Parse(m_longitudetextBoxT.Text); double lat = Double.Parse(m_latitudeTextBox.Text); double alt = Double.Parse(m_altitudeTextBox.Text); double gx, gy, gz; m_gm.Gravity(lat, lon, alt, out gx, out gy, out gz); m_accelXTextBox.Text = gx.ToString(); m_accelYTextBox.Text = gy.ToString(); m_accelZTextBox.Text = gz.ToString(); m_geoidTextBox.Text = m_gm.GeoidHeight(lat, lon).ToString(); Cursor = Cursors.Default; } catch (Exception xcpt) { Cursor = Cursors.Default; MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnNormGravity(object sender, EventArgs e) { try { double lat = Double.Parse(m_latitudeTextBox.Text); double alt = Double.Parse(m_altitudeTextBox.Text); double gx, gz; NormalGravity ng = m_gm.ReferenceEllipsoid(); ng.Gravity(lat, alt, out gx, out gz); m_accelXTextBox.Text = gx.ToString(); m_accelYTextBox.Text = "0.0"; m_accelZTextBox.Text = gz.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnGravityCircle(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; try { double lon = Double.Parse(m_longitudetextBoxT.Text); double lat = Double.Parse(m_latitudeTextBox.Text); double alt = Double.Parse(m_altitudeTextBox.Text); double gx, gy, gz; GravityCircle gc = m_gm.Circle(lat, alt, GravityModel.Mask.GEOID_HEIGHT|GravityModel.Mask.GRAVITY); gc.Gravity(lon, out gx, out gy, out gz); m_accelXTextBox.Text = gx.ToString(); m_accelYTextBox.Text = gy.ToString(); m_accelZTextBox.Text = gz.ToString(); if (alt != 0.0) MessageBox.Show("Geoid height cannot be calculated with GravityCircle if altitude is not 0", "", MessageBoxButtons.OK, MessageBoxIcon.Information); else m_geoidTextBox.Text = gc.GeoidHeight(lon).ToString(); Cursor = Cursors.Default; } catch (Exception xcpt) { Cursor = Cursors.Default; MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnValidate(object sender, EventArgs e) { try { double lon = -86.0; double lat = 32.0; double alt = 0.0; double x, y, z; GravityModel gm = new GravityModel(m_name,m_path); gm.Disturbance( lat, lon, alt, out x, out y, out z); gm.GeoidHeight(lat,lon); gm.Gravity(lat,lon,alt,out x,out y, out z); gm.Phi(5000000.0,5000000.0,out x,out y); gm.SphericalAnomaly(lat,lon,alt,out x, out y, out z); gm.T(5000000.0,5000000.0,5000000.0); gm.U(5000000.0,5000000.0,5000000.0,out x,out y,out z); gm.V(5000000.0,5000000.0,5000000.0,out x,out y,out z); gm.W(5000000.0,5000000.0,5000000.0,out x,out y,out z); NormalGravity ng = new NormalGravity(NormalGravity.StandardModels.GRS80); ng = new NormalGravity( NormalGravity.StandardModels.WGS84); ng = new NormalGravity(6378137.0,3.986005e+14,7.292115147e-5,1.08263e-3, false); ng = gm.ReferenceEllipsoid(); ng.DynamicalFormFactor(1); Geocentric geo = ng.Earth(); ng.Gravity(lat,alt,out x, out z); ng.Phi(5000000.0,5000000.0,out x,out y); ng.SurfaceGravity(lat); ng.U(5000000.0,5000000.0,5000000.0,out x, out y, out z); ng.V0(5000000.0,5000000.0,5000000.0,out x, out y, out z); GravityCircle gc = gm.Circle(lat,0.0,GravityModel.Mask.ALL); gc.Capabilities(); gc.Capabilities(GravityModel.Mask.GRAVITY); gc.Disturbance(lon, out x, out y, out z); gc.GeoidHeight(lon); gc.Gravity(lon, out x, out y, out z); gc.SphericalAnomaly(lon, out x, out y, out z); gc.T(lon); gc.V(lon, out x, out y, out z); gc.W(lon, out x, out y, out z); MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } GeographicLib-1.52/dotnet/Projections/GravityPanel.resx0000644000771000077100000001346714064202371023134 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/LocalCartesianPanel.Designer.cs0000644000771000077100000005665314064202371025562 0ustar ckarneyckarneynamespace Projections { partial class LocalCartesianPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.m_toolTip = new System.Windows.Forms.ToolTip(this.components); this.m_setButton = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_flatteningTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.m_equatorialRadiusTextBox = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.m_altitudeTextBox = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.m_latTextBox = new System.Windows.Forms.TextBox(); this.m_lonTextBox = new System.Windows.Forms.TextBox(); this.m_altTextBox = new System.Windows.Forms.TextBox(); this.m_XTextBox = new System.Windows.Forms.TextBox(); this.m_YTextBox = new System.Windows.Forms.TextBox(); this.m_ZTextBox = new System.Windows.Forms.TextBox(); this.m_functionComboBox = new System.Windows.Forms.ComboBox(); this.label12 = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.m_textBox22 = new System.Windows.Forms.TextBox(); this.m_textBox20 = new System.Windows.Forms.TextBox(); this.m_textBox21 = new System.Windows.Forms.TextBox(); this.m_textBox12 = new System.Windows.Forms.TextBox(); this.m_textBox10 = new System.Windows.Forms.TextBox(); this.m_textBox11 = new System.Windows.Forms.TextBox(); this.m_textBox02 = new System.Windows.Forms.TextBox(); this.m_textBox00 = new System.Windows.Forms.TextBox(); this.m_textBox01 = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.SuspendLayout(); // // m_setButton // this.m_setButton.Location = new System.Drawing.Point(12, 107); this.m_setButton.Name = "m_setButton"; this.m_setButton.Size = new System.Drawing.Size(75, 23); this.m_setButton.TabIndex = 4; this.m_setButton.Text = "Set"; this.m_toolTip.SetToolTip(this.m_setButton, "Sets the Ellipsoid Parameters"); this.m_setButton.UseVisualStyleBackColor = true; this.m_setButton.Click += new System.EventHandler(this.OnSetEllipsoid); // // button1 // this.button1.Location = new System.Drawing.Point(16, 150); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 6; this.button1.Text = "Set"; this.m_toolTip.SetToolTip(this.button1, "Sets the reference coordinates"); this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnSetReference); // // button2 // this.button2.Location = new System.Drawing.Point(517, 163); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 22; this.button2.Text = "Convert"; this.m_toolTip.SetToolTip(this.button2, "Executes the current function"); this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnConvert); // // groupBox1 // this.groupBox1.Controls.Add(this.m_setButton); this.groupBox1.Controls.Add(this.m_flatteningTextBox); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.m_equatorialRadiusTextBox); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(146, 140); this.groupBox1.TabIndex = 6; this.groupBox1.TabStop = false; this.groupBox1.Text = "Ellipsoid Parameters"; // // m_flatteningTextBox // this.m_flatteningTextBox.Location = new System.Drawing.Point(12, 83); this.m_flatteningTextBox.Name = "m_flatteningTextBox"; this.m_flatteningTextBox.Size = new System.Drawing.Size(125, 20); this.m_flatteningTextBox.TabIndex = 3; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(109, 13); this.label1.TabIndex = 0; this.label1.Text = "Equatorial Radius (meters)"; // // m_equatorialRadiusTextBox // this.m_equatorialRadiusTextBox.Location = new System.Drawing.Point(12, 42); this.m_equatorialRadiusTextBox.Name = "m_equatorialRadiusTextBox"; this.m_equatorialRadiusTextBox.Size = new System.Drawing.Size(125, 20); this.m_equatorialRadiusTextBox.TabIndex = 2; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 66); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 13); this.label2.TabIndex = 1; this.label2.Text = "Flattening"; // // groupBox2 // this.groupBox2.Controls.Add(this.button1); this.groupBox2.Controls.Add(this.m_altitudeTextBox); this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.m_longitudeTextBox); this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.m_latitudeTextBox); this.groupBox2.Controls.Add(this.label3); this.groupBox2.Location = new System.Drawing.Point(155, 6); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(128, 178); this.groupBox2.TabIndex = 7; this.groupBox2.TabStop = false; this.groupBox2.Text = "Origin"; // // m_altitudeTextBox // this.m_altitudeTextBox.Location = new System.Drawing.Point(16, 123); this.m_altitudeTextBox.Name = "m_altitudeTextBox"; this.m_altitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_altitudeTextBox.TabIndex = 5; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(13, 106); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(82, 13); this.label5.TabIndex = 4; this.label5.Text = "Altitude (meters)"; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(13, 79); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_longitudeTextBox.TabIndex = 3; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(10, 63); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(101, 13); this.label4.TabIndex = 2; this.label4.Text = "Longitude (degrees)"; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(10, 38); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_latitudeTextBox.TabIndex = 1; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(7, 22); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(92, 13); this.label3.TabIndex = 0; this.label3.Text = "Latitude (degrees)"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(295, 10); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(92, 13); this.label6.TabIndex = 8; this.label6.Text = "Latitude (degrees)"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(295, 36); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(101, 13); this.label7.TabIndex = 9; this.label7.Text = "Longitude (degrees)"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(295, 62); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(82, 13); this.label8.TabIndex = 10; this.label8.Text = "Altitude (meters)"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(295, 88); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(54, 13); this.label9.TabIndex = 11; this.label9.Text = "X (meters)"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(295, 114); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(54, 13); this.label10.TabIndex = 12; this.label10.Text = "Y (meters)"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(295, 140); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(54, 13); this.label11.TabIndex = 13; this.label11.Text = "Z (meters)"; // // m_latTextBox // this.m_latTextBox.Location = new System.Drawing.Point(405, 6); this.m_latTextBox.Name = "m_latTextBox"; this.m_latTextBox.Size = new System.Drawing.Size(100, 20); this.m_latTextBox.TabIndex = 14; // // m_lonTextBox // this.m_lonTextBox.Location = new System.Drawing.Point(405, 32); this.m_lonTextBox.Name = "m_lonTextBox"; this.m_lonTextBox.Size = new System.Drawing.Size(100, 20); this.m_lonTextBox.TabIndex = 15; // // m_altTextBox // this.m_altTextBox.Location = new System.Drawing.Point(405, 58); this.m_altTextBox.Name = "m_altTextBox"; this.m_altTextBox.Size = new System.Drawing.Size(100, 20); this.m_altTextBox.TabIndex = 16; // // m_XTextBox // this.m_XTextBox.Location = new System.Drawing.Point(405, 84); this.m_XTextBox.Name = "m_XTextBox"; this.m_XTextBox.Size = new System.Drawing.Size(100, 20); this.m_XTextBox.TabIndex = 17; // // m_YTextBox // this.m_YTextBox.Location = new System.Drawing.Point(405, 110); this.m_YTextBox.Name = "m_YTextBox"; this.m_YTextBox.Size = new System.Drawing.Size(100, 20); this.m_YTextBox.TabIndex = 18; // // m_ZTextBox // this.m_ZTextBox.Location = new System.Drawing.Point(405, 136); this.m_ZTextBox.Name = "m_ZTextBox"; this.m_ZTextBox.Size = new System.Drawing.Size(100, 20); this.m_ZTextBox.TabIndex = 19; // // m_functionComboBox // this.m_functionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_functionComboBox.FormattingEnabled = true; this.m_functionComboBox.Items.AddRange(new object[] { "Forward", "Reverse"}); this.m_functionComboBox.Location = new System.Drawing.Point(405, 163); this.m_functionComboBox.Name = "m_functionComboBox"; this.m_functionComboBox.Size = new System.Drawing.Size(100, 21); this.m_functionComboBox.TabIndex = 20; this.m_functionComboBox.SelectedIndexChanged += new System.EventHandler(this.OnNewFunction); // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(295, 167); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(48, 13); this.label12.TabIndex = 21; this.label12.Text = "Function"; // // groupBox3 // this.groupBox3.Controls.Add(this.m_textBox22); this.groupBox3.Controls.Add(this.m_textBox20); this.groupBox3.Controls.Add(this.m_textBox21); this.groupBox3.Controls.Add(this.m_textBox12); this.groupBox3.Controls.Add(this.m_textBox10); this.groupBox3.Controls.Add(this.m_textBox11); this.groupBox3.Controls.Add(this.m_textBox02); this.groupBox3.Controls.Add(this.m_textBox00); this.groupBox3.Controls.Add(this.m_textBox01); this.groupBox3.Location = new System.Drawing.Point(511, 10); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(325, 99); this.groupBox3.TabIndex = 25; this.groupBox3.TabStop = false; this.groupBox3.Text = "Rotation Matrix"; // // m_textBox22 // this.m_textBox22.Location = new System.Drawing.Point(218, 74); this.m_textBox22.Name = "m_textBox22"; this.m_textBox22.ReadOnly = true; this.m_textBox22.Size = new System.Drawing.Size(100, 20); this.m_textBox22.TabIndex = 30; // // m_textBox20 // this.m_textBox20.Location = new System.Drawing.Point(6, 74); this.m_textBox20.Name = "m_textBox20"; this.m_textBox20.ReadOnly = true; this.m_textBox20.Size = new System.Drawing.Size(100, 20); this.m_textBox20.TabIndex = 28; // // m_textBox21 // this.m_textBox21.Location = new System.Drawing.Point(112, 74); this.m_textBox21.Name = "m_textBox21"; this.m_textBox21.ReadOnly = true; this.m_textBox21.Size = new System.Drawing.Size(100, 20); this.m_textBox21.TabIndex = 29; // // m_textBox12 // this.m_textBox12.Location = new System.Drawing.Point(218, 50); this.m_textBox12.Name = "m_textBox12"; this.m_textBox12.ReadOnly = true; this.m_textBox12.Size = new System.Drawing.Size(100, 20); this.m_textBox12.TabIndex = 27; // // m_textBox10 // this.m_textBox10.Location = new System.Drawing.Point(6, 50); this.m_textBox10.Name = "m_textBox10"; this.m_textBox10.ReadOnly = true; this.m_textBox10.Size = new System.Drawing.Size(100, 20); this.m_textBox10.TabIndex = 25; // // m_textBox11 // this.m_textBox11.Location = new System.Drawing.Point(112, 50); this.m_textBox11.Name = "m_textBox11"; this.m_textBox11.ReadOnly = true; this.m_textBox11.Size = new System.Drawing.Size(100, 20); this.m_textBox11.TabIndex = 26; // // m_textBox02 // this.m_textBox02.Location = new System.Drawing.Point(218, 25); this.m_textBox02.Name = "m_textBox02"; this.m_textBox02.ReadOnly = true; this.m_textBox02.Size = new System.Drawing.Size(100, 20); this.m_textBox02.TabIndex = 24; // // m_textBox00 // this.m_textBox00.Location = new System.Drawing.Point(6, 25); this.m_textBox00.Name = "m_textBox00"; this.m_textBox00.ReadOnly = true; this.m_textBox00.Size = new System.Drawing.Size(100, 20); this.m_textBox00.TabIndex = 22; // // m_textBox01 // this.m_textBox01.Location = new System.Drawing.Point(112, 25); this.m_textBox01.Name = "m_textBox01"; this.m_textBox01.ReadOnly = true; this.m_textBox01.Size = new System.Drawing.Size(100, 20); this.m_textBox01.TabIndex = 23; // // button3 // this.button3.Location = new System.Drawing.Point(18, 155); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 26; this.button3.Text = "Validate"; this.m_toolTip.SetToolTip(this.button3, "Verifies LocalCartesian Interfaces"); this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.OnValidate); // // LocalCartesianPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.button3); this.Controls.Add(this.groupBox3); this.Controls.Add(this.button2); this.Controls.Add(this.label12); this.Controls.Add(this.m_functionComboBox); this.Controls.Add(this.m_ZTextBox); this.Controls.Add(this.m_YTextBox); this.Controls.Add(this.m_XTextBox); this.Controls.Add(this.m_altTextBox); this.Controls.Add(this.m_lonTextBox); this.Controls.Add(this.m_latTextBox); this.Controls.Add(this.label11); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Name = "LocalCartesianPanel"; this.Size = new System.Drawing.Size(842, 295); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.ToolTip m_toolTip; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button m_setButton; private System.Windows.Forms.TextBox m_flatteningTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox m_equatorialRadiusTextBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox m_altitudeTextBox; private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox m_latTextBox; private System.Windows.Forms.TextBox m_lonTextBox; private System.Windows.Forms.TextBox m_altTextBox; private System.Windows.Forms.TextBox m_XTextBox; private System.Windows.Forms.TextBox m_YTextBox; private System.Windows.Forms.TextBox m_ZTextBox; private System.Windows.Forms.ComboBox m_functionComboBox; private System.Windows.Forms.Label label12; private System.Windows.Forms.Button button2; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.TextBox m_textBox22; private System.Windows.Forms.TextBox m_textBox20; private System.Windows.Forms.TextBox m_textBox21; private System.Windows.Forms.TextBox m_textBox12; private System.Windows.Forms.TextBox m_textBox10; private System.Windows.Forms.TextBox m_textBox11; private System.Windows.Forms.TextBox m_textBox02; private System.Windows.Forms.TextBox m_textBox00; private System.Windows.Forms.TextBox m_textBox01; private System.Windows.Forms.Button button3; } } GeographicLib-1.52/dotnet/Projections/LocalCartesianPanel.cs0000644000771000077100000001523314064202371024010 0ustar ckarneyckarney/** * \file NETGeographicLib\LocalCartesianPanel.cs * \brief NETGeographicLib.LocalCartesian example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class LocalCartesianPanel : UserControl { LocalCartesian m_lc = null; enum Functions { Forward, Reverse }; Functions m_function = Functions.Forward; public LocalCartesianPanel() { InitializeComponent(); Geocentric g = new Geocentric(); m_majorRadiusTextBox.Text = g.EquatorialRadius.ToString(); m_flatteningTextBox.Text = g.Flattening.ToString(); m_lc = new LocalCartesian(g); m_functionComboBox.SelectedIndex = (int)m_function; } private void OnSetEllipsoid(object sender, EventArgs e) { double a, f; try { a = Double.Parse(m_majorRadiusTextBox.Text); f = Double.Parse(m_flatteningTextBox.Text); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { m_lc = new LocalCartesian(new Geocentric(a, f)); } catch (GeographicErr err) { MessageBox.Show(err.Message, "GeographicLib error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnSetReference(object sender, EventArgs e) { double lat, lon, alt; try { lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); alt = Double.Parse(m_altitudeTextBox.Text); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } m_lc.Reset(lat, lon, alt); } private void OnConvert(object sender, EventArgs e) { try { double lat, lon, alt, x, y, z; double[,] rot = null; switch (m_function) { case Functions.Forward: lat = Double.Parse(m_latTextBox.Text); lon = Double.Parse(m_lonTextBox.Text); alt = Double.Parse(m_altTextBox.Text); m_lc.Forward(lat, lon, alt, out x, out y, out z, out rot); m_XTextBox.Text = x.ToString("0.00###"); m_YTextBox.Text = y.ToString("0.00###"); m_ZTextBox.Text = z.ToString("0.00###"); break; case Functions.Reverse: x = Double.Parse(m_XTextBox.Text); y = Double.Parse(m_YTextBox.Text); z = Double.Parse(m_ZTextBox.Text); m_lc.Reverse(x, y, z, out lat, out lon, out alt, out rot); m_latTextBox.Text = lat.ToString(); m_lonTextBox.Text = lon.ToString(); m_altTextBox.Text = alt.ToString(); break; } m_textBox00.Text = rot[0, 0].ToString("#.000000000000"); m_textBox01.Text = rot[0, 1].ToString("#.000000000000"); m_textBox02.Text = rot[0, 2].ToString("#.000000000000"); m_textBox10.Text = rot[1, 0].ToString("#.000000000000"); m_textBox11.Text = rot[1, 1].ToString("#.000000000000"); m_textBox12.Text = rot[1, 2].ToString("#.000000000000"); m_textBox20.Text = rot[2, 0].ToString("#.000000000000"); m_textBox21.Text = rot[2, 1].ToString("#.000000000000"); m_textBox22.Text = rot[2, 2].ToString("#.000000000000"); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnNewFunction(object sender, EventArgs e) { m_function = (Functions)m_functionComboBox.SelectedIndex; switch (m_function) { case Functions.Forward: m_latTextBox.ReadOnly = m_lonTextBox.ReadOnly = m_altTextBox.ReadOnly = false; m_XTextBox.ReadOnly = m_YTextBox.ReadOnly = m_ZTextBox.ReadOnly = true; break; case Functions.Reverse: m_latTextBox.ReadOnly = m_lonTextBox.ReadOnly = m_altTextBox.ReadOnly = true; m_XTextBox.ReadOnly = m_YTextBox.ReadOnly = m_ZTextBox.ReadOnly = false; break; } } private void OnValidate(object sender, EventArgs e) { try { LocalCartesian p = new LocalCartesian(); p = new LocalCartesian(new Geocentric()); p = new LocalCartesian(32.0, -86.0, 45.0); p = new LocalCartesian(32.0, -86.0, 45.0, new Geocentric()); double x, y, z, x1, y1, z1; double[,] rot; p.Forward(32.0, -86.0, 45.0, out x, out y, out z, out rot); p.Forward(32.0, -86.0, 45.0, out x1, out y1, out z1); if (x != x1 || y != y1 || z != z1) throw new Exception("Error in Forward"); double lat, lon, alt; p.Reverse(x, y, z, out lat, out lon, out alt, out rot); p.Reverse(x, y, z, out x1, out y1, out z1); if (lat != x1 || lon != y1 || alt != z1) throw new Exception("Error in Reverse"); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } GeographicLib-1.52/dotnet/Projections/LocalCartesianPanel.resx0000644000771000077100000001347014064202371024365 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/MagneticPanel.Designer.cs0000644000771000077100000004450014064202371024411 0ustar ckarneyckarneynamespace Projections { partial class MagneticPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.m_validateButton = new System.Windows.Forms.Button(); this.m_dateTextBox = new System.Windows.Forms.TextBox(); this.m_descriptionTextBox = new System.Windows.Forms.TextBox(); this.m_nameTextBox = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.m_magneticModelNameTextBox = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.m_timeTextBox = new System.Windows.Forms.TextBox(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_altitudeTextBox = new System.Windows.Forms.TextBox(); this.m_updateButton = new System.Windows.Forms.Button(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.m_mfXTextBox = new System.Windows.Forms.TextBox(); this.m_mfYTextBox = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.m_mfZTextBox = new System.Windows.Forms.TextBox(); this.m_mfdXTextBox = new System.Windows.Forms.TextBox(); this.m_mfdYTextBox = new System.Windows.Forms.TextBox(); this.m_mfdZTextBox = new System.Windows.Forms.TextBox(); this.m_magCircButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // m_validateButton // this.m_validateButton.Enabled = false; this.m_validateButton.Location = new System.Drawing.Point(182, 126); this.m_validateButton.Name = "m_validateButton"; this.m_validateButton.Size = new System.Drawing.Size(75, 23); this.m_validateButton.TabIndex = 37; this.m_validateButton.Text = "Validate"; this.m_validateButton.UseVisualStyleBackColor = true; this.m_validateButton.Click += new System.EventHandler(this.OnValidate); // // m_dateTextBox // this.m_dateTextBox.Location = new System.Drawing.Point(82, 100); this.m_dateTextBox.Name = "m_dateTextBox"; this.m_dateTextBox.ReadOnly = true; this.m_dateTextBox.Size = new System.Drawing.Size(299, 20); this.m_dateTextBox.TabIndex = 36; // // m_descriptionTextBox // this.m_descriptionTextBox.Location = new System.Drawing.Point(82, 73); this.m_descriptionTextBox.Name = "m_descriptionTextBox"; this.m_descriptionTextBox.ReadOnly = true; this.m_descriptionTextBox.Size = new System.Drawing.Size(299, 20); this.m_descriptionTextBox.TabIndex = 35; // // m_nameTextBox // this.m_nameTextBox.Location = new System.Drawing.Point(82, 46); this.m_nameTextBox.Name = "m_nameTextBox"; this.m_nameTextBox.ReadOnly = true; this.m_nameTextBox.Size = new System.Drawing.Size(299, 20); this.m_nameTextBox.TabIndex = 34; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(9, 104); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(30, 13); this.label4.TabIndex = 33; this.label4.Text = "Date"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(9, 77); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(60, 13); this.label3.TabIndex = 32; this.label3.Text = "Description"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(9, 50); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(35, 13); this.label2.TabIndex = 31; this.label2.Text = "Name"; // // button1 // this.button1.Location = new System.Drawing.Point(388, 19); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(29, 23); this.button1.TabIndex = 30; this.button1.Text = "..."; this.toolTip1.SetToolTip(this.button1, "Select gravity model file"); this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnSelectMagneticModel); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(9, 4); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(83, 13); this.label1.TabIndex = 29; this.label1.Text = "Magnetic Model"; // // m_magneticModelNameTextBox // this.m_magneticModelNameTextBox.Location = new System.Drawing.Point(9, 20); this.m_magneticModelNameTextBox.Name = "m_magneticModelNameTextBox"; this.m_magneticModelNameTextBox.Size = new System.Drawing.Size(377, 20); this.m_magneticModelNameTextBox.TabIndex = 28; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(429, 8); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(64, 13); this.label5.TabIndex = 38; this.label5.Text = "Time (years)"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(429, 34); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(101, 13); this.label6.TabIndex = 39; this.label6.Text = "Longitude (degrees)"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(429, 60); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(92, 13); this.label7.TabIndex = 40; this.label7.Text = "Latitude (degrees)"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(429, 86); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(82, 13); this.label8.TabIndex = 41; this.label8.Text = "Altitude (meters)"; // // m_timeTextBox // this.m_timeTextBox.Location = new System.Drawing.Point(544, 4); this.m_timeTextBox.Name = "m_timeTextBox"; this.m_timeTextBox.Size = new System.Drawing.Size(118, 20); this.m_timeTextBox.TabIndex = 42; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(544, 30); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(118, 20); this.m_longitudeTextBox.TabIndex = 43; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(544, 56); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(118, 20); this.m_latitudeTextBox.TabIndex = 44; // // m_altitudeTextBox // this.m_altitudeTextBox.Location = new System.Drawing.Point(544, 82); this.m_altitudeTextBox.Name = "m_altitudeTextBox"; this.m_altitudeTextBox.Size = new System.Drawing.Size(118, 20); this.m_altitudeTextBox.TabIndex = 45; // // m_updateButton // this.m_updateButton.Enabled = false; this.m_updateButton.Location = new System.Drawing.Point(566, 108); this.m_updateButton.Name = "m_updateButton"; this.m_updateButton.Size = new System.Drawing.Size(75, 23); this.m_updateButton.TabIndex = 46; this.m_updateButton.Text = "Update"; this.m_updateButton.UseVisualStyleBackColor = true; this.m_updateButton.Click += new System.EventHandler(this.OnUpdate); // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(709, 8); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(76, 13); this.label9.TabIndex = 47; this.label9.Text = "Magnetic Field"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(814, 8); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(116, 13); this.label10.TabIndex = 48; this.label10.Text = "Magnetic Field Change"; // // m_mfXTextBox // this.m_mfXTextBox.Location = new System.Drawing.Point(688, 30); this.m_mfXTextBox.Name = "m_mfXTextBox"; this.m_mfXTextBox.ReadOnly = true; this.m_mfXTextBox.Size = new System.Drawing.Size(118, 20); this.m_mfXTextBox.TabIndex = 49; // // m_mfYTextBox // this.m_mfYTextBox.Location = new System.Drawing.Point(688, 56); this.m_mfYTextBox.Name = "m_mfYTextBox"; this.m_mfYTextBox.ReadOnly = true; this.m_mfYTextBox.Size = new System.Drawing.Size(118, 20); this.m_mfYTextBox.TabIndex = 50; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(668, 34); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(14, 13); this.label11.TabIndex = 51; this.label11.Text = "X"; // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(668, 60); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(14, 13); this.label12.TabIndex = 52; this.label12.Text = "Y"; // // label13 // this.label13.AutoSize = true; this.label13.Location = new System.Drawing.Point(668, 86); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(14, 13); this.label13.TabIndex = 53; this.label13.Text = "Z"; // // m_mfZTextBox // this.m_mfZTextBox.Location = new System.Drawing.Point(688, 82); this.m_mfZTextBox.Name = "m_mfZTextBox"; this.m_mfZTextBox.ReadOnly = true; this.m_mfZTextBox.Size = new System.Drawing.Size(118, 20); this.m_mfZTextBox.TabIndex = 54; // // m_mfdXTextBox // this.m_mfdXTextBox.Location = new System.Drawing.Point(813, 30); this.m_mfdXTextBox.Name = "m_mfdXTextBox"; this.m_mfdXTextBox.ReadOnly = true; this.m_mfdXTextBox.Size = new System.Drawing.Size(118, 20); this.m_mfdXTextBox.TabIndex = 55; // // m_mfdYTextBox // this.m_mfdYTextBox.Location = new System.Drawing.Point(813, 56); this.m_mfdYTextBox.Name = "m_mfdYTextBox"; this.m_mfdYTextBox.ReadOnly = true; this.m_mfdYTextBox.Size = new System.Drawing.Size(118, 20); this.m_mfdYTextBox.TabIndex = 56; // // m_mfdZTextBox // this.m_mfdZTextBox.Location = new System.Drawing.Point(813, 82); this.m_mfdZTextBox.Name = "m_mfdZTextBox"; this.m_mfdZTextBox.ReadOnly = true; this.m_mfdZTextBox.Size = new System.Drawing.Size(118, 20); this.m_mfdZTextBox.TabIndex = 57; // // m_magCircButton // this.m_magCircButton.Enabled = false; this.m_magCircButton.Location = new System.Drawing.Point(712, 108); this.m_magCircButton.Name = "m_magCircButton"; this.m_magCircButton.Size = new System.Drawing.Size(197, 23); this.m_magCircButton.TabIndex = 58; this.m_magCircButton.Text = "Use MagneticCircle to update Field"; this.m_magCircButton.UseVisualStyleBackColor = true; this.m_magCircButton.Click += new System.EventHandler(this.OnMagneticCircle); // // MagneticPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.m_magCircButton); this.Controls.Add(this.m_mfdZTextBox); this.Controls.Add(this.m_mfdYTextBox); this.Controls.Add(this.m_mfdXTextBox); this.Controls.Add(this.m_mfZTextBox); this.Controls.Add(this.label13); this.Controls.Add(this.label12); this.Controls.Add(this.label11); this.Controls.Add(this.m_mfYTextBox); this.Controls.Add(this.m_mfXTextBox); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.m_updateButton); this.Controls.Add(this.m_altitudeTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.m_longitudeTextBox); this.Controls.Add(this.m_timeTextBox); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.m_validateButton); this.Controls.Add(this.m_dateTextBox); this.Controls.Add(this.m_descriptionTextBox); this.Controls.Add(this.m_nameTextBox); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.button1); this.Controls.Add(this.label1); this.Controls.Add(this.m_magneticModelNameTextBox); this.Name = "MagneticPanel"; this.Size = new System.Drawing.Size(984, 428); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Button m_validateButton; private System.Windows.Forms.TextBox m_dateTextBox; private System.Windows.Forms.TextBox m_descriptionTextBox; private System.Windows.Forms.TextBox m_nameTextBox; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox m_magneticModelNameTextBox; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.TextBox m_timeTextBox; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_altitudeTextBox; private System.Windows.Forms.Button m_updateButton; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.TextBox m_mfXTextBox; private System.Windows.Forms.TextBox m_mfYTextBox; private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; private System.Windows.Forms.TextBox m_mfZTextBox; private System.Windows.Forms.TextBox m_mfdXTextBox; private System.Windows.Forms.TextBox m_mfdYTextBox; private System.Windows.Forms.TextBox m_mfdZTextBox; private System.Windows.Forms.Button m_magCircButton; } } GeographicLib-1.52/dotnet/Projections/MagneticPanel.cs0000644000771000077100000001331714064202371022654 0ustar ckarneyckarney/** * \file NETGeographicLib\MagneticPanel.cs * \brief NETGeographicLib.MagneticModel example * * NETGeographicLib.MagneticModel and * NETGeographicLib.MagneticCircle example. * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class MagneticPanel : UserControl { string m_path, m_name; MagneticModel m_magnetic = null; public MagneticPanel() { InitializeComponent(); } private void OnSelectMagneticModel(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Magnetic Model (*.wmm)|*.wmm"; dlg.DefaultExt = "wmm"; if (dlg.ShowDialog() == DialogResult.Cancel) return; m_path = dlg.FileName.Substring(0, dlg.FileName.LastIndexOf('\\')).Replace('\\', '/'); int length = dlg.FileName.LastIndexOf('.') - dlg.FileName.LastIndexOf('\\') - 1; m_name = dlg.FileName.Substring(dlg.FileName.LastIndexOf('\\') + 1, length); try { m_magnetic = new MagneticModel(m_name, m_path); m_magneticModelNameTextBox.Text = dlg.FileName; m_nameTextBox.Text = m_magnetic.MagneticModelName; m_descriptionTextBox.Text = m_magnetic.Description; m_dateTextBox.Text = m_magnetic.DateTime; m_updateButton.Enabled = true; m_magCircButton.Enabled = true; m_validateButton.Enabled = true; } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnUpdate(object sender, EventArgs e) { try { double time = Double.Parse(m_timeTextBox.Text); double lon = Double.Parse(m_longitudeTextBox.Text); double lat = Double.Parse(m_latitudeTextBox.Text); double alt = Double.Parse(m_altitudeTextBox.Text); double bx, by, bz, bxt, byt, bzt; m_magnetic.Field(time, lat, lon, alt, out bx, out by, out bz, out bxt, out byt, out bzt); m_mfXTextBox.Text = bx.ToString(); m_mfYTextBox.Text = by.ToString(); m_mfZTextBox.Text = bz.ToString(); m_mfdXTextBox.Text = bxt.ToString(); m_mfdYTextBox.Text = byt.ToString(); m_mfdZTextBox.Text = bzt.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnMagneticCircle(object sender, EventArgs e) { try { double time = Double.Parse(m_timeTextBox.Text); double lon = Double.Parse(m_longitudeTextBox.Text); double lat = Double.Parse(m_latitudeTextBox.Text); double alt = Double.Parse(m_altitudeTextBox.Text); double bx, by, bz, bxt, byt, bzt; MagneticCircle mc = m_magnetic.Circle(time, lat, alt); mc.Field(lon, out bx, out by, out bz, out bxt, out byt, out bzt); m_mfXTextBox.Text = bx.ToString(); m_mfYTextBox.Text = by.ToString(); m_mfZTextBox.Text = bz.ToString(); m_mfdXTextBox.Text = bxt.ToString(); m_mfdYTextBox.Text = byt.ToString(); m_mfdZTextBox.Text = bzt.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnValidate(object sender, EventArgs e) { try { double bx, by, bz, bxt, byt, bzt, x, y, z; double time = 1.0; double lon = -86.0; double lat = 32.0; double alt = 30.0; MagneticModel mag = new MagneticModel(m_name, m_path, new Geocentric()); mag = new MagneticModel(m_name, m_path); mag.Field(time, lat, lon, alt, out bx, out by, out bz, out bxt, out byt, out bzt); mag.Field(time, lat, lon, alt, out x, out y, out z); if (bx != x || by != y || bz != z) throw new Exception("Error in MagneticField.Field"); MagneticCircle mc = mag.Circle(time, lat, alt); mc.Field(lon, out bx, out by, out bz); mc.Field(lon, out x, out y, out z, out bxt, out byt, out bzt); if (bx != x || by != y || bz != z ) throw new Exception("Error in MagneticCircle.Field (2)"); double dtest = Utility.FractionalYear("2015.34"); dtest = Utility.FractionalYear("2015-07-31"); MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } GeographicLib-1.52/dotnet/Projections/MagneticPanel.resx0000644000771000077100000001346714064202371023236 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/MiscPanel.Designer.cs0000644000771000077100000002250114064202371023552 0ustar ckarneyckarneynamespace Projections { partial class MiscPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.m_toolTip = new System.Windows.Forms.ToolTip(this.components); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.m_longitudeDMSTextBox = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.m_latitudeDMSTextBox = new System.Windows.Forms.TextBox(); this.m_LongitudeTextBox = new System.Windows.Forms.TextBox(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_geohashTextBox = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.m_comboBox = new System.Windows.Forms.ComboBox(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(13, 33); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(54, 13); this.label1.TabIndex = 0; this.label1.Text = "Longitude"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(120, 4); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(31, 13); this.label2.TabIndex = 1; this.label2.Text = "DMS"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(229, 4); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(88, 13); this.label3.TabIndex = 2; this.label3.Text = "Decimal Degrees"; // // m_longitudeDMSTextBox // this.m_longitudeDMSTextBox.Location = new System.Drawing.Point(86, 29); this.m_longitudeDMSTextBox.Name = "m_longitudeDMSTextBox"; this.m_longitudeDMSTextBox.Size = new System.Drawing.Size(100, 20); this.m_longitudeDMSTextBox.TabIndex = 3; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(13, 63); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(45, 13); this.label4.TabIndex = 4; this.label4.Text = "Latitude"; // // m_latitudeDMSTextBox // this.m_latitudeDMSTextBox.Location = new System.Drawing.Point(86, 56); this.m_latitudeDMSTextBox.Name = "m_latitudeDMSTextBox"; this.m_latitudeDMSTextBox.Size = new System.Drawing.Size(100, 20); this.m_latitudeDMSTextBox.TabIndex = 5; // // m_LongitudeTextBox // this.m_LongitudeTextBox.Location = new System.Drawing.Point(203, 29); this.m_LongitudeTextBox.Name = "m_LongitudeTextBox"; this.m_LongitudeTextBox.Size = new System.Drawing.Size(137, 20); this.m_LongitudeTextBox.TabIndex = 6; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(203, 55); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(137, 20); this.m_latitudeTextBox.TabIndex = 7; // // m_geohashTextBox // this.m_geohashTextBox.Location = new System.Drawing.Point(360, 43); this.m_geohashTextBox.Name = "m_geohashTextBox"; this.m_geohashTextBox.Size = new System.Drawing.Size(155, 20); this.m_geohashTextBox.TabIndex = 8; // // button1 // this.button1.Location = new System.Drawing.Point(96, 83); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 10; this.button1.Text = "Convert ->"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnConvertDMS); // // button2 // this.button2.Location = new System.Drawing.Point(229, 83); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(85, 23); this.button2.TabIndex = 11; this.button2.Text = "<- Convert ->"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnConvert); // // button3 // this.button3.Location = new System.Drawing.Point(400, 83); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 12; this.button3.Text = "<- Convert"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.OnConvertGeohash); // // button4 // this.button4.Location = new System.Drawing.Point(541, 4); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(75, 23); this.button4.TabIndex = 13; this.button4.Text = "Validate"; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.OnValidate); // // m_comboBox // this.m_comboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_comboBox.FormattingEnabled = true; this.m_comboBox.Items.AddRange(new object[] { "Geohash", "GARS", "Georef"}); this.m_comboBox.Location = new System.Drawing.Point(376, 4); this.m_comboBox.Name = "m_comboBox"; this.m_comboBox.Size = new System.Drawing.Size(121, 21); this.m_comboBox.TabIndex = 14; this.m_toolTip.SetToolTip(this.m_comboBox, "Select the reference system"); // // MiscPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.m_comboBox); this.Controls.Add(this.button4); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.m_geohashTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.m_LongitudeTextBox); this.Controls.Add(this.m_latitudeDMSTextBox); this.Controls.Add(this.label4); this.Controls.Add(this.m_longitudeDMSTextBox); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "MiscPanel"; this.Size = new System.Drawing.Size(977, 389); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.ToolTip m_toolTip; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox m_longitudeDMSTextBox; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox m_latitudeDMSTextBox; private System.Windows.Forms.TextBox m_LongitudeTextBox; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_geohashTextBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.ComboBox m_comboBox; } } GeographicLib-1.52/dotnet/Projections/MiscPanel.cs0000644000771000077100000001312014064202371022010 0ustar ckarneyckarney/** * \file NETGeographicLib\MiscPanel.cs * \brief NETGeographicLib.DMS and NETGeographicLib.Geohash example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class MiscPanel : UserControl { public MiscPanel() { InitializeComponent(); m_comboBox.SelectedIndex = 0; } private void OnConvertDMS(object sender, EventArgs e) { try { DMS.Flag ind; double lon = DMS.Decode(m_longitudeDMSTextBox.Text, out ind); m_LongitudeTextBox.Text = lon.ToString(); double lat = DMS.Decode(m_latitudeDMSTextBox.Text, out ind); m_latitudeTextBox.Text = lat.ToString(); string tmp = ""; Geohash.Forward(lat, lon, 12, out tmp); m_geohashTextBox.Text = tmp; } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnConvert(object sender, EventArgs e) { try { double lon = Double.Parse(m_LongitudeTextBox.Text); double lat = Double.Parse(m_latitudeTextBox.Text); m_longitudeDMSTextBox.Text = DMS.Encode(lon, 5, DMS.Flag.LONGITUDE, 0); m_latitudeDMSTextBox.Text = DMS.Encode(lat, 5, DMS.Flag.LATITUDE, 0); string tmp = ""; switch (m_comboBox.SelectedIndex) { case 0: // Geohash Geohash.Forward(lat, lon, 12, out tmp); break; case 1: // GARS GARS.Forward(lat, lon, 2, out tmp); break; case 2: // Georef Georef.Forward(lat, lon, 2, out tmp); break; } m_geohashTextBox.Text = tmp; } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnConvertGeohash(object sender, EventArgs e) { try { double lat = 0.0, lon = 0.0; int len; switch (m_comboBox.SelectedIndex) { case 0: // Geohash Geohash.Reverse(m_geohashTextBox.Text, out lat, out lon, out len, true); break; case 1: // GARS GARS.Reverse(m_geohashTextBox.Text, out lat, out lon, out len, true); break; case 2: // Georef Georef.Reverse(m_geohashTextBox.Text, out lat, out lon, out len, true); break; } m_LongitudeTextBox.Text = lon.ToString(); m_latitudeTextBox.Text = lat.ToString(); m_longitudeDMSTextBox.Text = DMS.Encode(lon, 5, DMS.Flag.LONGITUDE, 0); m_latitudeDMSTextBox.Text = DMS.Encode(lat, 5, DMS.Flag.LATITUDE, 0); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnValidate(object sender, EventArgs e) { try { double lat, lon, d, m, s; DMS.Flag ind; int len; string tmp; DMS.Decode("34d22\'34.567\"", out ind); DMS.Decode(-86.0, 32.0, 34.214); DMS.DecodeAngle("-67.4532"); DMS.DecodeAzimuth("85.3245W"); DMS.DecodeLatLon("86d34\'24.5621\"", "21d56\'32.1234\"", out lat, out lon, false); DMS.Encode(-86.453214, out d, out m); DMS.Encode(-86.453214, out d, out m, out s); DMS.Encode(-86.453214, DMS.Component.SECOND, 12, DMS.Flag.LONGITUDE, 0); DMS.Encode(-86.453214, 12, DMS.Flag.LONGITUDE, 0); Geohash.DecimalPrecision(12); Geohash.Forward(31.23456, -86.43678, 12, out tmp); Geohash.GeohashLength(0.001); Geohash.GeohashLength(0.002, 0.003); Geohash.LatitudeResolution(12); Geohash.LongitudeResolution(12); Geohash.Reverse("djds54mrfc0g", out lat, out lon, out len, true); GARS.Forward(32.0, -86.0, 2, out tmp); GARS.Reverse("189LE37", out lat, out lon, out len, true); Georef.Forward(32.0, -86.0, 2, out tmp); Georef.Reverse("GJEC0000", out lat, out lon, out len, true); MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } GeographicLib-1.52/dotnet/Projections/MiscPanel.resx0000644000771000077100000001347014064202371022374 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/PolarStereoPanel.Designer.cs0000644000771000077100000003715114064202371025125 0ustar ckarneyckarneynamespace Projections { partial class PolarStereoPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_setButton = new System.Windows.Forms.Button(); this.m_flatteningTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.m_equatorialRadiusTextBox = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.m_scaleTextBox = new System.Windows.Forms.TextBox(); this.m_toolTip = new System.Windows.Forms.ToolTip(this.components); this.m_northPoleCheckBox = new System.Windows.Forms.CheckBox(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.m_xTextBox = new System.Windows.Forms.TextBox(); this.m_yTextBox = new System.Windows.Forms.TextBox(); this.m_gammaTextBox = new System.Windows.Forms.TextBox(); this.m_kTextBox = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); this.m_functionComboBox = new System.Windows.Forms.ComboBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.m_scaleTextBox); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.m_setButton); this.groupBox1.Controls.Add(this.m_flatteningTextBox); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.m_equatorialRadiusTextBox); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(146, 184); this.groupBox1.TabIndex = 20; this.groupBox1.TabStop = false; this.groupBox1.Text = "Ellipsoid Parameters"; // // m_setButton // this.m_setButton.Location = new System.Drawing.Point(15, 153); this.m_setButton.Name = "m_setButton"; this.m_setButton.Size = new System.Drawing.Size(75, 23); this.m_setButton.TabIndex = 4; this.m_setButton.Text = "Set"; this.m_toolTip.SetToolTip(this.m_setButton, "Sets parameters"); this.m_setButton.UseVisualStyleBackColor = true; this.m_setButton.Click += new System.EventHandler(this.OnSet); // // m_flatteningTextBox // this.m_flatteningTextBox.Location = new System.Drawing.Point(12, 83); this.m_flatteningTextBox.Name = "m_flatteningTextBox"; this.m_flatteningTextBox.Size = new System.Drawing.Size(125, 20); this.m_flatteningTextBox.TabIndex = 3; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(109, 13); this.label1.TabIndex = 0; this.label1.Text = "Equatorial Radius (meters)"; // // m_equatorialRadiusTextBox // this.m_equatorialRadiusTextBox.Location = new System.Drawing.Point(12, 42); this.m_equatorialRadiusTextBox.Name = "m_equatorialRadiusTextBox"; this.m_equatorialRadiusTextBox.Size = new System.Drawing.Size(125, 20); this.m_equatorialRadiusTextBox.TabIndex = 2; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 66); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 13); this.label2.TabIndex = 1; this.label2.Text = "Flattening"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(12, 110); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(103, 13); this.label3.TabIndex = 5; this.label3.Text = "Central Scale Factor"; // // m_scaleTextBox // this.m_scaleTextBox.Location = new System.Drawing.Point(12, 127); this.m_scaleTextBox.Name = "m_scaleTextBox"; this.m_scaleTextBox.Size = new System.Drawing.Size(125, 20); this.m_scaleTextBox.TabIndex = 6; // // m_northPoleCheckBox // this.m_northPoleCheckBox.AutoSize = true; this.m_northPoleCheckBox.Checked = true; this.m_northPoleCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.m_northPoleCheckBox.Location = new System.Drawing.Point(161, 4); this.m_northPoleCheckBox.Name = "m_northPoleCheckBox"; this.m_northPoleCheckBox.Size = new System.Drawing.Size(76, 17); this.m_northPoleCheckBox.TabIndex = 21; this.m_northPoleCheckBox.Text = "North Pole"; this.m_toolTip.SetToolTip(this.m_northPoleCheckBox, "checked = Noth Pole, uncheck = South Pole"); this.m_northPoleCheckBox.UseVisualStyleBackColor = true; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(161, 28); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(92, 13); this.label4.TabIndex = 22; this.label4.Text = "Latitude (degrees)"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(161, 55); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(101, 13); this.label5.TabIndex = 23; this.label5.Text = "Longitude (degrees)"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(161, 81); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(54, 13); this.label6.TabIndex = 24; this.label6.Text = "X (meters)"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(161, 107); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(54, 13); this.label7.TabIndex = 25; this.label7.Text = "Y (meters)"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(161, 133); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(90, 13); this.label8.TabIndex = 26; this.label8.Text = "Gamma (degrees)"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(161, 159); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(34, 13); this.label9.TabIndex = 27; this.label9.Text = "Scale"; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(274, 25); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(120, 20); this.m_latitudeTextBox.TabIndex = 28; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(274, 51); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(120, 20); this.m_longitudeTextBox.TabIndex = 29; // // m_xTextBox // this.m_xTextBox.Location = new System.Drawing.Point(274, 77); this.m_xTextBox.Name = "m_xTextBox"; this.m_xTextBox.Size = new System.Drawing.Size(120, 20); this.m_xTextBox.TabIndex = 30; // // m_yTextBox // this.m_yTextBox.Location = new System.Drawing.Point(274, 103); this.m_yTextBox.Name = "m_yTextBox"; this.m_yTextBox.Size = new System.Drawing.Size(120, 20); this.m_yTextBox.TabIndex = 31; // // m_gammaTextBox // this.m_gammaTextBox.Location = new System.Drawing.Point(274, 129); this.m_gammaTextBox.Name = "m_gammaTextBox"; this.m_gammaTextBox.ReadOnly = true; this.m_gammaTextBox.Size = new System.Drawing.Size(120, 20); this.m_gammaTextBox.TabIndex = 32; // // m_kTextBox // this.m_kTextBox.Location = new System.Drawing.Point(274, 155); this.m_kTextBox.Name = "m_kTextBox"; this.m_kTextBox.ReadOnly = true; this.m_kTextBox.Size = new System.Drawing.Size(120, 20); this.m_kTextBox.TabIndex = 33; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(411, 4); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(48, 13); this.label10.TabIndex = 34; this.label10.Text = "Function"; // // m_functionComboBox // this.m_functionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_functionComboBox.FormattingEnabled = true; this.m_functionComboBox.Items.AddRange(new object[] { "Forward", "Reverse"}); this.m_functionComboBox.Location = new System.Drawing.Point(414, 25); this.m_functionComboBox.Name = "m_functionComboBox"; this.m_functionComboBox.Size = new System.Drawing.Size(75, 21); this.m_functionComboBox.TabIndex = 35; this.m_functionComboBox.SelectedIndexChanged += new System.EventHandler(this.OnFunction); // // button1 // this.button1.Location = new System.Drawing.Point(414, 53); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 36; this.button1.Text = "Convert"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnConvert); // // button2 // this.button2.Location = new System.Drawing.Point(414, 155); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 37; this.button2.Text = "Validate"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnValidate); // // PolarStereoPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.m_functionComboBox); this.Controls.Add(this.label10); this.Controls.Add(this.m_kTextBox); this.Controls.Add(this.m_gammaTextBox); this.Controls.Add(this.m_yTextBox); this.Controls.Add(this.m_xTextBox); this.Controls.Add(this.m_longitudeTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.m_northPoleCheckBox); this.Controls.Add(this.groupBox1); this.Name = "PolarStereoPanel"; this.Size = new System.Drawing.Size(779, 299); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button m_setButton; private System.Windows.Forms.TextBox m_flatteningTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox m_equatorialRadiusTextBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox m_scaleTextBox; private System.Windows.Forms.Label label3; private System.Windows.Forms.ToolTip m_toolTip; private System.Windows.Forms.CheckBox m_northPoleCheckBox; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.TextBox m_xTextBox; private System.Windows.Forms.TextBox m_yTextBox; private System.Windows.Forms.TextBox m_gammaTextBox; private System.Windows.Forms.TextBox m_kTextBox; private System.Windows.Forms.Label label10; private System.Windows.Forms.ComboBox m_functionComboBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; } } GeographicLib-1.52/dotnet/Projections/PolarStereoPanel.cs0000644000771000077100000001174214064202371023364 0ustar ckarneyckarney/** * \file NETGeographicLib\PolarStereoPanel.cs * \brief NETGeographicLib.PolarStereographic example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class PolarStereoPanel : UserControl { PolarStereographic m_polar = null; public PolarStereoPanel() { InitializeComponent(); try { m_polar = new PolarStereographic(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } m_majorRadiusTextBox.Text = m_polar.EquatorialRadius.ToString(); m_flatteningTextBox.Text = m_polar.Flattening.ToString(); m_scaleTextBox.Text = m_polar.CentralScale.ToString(); m_functionComboBox.SelectedIndex = 0; } private void OnSet(object sender, EventArgs e) { try { double a = Double.Parse(m_majorRadiusTextBox.Text); double f = Double.Parse(m_flatteningTextBox.Text); double k = Double.Parse(m_scaleTextBox.Text); m_polar = new PolarStereographic(a, f, k); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnFunction(object sender, EventArgs e) { switch (m_functionComboBox.SelectedIndex) { case 0: m_latitudeTextBox.ReadOnly = m_longitudeTextBox.ReadOnly = false; m_xTextBox.ReadOnly = m_yTextBox.ReadOnly = true; break; case 1: m_latitudeTextBox.ReadOnly = m_longitudeTextBox.ReadOnly = true; m_xTextBox.ReadOnly = m_yTextBox.ReadOnly = false; break; } } private void OnConvert(object sender, EventArgs e) { try { double lat = 0.0, lon = 0.0, x = 0.0, y = 0.0, gamma = 0.0, k = 0.0; switch (m_functionComboBox.SelectedIndex) { case 0: lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); m_polar.Forward(m_northPoleCheckBox.Checked, lat, lon, out x, out y, out gamma, out k); m_xTextBox.Text = x.ToString(); m_yTextBox.Text = y.ToString(); break; case 1: x = Double.Parse(m_xTextBox.Text); y = Double.Parse(m_yTextBox.Text); m_polar.Reverse(m_northPoleCheckBox.Checked, x, y, out lat, out lon, out gamma, out k); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); break; } m_gammaTextBox.Text = gamma.ToString(); m_kTextBox.Text = k.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnValidate(object sender, EventArgs e) { try { double lat, lon, x, y, x1, y1, gamma, k; PolarStereographic p = new PolarStereographic(m_polar.EquatorialRadius, m_polar.Flattening, m_polar.CentralScale); p.SetScale(60.0, 1.0); p = new PolarStereographic(); p.Forward(true, 32.0, -86.0, out x, out y, out gamma, out k); p.Forward(true, 32.0, -86.0, out x1, out y1); if (x != x1 || y != y1) throw new Exception("Error in Forward"); p.Reverse(true, x, y, out lat, out lon, out gamma, out k); p.Reverse(true, x, y, out x1, out y1); if ( lat != x1 || lon != y1 ) throw new Exception("Error in Reverse"); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("No errors detected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } GeographicLib-1.52/dotnet/Projections/PolarStereoPanel.resx0000644000771000077100000001377514064202371023750 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 17, 17 GeographicLib-1.52/dotnet/Projections/PolyPanel.Designer.cs0000644000771000077100000004253314064202371023611 0ustar ckarneyckarneynamespace Projections { partial class PolyPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_setButton = new System.Windows.Forms.Button(); this.m_flatteningTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.m_equatorialRadiusTextBox = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.m_azimuthTextBox = new System.Windows.Forms.TextBox(); this.m_distanceTextBox = new System.Windows.Forms.TextBox(); this.m_edgeButton = new System.Windows.Forms.Button(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.m_numPointsTextBox = new System.Windows.Forms.TextBox(); this.m_currLatTextBox = new System.Windows.Forms.TextBox(); this.m_currLonTextBox = new System.Windows.Forms.TextBox(); this.m_lengthTextBox = new System.Windows.Forms.TextBox(); this.m_areaTextBox = new System.Windows.Forms.TextBox(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.m_polylineCheckBox = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.m_polylineCheckBox); this.groupBox1.Controls.Add(this.m_setButton); this.groupBox1.Controls.Add(this.m_flatteningTextBox); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.m_equatorialRadiusTextBox); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(146, 169); this.groupBox1.TabIndex = 6; this.groupBox1.TabStop = false; this.groupBox1.Text = "Ellipsoid Parameters"; // // m_setButton // this.m_setButton.Location = new System.Drawing.Point(30, 135); this.m_setButton.Name = "m_setButton"; this.m_setButton.Size = new System.Drawing.Size(75, 23); this.m_setButton.TabIndex = 4; this.m_setButton.Text = "Set"; this.m_setButton.UseVisualStyleBackColor = true; this.m_setButton.Click += new System.EventHandler(this.OnSet); // // m_flatteningTextBox // this.m_flatteningTextBox.Location = new System.Drawing.Point(12, 83); this.m_flatteningTextBox.Name = "m_flatteningTextBox"; this.m_flatteningTextBox.Size = new System.Drawing.Size(125, 20); this.m_flatteningTextBox.TabIndex = 3; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(109, 13); this.label1.TabIndex = 0; this.label1.Text = "Equatorial Radius (meters)"; // // m_equatorialRadiusTextBox // this.m_equatorialRadiusTextBox.Location = new System.Drawing.Point(12, 42); this.m_equatorialRadiusTextBox.Name = "m_equatorialRadiusTextBox"; this.m_equatorialRadiusTextBox.Size = new System.Drawing.Size(125, 20); this.m_equatorialRadiusTextBox.TabIndex = 2; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 66); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 13); this.label2.TabIndex = 1; this.label2.Text = "Flattening"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(154, 10); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(92, 13); this.label3.TabIndex = 7; this.label3.Text = "Latitude (degrees)"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(154, 36); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(101, 13); this.label4.TabIndex = 8; this.label4.Text = "Longitude (degrees)"; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(263, 6); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(127, 20); this.m_latitudeTextBox.TabIndex = 9; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(263, 32); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(127, 20); this.m_longitudeTextBox.TabIndex = 10; // // button1 // this.button1.Location = new System.Drawing.Point(289, 60); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 11; this.button1.Text = "Add Point"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnAddPoint); // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(400, 8); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(91, 13); this.label5.TabIndex = 12; this.label5.Text = "Azimuth (degrees)"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(400, 34); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(89, 13); this.label6.TabIndex = 13; this.label6.Text = "Distance (meters)"; // // m_azimuthTextBox // this.m_azimuthTextBox.Location = new System.Drawing.Point(495, 4); this.m_azimuthTextBox.Name = "m_azimuthTextBox"; this.m_azimuthTextBox.Size = new System.Drawing.Size(127, 20); this.m_azimuthTextBox.TabIndex = 14; // // m_distanceTextBox // this.m_distanceTextBox.Location = new System.Drawing.Point(495, 30); this.m_distanceTextBox.Name = "m_distanceTextBox"; this.m_distanceTextBox.Size = new System.Drawing.Size(127, 20); this.m_distanceTextBox.TabIndex = 15; // // m_edgeButton // this.m_edgeButton.Enabled = false; this.m_edgeButton.Location = new System.Drawing.Point(515, 58); this.m_edgeButton.Name = "m_edgeButton"; this.m_edgeButton.Size = new System.Drawing.Size(75, 23); this.m_edgeButton.TabIndex = 16; this.m_edgeButton.Text = "Add Edge"; this.m_edgeButton.UseVisualStyleBackColor = true; this.m_edgeButton.Click += new System.EventHandler(this.OnAddEdge); // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(634, 8); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(87, 13); this.label7.TabIndex = 17; this.label7.Text = "Number of points"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(634, 34); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(82, 13); this.label8.TabIndex = 18; this.label8.Text = "Current Latitude"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(634, 61); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(91, 13); this.label9.TabIndex = 19; this.label9.Text = "Current Longitude"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(634, 89); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(40, 13); this.label10.TabIndex = 20; this.label10.Text = "Length"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(634, 116); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(29, 13); this.label11.TabIndex = 21; this.label11.Text = "Area"; // // m_numPointsTextBox // this.m_numPointsTextBox.Location = new System.Drawing.Point(729, 4); this.m_numPointsTextBox.Name = "m_numPointsTextBox"; this.m_numPointsTextBox.ReadOnly = true; this.m_numPointsTextBox.Size = new System.Drawing.Size(127, 20); this.m_numPointsTextBox.TabIndex = 22; this.m_numPointsTextBox.Text = "0"; // // m_currLatTextBox // this.m_currLatTextBox.Location = new System.Drawing.Point(729, 30); this.m_currLatTextBox.Name = "m_currLatTextBox"; this.m_currLatTextBox.ReadOnly = true; this.m_currLatTextBox.Size = new System.Drawing.Size(127, 20); this.m_currLatTextBox.TabIndex = 23; // // m_currLonTextBox // this.m_currLonTextBox.Location = new System.Drawing.Point(729, 57); this.m_currLonTextBox.Name = "m_currLonTextBox"; this.m_currLonTextBox.ReadOnly = true; this.m_currLonTextBox.Size = new System.Drawing.Size(127, 20); this.m_currLonTextBox.TabIndex = 24; // // m_lengthTextBox // this.m_lengthTextBox.Location = new System.Drawing.Point(729, 85); this.m_lengthTextBox.Name = "m_lengthTextBox"; this.m_lengthTextBox.ReadOnly = true; this.m_lengthTextBox.Size = new System.Drawing.Size(127, 20); this.m_lengthTextBox.TabIndex = 25; // // m_areaTextBox // this.m_areaTextBox.Location = new System.Drawing.Point(729, 112); this.m_areaTextBox.Name = "m_areaTextBox"; this.m_areaTextBox.ReadOnly = true; this.m_areaTextBox.Size = new System.Drawing.Size(127, 20); this.m_areaTextBox.TabIndex = 26; // // button2 // this.button2.Location = new System.Drawing.Point(405, 84); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 27; this.button2.Text = "Clear"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnClear); // // button3 // this.button3.Location = new System.Drawing.Point(405, 109); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 28; this.button3.Text = "Validate"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.OnValidate); // // m_polylineCheckBox // this.m_polylineCheckBox.AutoSize = true; this.m_polylineCheckBox.Location = new System.Drawing.Point(15, 112); this.m_polylineCheckBox.Name = "m_polylineCheckBox"; this.m_polylineCheckBox.Size = new System.Drawing.Size(62, 17); this.m_polylineCheckBox.TabIndex = 29; this.m_polylineCheckBox.Text = "Polyline"; this.m_polylineCheckBox.UseVisualStyleBackColor = true; // // PolyPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.m_areaTextBox); this.Controls.Add(this.m_lengthTextBox); this.Controls.Add(this.m_currLonTextBox); this.Controls.Add(this.m_currLatTextBox); this.Controls.Add(this.m_numPointsTextBox); this.Controls.Add(this.label11); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.m_edgeButton); this.Controls.Add(this.m_distanceTextBox); this.Controls.Add(this.m_azimuthTextBox); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.button1); this.Controls.Add(this.m_longitudeTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.groupBox1); this.Name = "PolyPanel"; this.Size = new System.Drawing.Size(979, 359); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button m_setButton; private System.Windows.Forms.TextBox m_flatteningTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox m_equatorialRadiusTextBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox m_azimuthTextBox; private System.Windows.Forms.TextBox m_distanceTextBox; private System.Windows.Forms.Button m_edgeButton; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox m_numPointsTextBox; private System.Windows.Forms.TextBox m_currLatTextBox; private System.Windows.Forms.TextBox m_currLonTextBox; private System.Windows.Forms.TextBox m_lengthTextBox; private System.Windows.Forms.TextBox m_areaTextBox; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.CheckBox m_polylineCheckBox; } } GeographicLib-1.52/dotnet/Projections/PolyPanel.cs0000644000771000077100000001364014064202371022047 0ustar ckarneyckarney/** * \file NETGeographicLib\PolyPanel.cs * \brief NETGeographicLib.PolygonArea example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class PolyPanel : UserControl { PolygonArea m_poly = null; public PolyPanel() { InitializeComponent(); m_poly = new PolygonArea(false); m_majorRadiusTextBox.Text = m_poly.EquatorialRadius.ToString(); m_flatteningTextBox.Text = m_poly.Flattening.ToString(); m_lengthTextBox.Text = m_areaTextBox.Text = m_numPointsTextBox.Text = "0"; m_currLatTextBox.Text = m_currLonTextBox.Text = ""; } private void OnSet(object sender, EventArgs e) { try { double a = Double.Parse(m_majorRadiusTextBox.Text); double f = Double.Parse(m_flatteningTextBox.Text); m_poly = new PolygonArea(new Geodesic(a, f), m_polylineCheckBox.Checked); m_lengthTextBox.Text = m_areaTextBox.Text = m_numPointsTextBox.Text = "0"; m_currLatTextBox.Text = m_currLonTextBox.Text = ""; m_edgeButton.Enabled = false; } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnAddPoint(object sender, EventArgs e) { try { double lat = Double.Parse(m_latitudeTextBox.Text); double lon = Double.Parse(m_longitudeTextBox.Text); double length, area; m_poly.AddPoint(lat, lon); m_edgeButton.Enabled = true; m_currLatTextBox.Text = m_latitudeTextBox.Text; m_currLonTextBox.Text = m_longitudeTextBox.Text; m_numPointsTextBox.Text = m_poly.Compute(false, false, out length, out area).ToString(); m_lengthTextBox.Text = length.ToString(); if ( !m_polylineCheckBox.Checked ) m_areaTextBox.Text = area.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnAddEdge(object sender, EventArgs e) { try { double azi = Double.Parse(m_azimuthTextBox.Text); double dist = Double.Parse(m_distanceTextBox.Text); m_poly.AddEdge(azi, dist); double lat, lon, length, area; m_poly.CurrentPoint(out lat, out lon); m_currLatTextBox.Text = lat.ToString(); m_currLonTextBox.Text = lon.ToString(); m_numPointsTextBox.Text = m_poly.Compute(false, false, out length, out area).ToString(); m_lengthTextBox.Text = length.ToString(); if (!m_polylineCheckBox.Checked) m_areaTextBox.Text = area.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnClear(object sender, EventArgs e) { m_poly.Clear(); m_edgeButton.Enabled = false; m_lengthTextBox.Text = m_areaTextBox.Text = m_numPointsTextBox.Text = "0"; m_currLatTextBox.Text = m_currLonTextBox.Text = ""; } private void OnValidate(object sender, EventArgs e) { try { double lat, lon, perim, area; PolygonArea pa = new PolygonArea(new Geodesic(50000.0, 0.001), true); pa = new PolygonArea(false); pa.AddPoint(32.0, -86.0); pa.AddEdge(20.0, 10000.0); pa.AddEdge(-45.0, 10000.0); pa.CurrentPoint(out lat, out lon); pa.Compute(false, false, out perim, out area); pa.TestEdge(-70.0, 5000.0, false, false, out perim, out area); pa.TestPoint(31.0, -86.5, false, false, out perim, out area); PolygonAreaExact p2 = new PolygonAreaExact(new GeodesicExact(), false); p2.AddPoint(32.0, -86.0); p2.AddEdge(20.0, 10000.0); p2.AddEdge(-45.0, 10000.0); p2.CurrentPoint(out lat, out lon); p2.Compute(false, false, out perim, out area); p2.TestEdge(-70.0, 5000.0, false, false, out perim, out area); p2.TestPoint(31.0, -86.5, false, false, out perim, out area); PolygonAreaRhumb p3 = new PolygonAreaRhumb(Rhumb.WGS84(), false); p3.AddPoint(32.0, -86.0); p3.AddEdge(20.0, 10000.0); p3.AddEdge(-45.0, 10000.0); p3.CurrentPoint(out lat, out lon); p3.Compute(false, false, out perim, out area); p3.TestEdge(-70.0, 5000.0, false, false, out perim, out area); p3.TestPoint(31.0, -86.5, false, false, out perim, out area); MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } GeographicLib-1.52/dotnet/Projections/PolyPanel.resx0000644000771000077100000001316314064202371022423 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 GeographicLib-1.52/dotnet/Projections/Program.cs0000644000771000077100000000157714064202371021561 0ustar ckarneyckarney/** * \file NETGeographicLib\Program.cs * \brief NETGeographicLib application example * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace Projections { static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } } GeographicLib-1.52/dotnet/Projections/Projections-vs13.csproj0000644000771000077100000002534514064202371024135 0ustar ckarneyckarney Debug x86 8.0.30703 2.0 {74B48389-E1D1-491F-B198-ADD4878C3F2B} WinExe Properties Projections Projections v4.5 512 x86 true full false $(SolutionDir)$(Configuration)\ DEBUG;TRACE prompt 4 false x64 true full false $(SolutionDir)$(Configuration)64\ DEBUG;TRACE prompt 4 false x86 pdbonly true $(SolutionDir)$(Configuration)\ TRACE prompt 4 false x64 pdbonly true $(SolutionDir)$(Configuration)64\ TRACE prompt 4 false UserControl AccumPanel.cs UserControl AlbersPanel.cs UserControl EllipsoidPanel.cs UserControl EllipticPanel.cs Form Form1.cs UserControl GeocentricPanel.cs UserControl GeodesicPanel.cs UserControl GeoidPanel.cs UserControl GravityPanel.cs UserControl LocalCartesianPanel.cs UserControl MagneticPanel.cs UserControl MiscPanel.cs UserControl PolarStereoPanel.cs UserControl PolyPanel.cs UserControl ProjectionsPanel.cs True True Resources.resx True True Settings.settings UserControl RhumbPanel.cs UserControl SphericalHarmonicsPanel.cs UserControl TypeIIIProjPanel.cs AccumPanel.cs AlbersPanel.cs EllipsoidPanel.cs EllipticPanel.cs Form1.cs GeocentricPanel.cs GeodesicPanel.cs GeoidPanel.cs GravityPanel.cs LocalCartesianPanel.cs MagneticPanel.cs MiscPanel.cs PolarStereoPanel.cs PolyPanel.cs ProjectionsPanel.cs ResXFileCodeGenerator Resources.Designer.cs RhumbPanel.cs SphericalHarmonicsPanel.cs TypeIIIProjPanel.cs {BC1ADBEC-537D-487E-AF21-8B7025AAF46D} NETGeographic SettingsSingleFileGenerator Settings.Designer.cs GeographicLib-1.52/dotnet/Projections/Projections.csproj0000644000771000077100000002511514064202371023336 0ustar ckarneyckarney Debug x86 8.0.30703 2.0 {74B48389-E1D1-491F-B198-ADD4878C3F2B} WinExe Properties Projections Projections v4.0 Client 512 x86 true full false $(SolutionDir)$(Configuration)\ DEBUG;TRACE prompt 4 x64 true full false $(SolutionDir)$(Configuration)64\ DEBUG;TRACE prompt 4 x86 pdbonly true $(SolutionDir)$(Configuration)\ TRACE prompt 4 x64 pdbonly true $(SolutionDir)$(Configuration)64\ TRACE prompt 4 UserControl AccumPanel.cs UserControl AlbersPanel.cs UserControl EllipsoidPanel.cs UserControl EllipticPanel.cs Form Form1.cs UserControl GeocentricPanel.cs UserControl GeodesicPanel.cs UserControl GeoidPanel.cs UserControl GravityPanel.cs UserControl LocalCartesianPanel.cs UserControl MagneticPanel.cs UserControl MiscPanel.cs UserControl PolarStereoPanel.cs UserControl PolyPanel.cs UserControl ProjectionsPanel.cs True True Resources.resx True True Settings.settings UserControl RhumbPanel.cs UserControl SphericalHarmonicsPanel.cs UserControl TypeIIIProjPanel.cs AccumPanel.cs AlbersPanel.cs EllipsoidPanel.cs EllipticPanel.cs Form1.cs GeocentricPanel.cs GeodesicPanel.cs GeoidPanel.cs GravityPanel.cs LocalCartesianPanel.cs MagneticPanel.cs MiscPanel.cs PolarStereoPanel.cs PolyPanel.cs ProjectionsPanel.cs ResXFileCodeGenerator Resources.Designer.cs RhumbPanel.cs SphericalHarmonicsPanel.cs TypeIIIProjPanel.cs {BC1ADBEC-537D-487E-AF21-8B7025AAF46D} NETGeographic SettingsSingleFileGenerator Settings.Designer.cs GeographicLib-1.52/dotnet/Projections/ProjectionsPanel.Designer.cs0000644000771000077100000004305314064202371025163 0ustar ckarneyckarneynamespace Projections { partial class ProjectionsPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.m_toolTip = new System.Windows.Forms.ToolTip(this.components); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.m_setButton = new System.Windows.Forms.Button(); this.m_flatteningTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.m_equatorialRadiusTextBox = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.m_projectionComboBox = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); this.m_lat0TextBox = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.m_lon0TextBox = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.m_xTextBox = new System.Windows.Forms.TextBox(); this.m_yTextBox = new System.Windows.Forms.TextBox(); this.m_azimuthTextBox = new System.Windows.Forms.TextBox(); this.m_scaleTextBox = new System.Windows.Forms.TextBox(); this.m_functionComboBox = new System.Windows.Forms.ComboBox(); this.label12 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.m_setButton); this.groupBox1.Controls.Add(this.m_flatteningTextBox); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.m_equatorialRadiusTextBox); this.groupBox1.Controls.Add(this.label2); this.groupBox1.Location = new System.Drawing.Point(3, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(146, 140); this.groupBox1.TabIndex = 6; this.groupBox1.TabStop = false; this.groupBox1.Text = "Ellipsoid Parameters"; // // m_setButton // this.m_setButton.Location = new System.Drawing.Point(12, 107); this.m_setButton.Name = "m_setButton"; this.m_setButton.Size = new System.Drawing.Size(75, 23); this.m_setButton.TabIndex = 4; this.m_setButton.Text = "Set"; this.m_toolTip.SetToolTip(this.m_setButton, "Sets ellipsoid parameters"); this.m_setButton.UseVisualStyleBackColor = true; this.m_setButton.Click += new System.EventHandler(this.OnSet); // // m_flatteningTextBox // this.m_flatteningTextBox.Location = new System.Drawing.Point(12, 83); this.m_flatteningTextBox.Name = "m_flatteningTextBox"; this.m_flatteningTextBox.Size = new System.Drawing.Size(125, 20); this.m_flatteningTextBox.TabIndex = 3; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(109, 13); this.label1.TabIndex = 0; this.label1.Text = "Equatorial Radius (meters)"; // // m_equatorialRadiusTextBox // this.m_equatorialRadiusTextBox.Location = new System.Drawing.Point(12, 42); this.m_equatorialRadiusTextBox.Name = "m_equatorialRadiusTextBox"; this.m_equatorialRadiusTextBox.Size = new System.Drawing.Size(125, 20); this.m_equatorialRadiusTextBox.TabIndex = 2; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 66); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(53, 13); this.label2.TabIndex = 1; this.label2.Text = "Flattening"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(14, 146); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(54, 13); this.label3.TabIndex = 7; this.label3.Text = "Projection"; // // m_projectionComboBox // this.m_projectionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_projectionComboBox.FormattingEnabled = true; this.m_projectionComboBox.Items.AddRange(new object[] { "Azimuthal Equidistant", "Cassini Soldner", "Gnomonic"}); this.m_projectionComboBox.Location = new System.Drawing.Point(14, 163); this.m_projectionComboBox.Name = "m_projectionComboBox"; this.m_projectionComboBox.Size = new System.Drawing.Size(135, 21); this.m_projectionComboBox.TabIndex = 8; this.m_toolTip.SetToolTip(this.m_projectionComboBox, "Select projection type"); this.m_projectionComboBox.SelectedIndexChanged += new System.EventHandler(this.OnProjectectionType); // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(156, 12); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(122, 13); this.label4.TabIndex = 9; this.label4.Text = "Origin Latitude (degrees)"; // // m_lat0TextBox // this.m_lat0TextBox.Location = new System.Drawing.Point(156, 28); this.m_lat0TextBox.Name = "m_lat0TextBox"; this.m_lat0TextBox.Size = new System.Drawing.Size(128, 20); this.m_lat0TextBox.TabIndex = 10; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(156, 52); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(131, 13); this.label5.TabIndex = 11; this.label5.Text = "Origin Longitude (degrees)"; // // m_lon0TextBox // this.m_lon0TextBox.Location = new System.Drawing.Point(156, 69); this.m_lon0TextBox.Name = "m_lon0TextBox"; this.m_lon0TextBox.Size = new System.Drawing.Size(128, 20); this.m_lon0TextBox.TabIndex = 12; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(299, 12); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(92, 13); this.label6.TabIndex = 13; this.label6.Text = "Latitude (degrees)"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(299, 38); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(101, 13); this.label7.TabIndex = 14; this.label7.Text = "Longitude (degrees)"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(299, 64); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(54, 13); this.label8.TabIndex = 15; this.label8.Text = "X (meters)"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(299, 90); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(54, 13); this.label9.TabIndex = 16; this.label9.Text = "Y (meters)"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(299, 116); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(91, 13); this.label10.TabIndex = 17; this.label10.Text = "Azimuth (degrees)"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(299, 142); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(100, 13); this.label11.TabIndex = 18; this.label11.Text = "Reciprocal of Scale"; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(407, 8); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_latitudeTextBox.TabIndex = 19; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(407, 34); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_longitudeTextBox.TabIndex = 20; // // m_xTextBox // this.m_xTextBox.Location = new System.Drawing.Point(407, 60); this.m_xTextBox.Name = "m_xTextBox"; this.m_xTextBox.Size = new System.Drawing.Size(100, 20); this.m_xTextBox.TabIndex = 21; // // m_yTextBox // this.m_yTextBox.Location = new System.Drawing.Point(407, 86); this.m_yTextBox.Name = "m_yTextBox"; this.m_yTextBox.Size = new System.Drawing.Size(100, 20); this.m_yTextBox.TabIndex = 22; // // m_azimuthTextBox // this.m_azimuthTextBox.Location = new System.Drawing.Point(407, 112); this.m_azimuthTextBox.Name = "m_azimuthTextBox"; this.m_azimuthTextBox.ReadOnly = true; this.m_azimuthTextBox.Size = new System.Drawing.Size(100, 20); this.m_azimuthTextBox.TabIndex = 23; // // m_scaleTextBox // this.m_scaleTextBox.Location = new System.Drawing.Point(407, 138); this.m_scaleTextBox.Name = "m_scaleTextBox"; this.m_scaleTextBox.ReadOnly = true; this.m_scaleTextBox.Size = new System.Drawing.Size(100, 20); this.m_scaleTextBox.TabIndex = 24; // // m_functionComboBox // this.m_functionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_functionComboBox.FormattingEnabled = true; this.m_functionComboBox.Items.AddRange(new object[] { "Forward", "Reverse"}); this.m_functionComboBox.Location = new System.Drawing.Point(513, 34); this.m_functionComboBox.Name = "m_functionComboBox"; this.m_functionComboBox.Size = new System.Drawing.Size(75, 21); this.m_functionComboBox.TabIndex = 25; this.m_toolTip.SetToolTip(this.m_functionComboBox, "Select Function"); this.m_functionComboBox.SelectedIndexChanged += new System.EventHandler(this.OnFunction); // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(513, 12); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(48, 13); this.label12.TabIndex = 26; this.label12.Text = "Function"; // // button1 // this.button1.Location = new System.Drawing.Point(513, 59); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 27; this.button1.Text = "Convert"; this.m_toolTip.SetToolTip(this.button1, "Execute the selected Function using the selected Projection"); this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnConvert); // // button2 // this.button2.Location = new System.Drawing.Point(516, 137); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 28; this.button2.Text = "Validate"; this.m_toolTip.SetToolTip(this.button2, "Verified interfaces"); this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnValidate); // // ProjectionsPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.label12); this.Controls.Add(this.m_functionComboBox); this.Controls.Add(this.m_scaleTextBox); this.Controls.Add(this.m_azimuthTextBox); this.Controls.Add(this.m_yTextBox); this.Controls.Add(this.m_xTextBox); this.Controls.Add(this.m_longitudeTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.label11); this.Controls.Add(this.label10); this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.m_lon0TextBox); this.Controls.Add(this.label5); this.Controls.Add(this.m_lat0TextBox); this.Controls.Add(this.label4); this.Controls.Add(this.m_projectionComboBox); this.Controls.Add(this.label3); this.Controls.Add(this.groupBox1); this.Name = "ProjectionsPanel"; this.Size = new System.Drawing.Size(790, 289); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.ToolTip m_toolTip; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button m_setButton; private System.Windows.Forms.TextBox m_flatteningTextBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox m_equatorialRadiusTextBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.ComboBox m_projectionComboBox; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox m_lat0TextBox; private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox m_lon0TextBox; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.TextBox m_xTextBox; private System.Windows.Forms.TextBox m_yTextBox; private System.Windows.Forms.TextBox m_azimuthTextBox; private System.Windows.Forms.TextBox m_scaleTextBox; private System.Windows.Forms.ComboBox m_functionComboBox; private System.Windows.Forms.Label label12; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; } } GeographicLib-1.52/dotnet/Projections/ProjectionsPanel.cs0000644000771000077100000002437514064202371023432 0ustar ckarneyckarney/** * \file NETGeographicLib\ProjectionsPanel.cs * \brief NETGeographicLib projection example * * NETGeographicLib.AzimuthalEquidistant, * NETGeographicLib.CassiniSoldner, and * NETGeographicLib.Gnomonic example. * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class ProjectionsPanel : UserControl { enum ProjectionTypes { AzimuthalEquidistant = 0, CassiniSoldner = 1, Gnomonic = 2 } ProjectionTypes m_type; AzimuthalEquidistant m_azimuthal = null; CassiniSoldner m_cassini = null; Gnomonic m_gnomonic = null; Geodesic m_geodesic = null; public ProjectionsPanel() { InitializeComponent(); try { m_geodesic = new Geodesic(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } m_majorRadiusTextBox.Text = m_geodesic.EquatorialRadius.ToString(); m_flatteningTextBox.Text = m_geodesic.Flattening.ToString(); m_lat0TextBox.Text = m_lon0TextBox.Text = "0"; m_projectionComboBox.SelectedIndex = 0; m_functionComboBox.SelectedIndex = 0; } private void OnProjectectionType(object sender, EventArgs e) { m_type = (ProjectionTypes)m_projectionComboBox.SelectedIndex; switch (m_type) { case ProjectionTypes.AzimuthalEquidistant: m_azimuthal = new AzimuthalEquidistant(m_geodesic); break; case ProjectionTypes.CassiniSoldner: double lat0 = Double.Parse( m_lat0TextBox.Text ); double lon0 = Double.Parse( m_lon0TextBox.Text ); m_cassini = new CassiniSoldner(lat0, lon0, m_geodesic); break; case ProjectionTypes.Gnomonic: m_gnomonic = new Gnomonic(m_geodesic); break; } } private void OnSet(object sender, EventArgs e) { try { double a = Double.Parse(m_majorRadiusTextBox.Text); double f = Double.Parse(m_flatteningTextBox.Text); m_geodesic = new Geodesic(a, f); } catch ( Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnFunction(object sender, EventArgs e) { switch (m_functionComboBox.SelectedIndex) { case 0: m_latitudeTextBox.ReadOnly = m_longitudeTextBox.ReadOnly = false; m_xTextBox.ReadOnly = m_yTextBox.ReadOnly = true; break; case 1: m_latitudeTextBox.ReadOnly = m_longitudeTextBox.ReadOnly = true; m_xTextBox.ReadOnly = m_yTextBox.ReadOnly = false; break; } } private void OnConvert(object sender, EventArgs e) { try { switch (m_type) { case ProjectionTypes.AzimuthalEquidistant: ConvertAzimuthalEquidistant(); break; case ProjectionTypes.CassiniSoldner: ConvertCassiniSoldner(); break; case ProjectionTypes.Gnomonic: ConvertGnomonic(); break; } } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void ConvertAzimuthalEquidistant() { double lat0 = Double.Parse(m_lat0TextBox.Text); double lon0 = Double.Parse(m_lon0TextBox.Text); double lat = 0.0, lon = 0.0, x = 0.0, y = 0.0, azi = 0.0, rk = 0.0; switch (m_functionComboBox.SelectedIndex) { case 0: lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); m_azimuthal.Forward(lat0, lon0, lat, lon, out x, out y, out azi, out rk); m_xTextBox.Text = x.ToString(); m_yTextBox.Text = y.ToString(); break; case 1: x = Double.Parse(m_xTextBox.Text); y = Double.Parse(m_yTextBox.Text); m_azimuthal.Reverse(lat0, lon0, x, y, out lat, out lon, out azi, out rk); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); break; } m_azimuthTextBox.Text = azi.ToString(); m_scaleTextBox.Text = rk.ToString(); } private void ConvertCassiniSoldner() { double lat = 0.0, lon = 0.0, x = 0.0, y = 0.0, azi = 0.0, rk = 0.0; switch (m_functionComboBox.SelectedIndex) { case 0: lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); m_cassini.Forward(lat, lon, out x, out y, out azi, out rk); m_xTextBox.Text = x.ToString(); m_yTextBox.Text = y.ToString(); break; case 1: x = Double.Parse(m_xTextBox.Text); y = Double.Parse(m_yTextBox.Text); m_cassini.Reverse(x, y, out lat, out lon, out azi, out rk); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); break; } m_azimuthTextBox.Text = azi.ToString(); m_scaleTextBox.Text = rk.ToString(); } private void ConvertGnomonic() { double lat0 = Double.Parse(m_lat0TextBox.Text); double lon0 = Double.Parse(m_lon0TextBox.Text); double lat = 0.0, lon = 0.0, x = 0.0, y = 0.0, azi = 0.0, rk = 0.0; switch (m_functionComboBox.SelectedIndex) { case 0: lat = Double.Parse(m_latitudeTextBox.Text); lon = Double.Parse(m_longitudeTextBox.Text); m_gnomonic.Forward(lat0, lon0, lat, lon, out x, out y, out azi, out rk); m_xTextBox.Text = x.ToString(); m_yTextBox.Text = y.ToString(); break; case 1: x = Double.Parse(m_xTextBox.Text); y = Double.Parse(m_yTextBox.Text); m_gnomonic.Reverse(lat0, lon0, x, y, out lat, out lon, out azi, out rk); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); break; } m_azimuthTextBox.Text = azi.ToString(); m_scaleTextBox.Text = rk.ToString(); } private void OnValidate(object sender, EventArgs e) { try { double lat = 0.0, lon = 0.0, x = 0.0, y = 0.0, x1 = 0.0, y1 = 0.0, azi = 0.0, rk = 0.0; AzimuthalEquidistant azimuthal = new AzimuthalEquidistant(m_geodesic); azimuthal = new AzimuthalEquidistant(); azimuthal.Forward(32.0, -86.0, 33.0, -87.0, out x, out y, out azi, out rk); azimuthal.Forward(32.0, -86.0, 33.0, -87.0, out x1, out y1); if (x != x1 || y != y1) throw new Exception("Error in AzimuthalEquidistant.Forward"); azimuthal.Reverse(32.0, -86.0, x, y, out lat, out lon, out azi, out rk); azimuthal.Reverse(32.0, -86.0, x, y, out x1, out y1); if ( x1 != lat || y1 != lon ) throw new Exception("Error in AzimuthalEquidistant.Reverse"); CassiniSoldner cassini = new CassiniSoldner(32.0, -86.0, m_geodesic); cassini = new CassiniSoldner(32.0, -86.0); cassini.Reset(31.0, -87.0); cassini.Forward(32.0, -86.0, out x, out y, out azi, out rk); cassini.Forward(32.0, -86.0, out x1, out y1); if (x != x1 || y != y1) throw new Exception("Error in CassiniSoldner.Forward"); cassini.Reverse(x, y, out lat, out lon, out azi, out rk); cassini.Reverse(x, y, out x1, out y1); if (x1 != lat || y1 != lon) throw new Exception("Error in CassiniSoldner.Reverse"); Gnomonic gnomonic = new Gnomonic(m_geodesic); gnomonic = new Gnomonic(); gnomonic.Forward(32.0, -86.0, 31.0, -87.0, out x, out y, out azi, out rk); gnomonic.Forward(32.0, -86.0, 31.0, -87.0, out x1, out y1); if (x != x1 || y != y1) throw new Exception("Error in Gnomonic.Forward"); gnomonic.Reverse(32.0, -86.0, x, y, out lat, out lon, out azi, out rk); gnomonic.Reverse(32.0, -86.0, x, y, out x1, out y1); if (x1 != lat || y1 != lon) throw new Exception("Error in Gnomonic.Reverse"); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } GeographicLib-1.52/dotnet/Projections/ProjectionsPanel.resx0000644000771000077100000001347014064202371024000 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/Properties/AssemblyInfo.cs0000644000771000077100000000255614064202371024677 0ustar ckarneyckarneyusing System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Projections")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Projections")] [assembly: AssemblyCopyright("Copyright (c) 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("9ac75a52-f578-43e8-9994-5f993a535d0d")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] GeographicLib-1.52/dotnet/Projections/Properties/Resources.Designer.cs0000644000771000077100000000533014064202371026006 0ustar ckarneyckarney//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.239 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Projections.Properties { /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if ((resourceMan == null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Projections.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } } GeographicLib-1.52/dotnet/Projections/Properties/Resources.resx0000644000771000077100000001264614064202371024633 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 GeographicLib-1.52/dotnet/Projections/Properties/Settings.Designer.cs0000644000771000077100000000204714064202371025636 0ustar ckarneyckarney//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.239 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Projections.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } } } GeographicLib-1.52/dotnet/Projections/Properties/Settings.settings0000644000771000077100000000036614064202371025334 0ustar ckarneyckarney GeographicLib-1.52/dotnet/Projections/RhumbPanel.Designer.cs0000644000771000077100000002603214064202371023737 0ustar ckarneyckarneynamespace Projections { partial class RhumbPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.m_Lat1TextBox = new System.Windows.Forms.TextBox(); this.m_lon1TextBox = new System.Windows.Forms.TextBox(); this.m_lat2TextBox = new System.Windows.Forms.TextBox(); this.m_lon2TextBox = new System.Windows.Forms.TextBox(); this.m_s12TextBox = new System.Windows.Forms.TextBox(); this.m_azimuthTextBox = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.label7 = new System.Windows.Forms.Label(); this.m_pointsView = new System.Windows.Forms.ListView(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.button3 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(16, 15); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(101, 13); this.label1.TabIndex = 0; this.label1.Text = "Latitude 1 (degrees)"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(16, 42); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(110, 13); this.label2.TabIndex = 1; this.label2.Text = "Longitude 1 (degrees)"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(16, 69); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(101, 13); this.label3.TabIndex = 2; this.label3.Text = "Latitude 2 (degrees)"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(16, 96); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(110, 13); this.label4.TabIndex = 3; this.label4.Text = "Longitude 2 (degrees)"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(16, 123); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(66, 13); this.label5.TabIndex = 4; this.label5.Text = "S12 (meters)"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(16, 150); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(91, 13); this.label6.TabIndex = 5; this.label6.Text = "Azimuth (degrees)"; // // m_Lat1TextBox // this.m_Lat1TextBox.Location = new System.Drawing.Point(131, 11); this.m_Lat1TextBox.Name = "m_Lat1TextBox"; this.m_Lat1TextBox.Size = new System.Drawing.Size(129, 20); this.m_Lat1TextBox.TabIndex = 6; // // m_lon1TextBox // this.m_lon1TextBox.Location = new System.Drawing.Point(131, 38); this.m_lon1TextBox.Name = "m_lon1TextBox"; this.m_lon1TextBox.Size = new System.Drawing.Size(129, 20); this.m_lon1TextBox.TabIndex = 7; // // m_lat2TextBox // this.m_lat2TextBox.Location = new System.Drawing.Point(131, 65); this.m_lat2TextBox.Name = "m_lat2TextBox"; this.m_lat2TextBox.Size = new System.Drawing.Size(129, 20); this.m_lat2TextBox.TabIndex = 8; // // m_lon2TextBox // this.m_lon2TextBox.Location = new System.Drawing.Point(131, 92); this.m_lon2TextBox.Name = "m_lon2TextBox"; this.m_lon2TextBox.Size = new System.Drawing.Size(129, 20); this.m_lon2TextBox.TabIndex = 9; // // m_s12TextBox // this.m_s12TextBox.Location = new System.Drawing.Point(131, 119); this.m_s12TextBox.Name = "m_s12TextBox"; this.m_s12TextBox.Size = new System.Drawing.Size(129, 20); this.m_s12TextBox.TabIndex = 10; // // m_azimuthTextBox // this.m_azimuthTextBox.Location = new System.Drawing.Point(131, 146); this.m_azimuthTextBox.Name = "m_azimuthTextBox"; this.m_azimuthTextBox.Size = new System.Drawing.Size(129, 20); this.m_azimuthTextBox.TabIndex = 11; // // button1 // this.button1.Location = new System.Drawing.Point(19, 178); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 12; this.button1.Text = "Direct"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnDirect); // // button2 // this.button2.Location = new System.Drawing.Point(131, 177); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 13; this.button2.Text = "Inverse"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnIndirect); // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(306, 17); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(96, 13); this.label7.TabIndex = 14; this.label7.Text = "Rhumb Line Points"; // // m_pointsView // this.m_pointsView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, this.columnHeader2}); this.m_pointsView.Location = new System.Drawing.Point(309, 38); this.m_pointsView.Name = "m_pointsView"; this.m_pointsView.Size = new System.Drawing.Size(321, 128); this.m_pointsView.TabIndex = 15; this.m_pointsView.UseCompatibleStateImageBehavior = false; this.m_pointsView.View = System.Windows.Forms.View.Details; // // columnHeader1 // this.columnHeader1.Text = "Latitude (deg)"; this.columnHeader1.Width = 161; // // columnHeader2 // this.columnHeader2.Text = "Longitude (deg)"; this.columnHeader2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.columnHeader2.Width = 120; // // button3 // this.button3.Location = new System.Drawing.Point(309, 177); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 16; this.button3.Text = "Validate"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.OnValidate); // // RhumbPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.button3); this.Controls.Add(this.m_pointsView); this.Controls.Add(this.label7); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.m_azimuthTextBox); this.Controls.Add(this.m_s12TextBox); this.Controls.Add(this.m_lon2TextBox); this.Controls.Add(this.m_lat2TextBox); this.Controls.Add(this.m_lon1TextBox); this.Controls.Add(this.m_Lat1TextBox); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "RhumbPanel"; this.Size = new System.Drawing.Size(662, 287); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox m_Lat1TextBox; private System.Windows.Forms.TextBox m_lon1TextBox; private System.Windows.Forms.TextBox m_lat2TextBox; private System.Windows.Forms.TextBox m_lon2TextBox; private System.Windows.Forms.TextBox m_s12TextBox; private System.Windows.Forms.TextBox m_azimuthTextBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label7; private System.Windows.Forms.ListView m_pointsView; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; private System.Windows.Forms.Button button3; } } GeographicLib-1.52/dotnet/Projections/RhumbPanel.cs0000644000771000077100000001207214064202371022177 0ustar ckarneyckarneyusing System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class RhumbPanel : UserControl { Rhumb m_rhumb; public RhumbPanel() { InitializeComponent(); m_rhumb = Rhumb.WGS84(); m_Lat1TextBox.Text = "32"; m_lon1TextBox.Text = "-86"; m_lat2TextBox.Text = "33"; m_lon2TextBox.Text = "-87"; OnIndirect(this, null); } private void OnDirect(object sender, EventArgs e) { try { double lat1 = Double.Parse( m_Lat1TextBox.Text ); double lon1 = Double.Parse( m_lon1TextBox.Text ); double s12 = Double.Parse( m_s12TextBox.Text ); double azimuth = Double.Parse( m_azimuthTextBox.Text ); double lat2, lon2; m_rhumb.Direct(lat1, lon1, azimuth, s12, out lat2, out lon2); m_lat2TextBox.Text = lat2.ToString(); m_lon2TextBox.Text = lon2.ToString(); GeneratePoints(lat1, lon1, azimuth, 0.25 * s12); } catch (Exception xcpt ) { MessageBox.Show( xcpt.Message, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } private void OnIndirect(object sender, EventArgs e) { try { double lat1 = Double.Parse(m_Lat1TextBox.Text); double lon1 = Double.Parse(m_lon1TextBox.Text); double lat2 = Double.Parse(m_lat2TextBox.Text); double lon2 = Double.Parse(m_lon2TextBox.Text); double s12, azimuth; m_rhumb.Inverse(lat1, lon1, lat2, lon2, out s12, out azimuth); m_s12TextBox.Text = s12.ToString(); m_azimuthTextBox.Text = azimuth.ToString(); GeneratePoints(lat1, lon1, azimuth, 0.25 * s12); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void GeneratePoints( double lat1, double lon1, double azimuth, double space ) { RhumbLine line = m_rhumb.Line(lat1, lon1, azimuth); m_pointsView.Items.Clear(); for (int i = 0; i < 5; i++) { double lat2, lon2; line.Position(i * space, out lat2, out lon2); string[] items = new string[2] { lat2.ToString(), lon2.ToString() }; ListViewItem item = new ListViewItem(items); m_pointsView.Items.Add(item); } } private void OnValidate(object sender, EventArgs e) { try { Rhumb r = new Rhumb(NETGeographicLib.Constants.WGS84.EquatorialRadius, NETGeographicLib.Constants.WGS84.Flattening, true); double lat1 = 32.0, lon1 = -86.0, azi12 = 45.0, s12 = 5000.0; double lat2, lon2, _s12, _azi12, Area, _Area; r.Direct(lat1, lon1, azi12, s12, out lat2, out lon2); r.Inverse(lat1, lon1, lat2, lon2, out _s12, out _azi12); if ( Test(s12,_s12) || Test(azi12,_azi12)) throw new Exception(String.Format("Inverse != Direct: S12 -> {0}, {1}, azi12 -> {2}, {3}", s12, _s12, azi12, _azi12)); r.Direct(lat1, lon1, azi12, s12, out lat2, out lon2, out Area); r.Inverse(lat1, lon1, lat2, lon2, out _s12, out _azi12, out _Area); if (Test(s12, _s12) || Test(azi12, _azi12) || Test(Area,_Area)) throw new Exception(String.Format("Inverse != Direct: S12 -> {0}, {1}, azi12 -> {2}, {3}, Area -> {4}, {5}", s12, _s12, azi12, _azi12, Area, _Area)); double _lat2, _lon2; RhumbLine l = r.Line(lat1, lon1, azi12); l.Position(s12, out _lat2, out _lon2); if (Test(lat2,_lat2) || Test(lon2, _lon2)) throw new Exception(String.Format("Latitude -> {0}, {1}, Longitude -> {2}, {3}", lat2, _lat2, lon2, _lon2)); l.Position(s12, out _lat2, out _lon2, out _Area); if (Test(lat2, _lat2) || Test(lon2, _lon2) || Test(Area, _Area)) throw new Exception(String.Format("Latitude -> {0}, {1}, Longitude -> {2}, {3}, Area -> {4}, {5}", lat2, _lat2, lon2, _lon2, Area, _Area)); MessageBox.Show("No exceptions detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch ( Exception xcpt ) { MessageBox.Show( xcpt.Message, "Exception thrown", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } bool Test(double a, double b) { double delta = a != 0.0 ? Math.Abs((a - b) / a) : Math.Abs(a - b); return delta > 1.0e-12; } } } GeographicLib-1.52/dotnet/Projections/RhumbPanel.resx0000644000771000077100000001316314064202371022555 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 GeographicLib-1.52/dotnet/Projections/SphericalHarmonicsPanel.Designer.cs0000644000771000077100000004217414064202371026445 0ustar ckarneyckarneynamespace Projections { partial class SphericalHarmonicsPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.m_toolTip = new System.Windows.Forms.ToolTip(this.components); this.m_classComboBox = new System.Windows.Forms.ComboBox(); this.button1 = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.m_tau1Label = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.m_xTextBox = new System.Windows.Forms.TextBox(); this.m_yTextBox = new System.Windows.Forms.TextBox(); this.m_zTextBox = new System.Windows.Forms.TextBox(); this.m_tau1TextBox = new System.Windows.Forms.TextBox(); this.m_tau2TextBox = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.m_sumTextBox = new System.Windows.Forms.TextBox(); this.m_gradXTextBox = new System.Windows.Forms.TextBox(); this.m_gradYTextBox = new System.Windows.Forms.TextBox(); this.m_gradZTextBox = new System.Windows.Forms.TextBox(); this.button2 = new System.Windows.Forms.Button(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.m_circleRadiusTextBox = new System.Windows.Forms.TextBox(); this.m_circleHeightTextBox = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // m_classComboBox // this.m_classComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_classComboBox.FormattingEnabled = true; this.m_classComboBox.Items.AddRange(new object[] { "Spherical Harmonic", "Spherical Harmonic 1", "Spherical Harmonic 2"}); this.m_classComboBox.Location = new System.Drawing.Point(4, 155); this.m_classComboBox.Name = "m_classComboBox"; this.m_classComboBox.Size = new System.Drawing.Size(139, 21); this.m_classComboBox.TabIndex = 10; this.m_toolTip.SetToolTip(this.m_classComboBox, "Select Class"); this.m_classComboBox.SelectedIndexChanged += new System.EventHandler(this.OnClass); // // button1 // this.button1.Location = new System.Drawing.Point(203, 112); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 12; this.button1.Text = "Compute"; this.m_toolTip.SetToolTip(this.button1, "Compute harmonic sum and gradient"); this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnCompute); // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(4, 8); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(14, 13); this.label2.TabIndex = 0; this.label2.Text = "X"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(4, 34); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(14, 13); this.label1.TabIndex = 1; this.label1.Text = "Y"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(4, 60); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(14, 13); this.label3.TabIndex = 2; this.label3.Text = "Z"; // // m_tau1Label // this.m_tau1Label.AutoSize = true; this.m_tau1Label.Location = new System.Drawing.Point(4, 86); this.m_tau1Label.Name = "m_tau1Label"; this.m_tau1Label.Size = new System.Drawing.Size(31, 13); this.m_tau1Label.TabIndex = 3; this.m_tau1Label.Text = "tau 1"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(4, 112); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(31, 13); this.label4.TabIndex = 4; this.label4.Text = "tau 2"; // // m_xTextBox // this.m_xTextBox.Location = new System.Drawing.Point(43, 4); this.m_xTextBox.Name = "m_xTextBox"; this.m_xTextBox.Size = new System.Drawing.Size(100, 20); this.m_xTextBox.TabIndex = 5; // // m_yTextBox // this.m_yTextBox.Location = new System.Drawing.Point(43, 30); this.m_yTextBox.Name = "m_yTextBox"; this.m_yTextBox.Size = new System.Drawing.Size(100, 20); this.m_yTextBox.TabIndex = 6; // // m_zTextBox // this.m_zTextBox.Location = new System.Drawing.Point(43, 56); this.m_zTextBox.Name = "m_zTextBox"; this.m_zTextBox.Size = new System.Drawing.Size(100, 20); this.m_zTextBox.TabIndex = 7; // // m_tau1TextBox // this.m_tau1TextBox.Location = new System.Drawing.Point(43, 82); this.m_tau1TextBox.Name = "m_tau1TextBox"; this.m_tau1TextBox.Size = new System.Drawing.Size(100, 20); this.m_tau1TextBox.TabIndex = 8; // // m_tau2TextBox // this.m_tau2TextBox.Location = new System.Drawing.Point(43, 108); this.m_tau2TextBox.Name = "m_tau2TextBox"; this.m_tau2TextBox.Size = new System.Drawing.Size(100, 20); this.m_tau2TextBox.TabIndex = 9; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(4, 136); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(32, 13); this.label5.TabIndex = 11; this.label5.Text = "Class"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(158, 8); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(76, 13); this.label6.TabIndex = 13; this.label6.Text = "Harmonic Sum"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(158, 33); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(57, 13); this.label7.TabIndex = 14; this.label7.Text = "X Gradient"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(158, 60); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(57, 13); this.label8.TabIndex = 15; this.label8.Text = "Y Gradient"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(158, 86); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(57, 13); this.label9.TabIndex = 16; this.label9.Text = "X Gradient"; // // m_sumTextBox // this.m_sumTextBox.Location = new System.Drawing.Point(241, 4); this.m_sumTextBox.Name = "m_sumTextBox"; this.m_sumTextBox.ReadOnly = true; this.m_sumTextBox.Size = new System.Drawing.Size(100, 20); this.m_sumTextBox.TabIndex = 17; // // m_gradXTextBox // this.m_gradXTextBox.Location = new System.Drawing.Point(241, 29); this.m_gradXTextBox.Name = "m_gradXTextBox"; this.m_gradXTextBox.ReadOnly = true; this.m_gradXTextBox.Size = new System.Drawing.Size(100, 20); this.m_gradXTextBox.TabIndex = 18; // // m_gradYTextBox // this.m_gradYTextBox.Location = new System.Drawing.Point(241, 56); this.m_gradYTextBox.Name = "m_gradYTextBox"; this.m_gradYTextBox.ReadOnly = true; this.m_gradYTextBox.Size = new System.Drawing.Size(100, 20); this.m_gradYTextBox.TabIndex = 19; // // m_gradZTextBox // this.m_gradZTextBox.Location = new System.Drawing.Point(241, 82); this.m_gradZTextBox.Name = "m_gradZTextBox"; this.m_gradZTextBox.ReadOnly = true; this.m_gradZTextBox.Size = new System.Drawing.Size(100, 20); this.m_gradZTextBox.TabIndex = 20; // // button2 // this.button2.Location = new System.Drawing.Point(406, 86); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(100, 23); this.button2.TabIndex = 21; this.button2.Text = "Circular Engine"; this.m_toolTip.SetToolTip(this.button2, "Calculates the sum for the given radius, height, and longitude using a Circular E" + "ngine"); this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnCircularEngine); // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(348, 8); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(69, 13); this.label10.TabIndex = 22; this.label10.Text = "Circle Radius"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(348, 33); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(67, 13); this.label11.TabIndex = 23; this.label11.Text = "Circle Height"; // // m_circleRadiusTextBox // this.m_circleRadiusTextBox.Location = new System.Drawing.Point(458, 4); this.m_circleRadiusTextBox.Name = "m_circleRadiusTextBox"; this.m_circleRadiusTextBox.Size = new System.Drawing.Size(100, 20); this.m_circleRadiusTextBox.TabIndex = 24; // // m_circleHeightTextBox // this.m_circleHeightTextBox.Location = new System.Drawing.Point(458, 29); this.m_circleHeightTextBox.Name = "m_circleHeightTextBox"; this.m_circleHeightTextBox.Size = new System.Drawing.Size(100, 20); this.m_circleHeightTextBox.TabIndex = 25; // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point(348, 60); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(101, 13); this.label12.TabIndex = 26; this.label12.Text = "Longitude (degrees)"; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(458, 56); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(100, 20); this.m_longitudeTextBox.TabIndex = 27; // // button3 // this.button3.Location = new System.Drawing.Point(203, 155); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(75, 23); this.button3.TabIndex = 28; this.button3.Text = "Validate"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.OnValidate); // // SphericalHarmonicsPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.button3); this.Controls.Add(this.m_longitudeTextBox); this.Controls.Add(this.label12); this.Controls.Add(this.m_circleHeightTextBox); this.Controls.Add(this.m_circleRadiusTextBox); this.Controls.Add(this.label11); this.Controls.Add(this.label10); this.Controls.Add(this.button2); this.Controls.Add(this.m_gradZTextBox); this.Controls.Add(this.m_gradYTextBox); this.Controls.Add(this.m_gradXTextBox); this.Controls.Add(this.m_sumTextBox); this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.button1); this.Controls.Add(this.label5); this.Controls.Add(this.m_classComboBox); this.Controls.Add(this.m_tau2TextBox); this.Controls.Add(this.m_tau1TextBox); this.Controls.Add(this.m_zTextBox); this.Controls.Add(this.m_yTextBox); this.Controls.Add(this.m_xTextBox); this.Controls.Add(this.label4); this.Controls.Add(this.m_tau1Label); this.Controls.Add(this.label3); this.Controls.Add(this.label1); this.Controls.Add(this.label2); this.Name = "SphericalHarmonicsPanel"; this.Size = new System.Drawing.Size(785, 293); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.ToolTip m_toolTip; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label m_tau1Label; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox m_xTextBox; private System.Windows.Forms.TextBox m_yTextBox; private System.Windows.Forms.TextBox m_zTextBox; private System.Windows.Forms.TextBox m_tau1TextBox; private System.Windows.Forms.TextBox m_tau2TextBox; private System.Windows.Forms.ComboBox m_classComboBox; private System.Windows.Forms.Label label5; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.TextBox m_sumTextBox; private System.Windows.Forms.TextBox m_gradXTextBox; private System.Windows.Forms.TextBox m_gradYTextBox; private System.Windows.Forms.TextBox m_gradZTextBox; private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox m_circleRadiusTextBox; private System.Windows.Forms.TextBox m_circleHeightTextBox; private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.Button button3; } } GeographicLib-1.52/dotnet/Projections/SphericalHarmonicsPanel.cs0000644000771000077100000002150114064202371024675 0ustar ckarneyckarney/** * \file NETGeographicLib\SphericalHarmonicsPanel.cs * \brief NETGeographicLib Spherical Harmonics example * * NETGeographicLib.CircularEngine, * NETGeographicLib.SphericalHarmonic, * NETGeographicLib.SphericalHarmonic1, and * NETGeographicLib.SphericalHarmonic2 example. * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class SphericalHarmonicsPanel : UserControl { int N = 3, N1 = 2, N2 = 1; // The maxium degrees double[] C = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients double[] S = {6, 5, 4, 3, 2, 1}; // sine coefficients double[] C1 = {1, 2, 3, 4, 5, 6}; double[] S1 = {3, 2, 1}; double[] C2 = {1, 2, 3}; double[] S2 = {1}; double a = 1; SphericalHarmonic m_sh0 = null; SphericalHarmonic1 m_sh1 = null; SphericalHarmonic2 m_sh2 = null; public SphericalHarmonicsPanel() { InitializeComponent(); try { m_sh0 = new SphericalHarmonic(C, S, N, a, SphericalHarmonic.Normalization.SCHMIDT); m_sh1 = new SphericalHarmonic1(C, S, N, C1, S1, N1, a, SphericalHarmonic1.Normalization.FULL); m_sh2 = new SphericalHarmonic2(C, S, N, C1, S1, N1, C2, S2, N2, a, SphericalHarmonic2.Normalization.FULL); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } m_classComboBox.SelectedIndex = 0; } private void OnClass(object sender, EventArgs e) { switch (m_classComboBox.SelectedIndex) { case 0: m_tau1TextBox.ReadOnly = m_tau2TextBox.ReadOnly = true; break; case 1: m_tau1TextBox.ReadOnly = false; m_tau2TextBox.ReadOnly = true; break; case 2: m_tau1TextBox.ReadOnly = m_tau2TextBox.ReadOnly = false; break; } } private void OnCompute(object sender, EventArgs e) { try { double sum = 0.0, gradx = 0.0, grady = 0.0, gradz = 0.0; double x = Double.Parse(m_xTextBox.Text); double y = Double.Parse(m_yTextBox.Text); double z = Double.Parse(m_zTextBox.Text); switch (m_classComboBox.SelectedIndex) { case 0: sum = m_sh0.HarmonicSum(x, y, z, out gradx, out grady, out gradz); break; case 1: double tau1 = Double.Parse(m_tau1TextBox.Text); sum = m_sh1.HarmonicSum(tau1, x, y, z, out gradx, out grady, out gradz); break; case 2: tau1 = Double.Parse(m_tau1TextBox.Text); double tau2 = Double.Parse(m_tau2TextBox.Text); sum = m_sh2.HarmonicSum(tau1, tau2, x, y, z, out gradx, out grady, out gradz); break; } m_sumTextBox.Text = sum.ToString(); m_gradXTextBox.Text = gradx.ToString(); m_gradYTextBox.Text = grady.ToString(); m_gradZTextBox.Text = gradz.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnCircularEngine(object sender, EventArgs e) { try { CircularEngine ce = null; double p = Double.Parse(m_circleRadiusTextBox.Text); double z = Double.Parse(m_circleHeightTextBox.Text); double longitude = Double.Parse(m_longitudeTextBox.Text); switch (m_classComboBox.SelectedIndex) { case 0: ce = m_sh0.Circle(p, z, true); break; case 1: double tau1 = Double.Parse(m_tau1TextBox.Text); ce = m_sh1.Circle(tau1, p, z, true); break; case 2: tau1 = Double.Parse(m_tau1TextBox.Text); double tau2 = Double.Parse(m_tau2TextBox.Text); ce = m_sh2.Circle(tau1, tau2, p, z, true); break; } double gradx, grady, gradz; m_sumTextBox.Text = ce.LongitudeSum(longitude, out gradx, out grady, out gradz).ToString(); m_gradXTextBox.Text = gradx.ToString(); m_gradYTextBox.Text = grady.ToString(); m_gradZTextBox.Text = gradz.ToString(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnValidate(object sender, EventArgs e) { try { const double DEG_TO_RAD = 3.1415926535897932384626433832795 / 180.0; double gradx, grady, gradz; SphericalHarmonic s0 = new SphericalHarmonic(C, S, N, N - 1, 0, a, SphericalHarmonic.Normalization.SCHMIDT); s0 = new SphericalHarmonic(C, S, N, a, SphericalHarmonic.Normalization.SCHMIDT); double sum = s0.HarmonicSum(1.0, 2.0, 3.0); double test = s0.HarmonicSum(1.0, 2.0, 3.0, out gradx, out grady, out grady); if (sum != test) throw new Exception("Error in SphericalHarmonic.HarmonicSum"); SphericalCoefficients sc = s0.Coefficients(); CircularEngine ce = s0.Circle(1.0, 0.5, true); sum = ce.LongitudeSum(60.0); test = ce.LongitudeSum(Math.Cos(60.0 * DEG_TO_RAD), Math.Sin(60.0 * DEG_TO_RAD)); if ( sum != test ) throw new Exception("Error in CircularEngine.LongitudeSum 1"); test = ce.LongitudeSum(60.0, out gradx, out grady, out gradz); if ( sum != test ) throw new Exception("Error in CircularEngine.LongitudeSum 2"); ce.LongitudeSum(Math.Cos(60.0 * DEG_TO_RAD), Math.Sin(60.0 * DEG_TO_RAD), out gradx, out grady, out gradz); if (sum != test) throw new Exception("Error in CircularEngine.LongitudeSum 3"); SphericalHarmonic1 s1 = new SphericalHarmonic1(C, S, N, N - 1, 1, C1, S1, N1, N1 - 1, 0, a, SphericalHarmonic1.Normalization.SCHMIDT); s1 = new SphericalHarmonic1(C, S, N, C1, S1, N1, a, SphericalHarmonic1.Normalization.SCHMIDT); sum = s1.HarmonicSum(0.95, 1.0, 2.0, 3.0); test = s1.HarmonicSum(0.95, 1.0, 2.0, 3.0, out gradx, out grady, out gradz); if (sum != test) throw new Exception("Error in SphericalHarmonic1.HarmonicSum 3"); ce = s1.Circle(0.95, 1.0, 0.5, true); sc = s1.Coefficients(); sc = s1.Coefficients1(); SphericalHarmonic2 s2 = new SphericalHarmonic2(C, S, N, N - 1, 2, C1, S1, N1, N1 - 1, 1, C2, S2, N2, N2 - 1, 0, a, SphericalHarmonic2.Normalization.SCHMIDT); s2 = new SphericalHarmonic2(C, S, N, C1, S1, N1, C2, S2, N2, a, SphericalHarmonic2.Normalization.SCHMIDT); sum = s2.HarmonicSum(0.95, 0.8, 1.0, 2.0, 3.0); test = s2.HarmonicSum(0.95, 0.8, 1.0, 2.0, 3.0, out gradx, out grady, out gradz); if (sum != test) throw new Exception("Error in SphericalHarmonic2.HarmonicSum 3"); ce = s2.Circle(0.95, 0.8, 1.0, 0.5, true); sc = s2.Coefficients(); sc = s2.Coefficients1(); sc = s2.Coefficients2(); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MessageBox.Show("No errors found", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } GeographicLib-1.52/dotnet/Projections/SphericalHarmonicsPanel.resx0000644000771000077100000001347014064202371025257 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 17, 17 GeographicLib-1.52/dotnet/Projections/TypeIIIProjPanel.Designer.cs0000644000771000077100000003463014064202371024774 0ustar ckarneyckarneynamespace Projections { partial class TypeIIIProjPanel { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.m_latitudeTextBox = new System.Windows.Forms.TextBox(); this.m_longitudeTextBox = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.m_utmPoleCheckBox = new System.Windows.Forms.CheckBox(); this.m_utmXTextBox = new System.Windows.Forms.TextBox(); this.m_utmYTextBox = new System.Windows.Forms.TextBox(); this.m_utmZoneTextBox = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.label7 = new System.Windows.Forms.Label(); this.m_mgrsTextBox = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); this.label8 = new System.Windows.Forms.Label(); this.m_osgbYTextBox = new System.Windows.Forms.TextBox(); this.m_osgbXTextBox = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.m_osgbTextBox = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(167, 38); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(45, 13); this.label1.TabIndex = 0; this.label1.Text = "Latitude"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(167, 67); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(54, 13); this.label2.TabIndex = 1; this.label2.Text = "Longitude"; // // m_latitudeTextBox // this.m_latitudeTextBox.Location = new System.Drawing.Point(227, 34); this.m_latitudeTextBox.Name = "m_latitudeTextBox"; this.m_latitudeTextBox.Size = new System.Drawing.Size(126, 20); this.m_latitudeTextBox.TabIndex = 2; // // m_longitudeTextBox // this.m_longitudeTextBox.Location = new System.Drawing.Point(227, 63); this.m_longitudeTextBox.Name = "m_longitudeTextBox"; this.m_longitudeTextBox.Size = new System.Drawing.Size(126, 20); this.m_longitudeTextBox.TabIndex = 3; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(445, 10); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(53, 13); this.label3.TabIndex = 4; this.label3.Text = "UTMUPS"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(364, 38); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(14, 13); this.label4.TabIndex = 5; this.label4.Text = "X"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(364, 67); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(14, 13); this.label5.TabIndex = 6; this.label5.Text = "Y"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(364, 98); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(32, 13); this.label6.TabIndex = 7; this.label6.Text = "Zone"; // // m_utmPoleCheckBox // this.m_utmPoleCheckBox.AutoSize = true; this.m_utmPoleCheckBox.Location = new System.Drawing.Point(364, 124); this.m_utmPoleCheckBox.Name = "m_utmPoleCheckBox"; this.m_utmPoleCheckBox.Size = new System.Drawing.Size(76, 17); this.m_utmPoleCheckBox.TabIndex = 8; this.m_utmPoleCheckBox.Text = "North Pole"; this.m_utmPoleCheckBox.UseVisualStyleBackColor = true; // // m_utmXTextBox // this.m_utmXTextBox.Location = new System.Drawing.Point(456, 34); this.m_utmXTextBox.Name = "m_utmXTextBox"; this.m_utmXTextBox.Size = new System.Drawing.Size(126, 20); this.m_utmXTextBox.TabIndex = 9; // // m_utmYTextBox // this.m_utmYTextBox.Location = new System.Drawing.Point(456, 63); this.m_utmYTextBox.Name = "m_utmYTextBox"; this.m_utmYTextBox.Size = new System.Drawing.Size(126, 20); this.m_utmYTextBox.TabIndex = 10; // // m_utmZoneTextBox // this.m_utmZoneTextBox.Location = new System.Drawing.Point(456, 94); this.m_utmZoneTextBox.Name = "m_utmZoneTextBox"; this.m_utmZoneTextBox.Size = new System.Drawing.Size(126, 20); this.m_utmZoneTextBox.TabIndex = 11; // // button1 // this.button1.Location = new System.Drawing.Point(228, 148); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(85, 23); this.button1.TabIndex = 12; this.button1.Text = "<- Convert ->"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.OnConvertLatLon); // // button2 // this.button2.Location = new System.Drawing.Point(431, 148); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(81, 23); this.button2.TabIndex = 13; this.button2.Text = "<- Convert ->"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.OnConvertUTMUPS); // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(663, 10); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(39, 13); this.label7.TabIndex = 14; this.label7.Text = "MGRS"; // // m_mgrsTextBox // this.m_mgrsTextBox.Location = new System.Drawing.Point(606, 34); this.m_mgrsTextBox.Name = "m_mgrsTextBox"; this.m_mgrsTextBox.Size = new System.Drawing.Size(152, 20); this.m_mgrsTextBox.TabIndex = 15; // // button3 // this.button3.Location = new System.Drawing.Point(642, 148); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(81, 23); this.button3.TabIndex = 16; this.button3.Text = "<- Convert "; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.OnConvertMGRS); // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(69, 10); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(37, 13); this.label8.TabIndex = 17; this.label8.Text = "OSGB"; // // m_osgbYTextBox // this.m_osgbYTextBox.Location = new System.Drawing.Point(24, 63); this.m_osgbYTextBox.Name = "m_osgbYTextBox"; this.m_osgbYTextBox.Size = new System.Drawing.Size(126, 20); this.m_osgbYTextBox.TabIndex = 21; // // m_osgbXTextBox // this.m_osgbXTextBox.Location = new System.Drawing.Point(24, 38); this.m_osgbXTextBox.Name = "m_osgbXTextBox"; this.m_osgbXTextBox.Size = new System.Drawing.Size(126, 20); this.m_osgbXTextBox.TabIndex = 20; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point(4, 68); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(14, 13); this.label9.TabIndex = 19; this.label9.Text = "Y"; // // label10 // this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(4, 39); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(14, 13); this.label10.TabIndex = 18; this.label10.Text = "X"; // // button4 // this.button4.Location = new System.Drawing.Point(50, 147); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(75, 23); this.button4.TabIndex = 22; this.button4.Text = "Convert ->"; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.OnConvertOSGB); // // button5 // this.button5.Location = new System.Drawing.Point(367, 189); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(75, 23); this.button5.TabIndex = 23; this.button5.Text = "Validate"; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.OnValidate); // // m_osgbTextBox // this.m_osgbTextBox.Location = new System.Drawing.Point(7, 93); this.m_osgbTextBox.Name = "m_osgbTextBox"; this.m_osgbTextBox.ReadOnly = true; this.m_osgbTextBox.Size = new System.Drawing.Size(143, 20); this.m_osgbTextBox.TabIndex = 24; // // TypeIIIProjPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.m_osgbTextBox); this.Controls.Add(this.button5); this.Controls.Add(this.button4); this.Controls.Add(this.m_osgbYTextBox); this.Controls.Add(this.m_osgbXTextBox); this.Controls.Add(this.label9); this.Controls.Add(this.label10); this.Controls.Add(this.label8); this.Controls.Add(this.button3); this.Controls.Add(this.m_mgrsTextBox); this.Controls.Add(this.label7); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.m_utmZoneTextBox); this.Controls.Add(this.m_utmYTextBox); this.Controls.Add(this.m_utmXTextBox); this.Controls.Add(this.m_utmPoleCheckBox); this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.m_longitudeTextBox); this.Controls.Add(this.m_latitudeTextBox); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "TypeIIIProjPanel"; this.Size = new System.Drawing.Size(1001, 358); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox m_latitudeTextBox; private System.Windows.Forms.TextBox m_longitudeTextBox; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.CheckBox m_utmPoleCheckBox; private System.Windows.Forms.TextBox m_utmXTextBox; private System.Windows.Forms.TextBox m_utmYTextBox; private System.Windows.Forms.TextBox m_utmZoneTextBox; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox m_mgrsTextBox; private System.Windows.Forms.Button button3; private System.Windows.Forms.Label label8; private System.Windows.Forms.TextBox m_osgbYTextBox; private System.Windows.Forms.TextBox m_osgbXTextBox; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label10; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; private System.Windows.Forms.TextBox m_osgbTextBox; } } GeographicLib-1.52/dotnet/Projections/TypeIIIProjPanel.cs0000644000771000077100000001506514064202371023236 0ustar ckarneyckarney/** * \file NETGeographicLib\TypeIIIProjPanel.cs * \brief NETGeographicLib.projections example * * NETGeographicLib.UTMUPS, * NETGeographicLib.MGRS, and * NETGeographicLib.OSGB example. * * NETGeographicLib is copyright (c) Scott Heiman (2013) * GeographicLib is Copyright (c) Charles Karney (2010-2012) * and licensed under the MIT/X11 License. * For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using NETGeographicLib; namespace Projections { public partial class TypeIIIProjPanel : UserControl { public TypeIIIProjPanel() { InitializeComponent(); } private void OnConvertLatLon(object sender, EventArgs e) { try { int zone; bool northp; double x, y; string str; double lat = Double.Parse(m_latitudeTextBox.Text); double lon = Double.Parse(m_longitudeTextBox.Text); UTMUPS.Forward(lat, lon, out zone, out northp, out x, out y, (int)UTMUPS.ZoneSpec.STANDARD, true); m_utmPoleCheckBox.Checked = northp; m_utmXTextBox.Text = x.ToString(); m_utmYTextBox.Text = y.ToString(); m_utmZoneTextBox.Text = zone.ToString(); MGRS.Forward(zone,northp,x,y,8,out str ); m_mgrsTextBox.Text = str; OSGB.Forward(lat, lon, out x, out y); m_osgbXTextBox.Text = x.ToString(); m_osgbYTextBox.Text = y.ToString(); OSGB.GridReference(x, y, 8, out str); m_osgbTextBox.Text = str; } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnConvertUTMUPS(object sender, EventArgs e) { try { double lat, lon; string str; double x = Double.Parse(m_utmXTextBox.Text); double y = Double.Parse(m_utmYTextBox.Text); int zone = Int32.Parse(m_utmZoneTextBox.Text); UTMUPS.Reverse(zone, m_utmPoleCheckBox.Checked, x, y, out lat, out lon, true); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); MGRS.Forward(zone, m_utmPoleCheckBox.Checked, x, y, 8, out str); m_mgrsTextBox.Text = str; } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void OnConvertMGRS(object sender, EventArgs e) { int zone, prec; bool northp; double x, y, lat, lon; MGRS.Reverse(m_mgrsTextBox.Text, out zone, out northp, out x, out y, out prec, true); m_utmPoleCheckBox.Checked = northp; m_utmXTextBox.Text = x.ToString(); m_utmYTextBox.Text = y.ToString(); m_utmZoneTextBox.Text = zone.ToString(); UTMUPS.Reverse(zone, northp, x, y, out lat, out lon, true); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); } private void OnConvertOSGB(object sender, EventArgs e) { // the latitude and longitude returned by OSGB is not WGS84 and should not // be used with UTMUPS or MGRS. double x = Double.Parse(m_osgbXTextBox.Text); double y = Double.Parse(m_osgbYTextBox.Text); double lat, lon; OSGB.Reverse(x, y, out lat, out lon); m_latitudeTextBox.Text = lat.ToString(); m_longitudeTextBox.Text = lon.ToString(); } private void OnValidate(object sender, EventArgs e) { try { string str; int prec, zone, zout; bool northp; double x, y, x1, y1, gamma, k, lat, lon; OSGB.Forward(52.0,-2.0, out x, out y, out gamma, out k); OSGB.Forward(52.0, -2.0, out x1, out y1); if (x != x1 || y != y1) throw new Exception("Error in OSGB.Forward"); OSGB.Reverse(x, y, out lat, out lon, out gamma, out k); OSGB.Reverse(x, y, out x1, out y1); if ( lat != x1 || lon != y1 ) throw new Exception("Error in OSGB.Reverse"); OSGB.GridReference(x,y,8,out str); OSGB.GridReference(str, out x1, out y1, out prec, true); UTMUPS.StandardZone(32.0, -80.0, (int)UTMUPS.ZoneSpec.STANDARD); UTMUPS.UTMShift(); UTMUPS.StandardZone(32.0, -86.0, (int)UTMUPS.ZoneSpec.STANDARD); UTMUPS.Forward(32.0, -86.0, out zone, out northp, out x, out y, out gamma, out k, (int)UTMUPS.ZoneSpec.STANDARD, true); UTMUPS.Forward(32.0, -86.0, out zone, out northp, out x1, out y1, (int)UTMUPS.ZoneSpec.STANDARD, true); if (x != x1 || y != y1) throw new Exception("Error in UTMUPS.Forward"); UTMUPS.Reverse(zone, northp, x, y, out lat, out lon, out gamma, out k, true); UTMUPS.Reverse(zone, northp, x, y, out x1, out y1, true); if (lat != x1 || lon != y1) throw new Exception("Error in UTMUPS.Reverse"); UTMUPS.Transfer(zone, northp, x, y, zone + 1, true, out x1, out y1, out zout); str = UTMUPS.EncodeZone(zone, northp, true); prec = UTMUPS.EncodeEPSG(zone, northp); UTMUPS.DecodeZone(str, out zone, out northp); UTMUPS.DecodeEPSG(prec, out zone, out northp); MGRS.Forward(zone, northp, x, y, 8, out str); MGRS.Forward(zone, northp, x, y, 32.0, 8, out str); MGRS.Reverse(str, out zone, out northp, out x, out y, out prec, true); MessageBox.Show("No errors detected", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception xcpt) { MessageBox.Show(xcpt.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } GeographicLib-1.52/dotnet/Projections/TypeIIIProjPanel.resx0000644000771000077100000001316314064202371023607 0ustar ckarneyckarney text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 GeographicLib-1.52/dotnet/examples/CS/example-Accumulator.cs0000644000771000077100000000153514064202371023700 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_Accumulator { class Program { static void Main(string[] args) { try { // Compare using Accumulator and ordinary summation for a sum of large and // small terms. double sum = 0; Accumulator acc = new Accumulator(); acc.Assign( 0.0 ); sum += 1e20; sum += 1; sum += 2; sum += 100; sum += 5000; sum += -1e20; acc.Sum( 1e20 ); acc.Sum( 1 ); acc.Sum( 2 ); acc.Sum( 100 ); acc.Sum( 5000 ); acc.Sum( -1e20 ); Console.WriteLine(String.Format("{0} {1}", sum, acc.Result())); } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } } } } GeographicLib-1.52/dotnet/examples/CS/example-AlbersEqualArea.cs0000644000771000077100000000315714064202371024414 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_AlbersEqualArea { class Program { static void Main(string[] args) { try { const double lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels k1 = 1, // scale lon0 = -77 - 45/60.0; // Central meridian // Set up basic projection AlbersEqualArea albers = new AlbersEqualArea( Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening, 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, out x, out y); Console.WriteLine( String.Format("X: {0} Y: {1}", x, y ) ); } { // Sample conversion from Albers Equal Area grid to geodetic double x = 220e3, y = -53e3; double lat, lon; albers.Reverse(lon0, x, y, out lat, out lon); Console.WriteLine( String.Format("Latitude: {0} Longitude: {1}", lat, lon ) ); } } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } } } } GeographicLib-1.52/dotnet/examples/CS/example-AzimuthalEquidistant.cs0000644000771000077100000000231414064202371025566 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_AzimuthalEquidistant { class Program { static void Main(string[] args) { try { Geodesic geod = new Geodesic(); // WGS84 const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris AzimuthalEquidistant proj = new AzimuthalEquidistant(geod); { // Sample forward calculation double lat = 50.9, lon = 1.8; // Calais double x, y; proj.Forward(lat0, lon0, lat, lon, out x, out y); Console.WriteLine( String.Format("X: {0} Y: {1}", x, y ) ); } { // Sample reverse calculation double x = -38e3, y = 230e3; double lat, lon; proj.Reverse(lat0, lon0, x, y, out lat, out lon); Console.WriteLine( String.Format("Latitude: {0} Longitude: {1}", lat, lon ) ); } } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } } } } GeographicLib-1.52/dotnet/examples/CS/example-CassiniSoldner.cs0000644000771000077100000000225014064202371024334 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_CassiniSoldner { class Program { static void Main(string[] args) { try { Geodesic geod = new Geodesic(); // WGS84 const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris CassiniSoldner proj = new CassiniSoldner(lat0, lon0, geod); { // Sample forward calculation double lat = 50.9, lon = 1.8; // Calais double x, y; proj.Forward(lat, lon, out x, out y); Console.WriteLine(String.Format("X: {0} Y: {1}", x, y)); } { // Sample reverse calculation double x = -38e3, y = 230e3; double lat, lon; proj.Reverse(x, y, out lat, out lon); Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon)); } } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } } } } GeographicLib-1.52/dotnet/examples/CS/example-CircularEngine.cs0000644000771000077100000000232414064202371024310 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_CircularEngine { class Program { static void Main(string[] args) { // 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 double[] sa = {6, 5, 4, 3, 2, 1}; // sine coefficients double a = 1; SphericalHarmonic h = new SphericalHarmonic(ca, sa, N, a, SphericalHarmonic.Normalization.SCHMIDT); double x = 2, y = 3, z = 1, p = Math.Sqrt(x*x+y*y); CircularEngine circ = h.Circle(p, z, true); double v, vx, vy, vz; v = circ.LongitudeSum(x/p, y/p, out vx, out vy, out vz); Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz)); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-DMS.cs0000644000771000077100000000142414064202371022041 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_DMS { class Program { static void Main(string[] args) { try { { string dms = "30d14'45.6\"S"; DMS.Flag type; double ang = DMS.Decode(dms, out type); Console.WriteLine(String.Format("Type: {0} String: {1}", type, ang)); } { double ang = -30.245715; string dms = DMS.Encode(ang, 6, DMS.Flag.LATITUDE, 0); Console.WriteLine(String.Format("Latitude: {0}", dms)); } } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } } } } GeographicLib-1.52/dotnet/examples/CS/example-Ellipsoid.cs0000644000771000077100000000220114064202371023334 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_Ellipsoid { class Program { static void Main(string[] args) { try { Ellipsoid wgs84 = new Ellipsoid( Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening); // Alternatively: Ellipsoid wgs84 = new Ellipsoid(); Console.WriteLine( String.Format( "The latitude half way between the equator and the pole is {0}", wgs84.InverseRectifyingLatitude(45)) ); Console.WriteLine( String.Format( "Half the area of the ellipsoid lies between latitudes +/- {0}", wgs84.InverseAuthalicLatitude(30))); ; Console.WriteLine( String.Format( "The northernmost edge of a square Mercator map is at latitude {0}", wgs84.InverseIsometricLatitude(180))); } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } } } } GeographicLib-1.52/dotnet/examples/CS/example-EllipticFunction.cs0000644000771000077100000000432714064202371024676 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_EllipticFunction { class Program { static void Main(string[] args) { try { EllipticFunction ell = new EllipticFunction(0.1, 1.0); // parameter m = 0.1 // See Abramowitz and Stegun, table 17.1 Console.WriteLine( String.Format( "{0} {1}", ell.K(), ell.E())); double phi = 20 * Math.Acos(-1.0) / 180.0;; // See Abramowitz and Stegun, table 17.6 with // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg Console.WriteLine( String.Format("{0} {1}", ell.E(phi), ell.E(Math.Sin(phi), Math.Cos(phi), Math.Sqrt(1 - ell.k2 * Math.Sin(phi) * Math.Sin(phi))) ) ); // See Carlson 1995, Sec 3. Console.WriteLine(String.Format("RF(1,2,0) = {0}", EllipticFunction.RF(1,2))); Console.WriteLine(String.Format("RF(2,3,4) = {0}", EllipticFunction.RF(2,3,4))); Console.WriteLine(String.Format("RC(0,1/4) = {0}", EllipticFunction.RC(0,0.25))); Console.WriteLine(String.Format("RC(9/4,2) = {0}", EllipticFunction.RC(2.25,2))); Console.WriteLine(String.Format("RC(1/4,-2) = {0}", EllipticFunction.RC(0.25,-2))); Console.WriteLine(String.Format("RJ(0,1,2,3) = {0}", EllipticFunction.RJ(0,1,2,3))); Console.WriteLine(String.Format("RJ(2,3,4,5) = {0}", EllipticFunction.RJ(2,3,4,5))); Console.WriteLine(String.Format("RD(0,2,1) = {0}", EllipticFunction.RD(0,2,1))); Console.WriteLine(String.Format("RD(2,3,4) = {0}", EllipticFunction.RD(2,3,4))); Console.WriteLine(String.Format("RG(0,16,16) = {0}", EllipticFunction.RG(16,16))); Console.WriteLine(String.Format("RG(2,3,4) = {0}", EllipticFunction.RG(2,3,4))); Console.WriteLine(String.Format("RG(0,0.0796,4) = {0}", EllipticFunction.RG(0.0796, 4))); } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } } } } GeographicLib-1.52/dotnet/examples/CS/example-GARS.cs0000644000771000077100000000224114064202371022150 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_GARS { class Program { static void Main(string[] args) { try { { // Sample forward calculation double lat = 57.64911, lon = 10.40744; // Jutland string gars; for (int prec = 0; prec <= 2; ++prec) { GARS.Forward(lat, lon, prec, out gars); Console.WriteLine(String.Format("Precision: {0} GARS: {1}", prec, gars)); } } { // Sample reverse calculation string gars = "381NH45"; double lat, lon; for (int len = 5; len <= gars.Length; ++len) { int prec; GARS.Reverse(gars.Substring(0, len), out lat, out lon, out prec, true); Console.WriteLine(String.Format("Precision: {0} Latitude: {1} Longitude {2}", prec, lat, lon)); } } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught Exception {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-GeoCoords.cs0000644000771000077100000000157414064202371023310 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_GeoCoords { class Program { static void Main(string[] args) { try { // Miscellaneous conversions double lat = 33.3, lon = 44.4; GeoCoords c = new GeoCoords(lat, lon, -1); Console.WriteLine(c.MGRSRepresentation(-3)); c.Reset("18TWN0050", true, false); Console.WriteLine(c.DMSRepresentation(0, false, 0)); Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", c.Latitude, c.Longitude)); c.Reset("1d38'W 55d30'N", true, false); Console.WriteLine(c.GeoRepresentation(0, false)); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-Geocentric.cs0000644000771000077100000000260014064202371023475 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_Geocentric { class Program { static void Main(string[] args) { try { Geocentric earth = new Geocentric( Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening); // Alternatively: Geocentric earth = new Geocentric(); { // Sample forward calculation double lat = 27.99, lon = 86.93, h = 8820; // Mt Everest double X, Y, Z; earth.Forward(lat, lon, h, out X, out Y, out Z); Console.WriteLine( String.Format( "{0} {1} {2}", Math.Floor(X / 1000 + 0.5), Math.Floor(Y / 1000 + 0.5), Math.Floor(Z / 1000 + 0.5) ) ); } { // Sample reverse calculation double X = 302e3, Y = 5636e3, Z = 2980e3; double lat, lon, h; earth.Reverse(X, Y, Z, out lat, out lon, out h); Console.WriteLine(String.Format("{0} {1} {2}", lat, lon, h)); } } catch (GeographicErr e) { Console.WriteLine( String.Format( "Caught exception: {0}", e.Message ) ); } } } } GeographicLib-1.52/dotnet/examples/CS/example-Geodesic.cs0000644000771000077100000000251014064202371023135 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_Geodesic { class Program { static void Main(string[] args) { try { Geodesic geod = new Geodesic( Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening ); // Alternatively: Geodesic geod = new Geodesic(); { // 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, out lat2, out lon2); Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat2, lon2)); } { // 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, out s12); Console.WriteLine( s12 ); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-GeodesicExact.cs0000644000771000077100000000255114064202371024127 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_GeodesicExact { class Program { static void Main(string[] args) { try { GeodesicExact geod = new GeodesicExact( Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening ); // Alternatively: GeodesicExact geod = new GeodesicExact(); { // 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, out lat2, out lon2); Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat2, lon2)); } { // 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, out s12); Console.WriteLine(s12); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-GeodesicLine.cs0000644000771000077100000000371414064202371023754 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_GeodesicLine { class Program { static void Main(string[] args) { try { // Print waypoints between JFK and SIN Geodesic geod = new 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, out s12, out azi1, out azi2); GeodesicLine line = new GeodesicLine(geod, lat1, lon1, azi1, Mask.ALL); // Alternatively GeodesicLine line = geod.Line(lat1, lon1, azi1, Mask.ALL); double ds = 500e3; // Nominal distance between points = 500 km int num = (int)(Math.Ceiling(s12 / ds)); // The number of intervals { // Use intervals of equal length ds = s12 / num; for (int i = 0; i <= num; ++i) { double lat, lon; line.Position(i * ds, out lat, out lon); Console.WriteLine(String.Format("i: {0} Latitude: {1} Longitude: {2}", i, lat, lon)); } } { // 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, out lat, out lon); Console.WriteLine(String.Format("i: {0} Latitude: {1} Longitude: {2}", i, lat, lon)); } } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-GeodesicLineExact.cs0000644000771000077100000000365414064202371024744 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_GeodesicLineExact { class Program { static void Main(string[] args) { try { // Print waypoints between JFK and SIN GeodesicExact geod = new GeodesicExact(); // 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, out s12, out azi1, out azi2); GeodesicLineExact line = new GeodesicLineExact(geod, lat1, lon1, azi1, Mask.ALL); // Alternatively GeodesicLine line = geod.Line(lat1, lon1, azi1, Mask.ALL); double ds = 500e3; // Nominal distance between points = 500 km int num = (int)(Math.Ceiling(s12 / ds)); // The number of intervals { // Use intervals of equal length ds = s12 / num; for (int i = 0; i <= num; ++i) { double lat, lon; line.Position(i * ds, out lat, out lon); Console.WriteLine( String.Format( "i: {0} Latitude: {1} Longitude: {2}", i, lat, lon )); } } { // 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, out lat, out lon); Console.WriteLine( String.Format( "i: {0} Latitude: {1} Longitude: {2}", i, lat, lon )); } } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-Geohash.cs0000644000771000077100000000246014064202371022775 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_Geohash { class Program { static void Main(string[] args) { try { { // Sample forward calculation double lat = 57.64911, lon = 10.40744; // Jutland (the wikipedia example) string geohash; int maxlen = Geohash.GeohashLength(1.0e-5); for (int len = 0; len <= maxlen; ++len) { Geohash.Forward(lat, lon, len, out geohash); Console.WriteLine( geohash ); } } { // Sample reverse calculation string geohash = "u4pruydqqvj"; double lat, lon; for (int i = 0; i <= geohash.Length; ++i) { int len; Geohash.Reverse(geohash.Substring(0, i), out lat, out lon, out len, true); Console.WriteLine(String.Format("Length: {0} Latitude: {1} Longitude: {2}", len, lat, lon ) ); } } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-Geoid.cs0000644000771000077100000000150114064202371022441 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_Geoid { class Program { static void Main(string[] args) { try { Geoid egm96 = new Geoid("egm96-5", "", true, false); // Convert height above egm96 to height above the ellipsoid double lat = 42, lon = -75, height_above_geoid = 20; double geoid_height = egm96.Height(lat, lon), height_above_ellipsoid = (height_above_geoid + (double)Geoid.ConvertFlag.GEOIDTOELLIPSOID * geoid_height); Console.WriteLine(height_above_ellipsoid); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-Georef.cs0000644000771000077100000000247414064202371022633 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_Georef { class Program { static void Main(string[] args) { try { { // Sample forward calculation double lat = 57.64911, lon = 10.40744; // Jutland string georef; for (int prec = -1; prec <= 11; ++prec) { Georef.Forward(lat, lon, prec, out georef); Console.WriteLine(String.Format("Precision: {0} Georef: {1}", prec, georef)); } } { // Sample reverse calculation string georef = "NKLN2444638946"; double lat, lon; int prec; Georef.Reverse(georef.Substring(0, 2), out lat, out lon, out prec, true); Console.WriteLine(String.Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon)); Georef.Reverse(georef.Substring(0, 4), out lat, out lon, out prec, true); Console.WriteLine(String.Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon)); Georef.Reverse(georef, out lat, out lon, out prec, true); Console.WriteLine(String.Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon)); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught Exception {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-Gnomonic.cs0000644000771000077100000000223614064202371023171 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_Gnomonic { class Program { static void Main(string[] args) { try { Geodesic geod = new Geodesic(); // WGS84 const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris Gnomonic proj = new Gnomonic(geod); { // Sample forward calculation double lat = 50.9, lon = 1.8; // Calais double x, y; proj.Forward(lat0, lon0, lat, lon, out x, out y); Console.WriteLine(String.Format("X: {0} Y: {1}", x, y)); } { // Sample reverse calculation double x = -38e3, y = 230e3; double lat, lon; proj.Reverse(lat0, lon0, x, y, out lat, out lon); Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon)); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-GravityCircle.cs0000644000771000077100000000304714064202371024170 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_GravityCircle { class Program { static void Main(string[] args) { try { GravityModel grav = new GravityModel("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, out gx, out gy, out gz); Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, gx, gy, gz)); } } { // Fast method of evaluating the values at several points on a circle of // latitude using GravityCircle. GravityCircle circ = grav.Circle(lat, h, GravityModel.Mask.ALL); for (int i = -5; i <= 5; ++i) { double lon = lon0 + i * 0.2; double gx, gy, gz; circ.Gravity(lon, out gx, out gy, out gz); Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, gx, gy, gz)); } } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-GravityModel.cs0000644000771000077100000000121414064202371024021 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_GravityModel { class Program { static void Main(string[] args) { try { GravityModel grav = new GravityModel("egm96",""); double lat = 27.99, lon = 86.93, h = 8820; // Mt Everest double gx, gy, gz; grav.Gravity(lat, lon, h, out gx, out gy, out gz); Console.WriteLine(String.Format("{0} {1} {2}", gx, gy, gz)); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-LambertConformalConic.cs0000644000771000077100000000412214064202371025617 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_LambertConformalConic { class Program { static void Main(string[] args) { try { // Define the Pennsylvania South state coordinate system EPSG:3364 // http://www.spatialreference.org/ref/epsg/3364/ const double 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 LambertConformalConic PASouth = new LambertConformalConic( Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening, lat1, lat2, k1); double x0, y0; // Transform origin point PASouth.Forward(lon0, lat0, lon0, out x0, out 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, out x, out y); x -= x0; y -= y0; Console.WriteLine( String.Format("{0} {1}", x, y) ); } { // Sample conversion from PASouth grid to geodetic double x = 820e3, y = 72e3; double lat, lon; x += x0; y += y0; PASouth.Reverse(lon0, x, y, out lat, out lon); Console.WriteLine( String.Format("{0} {1}", lat, lon) ); } } catch (GeographicErr e) { Console.WriteLine( String.Format("Caught exception: {0}", e.Message) ); } } } } GeographicLib-1.52/dotnet/examples/CS/example-LocalCartesian.cs0000644000771000077100000000230214064202371024276 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_LocalCartesian { class Program { static void Main(string[] args) { try { Geocentric earth = new Geocentric(); const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris LocalCartesian proj = new LocalCartesian(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, out x, out y, out z); Console.WriteLine(String.Format("{0} {1} {2}", x, y, z)); } { // Sample reverse calculation double x = -38e3, y = 230e3, z = -4e3; double lat, lon, h; proj.Reverse(x, y, z, out lat, out lon, out h); Console.WriteLine(String.Format("{0} {1} {2}", lat, lon, h)); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-MGRS.cs0000644000771000077100000000257214064202371022173 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_MGRS { class Program { static void Main(string[] args) { 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, out zone, out northp, out x, out y, -1, true); string mgrs; MGRS.Forward(zone, northp, x, y, lat, 5, out mgrs); Console.WriteLine(mgrs); } { // Sample reverse calculation string mgrs = "38SMB4488"; int zone, prec; bool northp; double x, y; MGRS.Reverse(mgrs, out zone, out northp, out x, out y, out prec, true); double lat, lon; UTMUPS.Reverse(zone, northp, x, y, out lat, out lon, true); Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon)); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-MagneticCircle.cs0000644000771000077100000000303714064202371024271 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_MagneticCircle { class Program { static void Main(string[] args) { try { MagneticModel mag = new MagneticModel("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.Field(t, lat, lon, h, out Bx, out By, out Bz); Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, Bx, By, Bz)); } } { // 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.Field(lon, out Bx, out By, out Bz); Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, Bx, By, Bz)); } } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-MagneticModel.cs0000644000771000077100000000142714064202371024131 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_MagneticModel { class Program { static void Main(string[] args) { try { MagneticModel mag = new MagneticModel("wmm2010",""); double lat = 27.99, lon = 86.93, h = 8820, t = 2012; // Mt Everest double Bx, By, Bz; mag.Field(t, lat,lon, h, out Bx, out By, out Bz); double H, F, D, I; MagneticModel.FieldComponents(Bx, By, Bz, out H, out F, out D, out I); Console.WriteLine(String.Format("{0} {1} {2} {3}", H, F, D, I)); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-NormalGravity.cs0000644000771000077100000000123114064202371024210 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_NormalGravity { class Program { static void Main(string[] args) { try { NormalGravity grav = new NormalGravity(NormalGravity.StandardModels.WGS84); double lat = 27.99, h = 8820; // Mt Everest double gammay, gammaz; grav.Gravity(lat, h, out gammay, out gammaz); Console.WriteLine(String.Format("{0} {1}", gammay, gammaz)); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-OSGB.cs0000644000771000077100000000250414064202371022150 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_OSGB { class Program { static void Main(string[] args) { try { { // Sample forward calculation from // A guide to coordinate systems in Great Britain double lat = DMS.Decode(52,39,27.2531), lon = DMS.Decode( 1,43, 4.5177); double x, y; OSGB.Forward(lat, lon, out x, out y); string gridref; OSGB.GridReference(x, y, 2, out gridref); Console.WriteLine(String.Format("{0} {1} {2}", x, y, gridref)); } { // Sample reverse calculation string gridref = "TG5113"; double x, y; int prec; OSGB.GridReference(gridref, out x, out y, out prec, true); double lat, lon; OSGB.Reverse(x, y, out lat, out lon); Console.WriteLine(String.Format("{0} {1} {2}", prec, lat, lon)); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-PolarStereographic.cs0000644000771000077100000000210314064202371025206 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_PolarStereographic { class Program { static void Main(string[] args) { try { PolarStereographic proj = new PolarStereographic(); // WGS84 bool northp = true; { // Sample forward calculation double lat = 61.2, lon = -149.9; // Anchorage double x, y; proj.Forward(northp, lat, lon, out x, out y); Console.WriteLine(String.Format("{0} {1}", x, y)); } { // Sample reverse calculation double x = -1637e3, y = 2824e3; double lat, lon; proj.Reverse(northp, x, y, out lat, out lon); Console.WriteLine(String.Format("{0} {1}", lat, lon)); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-PolygonArea.cs0000644000771000077100000000157114064202371023641 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_PolygonArea { class Program { static void Main(string[] args) { try { Geodesic geod = new Geodesic(); // WGS84 PolygonArea poly = new PolygonArea(geod, true); 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; uint n = poly.Compute(false, true, out perimeter, out area); Console.WriteLine(String.Format("{0} {1} {2}", n, perimeter, area)); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-Rhumb.cs0000644000771000077100000000245114064202371022474 0ustar ckarneyckarneyusing System; using System.Collections.Generic; using System.Linq; using System.Text; using NETGeographicLib; namespace example_Rhumb { class Program { static void Main(string[] args) { try { Rhumb rhumb = new Rhumb(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening, true); // Alternatively: const Rhumb& rhumb = Rhumb::WGS84(); { // Sample direct calculation, travelling about NE from JFK double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi12 = 51; double lat2, lon2; rhumb.Direct(lat1, lon1, azi12, s12, out lat2, out lon2); Console.WriteLine( "{0} {1}", lat2, lon2 ); } { // 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, azi12; rhumb.Inverse(lat1, lon1, lat2, lon2, out s12, out azi12); Console.WriteLine( "{0} {1}", s12, azi12 ); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-RhumbLine.cs0000644000771000077100000000274214064202371023307 0ustar ckarneyckarneyusing System; using System.Collections.Generic; using System.Linq; using System.Text; using NETGeographicLib; namespace example_RhumbLine { class Program { static void Main(string[] args) { try { // Print waypoints between JFK and SIN Rhumb rhumb = new Rhumb(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening, true); // Alternatively: const Rhumb& rhumb = Rhumb::WGS84(); double lat1 = 40.640, lon1 = -73.779, // JFK lat2 = 1.359, lon2 = 103.989; // SIN double s12, azi12; rhumb.Inverse(lat1, lon1, lat2, lon2, out s12, out azi12); RhumbLine line = rhumb.Line(lat1, lon1, azi12); // Alternatively // const GeographicLib::RhumbLine line = rhumb.Line(lat1, lon1, azi1); double ds = 500e3; // Nominal distance between points = 500 km int num = (int)Math.Ceiling(s12 / ds); // The number of intervals { // Use intervals of equal length ds = s12 / num; for (int i = 0; i <= num; ++i) { double lat, lon; line.Position(i * ds, out lat, out lon); Console.WriteLine( "{0} {1} {2}", i, lat, lon ); } } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-SphericalHarmonic.cs0000644000771000077100000000165614064202371025020 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_SphericalHarmonic { class Program { static void Main(string[] args) { try { int N = 3; // The maximum degree double[] ca = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients double[] sa = {6, 5, 4, 3, 2, 1}; // sine coefficients double a = 1; SphericalHarmonic h = new SphericalHarmonic(ca, sa, N, a, SphericalHarmonic.Normalization.SCHMIDT); double x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h.HarmonicSum(x, y, z, out vx, out vy, out vz); Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz)); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-SphericalHarmonic1.cs0000644000771000077100000000206214064202371025071 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_SphericalHarmonic1 { class Program { static void Main(string[] args) { try { int N = 3, N1 = 2; // The maximum degrees double[] ca = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients double[] sa = {6, 5, 4, 3, 2, 1}; // sine coefficients double[] cb = {1, 2, 3, 4, 5, 6}; double[] sb = {3, 2, 1}; double a = 1; SphericalHarmonic1 h = new SphericalHarmonic1(ca, sa, N, cb, sb, N1, a, SphericalHarmonic1.Normalization.SCHMIDT); double tau = 0.1, x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h.HarmonicSum(tau, x, y, z, out vx, out vy, out vz); Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz)); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-SphericalHarmonic2.cs0000644000771000077100000000253114064202371025073 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_SphericalHarmonic2 { class Program { static void Main(string[] args) { try { int N = 3, N1 = 2, N2 = 1; // The maximum degrees double[] ca = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; // cosine coefficients double[] sa = { 6, 5, 4, 3, 2, 1 }; // sine coefficients double[] cb = { 1, 2, 3, 4, 5, 6 }; double[] sb = { 3, 2, 1 }; double[] cc = { 2, 1 }; double[] S2 = { 0 }; double a = 1; SphericalHarmonic2 h = new SphericalHarmonic2( ca, sa, N, N, N, cb, sb, N1, N1, N1, cc, S2, N2, N2, 0, a, SphericalHarmonic2.Normalization.SCHMIDT); double tau1 = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h.HarmonicSum(tau1, tau2, x, y, z, out vx, out vy, out vz); Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz)); } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-TransverseMercator.cs0000644000771000077100000000215314064202371025247 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_TransverseMercator { class Program { static void Main(string[] args) { try { TransverseMercator proj = new TransverseMercator(); // WGS84 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, out x, out y); Console.WriteLine(String.Format("{0} {1}", x, y)); } { // Sample reverse calculation double x = 25e3, y = 4461e3; double lat, lon; proj.Reverse(lon0, x, y, out lat, out lon); Console.WriteLine(String.Format("{0} {1}", lat, lon)); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-TransverseMercatorExact.cs0000644000771000077100000000217214064202371026235 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_TransverseMercatorExact { class Program { static void Main(string[] args) { try { TransverseMercatorExact proj = new TransverseMercatorExact(); // WGS84 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, out x, out y); Console.WriteLine(String.Format("{0} {1}", x, y)); } { // Sample reverse calculation double x = 25e3, y = 4461e3; double lat, lon; proj.Reverse(lon0, x, y, out lat, out lon); Console.WriteLine(String.Format("{0} {1}", lat, lon)); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/CS/example-UTMUPS.cs0000644000771000077100000000254214064202371022455 0ustar ckarneyckarneyusing System; using NETGeographicLib; namespace example_UTMUPS { class Program { static void Main(string[] args) { 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, out zone, out northp, out x, out y, -1, true); string zonestr = UTMUPS.EncodeZone(zone, northp, true); Console.WriteLine(String.Format("{0} {1} {2}", zonestr, x, y)); } { // Sample reverse calculation string zonestr = "38N"; int zone; bool northp; UTMUPS.DecodeZone(zonestr, out zone, out northp); double x = 444e3, y = 3688e3; double lat, lon; UTMUPS.Reverse(zone, northp, x, y, out lat, out lon, true); Console.WriteLine(String.Format("{0} {1}", lat,lon)); } } catch (GeographicErr e) { Console.WriteLine(String.Format("Caught exception: {0}", e.Message)); } } } } GeographicLib-1.52/dotnet/examples/ManagedCPP/CMakeLists.txt0000644000771000077100000000413414064202371023571 0ustar ckarneyckarney# Compile (but don't install) a bunch of tiny example programs for # NETGeographic. 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 (EXAMPLE "net${EXAMPLE}") set (EXAMPLES ${EXAMPLES} ${EXAMPLE}) add_executable (${EXAMPLE} EXCLUDE_FROM_ALL ${EXAMPLE_SOURCE}) add_dependencies (${EXAMPLE} ${NETGEOGRAPHICLIB_LIBRARIES}) if (CMAKE_VERSION VERSION_LESS 3.12) set_target_properties (${EXAMPLE} PROPERTIES COMPILE_FLAGS "/clr") else () set_target_properties (${EXAMPLE} PROPERTIES COMMON_LANGUAGE_RUNTIME "") endif() # This is set up for Release builds only. Change # Release/NETGeographic.dll to Debug/NETGeographic_d.dll for Debug # builds. TODO: get this to work for Debug + Release. Unfortunately # generator expressions don't work in this context. set_target_properties (${EXAMPLE} PROPERTIES VS_DOTNET_REFERENCES "${PROJECT_BINARY_DIR}/bin/Release/NETGeographic.dll") endforeach () string (REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string (REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") if (MSVC AND NOT MSVC_VERSION GREATER 1600) # Disable "already imported" and "unsupported default parameter" # warnings with VS 10 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4945 /wd4564") endif () add_custom_target (netexamples DEPENDS ${EXAMPLES}) get_target_property (_LIBTYPE ${PROJECT_LIBRARIES} TYPE) if (_LIBTYPE STREQUAL "SHARED_LIBRARY") # Copy the shared library on Windows systems to this directory # (examples) so that the tests can be run. add_custom_command (TARGET netexamples POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CFG_INTDIR} COMMENT "Copying shared library to examples directory") endif () # Put all the examples into a folder in the IDE set_property (TARGET netexamples ${EXAMPLES} PROPERTY FOLDER dotNET-examples) GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Accumulator.cpp0000644000771000077100000000135714064202371025451 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { // Compare using Accumulator and ordinary summation for a sum of large and // small terms. double sum = 0; Accumulator^ acc = gcnew Accumulator(); acc->Assign( 0.0 ); sum += 1e20; sum += 1; sum += 2; sum += 100; sum += 5000; sum += -1e20; acc->Sum( 1e20 ); acc->Sum( 1 ); acc->Sum( 2 ); acc->Sum( 100 ); acc->Sum( 5000 ); acc->Sum( -1e20 ); Console::WriteLine(String::Format("{0} {1}", sum, acc->Result())); } catch (GeographicErr^ e) { Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) ); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-AlbersEqualArea.cpp0000644000771000077100000000260314064202371026156 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { const double lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels k1 = 1, // scale lon0 = -77 - 45/60.0; // Central meridian // Set up basic projection AlbersEqualArea^ albers = gcnew AlbersEqualArea( Constants::WGS84::EquatorialRadius, Constants::WGS84::Flattening, 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); Console::WriteLine( String::Format("X: {0} Y: {1}", x, y ) ); } { // Sample conversion from Albers Equal Area grid to geodetic double x = 220e3, y = -53e3; double lat, lon; albers->Reverse(lon0, x, y, lat, lon); Console::WriteLine( String::Format("Latitude: {0} Longitude: {1}", lat, lon ) ); } } catch (GeographicErr^ e) { Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) ); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-AzimuthalEquidistant.cpp0000644000771000077100000000177414064202371027346 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { Geodesic^ geod = gcnew Geodesic(); // WGS84 const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris AzimuthalEquidistant^ proj = gcnew AzimuthalEquidistant(geod); { // Sample forward calculation double lat = 50.9, lon = 1.8; // Calais double x, y; proj->Forward(lat0, lon0, lat, lon, x, y); Console::WriteLine( String::Format("X: {0} Y: {1}", x, y ) ); } { // Sample reverse calculation double x = -38e3, y = 230e3; double lat, lon; proj->Reverse(lat0, lon0, x, y, lat, lon); Console::WriteLine( String::Format("Latitude: {0} Longitude: {1}", lat, lon ) ); } } catch (GeographicErr^ e) { Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) ); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-CassiniSoldner.cpp0000644000771000077100000000173614064202371026113 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { Geodesic^ geod = gcnew Geodesic(); // WGS84 const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris CassiniSoldner^ proj = gcnew CassiniSoldner(lat0, lon0, geod); { // Sample forward calculation double lat = 50.9, lon = 1.8; // Calais double x, y; proj->Forward(lat, lon, x, y); Console::WriteLine(String::Format("X: {0} Y: {1}", x, y)); } { // Sample reverse calculation double x = -38e3, y = 230e3; double lat, lon; proj->Reverse(x, y, lat, lon); Console::WriteLine(String::Format("Latitude: {0} Longitude: {1}", lat, lon)); } } catch (GeographicErr^ e) { Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) ); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-CircularEngine.cpp0000644000771000077100000000207114064202371026056 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { // 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 array^ ca = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients array^ sa = {6, 5, 4, 3, 2, 1}; // sine coefficients double a = 1; SphericalHarmonic^ h = gcnew SphericalHarmonic(ca, sa, N, a, SphericalHarmonic::Normalization::SCHMIDT); double x = 2, y = 3, z = 1, p = Math::Sqrt(x*x+y*y); CircularEngine^ circ = h->Circle(p, z, true); double v, vx, vy, vz; v = circ->LongitudeSum(x/p, y/p, vx, vy, vz); Console::WriteLine(String::Format("{0} {1} {2} {3}", v, vx, vy, vz)); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-DMS.cpp0000644000771000077100000000124014064202371023604 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { { System::String^ dms = "30d14'45.6\"S"; DMS::Flag type; double ang = DMS::Decode(dms, type); Console::WriteLine(String::Format("Type: {0} String: {1}", type, ang)); } { double ang = -30.245715; System::String^ dms = DMS::Encode(ang, 6, DMS::Flag::LATITUDE, 0); Console::WriteLine(String::Format("Latitude: {0}", dms)); } } catch (GeographicErr^ e) { Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) ); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Ellipsoid.cpp0000644000771000077100000000200214064202371025102 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { Ellipsoid^ wgs84 = gcnew Ellipsoid( Constants::WGS84::EquatorialRadius, Constants::WGS84::Flattening ); // Alternatively: Ellipsoid^ wgs84 = gcnew Ellipsoid(); Console::WriteLine( String::Format( "The latitude half way between the equator and the pole is {0}", wgs84->InverseRectifyingLatitude(45)) ); Console::WriteLine( String::Format( "Half the area of the ellipsoid lies between latitudes +/- {0}", wgs84->InverseAuthalicLatitude(30))); ; Console::WriteLine( String::Format( "The northernmost edge of a square Mercator map is at latitude {0}", wgs84->InverseIsometricLatitude(180))); } catch (GeographicErr^ e) { Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) ); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-EllipticFunction.cpp0000644000771000077100000000403514064202371026441 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { EllipticFunction^ ell = gcnew EllipticFunction(0.1, 1.0); // parameter m = 0.1 // See Abramowitz and Stegun, table 17.1 Console::WriteLine( String::Format( "{0} {1}", ell->K(), ell->E())); double phi = 20 * Math::Acos(-1.0) / 180.0;; // See Abramowitz and Stegun, table 17.6 with // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg Console::WriteLine( String::Format("{0} {1}", ell->E(phi), ell->E(Math::Sin(phi), Math::Cos(phi), Math::Sqrt(1 - ell->k2 * Math::Sin(phi) * Math::Sin(phi))) ) ); // See Carlson 1995, Sec 3. Console::WriteLine(String::Format("RF(1,2,0) = {0}", EllipticFunction::RF(1,2))); Console::WriteLine(String::Format("RF(2,3,4) = {0}", EllipticFunction::RF(2,3,4))); Console::WriteLine(String::Format("RC(0,1/4) = {0}", EllipticFunction::RC(0,0.25))); Console::WriteLine(String::Format("RC(9/4,2) = {0}", EllipticFunction::RC(2.25,2))); Console::WriteLine(String::Format("RC(1/4,-2) = {0}", EllipticFunction::RC(0.25,-2))); Console::WriteLine(String::Format("RJ(0,1,2,3) = {0}", EllipticFunction::RJ(0,1,2,3))); Console::WriteLine(String::Format("RJ(2,3,4,5) = {0}", EllipticFunction::RJ(2,3,4,5))); Console::WriteLine(String::Format("RD(0,2,1) = {0}", EllipticFunction::RD(0,2,1))); Console::WriteLine(String::Format("RD(2,3,4) = {0}", EllipticFunction::RD(2,3,4))); Console::WriteLine(String::Format("RG(0,16,16) = {0}", EllipticFunction::RG(16,16))); Console::WriteLine(String::Format("RG(2,3,4) = {0}", EllipticFunction::RG(2,3,4))); Console::WriteLine(String::Format("RG(0,0.0796,4) = {0}", EllipticFunction::RG(0.0796, 4))); } catch (GeographicErr^ e) { Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) ); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-GARS.cpp0000644000771000077100000000164614064202371023727 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { { // Sample forward calculation double lat = 57.64911, lon = 10.40744; // Jutland String^ gars; for (int prec = 0; prec <= 2; ++prec) { GARS::Forward(lat, lon, prec, gars); Console::WriteLine(String::Format("Precision: {0} GARS: {1}", prec, gars)); } } { // Sample reverse calculation String^ gars = gcnew String("381NH45"); double lat, lon; for (int len = 5; len <= gars->Length; ++len) { int prec; GARS::Reverse(gars->Substring(0, len), lat, lon, prec, true); Console::WriteLine(String::Format("Precision: {0} Latitude: {1} Longitude {2}", prec, lat, lon)); } } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught Exception {0}", e->Message)); return 1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-GeoCoords.cpp0000644000771000077100000000141214064202371025046 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { // Miscellaneous conversions double lat = 33.3, lon = 44.4; GeoCoords^ c = gcnew GeoCoords(lat, lon, -1); Console::WriteLine(c->MGRSRepresentation(-3)); c->Reset("18TWN0050", true, false); Console::WriteLine(c->DMSRepresentation(0, false, 0)); Console::WriteLine(String::Format("Latitude: {0} Longitude: {1}", c->Latitude, c->Longitude)); c->Reset("1d38'W 55d30'N", true, false); Console::WriteLine(c->GeoRepresentation(0, false)); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Geocentric.cpp0000644000771000077100000000224114064202371025245 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { Geocentric^ earth = gcnew Geocentric( Constants::WGS84::EquatorialRadius, Constants::WGS84::Flattening); // Alternatively: Geocentric earth = new Geocentric(); { // 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); Console::WriteLine( String::Format( "{0} {1} {2}", Math::Floor(X / 1000 + 0.5), Math::Floor(Y / 1000 + 0.5), Math::Floor(Z / 1000 + 0.5) ) ); } { // Sample reverse calculation double X = 302e3, Y = 5636e3, Z = 2980e3; double lat, lon, h; earth->Reverse(X, Y, Z, lat, lon, h); Console::WriteLine(String::Format("{0} {1} {2}", lat, lon, h)); } } catch (GeographicErr^ e) { Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) ); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Geodesic-small.cpp0000644000771000077100000000054614064202371026021 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main() { Geodesic^ geod = gcnew Geodesic(); // 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); Console::WriteLine( s12 / 1000 + " km" ); return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Geodesic.cpp0000644000771000077100000000217614064202371024714 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { Geodesic^ geod = gcnew Geodesic( Constants::WGS84::EquatorialRadius, Constants::WGS84::Flattening ); // Alternatively: Geodesic^ geod = gcnew Geodesic(); { // 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); Console::WriteLine(String::Format("Latitude: {0} Longitude: {1}", lat2, lon2)); } { // 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); Console::WriteLine( s12 ); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-GeodesicExact.cpp0000644000771000077100000000223214064202371025672 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { GeodesicExact^ geod = gcnew GeodesicExact( Constants::WGS84::EquatorialRadius, Constants::WGS84::Flattening ); // Alternatively: GeodesicExact^ geod = gcnew GeodesicExact(); { // 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); Console::WriteLine(String::Format("Latitude: {0} Longitude: {1}", lat2, lon2)); } { // 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); Console::WriteLine(s12); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-GeodesicLine.cpp0000644000771000077100000000317214064202371025521 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { // Print waypoints between JFK and SIN Geodesic^ geod = gcnew 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); GeodesicLine^ line = gcnew GeodesicLine(geod, lat1, lon1, azi1, Mask::ALL); // Alternatively // const GeographicLib::GeodesicLine line = geod.Line(lat1, lon1, azi1); double ds0 = 500e3; // Nominal distance between points = 500 km int num = int(Math::Ceiling(s12 / ds0)); // The number of intervals { // 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); Console::WriteLine( String::Format( "i: {0} Latitude: {1} Longitude: {2}", i, lat, lon )); } } { // 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); Console::WriteLine( String::Format( "i: {0} Latitude: {1} Longitude: {2}", i, lat, lon )); } } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-GeodesicLineExact.cpp0000644000771000077100000000321614064202371026505 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { // Print waypoints between JFK and SIN GeodesicExact^ geod = gcnew GeodesicExact(); // 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); GeodesicLineExact^ line = gcnew GeodesicLineExact(geod, lat1, lon1, azi1, Mask::ALL); // Alternatively // const GeographicLib::GeodesicLine line = geod.Line(lat1, lon1, azi1); double ds0 = 500e3; // Nominal distance between points = 500 km int num = int(Math::Ceiling(s12 / ds0)); // The number of intervals { // 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); Console::WriteLine( String::Format( "i: {0} Latitude: {1} Longitude: {2}", i, lat, lon )); } } { // 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); Console::WriteLine( String::Format( "i: {0} Latitude: {1} Longitude: {2}", i, lat, lon )); } } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Geohash.cpp0000644000771000077100000000212314064202371024540 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { { // Sample forward calculation double lat = 57.64911, lon = 10.40744; // Jutland (the wikipedia example) String^ geohash; int maxlen = Geohash::GeohashLength(1.0e-5); for (int len = 0; len <= maxlen; ++len) { Geohash::Forward(lat, lon, len, geohash); Console::WriteLine( geohash ); } } { // Sample reverse calculation String^ geohash = "u4pruydqqvj"; double lat, lon; for (int i = 0; i <= geohash->Length; ++i) { int len; Geohash::Reverse(geohash->Substring(0, i), lat, lon, len, true); Console::WriteLine(String::Format("Length: {0} Latitude: {1} Longitude: {2}", len, lat, lon ) ); } } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Geoid.cpp0000644000771000077100000000132314064202371024212 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { Geoid^ egm96 = gcnew Geoid("egm96-5", "", true, false); // Convert height above egm96 to height above the ellipsoid double lat = 42, lon = -75, height_above_geoid = 20; double geoid_height = egm96->Height(lat, lon), height_above_ellipsoid = (height_above_geoid + (double)Geoid::ConvertFlag::GEOIDTOELLIPSOID * geoid_height); Console::WriteLine(height_above_ellipsoid); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Georef.cpp0000644000771000077100000000230714064202371024375 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { { // Sample forward calculation double lat = 57.64911, lon = 10.40744; // Jutland String^ georef; for (int prec = -1; prec <= 11; ++prec) { Georef::Forward(lat, lon, prec, georef); Console::WriteLine(String::Format("Precision: {0} Georef: {1}", prec, georef)); } } { // Sample reverse calculation String^ georef = gcnew String("NKLN2444638946"); double lat, lon; int prec; Georef::Reverse(georef->Substring(0, 2), lat, lon, prec, true); Console::WriteLine(String::Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon)); Georef::Reverse(georef->Substring(0, 4), lat, lon, prec, true); Console::WriteLine(String::Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon)); Georef::Reverse(georef, lat, lon, prec, true); Console::WriteLine(String::Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon)); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught Exception {0}", e->Message)); return 1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Gnomonic.cpp0000644000771000077100000000173214064202371024740 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { Geodesic^ geod = gcnew Geodesic(); // WGS84 const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris Gnomonic^ proj = gcnew Gnomonic(geod); { // Sample forward calculation double lat = 50.9, lon = 1.8; // Calais double x, y; proj->Forward(lat0, lon0, lat, lon, x, y); Console::WriteLine(String::Format("X: {0} Y: {1}", x, y)); } { // Sample reverse calculation double x = -38e3, y = 230e3; double lat, lon; proj->Reverse(lat0, lon0, x, y, lat, lon); Console::WriteLine(String::Format("Latitude: {0} Longitude: {1}", lat, lon)); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-GravityCircle.cpp0000644000771000077100000000244714064202371025742 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { GravityModel^ grav = gcnew GravityModel("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); Console::WriteLine(String::Format("{0} {1} {2} {3}", lon, gx, gy, gz)); } } { // Fast method of evaluating the values at several points on a circle of // latitude using GravityCircle. GravityCircle^ circ = grav->Circle(lat, h, GravityModel::Mask::ALL); for (int i = -5; i <= 5; ++i) { double lon = lon0 + i * 0.2; double gx, gy, gz; circ->Gravity(lon, gx, gy, gz); Console::WriteLine(String::Format("{0} {1} {2} {3}", lon, gx, gy, gz)); } } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-GravityModel.cpp0000644000771000077100000000104214064202371025567 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { GravityModel^ grav = gcnew GravityModel("egm96",""); double lat = 27.99, lon = 86.93, h = 8820; // Mt Everest double gx, gy, gz; grav->Gravity(lat, lon, h, gx, gy, gz); Console::WriteLine(String::Format("{0} {1} {2}", gx, gy, gz)); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-LambertConformalConic.cpp0000644000771000077100000000342114064202371027367 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { // Define the Pennsylvania South state coordinate system EPSG:3364 // http://www.spatialreference.org/ref/epsg/3364/ const double 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 LambertConformalConic^ PASouth = gcnew LambertConformalConic( Constants::WGS84::EquatorialRadius, Constants::WGS84::Flattening, 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; Console::WriteLine( String::Format("{0} {1}", x, y) ); } { // 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); Console::WriteLine( String::Format("{0} {1}", lat, lon) ); } } catch (GeographicErr^ e) { Console::WriteLine( String::Format("Caught exception: {0}", e->Message) ); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-LocalCartesian.cpp0000644000771000077100000000176014064202371026054 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { Geocentric^ earth = gcnew Geocentric(); const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris LocalCartesian^ proj = gcnew LocalCartesian(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); Console::WriteLine(String::Format("{0} {1} {2}", x, y, z)); } { // Sample reverse calculation double x = -38e3, y = 230e3, z = -4e3; double lat, lon, h; proj->Reverse(x, y, z, lat, lon, h); Console::WriteLine(String::Format("{0} {1} {2}", lat, lon, h)); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-MGRS.cpp0000644000771000077100000000214714064202371023740 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { 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, -1, true); String^ mgrs; MGRS::Forward(zone, northp, x, y, lat, 5, mgrs); Console::WriteLine(mgrs); } { // Sample reverse calculation String^ mgrs = "38SMB4488"; int zone, prec; bool northp; double x, y; MGRS::Reverse(mgrs, zone, northp, x, y, prec, true); double lat, lon; UTMUPS::Reverse(zone, northp, x, y, lat, lon, true); Console::WriteLine(String::Format("Latitude: {0} Longitude: {1}", lat, lon)); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-MagneticCircle.cpp0000644000771000077100000000243414064202371026040 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { MagneticModel^ mag = gcnew MagneticModel("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->Field(t, lat, lon, h, Bx, By, Bz); Console::WriteLine(String::Format("{0} {1} {2} {3}", lon, Bx, By, Bz)); } } { // 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->Field(lon, Bx, By, Bz); Console::WriteLine(String::Format("{0} {1} {2} {3}", lon, Bx, By, Bz)); } } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-MagneticModel.cpp0000644000771000077100000000121514064202371025673 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { MagneticModel^ mag = gcnew MagneticModel("wmm2010",""); double lat = 27.99, lon = 86.93, h = 8820, t = 2012; // Mt Everest double Bx, By, Bz; mag->Field(t, lat,lon, h, Bx, By, Bz); double H, F, D, I; MagneticModel::FieldComponents(Bx, By, Bz, H, F, D, I); Console::WriteLine(String::Format("{0} {1} {2} {3}", H, F, D, I)); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-NormalGravity.cpp0000644000771000077100000000106414064202371025763 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { NormalGravity^ grav = gcnew NormalGravity(NormalGravity::StandardModels::WGS84); double lat = 27.99, h = 8820; // Mt Everest double gammay, gammaz; grav->Gravity(lat, h, gammay, gammaz); Console::WriteLine(String::Format("{0} {1}", gammay, gammaz)); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-OSGB.cpp0000644000771000077100000000211314064202371023713 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { { // Sample forward calculation from // A guide to coordinate systems in Great Britain double lat = DMS::Decode(52,39,27.2531), lon = DMS::Decode( 1,43, 4.5177); double x, y; OSGB::Forward(lat, lon, x, y); String^ gridref; OSGB::GridReference(x, y, 2, gridref); Console::WriteLine(String::Format("{0} {1} {2}", x, y, gridref)); } { // Sample reverse calculation String^ gridref = "TG5113"; double x, y; int prec; OSGB::GridReference(gridref, x, y, prec, true); double lat, lon; OSGB::Reverse(x, y, lat, lon); Console::WriteLine(String::Format("{0} {1} {2}", prec, lat, lon)); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return 0; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-PolarStereographic.cpp0000644000771000077100000000157214064202371026766 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { PolarStereographic^ proj = gcnew PolarStereographic(); // WGS84 bool northp = true; { // Sample forward calculation double lat = 61.2, lon = -149.9; // Anchorage double x, y; proj->Forward(northp, lat, lon, x, y); Console::WriteLine(String::Format("{0} {1}", x, y)); } { // Sample reverse calculation double x = -1637e3, y = 2824e3; double lat, lon; proj->Reverse(northp, x, y, lat, lon); Console::WriteLine(String::Format("{0} {1}", lat, lon)); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-PolygonArea.cpp0000644000771000077100000000140314064202371025402 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { Geodesic^ geod = gcnew Geodesic(); // WGS84 PolygonArea^ poly = gcnew PolygonArea(geod, true); 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 int n = poly->Compute(false, true, perimeter, area); Console::WriteLine(String::Format("{0} {1} {2}", n, perimeter, area)); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-Rhumb.cpp0000644000771000077100000000175614064202371024252 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/ ) { try { Rhumb^ rhumb = gcnew Rhumb(Constants::WGS84::EquatorialRadius, Constants::WGS84::Flattening, true); // Alternatively: const Rhumb& rhumb = Rhumb::WGS84(); { // Sample direct calculation, travelling about NE from JFK double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi12 = 51; double lat2, lon2; rhumb->Direct(lat1, lon1, azi12, s12, lat2, lon2); Console::WriteLine( "{0} {1}", lat2, lon2 ); } { // 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, azi12; rhumb->Inverse(lat1, lon1, lat2, lon2, s12, azi12); Console::WriteLine( "{0} {1}", s12, azi12 ); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-RhumbLine.cpp0000644000771000077100000000225214064202371025052 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { // Print waypoints between JFK and SIN Rhumb^ rhumb = gcnew Rhumb(Constants::WGS84::EquatorialRadius, Constants::WGS84::Flattening, true); // Alternatively: const Rhumb& rhumb = Rhumb::WGS84(); double lat1 = 40.640, lon1 = -73.779, // JFK lat2 = 1.359, lon2 = 103.989; // SIN double s12, azi12; rhumb->Inverse(lat1, lon1, lat2, lon2, s12, azi12); RhumbLine^ line = rhumb->Line(lat1, lon1, azi12); // Alternatively // const GeographicLib::RhumbLine line = rhumb.Line(lat1, lon1, azi1); double ds0 = 500e3; // Nominal distance between points = 500 km int num = int(Math::Ceiling(s12 / ds0)); // The number of intervals { // 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); Console::WriteLine( "{0} {1} {2}", i, lat, lon ); } } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-SphericalHarmonic.cpp0000644000771000077100000000145514064202371026564 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { int N = 3; // The maximum degree array^ ca = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients array^ sa = {6, 5, 4, 3, 2, 1}; // sine coefficients double a = 1; SphericalHarmonic^ h = gcnew SphericalHarmonic(ca, sa, N, a, SphericalHarmonic::Normalization::SCHMIDT); double x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h->HarmonicSum(x, y, z, vx, vy, vz); Console::WriteLine(String::Format("{0} {1} {2} {3}", v, vx, vy, vz)); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-SphericalHarmonic1.cpp0000644000771000077100000000165414064202371026646 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { int N = 3, N1 = 2; // The maximum degrees array^ ca = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients array^ sa = {6, 5, 4, 3, 2, 1}; // sine coefficients array^ cb = {1, 2, 3, 4, 5, 6}; array^ sb = {3, 2, 1}; double a = 1; SphericalHarmonic1^ h = gcnew SphericalHarmonic1(ca, sa, N, cb, sb, N1, a, SphericalHarmonic1::Normalization::SCHMIDT); double tau = 0.1, x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h->HarmonicSum(tau, x, y, z, vx, vy, vz); Console::WriteLine(String::Format("{0} {1} {2} {3}", v, vx, vy, vz)); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-SphericalHarmonic2.cpp0000644000771000077100000000224314064202371026642 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { int N = 3, N1 = 2, N2 = 1; // The maximum degrees array^ ca = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; // cosine coefficients array^ sa = { 6, 5, 4, 3, 2, 1 }; // sine coefficients array^ cb = { 1, 2, 3, 4, 5, 6 }; array^ sb = { 3, 2, 1 }; array^ cc = { 2, 1 }; array^ S2 = { 0 }; double a = 1; SphericalHarmonic2^ h = gcnew SphericalHarmonic2( ca, sa, N, N, N, cb, sb, N1, N1, N1, cc, S2, N2, N2, 0, a, SphericalHarmonic2::Normalization::SCHMIDT); double tau1 = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1; double v, vx, vy, vz; v = h->HarmonicSum(tau1, tau2, x, y, z, vx, vy, vz); Console::WriteLine(String::Format("{0} {1} {2} {3}", v, vx, vy, vz)); } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-TransverseMercator.cpp0000644000771000077100000000164214064202371027020 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { TransverseMercator^ proj = gcnew TransverseMercator(); // WGS84 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); Console::WriteLine(String::Format("{0} {1}", x, y)); } { // Sample reverse calculation double x = 25e3, y = 4461e3; double lat, lon; proj->Reverse(lon0, x, y, lat, lon); Console::WriteLine(String::Format("{0} {1}", lat, lon)); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-TransverseMercatorExact.cpp0000644000771000077100000000165414064202371030010 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { try { TransverseMercatorExact^ proj = gcnew TransverseMercatorExact(); // WGS84 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); Console::WriteLine(String::Format("{0} {1}", x, y)); } { // Sample reverse calculation double x = 25e3, y = 4461e3; double lat, lon; proj->Reverse(lon0, x, y, lat, lon); Console::WriteLine(String::Format("{0} {1}", lat, lon)); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/ManagedCPP/example-UTMUPS.cpp0000644000771000077100000000214614064202371024224 0ustar ckarneyckarneyusing namespace System; using namespace NETGeographicLib; int main(array ^/*args*/) { 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, -1, true); String^ zonestr = UTMUPS::EncodeZone(zone, northp, true); Console::WriteLine(String::Format("{0} {1} {2}", zonestr, x, y)); } { // 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, true); Console::WriteLine(String::Format("{0} {1}", lat,lon)); } } catch (GeographicErr^ e) { Console::WriteLine(String::Format("Caught exception: {0}", e->Message)); return -1; } return 0; } GeographicLib-1.52/dotnet/examples/VB/example-Accumulator.vb0000644000771000077100000000135514064202371023704 0ustar ckarneyckarneyImports NETGeographicLib Module example_Accumulator Public Sub Main() Try ' Compare using Accumulator and ordinary summation for a sum of large and ' small terms. Dim sum As Double = 0.0 Dim acc As Accumulator = New Accumulator() acc.Assign(0.0) sum += 1.0E+20 : sum += 1 : sum += 2 : sum += 100 : sum += 5000 sum += -1.0E+20 : acc.Sum(1.0E+20) : acc.Sum(1) : acc.Sum(2) : acc.Sum(100) : acc.Sum(5000) : acc.Sum(-1.0E+20) Console.WriteLine(String.Format("{0} {1}", sum, acc.Result())) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-AlbersEqualArea.vb0000644000771000077100000000243614064202371024417 0ustar ckarneyckarneyImports NETGeographicLib Module example_AlbersEqualArea Sub Main() Try Dim lat1 As Double = 40 + 58 / 60.0 : Dim lat2 As Double = 39 + 56 / 60.0 ' standard parallels Dim k1 As Double = 1 ' scale Dim lon0 As Double = -77 - 45 / 60.0 ' Central meridian ' Set up basic projection Dim albers As AlbersEqualArea = New AlbersEqualArea(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening, lat1, lat2, k1) ' Sample conversion from geodetic to Albers Equal Area Dim lat As Double = 39.95 : Dim lon As Double = -75.17 ' Philadelphia Dim x, y As Double albers.Forward(lon0, lat, lon, x, y) Console.WriteLine(String.Format("X: {0} Y: {1}", x, y)) ' Sample conversion from Albers Equal Area grid to geodetic x = 220000.0 : y = -53000.0 albers.Reverse(lon0, x, y, lat, lon) Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-AzimuthalEquidistant.vb0000644000771000077100000000164114064202371025574 0ustar ckarneyckarneyImports NETGeographicLib Module example_AzimuthalEquidistant Sub Main() Try Dim geod As Geodesic = New Geodesic() ' WGS84 Dim lat0 As Double = 48 + 50 / 60.0, lon0 = 2 + 20 / 60.0 ' Paris Dim proj As AzimuthalEquidistant = New AzimuthalEquidistant(geod) ' Sample forward calculation Dim lat As Double = 50.9, lon = 1.8 ' Calais Dim x, y As Double proj.Forward(lat0, lon0, lat, lon, x, y) Console.WriteLine(String.Format("X: {0} Y: {1}", x, y)) ' Sample reverse calculation x = -38000.0 : y = 230000.0 proj.Reverse(lat0, lon0, x, y, lat, lon) Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-CassiniSoldner.vb0000644000771000077100000000160314064202371024341 0ustar ckarneyckarneyImports NETGeographicLib Module example_CassiniSoldner Sub Main() Try Dim geod As Geodesic = New Geodesic() ' WGS84 Dim lat0 As Double = 48 + 50 / 60.0, lon0 = 2 + 20 / 60.0 ' Paris Dim proj As CassiniSoldner = New CassiniSoldner(lat0, lon0, geod) ' Sample forward calculation Dim lat As Double = 50.9, lon = 1.8 ' Calais Dim x, y As Double proj.Forward(lat, lon, x, y) Console.WriteLine(String.Format("X: {0} Y: {1}", x, y)) ' Sample reverse calculation x = -38000.0 : y = 230000.0 proj.Reverse(x, y, lat, lon) Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-CircularEngine.vb0000644000771000077100000000212714064202371024315 0ustar ckarneyckarneyImports NETGeographicLib Module example_CircularEngine Sub 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 Dim N As Integer = 3 ' The maxium degree Dim ca As Double() = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1} ' cosine coefficients Dim sa As Double() = {6, 5, 4, 3, 2, 1} ' sine coefficients Dim a As Double = 1 Dim h As SphericalHarmonic = New SphericalHarmonic(ca, sa, N, a, SphericalHarmonic.Normalization.SCHMIDT) Dim x As Double = 2, y = 3, z = 1, p = Math.Sqrt(x * x + y * y) Dim circ As CircularEngine = h.Circle(p, z, True) Dim v, vx, vy, vz As Double v = circ.LongitudeSum(x / p, y / p, vx, vy, vz) Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-DMS.vb0000644000771000077100000000120214064202371022037 0ustar ckarneyckarneyImports NETGeographicLib Module example_DMS Sub Main() Try Dim desc As String = "30d14'45.6""S" Dim type As DMS.Flag Dim ang As Double = DMS.Decode(desc, type) Console.WriteLine(String.Format("Type: {0} String: {1}", type, ang)) ang = -30.245715 Dim prec As UInteger = 6 desc = DMS.Encode(ang, prec, DMS.Flag.LATITUDE, 0) Console.WriteLine(String.Format("Latitude: {0}", desc)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-Ellipsoid.vb0000644000771000077100000000176514064202371023356 0ustar ckarneyckarneyImports NETGeographicLib Module example_Ellipsoid Sub Main() Try Dim wgs84 As Ellipsoid = New Ellipsoid(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening) ' Alternatively: Dim wgs84 As Ellipsoid = new Ellipsoid() Console.WriteLine(String.Format( "The latitude half way between the equator and the pole is {0}", wgs84.InverseRectifyingLatitude(45))) Console.WriteLine(String.Format( "Half the area of the ellipsoid lies between latitudes +/- {0}", wgs84.InverseAuthalicLatitude(30))) Console.WriteLine(String.Format( "The northernmost edge of a square Mercator map is at latitude {0}", wgs84.InverseIsometricLatitude(180))) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-EllipticFunction.vb0000644000771000077100000000401214064202371024671 0ustar ckarneyckarneyImports NETGeographicLib Module example_EllipticFunction Sub Main() Try Dim ell As EllipticFunction = New EllipticFunction(0.1, 1.0) ' See Abramowitz and Stegun, table 17.1 Console.WriteLine(String.Format("{0} {1}", ell.K(), ell.E())) Dim phi As Double = 20 * Math.Acos(-1.0) / 180.0 ' See Abramowitz and Stegun, table 17.6 with ' alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg Console.WriteLine(String.Format("{0} {1}", ell.E(phi), ell.E(Math.Sin(phi), Math.Cos(phi), Math.Sqrt(1 - ell.k2 * Math.Sin(phi) * Math.Sin(phi))))) ' See Carlson 1995, Sec 3. Console.WriteLine(String.Format("RF(1,2,0) = {0}", EllipticFunction.RF(1, 2))) Console.WriteLine(String.Format("RF(2,3,4) = {0}", EllipticFunction.RF(2, 3, 4))) Console.WriteLine(String.Format("RC(0,1/4) = {0}", EllipticFunction.RC(0, 0.25))) Console.WriteLine(String.Format("RC(9/4,2) = {0}", EllipticFunction.RC(2.25, 2))) Console.WriteLine(String.Format("RC(1/4,-2) = {0}", EllipticFunction.RC(0.25, -2))) Console.WriteLine(String.Format("RJ(0,1,2,3) = {0}", EllipticFunction.RJ(0, 1, 2, 3))) Console.WriteLine(String.Format("RJ(2,3,4,5) = {0}", EllipticFunction.RJ(2, 3, 4, 5))) Console.WriteLine(String.Format("RD(0,2,1) = {0}", EllipticFunction.RD(0, 2, 1))) Console.WriteLine(String.Format("RD(2,3,4) = {0}", EllipticFunction.RD(2, 3, 4))) Console.WriteLine(String.Format("RG(0,16,16) = {0}", EllipticFunction.RG(16, 16))) Console.WriteLine(String.Format("RG(2,3,4) = {0}", EllipticFunction.RG(2, 3, 4))) Console.WriteLine(String.Format("RG(0,0.0796,4) = {0}", EllipticFunction.RG(0.0796, 4))) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-GARS.vb0000644000771000077100000000165614064202371022165 0ustar ckarneyckarneyImports NETGeographicLib Module example_GARS Sub Main() Try ' Sample forward calculation Dim lat As Double = 57.64911, lon = 10.40744 Dim garstring As String For prec As Integer = 0 To 2 GARS.Forward(lat, lon, prec, garstring) Console.WriteLine(String.Format("Precision: {0} GARS: {1}", prec, garstring)) Next ' Sample reverse calculation garstring = "381NH45" For len As Integer = 5 To garstring.Length Dim prec As Integer GARS.Reverse(garstring.Substring(0, len), lat, lon, prec, True) Console.WriteLine(String.Format("Precision: {0} Latitude: {1} Longitude {2}", prec, lat, lon)) Next Catch ex As GeographicErr Console.WriteLine(String.Format("Caught Exception {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-GeoCoords.vb0000644000771000077100000000137314064202371023311 0ustar ckarneyckarneyImports NETGeographicLib Module example_GeoCoords Sub Main() Try ' Miscellaneous conversions Dim lat As Double = 33.3, lon = 44.4 Dim c As GeoCoords = New GeoCoords(lat, lon, -1) Console.WriteLine(c.MGRSRepresentation(-3)) c.Reset("18TWN0050", True, False) Console.WriteLine(c.DMSRepresentation(0, False, 0)) Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", c.Latitude, c.Longitude)) c.Reset("1d38'W 55d30'N", True, False) Console.WriteLine(c.GeoRepresentation(0, False)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-Geocentric.vb0000644000771000077100000000206414064202371023505 0ustar ckarneyckarneyImports NETGeographicLib Module example_Geocentric Sub Main() Try Dim earth As Geocentric = New Geocentric(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening) ' Alternatively: Geocentric earth = new Geocentric(); ' Sample forward calculation Dim lat As Double = 27.99, lon = 86.93, h = 8820 ' Mt Everest Dim X, Y, Z As Double earth.Forward(lat, lon, h, X, Y, Z) Console.WriteLine(String.Format("{0} {1} {2}", Math.Floor(X / 1000 + 0.5), Math.Floor(Y / 1000 + 0.5), Math.Floor(Z / 1000 + 0.5))) ' Sample reverse calculation X = 302000.0 : Y = 5636000.0 : Z = 2980000.0 earth.Reverse(X, Y, Z, lat, lon, h) Console.WriteLine(String.Format("{0} {1} {2}", lat, lon, h)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-Geodesic.vb0000644000771000077100000000202014064202371023135 0ustar ckarneyckarneyImports NETGeographicLib Module example_Geodesic Sub Main() Try Dim geod As Geodesic = New Geodesic(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening) ' Alternatively: Dim geod As Geodesic = new Geodesic() ' Sample direct calculation, travelling about NE from JFK Dim lat1 As Double = 40.6, lon1 = -73.8, s12 = 5500000.0, azi1 = 51 Dim lat2, lon2 As Double geod.Direct(lat1, lon1, azi1, s12, lat2, lon2) Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat2, lon2)) ' Sample inverse calculation, JFK to LHR lat1 = 40.6 : lon1 = -73.8 ' JFK Airport lat2 = 51.6 : lon2 = -0.5 ' LHR Airport geod.Inverse(lat1, lon1, lat2, lon2, s12) Console.WriteLine(s12) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-GeodesicExact.vb0000644000771000077100000000206314064202371024131 0ustar ckarneyckarneyImports NETGeographicLib Module example_GeodesicExact Sub Main() Try Dim geod As GeodesicExact = New GeodesicExact(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening) ' Alternatively: Dim geod As GeodesicExact = new GeodesicExact() ' Sample direct calculation, travelling about NE from JFK Dim lat1 As Double = 40.6, lon1 = -73.8, s12 = 5500000.0, azi1 = 51 Dim lat2, lon2 As Double geod.Direct(lat1, lon1, azi1, s12, lat2, lon2) Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat2, lon2)) ' Sample inverse calculation, JFK to LHR lat1 = 40.6 : lon1 = -73.8 ' JFK Airport lat2 = 51.6 : lon2 = -0.5 ' LHR Airport geod.Inverse(lat1, lon1, lat2, lon2, s12) Console.WriteLine(s12) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-GeodesicLine.vb0000644000771000077100000000312714064202371023756 0ustar ckarneyckarneyImports NETGeographicLib Module example_GeodesicLine Sub Main() Try ' Print waypoints between JFK and SIN Dim geod As Geodesic = New Geodesic() ' WGS84 Dim lat1 As Double = 40.64, lon1 = -73.779 ' JFK Dim lat2 As Double = 1.359, lon2 = 103.989 ' SIN Dim s12, azi1, azi2 As Double Dim a12 As Double = geod.Inverse(lat1, lon1, lat2, lon2, s12, azi1, azi2) Dim line As GeodesicLine = New GeodesicLine(geod, lat1, lon1, azi1, Mask.ALL) ' Alternatively Dim line As GeodesicLineExact = geod.Line(lat1, lon1, azi1, Mask.ALL) Dim ds As Double = 500000.0 ' Nominal distance between points = 500 km Dim num As Integer = CInt(Math.Ceiling(s12 / ds)) ' The number of intervals ' Use intervals of equal length ds = s12 / num For i As Integer = 0 To num Dim lat, lon As Double line.Position(i * ds, lat, lon) Console.WriteLine(String.Format("i: {0} Latitude: {1} Longitude: {2}", i, lat, lon)) Next ' Slightly faster, use intervals of equal arc length Dim da As Double = a12 / num For i As Integer = 0 To num Dim lat, lon As Double line.ArcPosition(i * da, lat, lon) Console.WriteLine(String.Format("i: {0} Latitude: {1} Longitude: {2}", i, lat, lon)) Next Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-GeodesicLineExact.vb0000644000771000077100000000316014064202371024740 0ustar ckarneyckarneyImports NETGeographicLib Module example_GeodesicLineExact Sub Main() Try ' Print waypoints between JFK and SIN Dim geod As GeodesicExact = New GeodesicExact() ' WGS84 Dim lat1 As Double = 40.64, lon1 = -73.779 ' JFK Dim lat2 As Double = 1.359, lon2 = 103.989 ' SIN Dim s12, azi1, azi2 As Double Dim a12 As Double = geod.Inverse(lat1, lon1, lat2, lon2, s12, azi1, azi2) Dim line As GeodesicLineExact = New GeodesicLineExact(geod, lat1, lon1, azi1, Mask.ALL) ' Alternatively Dim line As GeodesicLineExact = geod.Line(lat1, lon1, azi1, Mask.ALL) Dim ds As Double = 500000.0 ' Nominal distance between points = 500 km Dim num As Integer = CInt(Math.Ceiling(s12 / ds)) ' The number of intervals ' Use intervals of equal length ds = s12 / num For i As Integer = 0 To num Dim lat, lon As Double line.Position(i * ds, lat, lon) Console.WriteLine(String.Format("i: {0} Latitude: {1} Longitude: {2}", i, lat, lon)) Next ' Slightly faster, use intervals of equal arc length Dim da As Double = a12 / num For i As Integer = 0 To num Dim lat, lon As Double line.ArcPosition(i * da, lat, lon) Console.WriteLine(String.Format("i: {0} Latitude: {1} Longitude: {2}", i, lat, lon)) Next Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-Geohash.vb0000644000771000077100000000172714064202371023006 0ustar ckarneyckarneyImports NETGeographicLib Module example_Geohash Sub Main() Try ' Sample forward calculation Dim lat As Double = 57.64911, lon = 10.40744 ' Jutland (the wikipedia example) Dim ghash As String Dim maxlen As Integer = Geohash.GeohashLength(0.00001) For len As Integer = 0 To maxlen Geohash.Forward(lat, lon, len, ghash) Console.WriteLine(ghash) Next ' Sample reverse calculation ghash = "u4pruydqqvj" For i As Integer = 0 To ghash.Length - 1 Dim len As Integer Geohash.Reverse(ghash.Substring(0, i), lat, lon, len, True) Console.WriteLine(String.Format("Length: {0} Latitude: {1} Longitude: {2}", len, lat, lon)) Next Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-Geoid.vb0000644000771000077100000000130714064202371022451 0ustar ckarneyckarneyImports NETGeographicLib Module example_Geoid Sub Main() Try Dim egm96 As Geoid = New Geoid("egm96-5", "", True, False) ' Convert height above egm96 to height above the ellipsoid Dim lat As Double = 42, lon = -75, height_above_geoid = 20 Dim geoid_height As Double = egm96.Height(lat, lon) Dim height_above_ellipsoid As Double = (height_above_geoid + CDbl(Geoid.ConvertFlag.GEOIDTOELLIPSOID) * geoid_height) Console.WriteLine(height_above_ellipsoid) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-Georef.vb0000644000771000077100000000235414064202371022634 0ustar ckarneyckarneyImports NETGeographicLib Module example_Georef Sub Main() Try ' Sample forward calculation Dim lat As Double = 57.64911, lon = 10.40744 ' Jutland Dim georefstring As String For prec1 As Integer = -1 To 11 Georef.Forward(lat, lon, prec1, georefstring) Console.WriteLine(String.Format("Precision: {0} Georef: {1}", prec1, georefstring)) Next ' Sample reverse calculation georefstring = "NKLN2444638946" Dim prec As Integer Georef.Reverse(georefstring.Substring(0, 2), lat, lon, prec, True) Console.WriteLine(String.Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon)) Georef.Reverse(georefstring.Substring(0, 4), lat, lon, prec, True) Console.WriteLine(String.Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon)) Georef.Reverse(georefstring, lat, lon, prec, True) Console.WriteLine(String.Format("Precision: {0} Latitude: {1} Longitude: {2}", prec, lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught Exception {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-Gnomonic.vb0000644000771000077100000000157514064202371023202 0ustar ckarneyckarneyImports NETGeographicLib Module example_Gnomonic Sub Main() Try Dim geod As Geodesic = New Geodesic() ' WGS84 Dim lat0 As Double = 48 + 50 / 60.0, lon0 = 2 + 20 / 60.0 ' Paris Dim proj As Gnomonic = New Gnomonic(geod) ' Sample forward calculation Dim lat As Double = 50.9, lon = 1.8 ' Calais Dim x, y As Double proj.Forward(lat0, lon0, lat, lon, x, y) Console.WriteLine(String.Format("X: {0} Y: {1}", x, y)) ' Sample reverse calculation x = -38000.0 : y = 230000.0 proj.Reverse(lat0, lon0, x, y, lat, lon) Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-GravityCircle.vb0000644000771000077100000000236214064202371024173 0ustar ckarneyckarneyImports NETGeographicLib Module example_GravityCircle Sub Main() Try Dim grav As GravityModel = New GravityModel("egm96", "") Dim lat As Double = 27.99, lon0 = 86.93, h = 8820 ' Mt Everest ' Slow method of evaluating the values at several points on a circle of ' latitude. For i As Integer = -5 To 5 Dim lon As Double = lon0 + i * 0.2 Dim gx, gy, gz As Double grav.Gravity(lat, lon, h, gx, gy, gz) Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, gx, gy, gz)) Next ' Fast method of evaluating the values at several points on a circle of ' latitude using GravityCircle. Dim circ As GravityCircle = grav.Circle(lat, h, GravityModel.Mask.ALL) For i As Integer = -5 To 5 Dim lon As Double = lon0 + i * 0.2 Dim gx, gy, gz As Double circ.Gravity(lon, gx, gy, gz) Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, gx, gy, gz)) Next Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-GravityModel.vb0000644000771000077100000000103214064202371024023 0ustar ckarneyckarneyImports NETGeographicLib Module example_GravityModel Sub Main() Try Dim grav As GravityModel = New GravityModel("egm96", "") Dim lat As Double = 27.99, lon = 86.93, h = 8820 ' Mt Everest Dim gx, gy, gz As Double grav.Gravity(lat, lon, h, gx, gy, gz) Console.WriteLine(String.Format("{0} {1} {2}", gx, gy, gz)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-LambertConformalConic.vb0000644000771000077100000000340214064202371025623 0ustar ckarneyckarneyImports NETGeographicLib Module example_LambertConformalConic Sub Main() Try ' Define the Pennsylvania South state coordinate system EPSG:3364 ' http://www.spatialreference.org/ref/epsg/3364/ Dim lat1 As Double = 40 + 58 / 60.0, lat2 = 39 + 56 / 60.0 ' standard parallels Dim k1 As Double = 1 ' scale Dim lat0 As Double = 39 + 20 / 60.0, lon0 = -77 - 45 / 60.0 ' origin Dim fe As Double = 600000, fn = 0 ' false easting and northing ' Set up basic projection Dim PASouth As LambertConformalConic = New LambertConformalConic(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening, lat1, lat2, k1) Dim x0, y0 As Double ' Transform origin point PASouth.Forward(lon0, lat0, lon0, x0, y0) x0 -= fe : y0 -= fn ' Sample conversion from geodetic to PASouth grid Dim lat As Double = 39.95, lon = -75.17 ' Philadelphia Dim x, y As Double PASouth.Forward(lon0, lat, lon, x, y) x -= x0 : y -= y0 Console.WriteLine(String.Format("{0} {1}", x, y)) ' Sample conversion from PASouth grid to geodetic x = 820000.0 : y = 72000.0 x += x0 : y += y0 PASouth.Reverse(lon0, x, y, lat, lon) Console.WriteLine(String.Format("{0} {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-LocalCartesian.vb0000644000771000077100000000163314064202371024310 0ustar ckarneyckarneyImports NETGeographicLib Module example_LocalCartesian Sub Main() Try Dim earth As Geocentric = New Geocentric() Dim lat0 As Double = 48 + 50 / 60.0, lon0 = 2 + 20 / 60.0 ' Paris Dim proj As LocalCartesian = New LocalCartesian(lat0, lon0, 0, earth) ' Sample forward calculation Dim lat As Double = 50.9, lon = 1.8, h = 0 ' Calais Dim x, y, z As Double proj.Forward(lat, lon, h, x, y, z) Console.WriteLine(String.Format("{0} {1} {2}", x, y, z)) ' Sample reverse calculation x = -38000.0 : y = 230000.0 : z = -4000.0 proj.Reverse(x, y, z, lat, lon, h) Console.WriteLine(String.Format("{0} {1} {2}", lat, lon, h)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-MGRS.vb0000644000771000077100000000174314064202371022176 0ustar ckarneyckarneyImports NETGeographicLib Module example_MGRS Sub Main() Try ' See also example-GeoCoords.cpp ' Sample forward calculation Dim lat As Double = 33.3, lon = 44.4 ' Baghdad Dim zone As Integer Dim northp As Boolean Dim x, y As Double UTMUPS.Forward(lat, lon, zone, northp, x, y, -1, True) Dim mgrsStr As String MGRS.Forward(zone, northp, x, y, lat, 5, mgrsStr) Console.WriteLine(mgrsStr) ' Sample reverse calculation mgrsStr = "38SMB4488" Dim prec As Integer MGRS.Reverse(mgrsStr, zone, northp, x, y, prec, True) UTMUPS.Reverse(zone, northp, x, y, lat, lon, True) Console.WriteLine(String.Format("Latitude: {0} Longitude: {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-MagneticCircle.vb0000644000771000077100000000235314064202371024275 0ustar ckarneyckarneyImports NETGeographicLib Module example_MagneticCircle Sub Main() Try Dim mag As MagneticModel = New MagneticModel("wmm2010", "") Dim lat As Double = 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 i As Integer = -5 To 5 Dim lon As Double = lon0 + i * 0.2 Dim Bx, By, Bz As Double mag.Field(t, lat, lon, h, Bx, By, Bz) Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, Bx, By, Bz)) Next ' Fast method of evaluating the values at several points on a circle of ' latitude using MagneticCircle. Dim circ As MagneticCircle = mag.Circle(t, lat, h) For i As Integer = -5 To 5 Dim lon As Double = lon0 + i * 0.2 Dim Bx, By, Bz As Double circ.Field(lon, Bx, By, Bz) Console.WriteLine(String.Format("{0} {1} {2} {3}", lon, Bx, By, Bz)) Next Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-MagneticModel.vb0000644000771000077100000000123414064202371024131 0ustar ckarneyckarneyImports NETGeographicLib Module example_MagneticModel Sub Main() Try Dim mag As MagneticModel = New MagneticModel("wmm2010", "") Dim lat As Double = 27.99, lon = 86.93, h = 8820, t = 2012 ' Mt Everest Dim Bx, By, Bz As Double mag.Field(t, lat, lon, H, Bx, By, Bz) Dim bigH, F, D, I As Double MagneticModel.FieldComponents(Bx, By, Bz, bigH, F, D, I) Console.WriteLine(String.Format("{0} {1} {2} {3}", bigH, F, D, I)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-NormalGravity.vb0000644000771000077100000000105214064202371024215 0ustar ckarneyckarneyImports NETGeographicLib Module example_NormalGravity Sub Main() Try Dim grav As NormalGravity = New NormalGravity(NormalGravity.StandardModels.WGS84) Dim lat As Double = 27.99, h = 8820 ' Mt Everest Dim gammay, gammaz As Double grav.Gravity(lat, h, gammay, gammaz) Console.WriteLine(String.Format("{0} {1}", gammay, gammaz)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-OSGB.vb0000644000771000077100000000170714064202371022160 0ustar ckarneyckarneyImports NETGeographicLib Module example_OSGB Sub Main() Try ' Sample forward calculation from ' A guide to coordinate systems in Great Britain Dim lat As Double = DMS.Decode(52, 39, 27.2531) Dim lon As Double = DMS.Decode(1, 43, 4.5177) Dim x, y As Double OSGB.Forward(lat, lon, x, y) Dim gridref As String = "" OSGB.GridReference(x, y, 2, gridref) Console.WriteLine(String.Format("{0} {1} {2}", x, y, gridref)) ' Sample reverse calculation gridref = "TG5113" Dim prec As Integer OSGB.GridReference(gridref, x, y, prec, True) OSGB.Reverse(x, y, lat, lon) Console.WriteLine(String.Format("{0} {1} {2}", prec, lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-PolarStereographic.vb0000644000771000077100000000144614064202371025223 0ustar ckarneyckarneyImports NETGeographicLib Module example_PolarStereographic Sub Main() Try Dim proj As PolarStereographic = New PolarStereographic() ' WGS84 Dim northp As Boolean = True ' Sample forward calculation Dim lat As Double = 61.2, lon = -149.9 ' Anchorage Dim x, y As Double proj.Forward(northp, lat, lon, x, y) Console.WriteLine(String.Format("{0} {1}", x, y)) ' Sample reverse calculation x = -1637000.0 : y = 2824000.0 proj.Reverse(northp, x, y, lat, lon) Console.WriteLine(String.Format("{0} {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-PolygonArea.vb0000644000771000077100000000136514064202371023646 0ustar ckarneyckarneyImports NETGeographicLib Module example_PolygonArea Sub Main() Try Dim geod As Geodesic = New Geodesic() ' WGS84 Dim poly As PolygonArea = New PolygonArea(geod, True) poly.AddPoint(52, 0) ' London poly.AddPoint(41, -74) ' New York poly.AddPoint(-23, -43) ' Rio de Janeiro poly.AddPoint(-26, 28) ' Johannesburg Dim perimeter, area As Double Dim n As UInteger = poly.Compute(False, True, perimeter, area) Console.WriteLine(String.Format("{0} {1} {2}", n, perimeter, area)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-Rhumb.vb0000644000771000077100000000173014064202371022477 0ustar ckarneyckarneyImports NETGeographicLib Module example_Rhumb Sub Main() Try Dim rhumb As Rhumb = New Rhumb(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening, True) ' Alternatively: const Rhumb& rhumb = Rhumb::WGS84(); ' Sample direct calculation, travelling about NE from JFK Dim lat1 As Double = 40.6, lon1 = -73.8, s12 = 5500000.0, azi12 = 51 Dim lat2 As Double, lon2 rhumb.Direct(lat1, lon1, azi12, s12, lat2, lon2) Console.WriteLine("{0} {1}", lat2, lon2) ' Sample inverse calculation, JFK to LHR lat1 = 40.6 : lon1 = -73.8 ' JFK Airport lat2 = 51.6 : lon2 = -0.5 ' LHR Airport rhumb.Inverse(lat1, lon1, lat2, lon2, s12, azi12) Console.WriteLine("{0} {1}", s12, azi12) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-RhumbLine.vb0000644000771000077100000000227414064202371023313 0ustar ckarneyckarneyImports NETGeographicLib Module example_RhumbLine Sub Main() Try ' Print waypoints between JFK and SIN Dim rhumb As Rhumb = New Rhumb(Constants.WGS84.EquatorialRadius, Constants.WGS84.Flattening, True) ' Alternatively: const Rhumb& rhumb = Rhumb::WGS84(); Dim lat1 As Double = 40.64, lon1 = -73.779 ' JFK Dim lat2 As Double = 1.359, lon2 = 103.989 ' SIN Dim s12 As Double, azi12 rhumb.Inverse(lat1, lon1, lat2, lon2, s12, azi12); Dim line As RhumbLine = rhumb.Line(lat1, lon1, azi12) Dim ds As Double = 500000.0 ' Nominal distance between points = 500 km Dim num As Integer = (Integer)Math.Ceiling(s12 / ds) ' The number of intervals ' Use intervals of equal length ds = s12 / num For i As Integer = 0 To num - 1 Dim lat As Double, lon line.Position(i * ds, lat, lon) Console.WriteLine("{0} {1} {2}", i, lat, lon) Next Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-SphericalHarmonic.vb0000644000771000077100000000147714064202371025025 0ustar ckarneyckarneyImports NETGeographicLib Module example_SphericalHarmonic Sub Main() Try Dim N As Integer = 3 ' The maximum degree Dim ca As Double() = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1} ' cosine coefficients Dim sa As Double() = {6, 5, 4, 3, 2, 1} ' sine coefficients Dim a As Double = 1 Dim h As SphericalHarmonic = New SphericalHarmonic(ca, sa, N, a, SphericalHarmonic.Normalization.SCHMIDT) Dim x As Double = 2, y = 3, z = 1 Dim vx, vy, vz As Double Dim v As Double = h.HarmonicSum(x, y, z, vx, vy, vz) Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-SphericalHarmonic1.vb0000644000771000077100000000173014064202371025076 0ustar ckarneyckarneyImports NETGeographicLib Module example_SphericalHarmonic1 Sub Main() Try Dim N As Integer = 3, N1 = 2 ' The maximum degrees Dim ca As Double() = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1} ' cosine coefficients Dim sa As Double() = {6, 5, 4, 3, 2, 1} ' sine coefficients Dim cb As Double() = {1, 2, 3, 4, 5, 6} Dim sb As Double() = {3, 2, 1} Dim a As Double = 1 Dim h As SphericalHarmonic1 = New SphericalHarmonic1(ca, sa, N, cb, sb, N1, a, SphericalHarmonic1.Normalization.SCHMIDT) Dim tau As Double = 0.1, x = 2, y = 3, z = 1 Dim vx, vy, vz As Double Dim v As Double = h.HarmonicSum(tau, x, y, z, vx, vy, vz) Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-SphericalHarmonic2.vb0000644000771000077100000000227714064202371025106 0ustar ckarneyckarneyImports NETGeographicLib Module example_SphericalHarmonic2 Sub Main() Try Dim N As Integer = 3, N1 = 2, N2 = 1 ' The maximum degrees Dim ca As Double() = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1} ' cosine coefficients Dim sa As Double() = {6, 5, 4, 3, 2, 1} ' sine coefficients Dim cb As Double() = {1, 2, 3, 4, 5, 6} Dim sb As Double() = {3, 2, 1} Dim cc As Double() = {2, 1} Dim S2 As Double() = {0} Dim a As Double = 1 Dim h As SphericalHarmonic2 = New SphericalHarmonic2( ca, sa, N, N, N, cb, sb, N1, N1, N1, cc, S2, N2, N2, 0, a, SphericalHarmonic2.Normalization.SCHMIDT) Dim tau1 As Double = 0.1, tau2 = 0.05, x = 2, y = 3, z = 1 Dim vx, vy, vz As Double Dim v As Double = h.HarmonicSum(tau1, tau2, x, y, z, vx, vy, vz) Console.WriteLine(String.Format("{0} {1} {2} {3}", v, vx, vy, vz)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-TransverseMercator.vb0000644000771000077100000000151214064202371025251 0ustar ckarneyckarneyImports NETGeographicLib Module example_TransverseMercator Sub Main() Try Dim proj As TransverseMercator = New TransverseMercator() ' WGS84 Dim lon0 As Double = -75 ' Central meridian for UTM zone 18 ' Sample forward calculation Dim lat As Double = 40.3, lon = -74.7 ' Princeton, NJ Dim x, y As Double proj.Forward(lon0, lat, lon, x, y) Console.WriteLine(String.Format("{0} {1}", x, y)) ' Sample reverse calculation x = 25000.0 : y = 4461000.0 proj.Reverse(lon0, x, y, lat, lon) Console.WriteLine(String.Format("{0} {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-TransverseMercatorExact.vb0000644000771000077100000000153114064202371026237 0ustar ckarneyckarneyImports NETGeographicLib Module example_TransverseMercatorExact Sub Main() Try Dim proj As TransverseMercatorExact = New TransverseMercatorExact() ' WGS84 Dim lon0 As Double = -75 ' Central meridian for UTM zone 18 ' Sample forward calculation Dim lat As Double = 40.3, lon = -74.7 ' Princeton, NJ Dim x, y As Double proj.Forward(lon0, lat, lon, x, y) Console.WriteLine(String.Format("{0} {1}", x, y)) ' Sample reverse calculation x = 25000.0 : y = 4461000.0 proj.Reverse(lon0, x, y, lat, lon) Console.WriteLine(String.Format("{0} {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/dotnet/examples/VB/example-UTMUPS.vb0000644000771000077100000000172414064202371022462 0ustar ckarneyckarneyImports NETGeographicLib Module example_UTMUPS Sub Main() Try ' See also example-GeoCoords.cpp ' Sample forward calculation Dim lat As Double = 33.3, lon = 44.4 ' Baghdad Dim zone As Integer Dim northp As Boolean Dim x, y As Double UTMUPS.Forward(lat, lon, zone, northp, x, y, -1, True) Dim zonestr As String = UTMUPS.EncodeZone(zone, northp, True) Console.WriteLine(String.Format("{0} {1} {2}", zonestr, x, y)) ' Sample reverse calculation zonestr = "38N" UTMUPS.DecodeZone(zonestr, zone, northp) x = 444000.0 : y = 3688000.0 UTMUPS.Reverse(zone, northp, x, y, lat, lon, True) Console.WriteLine(String.Format("{0} {1}", lat, lon)) Catch ex As GeographicErr Console.WriteLine(String.Format("Caught exception: {0}", ex.Message)) End Try End Sub End Module GeographicLib-1.52/examples/CMakeLists.txt0000644000771000077100000000356414064202371020403 0ustar ckarneyckarney# Compile a bunch of tiny example programs. These are built with the # "exampleprograms" target. These are mainly for including as examples # within the doxygen documentation; however, compiling them catches some # obvious blunders. if (GEOGRAPHICLIB_PRECISION EQUAL 2) # These examples all assume real = double file (GLOB EXAMPLE_SOURCES example-*.cpp) if (USE_BOOST_FOR_EXAMPLES AND Boost_FOUND) add_definitions (-DGEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION=1) include_directories ("${Boost_INCLUDE_DIRS}") endif () else () set (EXAMPLE_SOURCES) endif () set (EXAMPLE_SOURCES ${EXAMPLE_SOURCES} GeoidToGTX.cpp make-egmcof.cpp JacobiConformal.cpp) set (EXAMPLES) add_definitions (${PROJECT_DEFINITIONS}) foreach (EXAMPLE_SOURCE ${EXAMPLE_SOURCES}) get_filename_component (EXAMPLE ${EXAMPLE_SOURCE} NAME_WE) set (EXAMPLES ${EXAMPLES} ${EXAMPLE}) if (EXISTS ${EXAMPLE}.hpp) set (EXAMPLE_SOURCE ${EXAMPLE_SOURCE} ${EXAMPLE}.hpp) endif () add_executable (${EXAMPLE} EXCLUDE_FROM_ALL ${EXAMPLE_SOURCE}) target_link_libraries (${EXAMPLE} ${PROJECT_LIBRARIES} ${HIGHPREC_LIBRARIES}) endforeach () if (Boost_FOUND AND GEOGRAPHICLIB_PRECISION EQUAL 2) target_link_libraries (example-NearestNeighbor ${Boost_LIBRARIES}) endif () find_package (OpenMP QUIET) if (OPENMP_FOUND OR OpenMP_FOUND) set_target_properties (GeoidToGTX PROPERTIES COMPILE_FLAGS ${OpenMP_CXX_FLAGS}) if (NOT WIN32) set_target_properties (GeoidToGTX PROPERTIES LINK_FLAGS ${OpenMP_CXX_FLAGS}) endif () endif () if (MSVC OR CMAKE_CONFIGURATION_TYPES) # Add _d suffix for your debug versions of the tools set_target_properties (${EXAMPLES} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) endif () add_custom_target (exampleprograms DEPENDS ${EXAMPLES}) # Put all the examples into a folder in the IDE set_property (TARGET exampleprograms ${EXAMPLES} PROPERTY FOLDER examples) GeographicLib-1.52/examples/GeoidToGTX.cpp0000644000771000077100000000666214064202371020266 0ustar ckarneyckarney// Write out a gtx file of geoid heights above the ellipsoid. For egm2008 at // 1' resolution this takes about 10 mins on a 8-processor Intel 3.0 GHz // machine using OpenMP. // // For the format of gtx files, see // https://vdatum.noaa.gov/docs/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 defined(_OPENMP) #define HAVE_OPENMP 1 #else #define HAVE_OPENMP 0 #endif #if HAVE_OPENMP # include #endif #include #include #include using namespace std; using namespace GeographicLib; int main(int argc, const char* const 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 { // Will need to set the precision for each thread, so save return value int ndigits = Utility::set_digits(); string model(argv[1]); // Number of intervals per degree int ndeg = Utility::val(string(argv[2])); string filename(argv[3]); GravityModel g(model); int nlat = 180 * ndeg + 1, nlon = 360 * ndeg; Math::real delta = 1 / Math::real(ndeg), // Grid spacing latorg = -90, lonorg = -180; // Write results as floats in binary mode ofstream file(filename.c_str(), ios::binary); // Write header { Math::real transform[] = {latorg, lonorg, delta, delta}; unsigned sizes[] = {unsigned(nlat), unsigned(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 Utility::set_digits(ndigits); // Set the precision Math::real 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 Math::real 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; } } GeographicLib-1.52/examples/JacobiConformal.cpp0000644000771000077100000000303614064202371021371 0ustar ckarneyckarney// Example of using the GeographicLib::JacobiConformal class. #include #include #include #include #include "JacobiConformal.hpp" using namespace std; using namespace GeographicLib; int main() { try { Utility::set_digits(); // These parameters were derived from the EGM2008 geoid; see 2011-07-04 // E-mail to PROJ.4 list, "Analyzing the bumps in the EGM2008 geoid". The // longitude of the major axis is -15. These are close to the values given // by Milan Bursa, Vladimira Fialova, "Parameters of the Earth's tri-axial // level ellipsoid", Studia Geophysica et Geodaetica 37(1), 1-13 (1993): // // longitude of major axis = -14.93 +/- 0.05 // a = 6378171.36 +/- 0.30 // a/(a-c) = 297.7738 +/- 0.0003 // a/(a-b) = 91449 +/- 60 // which gives: a = 6378171.36, b = 6378101.61, c = 6356751.84 Math::real a = 6378137+35, b = 6378137-35, c = 6356752; JacobiConformal jc(a, b, c, a-b, b-c); cout << fixed << setprecision(1) << "Ellipsoid parameters: a = " << a << ", b = " << b << ", c = " << c << "\n" << setprecision(10) << "Quadrants: x = " << jc.x() << ", y = " << jc.y() << "\n"; cout << "Coordinates (angle x y) in degrees:\n"; for (int i = 0; i <= 90; i += 5) { Math::real omg = i, bet = i; cout << i << " " << jc.x(omg) << " " << jc.y(bet) << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/JacobiConformal.hpp0000644000771000077100000001542114064202371021377 0ustar ckarneyckarney/** * \file JacobiConformal.hpp * \brief Header for GeographicLib::JacobiConformal class * * NOTE: This is just sample code. It is not part of GeographicLib * itself. * * Copyright (c) Charles Karney (2014-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { /** * \brief Jacobi's conformal projection of a triaxial ellipsoid * * NOTE: This is just sample code. It is not part of GeographicLib * itself. * * This is a conformal projection of the ellipsoid to a plane in which * the grid lines are straight; see Jacobi, * * Vorlesungen über Dynamik, §28. The constructor takes the * semi-axes of the ellipsoid (which must be in order). Member functions map * the ellipsoidal coordinates ω and β separately to \e x and \e * y. Jacobi's coordinates have been multiplied by * (a2c2)1/2 / * (2b) so that the customary results are returned in the cases of * a sphere or an ellipsoid of revolution. * * The ellipsoid is oriented so that the large principal ellipse, \f$Z=0\f$, * is the equator, \f$\beta=0\f$, while the small principal ellipse, * \f$Y=0\f$, is the prime meridian, \f$\omega=0\f$. The four umbilic * points, \f$\left|\omega\right| = \left|\beta\right| = \frac12\pi\f$, lie * on middle principal ellipse in the plane \f$X=0\f$. * * For more information on this projection, see \ref jacobi. **********************************************************************/ class JacobiConformal { typedef Math::real real; real _a, _b, _c, _ab2, _bc2, _ac2; EllipticFunction _ex, _ey; static void norm(real& x, real& y) { using std::hypot; real z = hypot(x, y); x /= z; y /= z; } public: /** * Constructor for a trixial ellipsoid with semi-axes. * * @param[in] a the largest semi-axis. * @param[in] b the middle semi-axis. * @param[in] c the smallest semi-axis. * * The semi-axes must satisfy \e a ≥ \e b ≥ \e c > 0 and \e a > * \e c. This form of the constructor cannot be used to specify a * sphere (use the next constructor). **********************************************************************/ JacobiConformal(real a, real b, real c) : _a(a), _b(b), _c(c) , _ab2((_a - _b) * (_a + _b)) , _bc2((_b - _c) * (_b + _c)) , _ac2((_a - _c) * (_a + _c)) , _ex(_ab2 / _ac2 * Math::sq(_c / _b), -_ab2 / Math::sq(_b), _bc2 / _ac2 * Math::sq(_a / _b), Math::sq(_a / _b)) , _ey(_bc2 / _ac2 * Math::sq(_a / _b), +_bc2 / Math::sq(_b), _ab2 / _ac2 * Math::sq(_c / _b), Math::sq(_c / _b)) { using std::isfinite; if (!(isfinite(_a) && _a >= _b && _b >= _c && _c > 0)) throw GeographicErr("JacobiConformal: axes are not in order"); if (!(_a > _c)) throw GeographicErr ("JacobiConformal: use alternate constructor for sphere"); } /** * Alternate constructor for a triaxial ellipsoid. * * @param[in] a the largest semi-axis. * @param[in] b the middle semi-axis. * @param[in] c the smallest semi-axis. * @param[in] ab the relative magnitude of \e a − \e b. * @param[in] bc the relative magnitude of \e b − \e c. * * This form can be used to specify a sphere. The semi-axes must * satisfy \e a ≥ \e b ≥ c > 0. The ratio \e ab : \e bc must equal * (ab) : (bc) with \e ab * ≥ 0, \e bc ≥ 0, and \e ab + \e bc > 0. **********************************************************************/ JacobiConformal(real a, real b, real c, real ab, real bc) : _a(a), _b(b), _c(c) , _ab2(ab * (_a + _b)) , _bc2(bc * (_b + _c)) , _ac2(_ab2 + _bc2) , _ex(_ab2 / _ac2 * Math::sq(_c / _b), -(_a - _b) * (_a + _b) / Math::sq(_b), _bc2 / _ac2 * Math::sq(_a / _b), Math::sq(_a / _b)) , _ey(_bc2 / _ac2 * Math::sq(_a / _b), +(_b - _c) * (_b + _c) / Math::sq(_b), _ab2 / _ac2 * Math::sq(_c / _b), Math::sq(_c / _b)) { using std::isfinite; if (!(isfinite(_a) && _a >= _b && _b >= _c && _c > 0 && ab >= 0 && bc >= 0)) throw GeographicErr("JacobiConformal: axes are not in order"); if (!(ab + bc > 0 && isfinite(_ac2))) throw GeographicErr("JacobiConformal: ab + bc must be positive"); } /** * @return the quadrant length in the \e x direction. **********************************************************************/ Math::real x() const { return Math::sq(_a / _b) * _ex.Pi(); } /** * The \e x projection. * * @param[in] somg sin(ω). * @param[in] comg cos(ω). * @return \e x. **********************************************************************/ Math::real x(real somg, real comg) const { real somg1 = _b * somg, comg1 = _a * comg; norm(somg1, comg1); return Math::sq(_a / _b) * _ex.Pi(somg1, comg1, _ex.Delta(somg1, comg1)); } /** * The \e x projection. * * @param[in] omg ω (in degrees). * @return \e x (in degrees). * * ω must be in (−180°, 180°]. **********************************************************************/ Math::real x(real omg) const { real somg, comg; Math::sincosd(omg, somg, comg); return x(somg, comg) / Math::degree(); } /** * @return the quadrant length in the \e y direction. **********************************************************************/ Math::real y() const { return Math::sq(_c / _b) * _ey.Pi(); } /** * The \e y projection. * * @param[in] sbet sin(β). * @param[in] cbet cos(β). * @return \e y. **********************************************************************/ Math::real y(real sbet, real cbet) const { real sbet1 = _b * sbet, cbet1 = _c * cbet; norm(sbet1, cbet1); return Math::sq(_c / _b) * _ey.Pi(sbet1, cbet1, _ey.Delta(sbet1, cbet1)); } /** * The \e y projection. * * @param[in] bet β (in degrees). * @return \e y (in degrees). * * β must be in (−180°, 180°]. **********************************************************************/ Math::real y(real bet) const { real sbet, cbet; Math::sincosd(bet, sbet, cbet); return y(sbet, cbet) / Math::degree(); } }; } // namespace GeographicLib GeographicLib-1.52/examples/Makefile.am0000644000771000077100000000267414064202371017700 0ustar ckarneyckarney# # Makefile.am # # Copyright (C) 2011, Charles Karney EXAMPLE_FILES = \ example-Accumulator.cpp \ example-AlbersEqualArea.cpp \ example-AzimuthalEquidistant.cpp \ example-CassiniSoldner.cpp \ example-CircularEngine.cpp \ example-Constants.cpp \ example-DMS.cpp \ example-Ellipsoid.cpp \ example-EllipticFunction.cpp \ example-GARS.cpp \ example-GeoCoords.cpp \ example-Geocentric.cpp \ example-Geodesic.cpp \ example-Geodesic-small.cpp \ example-GeodesicExact.cpp \ example-GeodesicLine.cpp \ example-GeodesicLineExact.cpp \ example-GeographicErr.cpp \ example-Geohash.cpp \ example-Geoid.cpp \ example-Georef.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-NearestNeighbor.cpp \ example-NormalGravity.cpp \ example-OSGB.cpp \ example-PolarStereographic.cpp \ example-PolygonArea.cpp \ example-Rhumb.cpp \ example-RhumbLine.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 \ JacobiConformal.cpp JacobiConformal.hpp \ make-egmcof.cpp EXTRA_DIST = CMakeLists.txt $(EXAMPLE_FILES) GeographicLib-1.52/examples/example-Accumulator.cpp0000644000771000077100000000122714064202371022251 0ustar ckarneyckarney// Example of using the GeographicLib::Accumulator class #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; } } GeographicLib-1.52/examples/example-AlbersEqualArea.cpp0000644000771000077100000000215014064202371022757 0ustar ckarneyckarney// Example of using the GeographicLib::AlbersEqualArea class #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 meridian // 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); 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); cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-AzimuthalEquidistant.cpp0000644000771000077100000000175414064202371024150 0ustar ckarneyckarney// Example of using the GeographicLib::AzimuthalEquidistant class #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; } } GeographicLib-1.52/examples/example-CassiniSoldner.cpp0000644000771000077100000000171614064202371022715 0ustar ckarneyckarney// Example of using the GeographicLib::CassiniSoldner class #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; } } GeographicLib-1.52/examples/example-CircularEngine.cpp0000644000771000077100000000221014064202371022655 0ustar ckarneyckarney// Example of using the GeographicLib::CircularEngine class #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 { using std::hypot; 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 = 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; } } GeographicLib-1.52/examples/example-Constants.cpp0000644000771000077100000000071714064202371021751 0ustar ckarneyckarney// Example of using the GeographicLib::Constants class #include #include #include using namespace std; using namespace GeographicLib; int main() { try { cout << "WGS84 parameters:\n" << "a = " << Constants::WGS84_a() << " m\n" << "f = 1/" << 1/Constants::WGS84_f() << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-DMS.cpp0000644000771000077100000000113614064202371020414 0ustar ckarneyckarney// Example of using the GeographicLib::DMS class #include #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; } } GeographicLib-1.52/examples/example-Ellipsoid.cpp0000644000771000077100000000267214064202371021723 0ustar ckarneyckarney// Example of using the GeographicLib::Ellipsoid class #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Ellipsoid wgs84(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Ellipsoid& wgs84 = Ellipsoid::WGS84(); cout << "The latitude half way between the equator and the pole is " << wgs84.InverseRectifyingLatitude(45) << "\n"; cout << "Half the area of the ellipsoid lies between latitudes +/- " << wgs84.InverseAuthalicLatitude(30) << "\n"; cout << "The northernmost edge of a square Mercator map is at latitude " << wgs84.InverseIsometricLatitude(180) << "\n"; cout << "Table phi(deg) beta-phi xi-phi mu-phi chi-phi theta-phi (mins)\n" << fixed << setprecision(2); for (int i = 0; i <= 90; i += 15) { double phi = i, bet = wgs84.ParametricLatitude(phi), xi = wgs84.AuthalicLatitude(phi), mu = wgs84.RectifyingLatitude(phi), chi = wgs84.ConformalLatitude(phi), theta = wgs84.GeocentricLatitude(phi); cout << i << " " << (bet-phi)*60 << " " << (xi-phi)*60 << " " << (mu-phi)*60 << " " << (chi-phi)*60 << " " << (theta-phi)*60 << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-EllipticFunction.cpp0000644000771000077100000000335514064202371023251 0ustar ckarneyckarney// Example of using the GeographicLib::EllipticFunction class #include #include #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, sn, cn; Math::sincosd(phi, sn ,cn); // See Abramowitz and Stegun, table 17.6 with // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg cout << ell.E(phi * Math::degree()) << " " << ell.E(sn, cn, ell.Delta(sn, cn)) << "\n"; // See Carlson 1995, Sec 3. cout << fixed << setprecision(16) << "RF(1,2,0) = " << EllipticFunction::RF(1,2) << "\n" << "RF(2,3,4) = " << EllipticFunction::RF(2,3,4) << "\n" << "RC(0,1/4) = " << EllipticFunction::RC(0,0.25) << "\n" << "RC(9/4,2) = " << EllipticFunction::RC(2.25,2) << "\n" << "RC(1/4,-2) = " << EllipticFunction::RC(0.25,-2) << "\n" << "RJ(0,1,2,3) = " << EllipticFunction::RJ(0,1,2,3) << "\n" << "RJ(2,3,4,5) = " << EllipticFunction::RJ(2,3,4,5) << "\n" << "RD(0,2,1) = " << EllipticFunction::RD(0,2,1) << "\n" << "RD(2,3,4) = " << EllipticFunction::RD(2,3,4) << "\n" << "RG(0,16,16) = " << EllipticFunction::RG(16,16) << "\n" << "RG(2,3,4) = " << EllipticFunction::RG(2,3,4) << "\n" << "RG(0,0.0796,4) = " << EllipticFunction::RG(0.0796,4) << "\n"; } catch (const exception& e) { cout << "Caught exception: " << e.what() << "\n"; } } GeographicLib-1.52/examples/example-GARS.cpp0000644000771000077100000000165314064202371020531 0ustar ckarneyckarney// Example of using the GeographicLib::GARS class #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { { // Sample forward calculation double lat = 57.64911, lon = 10.40744; // Jutland string gars; for (int prec = 0; prec <= 2; ++prec) { GARS::Forward(lat, lon, prec, gars); cout << prec << " " << gars << "\n"; } } { // Sample reverse calculation string gars = "381NH45"; double lat, lon; cout << fixed; for (int len = 5; len <= int(gars.size()); ++len) { int prec; GARS::Reverse(gars.substr(0, len), lat, lon, prec); cout << prec << " " << lat << " " << lon << "\n"; } } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-GeoCoords.cpp0000644000771000077100000000122614064202371021655 0ustar ckarneyckarney// Example of using the GeographicLib::GeoCoords class #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; } } GeographicLib-1.52/examples/example-Geocentric.cpp0000644000771000077100000000174714064202371022063 0ustar ckarneyckarney// Example of using the GeographicLib::Geocentric class #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; } } GeographicLib-1.52/examples/example-Geodesic-small.cpp0000644000771000077100000000070714064202371022624 0ustar ckarneyckarney// Small example of using the GeographicLib::Geodesic class #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"; } GeographicLib-1.52/examples/example-Geodesic.cpp0000644000771000077100000000176614064202371021524 0ustar ckarneyckarney// Example of using the GeographicLib::Geodesic class #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; } } GeographicLib-1.52/examples/example-GeodesicExact.cpp0000644000771000077100000000201714064202371022477 0ustar ckarneyckarney// Example of using the GeographicLib::GeodesicExact class #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { GeodesicExact geod(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const GeodesicExact& geod = GeodesicExact::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; } } GeographicLib-1.52/examples/example-GeodesicLine.cpp0000644000771000077100000000273614064202371022332 0ustar ckarneyckarney// Example of using the GeographicLib::GeodesicLine class #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 GeodesicLine line = geod.InverseLine(lat1, lon1, lat2, lon2); double ds0 = 500e3; // Nominal distance between points = 500 km int num = int(ceil(line.Distance() / ds0)); // The number of intervals cout << fixed << setprecision(3); { // Use intervals of equal length double ds = line.Distance() / 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 = line.Arc() / 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; } } GeographicLib-1.52/examples/example-GeodesicLineExact.cpp0000644000771000077100000000300114064202371023301 0ustar ckarneyckarney// Example of using the GeographicLib::GeodesicLineExact class #include #include #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { // Print waypoints between JFK and SIN GeodesicExact geod(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const GeodesicExact& geod = GeodesicExact::WGS84(); double lat1 = 40.640, lon1 = -73.779, // JFK lat2 = 1.359, lon2 = 103.989; // SIN GeodesicLineExact line = geod.InverseLine(lat1, lon1, lat2, lon2); double ds0 = 500e3; // Nominal distance between points = 500 km int num = int(ceil(line.Distance() / ds0)); // The number of intervals cout << fixed << setprecision(3); { // Use intervals of equal length double ds = line.Distance() / 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 = line.Arc() / 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; } } GeographicLib-1.52/examples/example-GeographicErr.cpp0000644000771000077100000000053414064202371022513 0ustar ckarneyckarney// Example of using the GeographicLib::GeographicErr class #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"; } } GeographicLib-1.52/examples/example-Geohash.cpp0000644000771000077100000000241714064202371021352 0ustar ckarneyckarney// Example of using the GeographicLib::Geohash class #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { { // Sample forward calculation double lat = 57.64911, lon = 10.40744; // Jutland (the wikipedia example) string geohash; int maxlen = Geohash::GeohashLength(1.0e-5); for (int len = 0; len <= maxlen; ++len) { Geohash::Forward(lat, lon, len, geohash); cout << len << " " << geohash << "\n"; } } { // Sample reverse calculation string geohash = "u4pruydqqvj"; double lat, lon, latres, lonres; cout << fixed; for (unsigned i = 0; i <= geohash.length(); ++i) { int len; Geohash::Reverse(geohash.substr(0, i), lat, lon, len); latres = Geohash::LatitudeResolution(len); lonres = Geohash::LongitudeResolution(len); cout << setprecision(max(0, Geohash::DecimalPrecision(len))) << len << " " << lat << "+/-" << latres/2 << " " << lon << "+/-" << lonres/2 << "\n"; } } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-Geoid.cpp0000644000771000077100000000145214064202371021021 0ustar ckarneyckarney// Example of using the GeographicLib::Geoid class // This requires that the egm96-5 geoid model be installed; see // https://geographiclib.sourceforge.io/html/geoid.html#geoidinst #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; } } GeographicLib-1.52/examples/example-Georef.cpp0000644000771000077100000000212514064202371021177 0ustar ckarneyckarney// Example of using the GeographicLib::GARS class #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { { // Sample forward calculation double lat = 57.64911, lon = 10.40744; // Jutland string georef; for (int prec = -1; prec <= 11; ++prec) { Georef::Forward(lat, lon, prec, georef); cout << prec << " " << georef << "\n"; } } { // Sample reverse calculation string georef = "NKLN2444638946"; double lat, lon; int prec; cout << fixed; Georef::Reverse(georef.substr(0, 2), lat, lon, prec); cout << prec << " " << lat << " " << lon << "\n"; Georef::Reverse(georef.substr(0, 4), lat, lon, prec); cout << prec << " " << lat << " " << lon << "\n"; Georef::Reverse(georef, lat, lon, prec); cout << prec << " " << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-Gnomonic.cpp0000644000771000077100000000171014064202371021540 0ustar ckarneyckarney// Example of using the GeographicLib::Gnomonic class #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; } } GeographicLib-1.52/examples/example-GravityCircle.cpp0000644000771000077100000000246014064202371022541 0ustar ckarneyckarney// Example of using the GeographicLib::GravityCircle class // This requires that the egm96 gravity model be installed; see // https://geographiclib.sourceforge.io/html/gravity.html#gravityinst #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; } } GeographicLib-1.52/examples/example-GravityModel.cpp0000644000771000077100000000123414064202371022376 0ustar ckarneyckarney// Example of using the GeographicLib::GravityModel class // This requires that the egm96 gravity model be installed; see // https://geographiclib.sourceforge.io/html/gravity.html#gravityinst #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; } } GeographicLib-1.52/examples/example-LambertConformalConic.cpp0000644000771000077100000000300614064202371024172 0ustar ckarneyckarney// Example of using the GeographicLib::LambertConformalConic class #include #include #include using namespace std; using namespace GeographicLib; int main() { try { // Define the Pennsylvania South state coordinate system EPSG:3364 // https://www.spatialreference.org/ref/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; 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); cout << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-LocalCartesian.cpp0000644000771000077100000000205014064202371022651 0ustar ckarneyckarney// Example of using the GeographicLib::LocalCartesian class #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; } } GeographicLib-1.52/examples/example-MGRS.cpp0000644000771000077100000000201114064202371020532 0ustar ckarneyckarney// Example of using the GeographicLib::MGRS class #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, lat, 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; } } GeographicLib-1.52/examples/example-MagneticCircle.cpp0000644000771000077100000000247214064202371022646 0ustar ckarneyckarney// Example of using the GeographicLib::MagneticCircle class // This requires that the wmm2010 magnetic model be installed; see // https://geographiclib.sourceforge.io/html/magnetic.html#magneticinst #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; } } GeographicLib-1.52/examples/example-MagneticModel.cpp0000644000771000077100000000140514064202371022500 0ustar ckarneyckarney// Example of using the GeographicLib::MagneticModel class // This requires that the wmm2010 magnetic model be installed; see // https://geographiclib.sourceforge.io/html/magnetic.html#magneticinst #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; } } GeographicLib-1.52/examples/example-Math.cpp0000644000771000077100000000056514064202371020667 0ustar ckarneyckarney// Example of using the GeographicLib::Math class #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; } } GeographicLib-1.52/examples/example-NearestNeighbor.cpp0000644000771000077100000001024014064202371023044 0ustar ckarneyckarney// Example of using the GeographicLib::NearestNeighbor class. WARNING: this // creates a file, pointset.xml or pointset.txt, in the current directory. // Read lat/lon locations from locations.txt and lat/lon queries from // queries.txt. For each query print to standard output: the index for the // closest location and the distance to it. Print statistics to standard error // at the end. #include #include #include #include #include #if !defined(GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION) #define GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION 0 #endif #if GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION // If Boost serialization is available, use it. #include #include #endif #include #include #include using namespace std; using namespace GeographicLib; // A structure to hold a geographic coordinate. struct pos { double _lat, _lon; pos(double lat = 0, double lon = 0) : _lat(lat), _lon(lon) {} }; // A class to compute the distance between 2 positions. class DistanceCalculator { private: Geodesic _geod; public: explicit DistanceCalculator(const Geodesic& geod) : _geod(geod) {} double operator() (const pos& a, const pos& b) const { double d; _geod.Inverse(a._lat, a._lon, b._lat, b._lon, d); if ( !(d >= 0) ) // Catch illegal positions which result in d = NaN throw GeographicErr("distance doesn't satisfy d >= 0"); return d; } }; int main() { try { // Read in locations vector locs; double lat, lon; string sa, sb; { ifstream is("locations.txt"); if (!is.good()) throw GeographicErr("locations.txt not readable"); while (is >> sa >> sb) { DMS::DecodeLatLon(sa, sb, lat, lon); locs.push_back(pos(lat, lon)); } if (locs.size() == 0) throw GeographicErr("need at least one location"); } // Define a distance function object DistanceCalculator distance(Geodesic::WGS84()); // Create NearestNeighbor object NearestNeighbor pointset; { // Used saved object if it is available #if GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION ifstream is("pointset.xml"); if (is.good()) { boost::archive::xml_iarchive ia(is); ia >> BOOST_SERIALIZATION_NVP(pointset); } #else ifstream is("pointset.txt"); if (is.good()) is >> pointset; #endif } // Is the saved pointset up-to-date? if (pointset.NumPoints() != int(locs.size())) { // else initialize it pointset.Initialize(locs, distance); // and save it #if GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION ofstream os("pointset.xml"); if (!os.good()) throw GeographicErr("cannot write to pointset.xml"); boost::archive::xml_oarchive oa(os); oa << BOOST_SERIALIZATION_NVP(pointset); #else ofstream os("pointset.txt"); if (!os.good()) throw GeographicErr("cannot write to pointset.txt"); os << pointset << "\n"; #endif } ifstream is("queries.txt"); double d; int count = 0; vector k; while (is >> sa >> sb) { ++count; DMS::DecodeLatLon(sa, sb, lat, lon); d = pointset.Search(locs, distance, pos(lat, lon), k); if (k.size() != 1) throw GeographicErr("unexpected number of results"); cout << k[0] << " " << d << "\n"; } int setupcost, numsearches, searchcost, mincost, maxcost; double mean, sd; pointset.Statistics(setupcost, numsearches, searchcost, mincost, maxcost, mean, sd); int totcost = setupcost + searchcost, exhaustivecost = count * pointset.NumPoints(); cerr << "Number of distance calculations = " << totcost << "\n" << "With an exhaustive search = " << exhaustivecost << "\n" << "Ratio = " << double(totcost) / exhaustivecost << "\n" << "Efficiency improvement = " << 100 * (1 - double(totcost) / exhaustivecost) << "%\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-NormalGravity.cpp0000644000771000077100000000134714064202371022573 0ustar ckarneyckarney// Example of using the GeographicLib::NormalGravity class #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()); // 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; } } GeographicLib-1.52/examples/example-OSGB.cpp0000644000771000077100000000214214064202371020521 0ustar ckarneyckarney// Example of using the GeographicLib::OSGB class #include #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { { // Sample forward calculation from // A guide to coordinate systems in Great Britain double lat = DMS::Decode(52,39,27.2531), lon = DMS::Decode( 1,43, 4.5177); double x, y; OSGB::Forward(lat, lon, x, y); string gridref; OSGB::GridReference(x, y, 2, gridref); cout << fixed << setprecision(3) << x << " " << y << " " << gridref << "\n"; } { // Sample reverse calculation string gridref = "TG5113"; double x, y; int prec; OSGB::GridReference(gridref, x, y, prec); double lat, lon; OSGB::Reverse(x, y, lat, lon); cout << fixed << setprecision(8) << prec << " " << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-PolarStereographic.cpp0000644000771000077100000000173214064202371023570 0ustar ckarneyckarney// Example of using the GeographicLib::PolarStereographic class #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; } } GeographicLib-1.52/examples/example-PolygonArea.cpp0000644000771000077100000000250114064202371022206 0ustar ckarneyckarney// Example of using the GeographicLib::PolygonArea class #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"; // This adds a test for a bug fix for AddEdge. (Implements the // Planimeter29 test in geodtest.c.) PolygonArea poly1(geod); poly1.AddPoint(0,0); poly1.AddEdge(90,1000); poly1.AddEdge(0,1000); poly1.AddEdge(-90,1000); n = poly1.Compute(false, true, perimeter, area); // The area should be 1e6. Prior to the fix it was 1e6 - A/2, where // A = ellipsoid area. cout << n << " " << perimeter << " " << area << "\n"; } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-Rhumb.cpp0000644000771000077100000000201314064202371021041 0ustar ckarneyckarney// Example of using the GeographicLib::Rhumb class #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Rhumb rhumb(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Rhumb& rhumb = Rhumb::WGS84(); { // Sample direct calculation, travelling about NE from JFK double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi12 = 51; double lat2, lon2; rhumb.Direct(lat1, lon1, azi12, 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, azi12; rhumb.Inverse(lat1, lon1, lat2, lon2, s12, azi12); cout << s12 << " " << azi12 << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-RhumbLine.cpp0000644000771000077100000000227214064202371021660 0ustar ckarneyckarney// Example of using the GeographicLib::RhumbLine class #include #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { // Print waypoints between JFK and SIN Rhumb rhumb(Constants::WGS84_a(), Constants::WGS84_f()); // Alternatively: const Rhumb& rhumb = Rhumb::WGS84(); double lat1 = 40.640, lon1 = -73.779, // JFK lat2 = 1.359, lon2 = 103.989; // SIN double s12, azi12; rhumb.Inverse(lat1, lon1, lat2, lon2, s12, azi12); RhumbLine line = rhumb.Line(lat1, lon1, azi12); double ds0 = 500e3; // Nominal distance between points = 500 km int num = int(ceil(s12 / ds0)); // 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"; } } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-SphericalEngine.cpp0000644000771000077100000000175714064202371023042 0ustar ckarneyckarney// Example of using the GeographicLib::SphericalEngine class #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; } } GeographicLib-1.52/examples/example-SphericalHarmonic.cpp0000644000771000077100000000152114064202371023362 0ustar ckarneyckarney// Example of using the GeographicLib::SphericalHarmonic class #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; } } GeographicLib-1.52/examples/example-SphericalHarmonic1.cpp0000644000771000077100000000205014064202371023441 0ustar ckarneyckarney// Example of using the GeographicLib::SphericalHarmonic1 class #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; } } GeographicLib-1.52/examples/example-SphericalHarmonic2.cpp0000644000771000077100000000233514064202371023450 0ustar ckarneyckarney// Example of using the GeographicLib::SphericalHarmonic2 class #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; } } GeographicLib-1.52/examples/example-TransverseMercator.cpp0000644000771000077100000000342114064202371023621 0ustar ckarneyckarney// Example of using the GeographicLib::TransverseMercator class #include #include #include #include using namespace std; using namespace GeographicLib; // Define a UTM projection for an arbitrary ellipsoid class UTMalt { private: TransverseMercator _tm; // The projection double _lon0; // Central longitude double _falseeasting, _falsenorthing; public: UTMalt(double a, // equatorial radius double f, // flattening int zone, // the UTM zone + hemisphere bool northp) : _tm(a, f, Constants::UTM_k0()) , _lon0(6 * zone - 183) , _falseeasting(5e5) , _falsenorthing(northp ? 0 : 100e5) { if (!(zone >= 1 && zone <= 60)) throw GeographicErr("zone not in [1,60]"); } void Forward(double lat, double lon, double& x, double& y) { _tm.Forward(_lon0, lat, lon, x, y); x += _falseeasting; y += _falsenorthing; } void Reverse(double x, double y, double& lat, double& lon) { x -= _falseeasting; y -= _falsenorthing; _tm.Reverse(_lon0, x, y, lat, lon); } }; int main() { try { UTMalt tm(6378388, 1/297.0, 30, true); // International ellipsoid, zone 30n { // Sample forward calculation double lat = 40.4, lon = -3.7; // Madrid double x, y; tm.Forward(lat, lon, x, y); cout << fixed << setprecision(0) << x << " " << y << "\n"; } { // Sample reverse calculation double x = 441e3, y = 4472e3; double lat, lon; tm.Reverse(x, y, lat, lon); cout << fixed << setprecision(5) << lat << " " << lon << "\n"; } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } } GeographicLib-1.52/examples/example-TransverseMercatorExact.cpp0000644000771000077100000000204014064202371024602 0ustar ckarneyckarney// Example of using the GeographicLib::TransverseMercatorExact class #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; } } GeographicLib-1.52/examples/example-UTMUPS.cpp0000644000771000077100000000204214064202371021023 0ustar ckarneyckarney// Example of using the GeographicLib::UTMUPS class #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; } } GeographicLib-1.52/examples/example-Utility.cpp0000644000771000077100000000102714064202371021433 0ustar ckarneyckarney// Example of using the GeographicLib::Utility class #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; } } GeographicLib-1.52/examples/make-egmcof.cpp0000644000771000077100000000277414064202371020524 0ustar ckarneyckarney// Write the coefficient files needed for approximating the normal gravity // field with a GravityModel. WARNING: this creates files, wgs84.egm.cof and // grs80.egm.cof, in the current directory. #include #include #include #include #include using namespace std; using namespace GeographicLib; int main() { try { Utility::set_digits(); const char* filenames[] = {"wgs84.egm.cof", "grs80.egm.cof"}; const char* ids[] = {"WGS1984A", "GRS1980A"}; for (int grs80 = 0; grs80 < 2; ++grs80) { ofstream file(filenames[grs80], ios::binary); Utility::writearray(file, ids[grs80], 8); const int N = 20, M = 0, cnum = (M + 1) * (2 * N - M + 2) / 2; // cnum = N + 1 vector num(2); num[0] = N; num[1] = M; Utility::writearray(file, num); vector c(cnum, 0); const NormalGravity& earth(grs80 ? NormalGravity::GRS80() : NormalGravity::WGS84()); for (int n = 2; n <= N; n += 2) c[n] = - earth.DynamicalFormFactor(n) / sqrt(Math::real(2*n + 1)); Utility::writearray(file, c); num[0] = num[1] = -1; Utility::writearray(file, num); } } catch (const exception& e) { cerr << "Caught exception: " << e.what() << "\n"; return 1; } catch (...) { cerr << "Caught unknown exception\n"; return 1; } } GeographicLib-1.52/examples/Makefile.in0000644000771000077100000003371214064202402017701 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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 VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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@ pkgconfigdir = @pkgconfigdir@ 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-Ellipsoid.cpp \ example-EllipticFunction.cpp \ example-GARS.cpp \ example-GeoCoords.cpp \ example-Geocentric.cpp \ example-Geodesic.cpp \ example-Geodesic-small.cpp \ example-GeodesicExact.cpp \ example-GeodesicLine.cpp \ example-GeodesicLineExact.cpp \ example-GeographicErr.cpp \ example-Geohash.cpp \ example-Geoid.cpp \ example-Georef.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-NearestNeighbor.cpp \ example-NormalGravity.cpp \ example-OSGB.cpp \ example-PolarStereographic.cpp \ example-PolygonArea.cpp \ example-Rhumb.cpp \ example-RhumbLine.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 \ JacobiConformal.cpp JacobiConformal.hpp \ make-egmcof.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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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 \ cscopelist-am ctags-am 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 \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # 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.52/include/GeographicLib/Accumulator.hpp0000644000771000077100000001756514064202371023145 0ustar ckarneyckarney/** * \file Accumulator.hpp * \brief Header for GeographicLib::Accumulator class * * Copyright (c) Charles Karney (2010-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_ACCUMULATOR_HPP) #define GEOGRAPHICLIB_ACCUMULATOR_HPP 1 #include namespace GeographicLib { /** * \brief An accumulator for sums * * This allows 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 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 GEOGRAPHICLIB_EXPORT Accumulator { private: // _s + _t accumulators for the sum. T _s, _t; // Same as Math::sum, but requires abs(u) >= abs(v). This isn't currently // used. static T fastsum(T u, T v, T& t) { GEOGRAPHICLIB_VOLATILE T s = u + v; GEOGRAPHICLIB_VOLATILE T vp = s - u; t = v - vp; return s; } void Add(T y) { // Here's Shewchuk's solution... T u; // hold exact sum as [s, t, u] // Accumulate starting at least significant end y = Math::sum(y, _t, u); _s = Math::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 { 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)) : _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) { _s = y; _t = 0; return *this; } /** * Return the value held in the accumulator. * * @return \e sum. **********************************************************************/ T operator()() const { 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 { return Sum(y); } /** * Add a number to the accumulator. * * @param[in] y set \e sum += \e y. **********************************************************************/ Accumulator& operator+=(T y) { Add(y); return *this; } /** * Subtract a number from the accumulator. * * @param[in] y set \e sum -= \e y. **********************************************************************/ Accumulator& operator-=(T y) { 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) { _s *= n; _t *= n; return *this; } /** * Multiply accumulator by a number. The fma (fused multiply and add) * instruction is used (if available) in order to maintain accuracy. * * @param[in] y set \e sum *= \e y. **********************************************************************/ Accumulator& operator*=(T y) { using std::fma; T d = _s; _s *= y; d = fma(y, d, -_s); // the error in the first multiplication _t = fma(y, _t, d); // add error to the second term return *this; } /** * Reduce accumulator to the range [-y/2, y/2]. * * @param[in] y the modulus. **********************************************************************/ Accumulator& remainder(T y) { using std::remainder; _s = remainder(_s, y); Add(0); // This renormalizes the result. return *this; } /** * Test equality of an Accumulator with a number. **********************************************************************/ bool operator==(T y) const { return _s == y; } /** * Test inequality of an Accumulator with a number. **********************************************************************/ bool operator!=(T y) const { return _s != y; } /** * Less operator on an Accumulator and a number. **********************************************************************/ bool operator<(T y) const { return _s < y; } /** * Less or equal operator on an Accumulator and a number. **********************************************************************/ bool operator<=(T y) const { return _s <= y; } /** * Greater operator on an Accumulator and a number. **********************************************************************/ bool operator>(T y) const { return _s > y; } /** * Greater or equal operator on an Accumulator and a number. **********************************************************************/ bool operator>=(T y) const { return _s >= y; } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_ACCUMULATOR_HPP GeographicLib-1.52/include/GeographicLib/AlbersEqualArea.hpp0000644000771000077100000003414114064202371023644 0ustar ckarneyckarney/** * \file AlbersEqualArea.hpp * \brief Header for GeographicLib::AlbersEqualArea class * * Copyright (c) Charles Karney (2010-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_ALBERSEQUALAREA_HPP) #define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP 1 #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, γ, 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 γ 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 GEOGRAPHICLIB_EXPORT AlbersEqualArea { private: typedef Math::real real; real eps_, epsx_, epsx2_, tol_, tol0_; real _a, _f, _fm, _e2, _e, _e2m, _qZ, _qx; real _sign, _lat0, _k0; real _n0, _m02, _nrho0, _k2, _txi0, _scxi0, _sxi0; static const int numit_ = 5; // Newton iterations in Reverse static const int numit0_ = 20; // Newton iterations in Init static real hyp(real x) { using std::hypot; return hypot(real(1), x); } // atanh( e * x)/ e if f > 0 // atan (sqrt(-e2) * x)/sqrt(-e2) if f < 0 // x if f = 0 real atanhee(real x) const { using std::atan; using std::abs; using std::atanh; return _f > 0 ? atanh(_e * x)/_e : (_f < 0 ? (atan(_e * x)/_e) : x); } // return atanh(sqrt(x))/sqrt(x) - 1, accurate for small x static real atanhxm1(real 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) // https://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 // // sn(x) = x/sqrt(1+x^2): Dsn(x,y) = (x+y)/((sn(x)+sn(y))*(1+x^2)*(1+y^2)) static real Dsn(real x, real y, real sx, real sy) { // 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) = (atanee(x)-atanee(y))/(x-y) // = atanhee((x-y)/(1-e^2*x*y))/(x-y) real Datanhee(real x, real y) const { real t = x - y, d = 1 - _e2 * x * y; return t == 0 ? 1 / d : (x*y < 0 ? atanhee(x) - atanhee(y) : atanhee(t / d)) / t; } // DDatanhee(x,y) = (Datanhee(1,y) - Datanhee(1,x))/(y-x) real DDatanhee(real x, real y) const; real DDatanhee0(real x, real y) const; real DDatanhee1(real x, real y) const; real DDatanhee2(real x, real y) const; void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1); real txif(real tphi) const; real tphif(real txi) const; friend class Ellipsoid; // For access to txif, tphif, etc. 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. * @param[in] stdlat standard parallel (degrees), the circle of tangency. * @param[in] k0 azimuthal scale on the standard parallel. * @exception GeographicErr if \e a, (1 − \e f) \e a, or \e k0 is * not positive. * @exception GeographicErr if \e stdlat is not in [−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. * @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees). * @param[in] k1 azimuthal scale on the standard parallels. * @exception GeographicErr if \e a, (1 − \e f) \e a, or \e k1 is * not positive. * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * [−90°, 90°], or 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. * @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. * @exception GeographicErr if \e a, (1 − \e f) \e a, or \e k1 is * not positive. * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * [−90°, 90°], or if \e stdlat1 and \e stdlat2 are * opposite poles. * * 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) ≤ 160°, * then the error in the latitude of origin is less than 4.5 × * 10−14d;. **********************************************************************/ 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). * @exception GeographicErr \e k is not positive. * @exception GeographicErr if \e lat is not in (−90°, * 90°). * * This allows a "latitude of conformality" to be specified. **********************************************************************/ 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°]. 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; /** * 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. 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; /** * AlbersEqualArea::Forward without returning the convergence and * scale. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y) const { 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 { 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 EquatorialRadius() const { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ Math::real Flattening() const { return _f; } /** * @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 { return _lat0; } /** * @return central scale for the projection. This is the azimuthal scale * on the latitude of origin. **********************************************************************/ Math::real CentralScale() const { return _k0; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * 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 = 90°, 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 = −90°, 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.52/include/GeographicLib/AzimuthalEquidistant.hpp0000644000771000077100000001444214064202371025026 0ustar ckarneyckarney/** * \file AzimuthalEquidistant.hpp * \brief Header for GeographicLib::AzimuthalEquidistant class * * Copyright (c) Charles Karney (2009-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP) #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP 1 #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 GEOGRAPHICLIB_EXPORT AzimuthalEquidistant { private: typedef Math::real real; real eps_; Geodesic _earth; 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()); /** * 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°]. * 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; /** * 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°]. \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; /** * AzimuthalEquidistant::Forward without returning the azimuth and scale. **********************************************************************/ void Forward(real lat0, real lon0, real lat, real lon, real& x, real& y) const { 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 { 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 EquatorialRadius() const { return _earth.EquatorialRadius(); } /** * @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 { return _earth.Flattening(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP GeographicLib-1.52/include/GeographicLib/CMakeLists.txt0000644000771000077100000000042414064202371022677 0ustar ckarneyckarney# Install the header files including the generated Config.h (which is in # the build tree). file (GLOB HEADERS [A-Za-z]*.hpp) install (FILES ${HEADERS} DESTINATION include/GeographicLib) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Config.h DESTINATION include/GeographicLib) GeographicLib-1.52/include/GeographicLib/CassiniSoldner.hpp0000644000771000077100000002226414064202371023576 0ustar ckarneyckarney/** * \file CassiniSoldner.hpp * \brief Header for GeographicLib::CassiniSoldner class * * Copyright (c) Charles Karney (2009-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_CASSINISOLDNER_HPP) #define GEOGRAPHICLIB_CASSINISOLDNER_HPP 1 #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 90° 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 + * 180°. \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 GEOGRAPHICLIB_EXPORT CassiniSoldner { private: typedef Math::real real; Geodesic _earth; GeodesicLine _meridian; real _sbet0, _cbet0; static const unsigned maxit_ = 10; 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()); /** * 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°]. **********************************************************************/ CassiniSoldner(real lat0, real lon0, const Geodesic& earth = Geodesic::WGS84()); /** * 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°]. **********************************************************************/ void Reset(real lat0, real lon0); /** * 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°]. 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; /** * 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; /** * CassiniSoldner::Forward without returning the azimuth and scale. **********************************************************************/ void Forward(real lat, real lon, real& x, real& y) const { 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 { real azi, rk; Reverse(x, y, lat, lon, azi, rk); } /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const { return _meridian.Init(); } /** * @return \e lat0 the latitude of origin (degrees). **********************************************************************/ Math::real LatitudeOrigin() const { return _meridian.Latitude(); } /** * @return \e lon0 the longitude of origin (degrees). **********************************************************************/ Math::real LongitudeOrigin() const { 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 EquatorialRadius() const { return _earth.EquatorialRadius(); } /** * @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 { return _earth.Flattening(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_CASSINISOLDNER_HPP GeographicLib-1.52/include/GeographicLib/CircularEngine.hpp0000644000771000077100000001550314064202371023546 0ustar ckarneyckarney/** * \file CircularEngine.hpp * \brief Header for GeographicLib::CircularEngine class * * Copyright (c) Charles Karney (2011-2015) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_CIRCULARENGINE_HPP) #define GEOGRAPHICLIB_CIRCULARENGINE_HPP 1 #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 std::bad_alloc exception. * * Example of use: * \include example-CircularEngine.cpp **********************************************************************/ class GEOGRAPHICLIB_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 sl, real cl, real& gradx, real& grady, real& gradz) const; friend class SphericalEngine; 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 * sine and cosine. * * @param[in] sinlon the sine of the longitude. * @param[in] coslon the cosine of the longitude. * @return \e V the value of the sum. * * The arguments must satisfy sinlon2 + * coslon2 = 1. **********************************************************************/ Math::real operator()(real sinlon, real coslon) const { real dummy; return Value(false, sinlon, coslon, 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 { real sinlon, coslon; Math::sincosd(lon, sinlon, coslon); return (*this)(sinlon, coslon); } /** * Evaluate the sum and its gradient for a particular longitude given in * terms of its sine and cosine. * * @param[in] sinlon the sine of the longitude. * @param[in] coslon the cosine 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 sinlon2 + * coslon2 = 1. **********************************************************************/ Math::real operator()(real sinlon, real coslon, real& gradx, real& grady, real& gradz) const { return Value(true, sinlon, coslon, 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 { real sinlon, coslon; Math::sincosd(lon, sinlon, coslon); return (*this)(sinlon, coslon, gradx, grady, gradz); } }; } // namespace GeographicLib #if defined(_MSC_VER) # pragma warning (pop) #endif #endif // GEOGRAPHICLIB_CIRCULARENGINE_HPP GeographicLib-1.52/include/GeographicLib/Config.h.in0000644000771000077100000000262114064202371022123 0ustar ckarneyckarney#define GEOGRAPHICLIB_VERSION_STRING "@PROJECT_VERSION@" #define GEOGRAPHICLIB_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ #define GEOGRAPHICLIB_VERSION_MINOR @PROJECT_VERSION_MINOR@ #define GEOGRAPHICLIB_VERSION_PATCH @PROJECT_VERSION_PATCH@ #define GEOGRAPHICLIB_DATA "@GEOGRAPHICLIB_DATA@" // These are macros which affect the building of the library #cmakedefine01 GEOGRAPHICLIB_HAVE_LONG_DOUBLE #cmakedefine01 GEOGRAPHICLIB_WORDS_BIGENDIAN #define GEOGRAPHICLIB_PRECISION @GEOGRAPHICLIB_PRECISION@ // Specify whether GeographicLib is a shared or static library. When compiling // under Visual Studio it is necessary to specify whether GeographicLib is a // shared library. This is done with the macro GEOGRAPHICLIB_SHARED_LIB, which // cmake will correctly define as 0 or 1 when only one type of library is in // the package. If both shared and static libraries are available, // GEOGRAPHICLIB_SHARED_LIB is set to 2 which triggers a preprocessor error in // Constants.hpp. In this case, the appropriate value (0 or 1) for // GEOGRAPHICLIB_SHARED_LIB must be specified when compiling any program that // includes GeographicLib headers. This is done automatically if GeographicLib // and the user's code were built with cmake version 2.8.11 (which introduced // the command target_compile_definitions) or later. #if !defined(GEOGRAPHICLIB_SHARED_LIB) #define GEOGRAPHICLIB_SHARED_LIB @GEOGRAPHICLIB_LIB_TYPE_VAL@ #endif GeographicLib-1.52/include/GeographicLib/Constants.hpp0000644000771000077100000003165214064202371022633 0ustar ckarneyckarney/** * \file Constants.hpp * \brief Header for GeographicLib::Constants class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_CONSTANTS_HPP) #define GEOGRAPHICLIB_CONSTANTS_HPP 1 #include /** * @relates GeographicLib::Constants * Pack the version components into a single integer. Users should not rely on * this particular packing of the components of the version number; see the * documentation for GEOGRAPHICLIB_VERSION, below. **********************************************************************/ #define GEOGRAPHICLIB_VERSION_NUM(a,b,c) ((((a) * 10000 + (b)) * 100) + (c)) /** * @relates GeographicLib::Constants * The version of GeographicLib as a single integer, packed as MMmmmmpp where * MM is the major version, mmmm is the minor version, and pp is the patch * level. Users should not rely on this particular packing of the components * of the version number. Instead they should use a test such as \code #if GEOGRAPHICLIB_VERSION >= GEOGRAPHICLIB_VERSION_NUM(1,37,0) ... #endif * \endcode **********************************************************************/ #define GEOGRAPHICLIB_VERSION \ GEOGRAPHICLIB_VERSION_NUM(GEOGRAPHICLIB_VERSION_MAJOR, \ GEOGRAPHICLIB_VERSION_MINOR, \ GEOGRAPHICLIB_VERSION_PATCH) // For reference, here is a table of Visual Studio and _MSC_VER // correspondences: // // _MSC_VER Visual Studio // 1100 vc5 // 1200 vc6 // 1300 vc7 // 1310 vc7.1 (2003) // 1400 vc8 (2005) // 1500 vc9 (2008) // 1600 vc10 (2010) // 1700 vc11 (2012) // 1800 vc12 (2013) // 1900 vc14 (2015) First version of VS to include enough C++11 support // 191[0-9] vc15 (2017) // 192[0-9] vc16 (2019) #if defined(_MSC_VER) && defined(GEOGRAPHICLIB_SHARED_LIB) && \ GEOGRAPHICLIB_SHARED_LIB # if GEOGRAPHICLIB_SHARED_LIB > 1 # error GEOGRAPHICLIB_SHARED_LIB must be 0 or 1 # elif defined(GeographicLib_SHARED_EXPORTS) # define GEOGRAPHICLIB_EXPORT __declspec(dllexport) # else # define GEOGRAPHICLIB_EXPORT __declspec(dllimport) # endif #else # define GEOGRAPHICLIB_EXPORT #endif // Use GEOGRAPHICLIB_DEPRECATED to mark functions, types or variables as // deprecated. Code inspired by Apache Subversion's svn_types.h file (via // MPFR). #if defined(__GNUC__) # if __GNUC__ > 4 # define GEOGRAPHICLIB_DEPRECATED(msg) __attribute__((deprecated(msg))) # else # define GEOGRAPHICLIB_DEPRECATED(msg) __attribute__((deprecated)) # endif #elif defined(_MSC_VER) && _MSC_VER >= 1300 # define GEOGRAPHICLIB_DEPRECATED(msg) __declspec(deprecated(msg)) #else # define GEOGRAPHICLIB_DEPRECATED(msg) #endif #include #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/Class.hpp. * 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 GEOGRAPHICLIB_EXPORT Constants { private: typedef Math::real real; Constants(); // Disable constructor public: /** * A synonym for Math::degree(). **********************************************************************/ static Math::real degree() { return Math::degree(); } /** * @return the number of radians in an arcminute. **********************************************************************/ static Math::real arcminute() { return Math::degree() / 60; } /** * @return the number of radians in an arcsecond. **********************************************************************/ static Math::real arcsecond() { 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 T WGS84_a() { return 6378137 * meter(); } /** * @tparam T the type of the returned value. * @return the flattening of WGS84 ellipsoid (1/298.257223563). **********************************************************************/ template static T WGS84_f() { // Evaluating this as 1000000000 / T(298257223563LL) reduces the // round-off error by about 10%. However, expressing the flattening as // 1/298.257223563 is well ingrained. return 1 / ( T(298257223563LL) / 1000000000 ); } /** * @tparam T the type of the returned value. * @return the gravitational constant of the WGS84 ellipsoid, \e GM, in * m3 s−2. **********************************************************************/ template static T WGS84_GM() { return T(3986004) * 100000000 + 41800000; } /** * @tparam T the type of the returned value. * @return the angular velocity of the WGS84 ellipsoid, ω, in rad * s−1. **********************************************************************/ template static T WGS84_omega() { return 7292115 / (T(1000000) * 100000); } /** * @tparam T the type of the returned value. * @return the equatorial radius of GRS80 ellipsoid, \e a, in m. **********************************************************************/ template static T GRS80_a() { return 6378137 * meter(); } /** * @tparam T the type of the returned value. * @return the gravitational constant of the GRS80 ellipsoid, \e GM, in * m3 s−2. **********************************************************************/ template static T GRS80_GM() { return T(3986005) * 100000000; } /** * @tparam T the type of the returned value. * @return the angular velocity of the GRS80 ellipsoid, ω, in rad * s−1. * * This is about 2 π 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 T GRS80_omega() { return 7292115 / (T(1000000) * 100000); } /** * @tparam T the type of the returned value. * @return the dynamical form factor of the GRS80 ellipsoid, * J2. **********************************************************************/ template static T GRS80_J2() { return T(108263) / 100000000; } /** * @tparam T the type of the returned value. * @return the central scale factor for UTM (0.9996). **********************************************************************/ template static T UTM_k0() {return T(9996) / 10000; } /** * @tparam T the type of the returned value. * @return the central scale factor for UPS (0.994). **********************************************************************/ template static T UPS_k0() { return T(994) / 1000; } ///@} /** \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 T meter() { return T(1); } /** * @return the number of meters in a kilometer. **********************************************************************/ static Math::real kilometer() { return 1000 * meter(); } /** * @return the number of meters in a nautical mile (approximately 1 arc * minute) **********************************************************************/ static Math::real nauticalmile() { 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 T square_meter() { return meter() * meter(); } /** * @return the number of square meters in a hectare. **********************************************************************/ static Math::real hectare() { return 10000 * square_meter(); } /** * @return the number of square meters in a square kilometer. **********************************************************************/ static Math::real square_kilometer() { return kilometer() * kilometer(); } /** * @return the number of square meters in a square nautical mile. **********************************************************************/ static Math::real square_nauticalmile() { return nauticalmile() * nauticalmile(); } ///@} /** \name Anachronistic British units **********************************************************************/ ///@{ /** * @return the number of meters in an international foot. **********************************************************************/ static Math::real foot() { return real(254 * 12) / 10000 * meter(); } /** * @return the number of meters in a yard. **********************************************************************/ static Math::real yard() { return 3 * foot(); } /** * @return the number of meters in a fathom. **********************************************************************/ static Math::real fathom() { return 2 * yard(); } /** * @return the number of meters in a chain. **********************************************************************/ static Math::real chain() { return 22 * yard(); } /** * @return the number of meters in a furlong. **********************************************************************/ static Math::real furlong() { return 10 * chain(); } /** * @return the number of meters in a statute mile. **********************************************************************/ static Math::real mile() { return 8 * furlong(); } /** * @return the number of square meters in an acre. **********************************************************************/ static Math::real acre() { return chain() * furlong(); } /** * @return the number of square meters in a square statute mile. **********************************************************************/ static Math::real square_mile() { return mile() * mile(); } ///@} /** \name Anachronistic US units **********************************************************************/ ///@{ /** * @return the number of meters in a US survey foot. **********************************************************************/ static Math::real surveyfoot() { return real(1200) / 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.52/include/GeographicLib/DMS.hpp0000644000771000077100000004213014064202371021273 0ustar ckarneyckarney/** * \file DMS.hpp * \brief Header for GeographicLib::DMS class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_DMS_HPP) #define GEOGRAPHICLIB_DMS_HPP 1 #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs vector and constant conditional expressions # pragma warning (push) # pragma warning (disable: 4251 4127) #endif namespace GeographicLib { /** * \brief Convert between degrees and the %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 GEOGRAPHICLIB_EXPORT DMS { 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, }; private: typedef Math::real real; // Replace all occurrences of pat by c. If c is NULL remove pat. static void replace(std::string& s, const std::string& pat, char c) { std::string::size_type p = 0; int count = c ? 1 : 0; while (true) { p = s.find(pat, p); if (p == std::string::npos) break; s.replace(p, pat.length(), count, c); } } static const char* const hemispheres_; static const char* const signs_; static const char* const digits_; static const char* const dmsindicators_; static const char* const components_[3]; static Math::real NumMatch(const std::string& s); static Math::real InternalDecode(const std::string& dmsa, flag& ind); DMS(); // Disable constructor public: /** * 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. * @exception GeographicErr if \e dms is malformed (see below). * @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 ° symbol for degrees and the unicode prime * and double prime symbols for minutes and seconds) may be substituted; * two single quotes can be used instead of ". 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, -20°30'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 * - 4:59.99999999999999, 4:60.0, 4:59:59.9999999999999, 4:59:60.0, 5 * - ILLEGAL (the exception thrown explains the problem) * - 4d5"4', 4::5, 4:5:, :4:5, 4d4.5'4", -N20.5, 1.8e2d, 4:60, * 4:59:60 * * The decoding operation can also perform addition and subtraction * operations. If the string includes internal signs (i.e., not at * the beginning nor immediately after an initial hemisphere designator), * then the string is split immediately before such signs and each piece is * decoded according to the above rules and the results added; thus * S3-2.5+4.1N is parsed as the sum of S3, * -2.5, +4.1N. Any piece can include a * hemisphere designator; however, if multiple designators are given, they * must compatible; e.g., you cannot mix N and E. In addition, the * designator can appear at the beginning or end of the first piece, but * must be at the end of all subsequent pieces (a hemisphere designator is * not allowed after the initial sign). Examples of legal and illegal * combinations are * - LEGAL (these are all equivalent) * - 070:00:45, 70:01:15W+0:0.5, 70:01:15W-0:0:30W, W70:01:15+0:0:30E * - ILLEGAL (the exception thrown explains the problem) * - 70:01:15W+0:0:15N, W70:01:15+W0:0:15 * * \warning The "exponential" notation is not recognized. Thus * 7.0E1 is illegal, while 7.0E+1 is parsed as * (7.0E) + (+1), yielding the same result as * 8.0E. * * \note At present, all the string handling in the C++ implementation of * %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, and the plus and minus signs; various symbols denoting variants * of a space, which may separate the components of a DMS string, are * removed: * - degrees: * - d, D lower and upper case letters * - U+00b0 degree symbol (°) * - U+00ba masculine ordinal indicator (º) * - U+2070 superscript zero (⁰) * - U+02da ring above (˚) * - U+2218 compose function (∘) * - * the GRiD symbol for degrees * - minutes: * - ' apostrophe * - ` grave accent * - U+2032 prime (′) * - U+2035 back prime (‵) * - U+00b4 acute accent (´) * - U+2018 left single quote (‘) * - U+2019 right single quote (’) * - U+201b reversed-9 single quote (‛) * - U+02b9 modifier letter prime (ʹ) * - U+02ca modifier letter acute accent (ˊ) * - U+02cb modifier letter grave accent (ˋ) * - seconds: * - " quotation mark * - U+2033 double prime (″) * - U+2036 reversed double prime (‶) * + U+02dd double acute accent (˝) * - U+201c left double quote (“) * - U+201d right double quote (”) * - U+201f reversed-9 double quote (‟) * - U+02ba modifier letter double prime (ʺ) * - ' ' any two consecutive symbols for minutes * - plus sign: * - + plus * - U+2795 heavy plus (➕) * - U+2064 invisible plus (|⁤|) * - minus sign: * - - hyphen * - U+2010 dash (‐) * - U+2011 non-breaking hyphen (‑) * - U+2013 en dash (–) * - U+2014 em dash (—) * - U+2212 minus sign (−) * - U+2796 heavy minus (➖) * - ignored spaces: * - U+00a0 non-breaking space * - U+2007 figure space (| |) * - U+2009 thin space (| |) * - U+200a hair space ( | |) * - U+200b invisible space (|​|) * - U+202f narrow space ( | |) * - U+2063 invisible separator (|⁣|) * . * 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) { return d + (m + s / 60) / 60; } /** * Convert a pair of strings to latitude and longitude. * * @param[in] dmsa first string. * @param[in] dmsb second string. * @param[out] lat latitude (degrees). * @param[out] lon longitude (degrees). * @param[in] longfirst if true assume longitude is given before latitude * in the absence of hemisphere designators (default false). * @exception GeographicErr if \e dmsa or \e dmsb is malformed. * @exception GeographicErr if \e dmsa and \e dmsb are both interpreted as * latitudes. * @exception GeographicErr if \e dmsa and \e dmsb are both interpreted as * longitudes. * @exception GeographicErr if decoded latitude is not in [−90°, * 90°]. * * 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). If an exception is thrown, \e lat and \e lon are * unchanged. **********************************************************************/ static void DecodeLatLon(const std::string& dmsa, const std::string& dmsb, real& lat, real& lon, bool longfirst = false); /** * Convert a string to an angle in degrees. * * @param[in] angstr input string. * @exception GeographicErr if \e angstr is malformed. * @exception GeographicErr if \e angstr includes a hemisphere designator. * @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. * @exception GeographicErr if \e azistr is malformed. * @exception GeographicErr if \e azistr includes a N/S designator. * @return azimuth (degrees) reduced to the range [−180°, * 180°]. * * A hemisphere designator E/W can be used; the result is multiplied by * −1 if W is present. **********************************************************************/ 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 * of the string (this component 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 indicating additional formatting. * @param[in] dmssep if non-null, use as the DMS separator character * (instead of d, ', " delimiters). * @exception std::bad_alloc if memory for the string can't be allocated. * @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, 360°), 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 = NONE, char dmssep = char(0)); /** * 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). * @exception std::bad_alloc if memory for the string can't be allocated. * @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) { 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) { 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.52/include/GeographicLib/Ellipsoid.hpp0000644000771000077100000005723714064202371022612 0ustar ckarneyckarney/** * \file Ellipsoid.hpp * \brief Header for GeographicLib::Ellipsoid class * * Copyright (c) Charles Karney (2012-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_ELLIPSOID_HPP) #define GEOGRAPHICLIB_ELLIPSOID_HPP 1 #include #include #include #include namespace GeographicLib { /** * \brief Properties of an ellipsoid * * This class returns various properties of the ellipsoid and converts * between various types of latitudes. The latitude conversions are also * possible using the various projections supported by %GeographicLib; but * Ellipsoid provides more direct access (sometimes using private functions * of the projection classes). Ellipsoid::RectifyingLatitude, * Ellipsoid::InverseRectifyingLatitude, and Ellipsoid::MeridianDistance * provide functionality which can be provided by the Geodesic class. * However Geodesic uses a series approximation (valid for abs \e f < 1/150), * whereas Ellipsoid computes these quantities using EllipticFunction which * provides accurate results even when \e f is large. Use of this class * should be limited to −3 < \e f < 3/4 (i.e., 1/4 < b/a < 4). * * Example of use: * \include example-Ellipsoid.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT Ellipsoid { private: typedef Math::real real; static const int numit_ = 10; real stol_; real _a, _f, _f1, _f12, _e2, _es, _e12, _n, _b; TransverseMercator _tm; EllipticFunction _ell; AlbersEqualArea _au; // These are the alpha and beta coefficients in the Krueger series from // TransverseMercator. Thy are used by RhumbSolve to compute // (psi2-psi1)/(mu2-mu1). const Math::real* ConformalToRectifyingCoeffs() const { return _tm._alp; } const Math::real* RectifyingToConformalCoeffs() const { return _tm._bet; } friend class Rhumb; friend class RhumbLine; public: /** \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. * @exception GeographicErr if \e a or (1 − \e f) \e a is not * positive. **********************************************************************/ Ellipsoid(real a, real f); ///@} /** \name %Ellipsoid dimensions. **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real EquatorialRadius() const { return _a; } /** * @return \e b the polar semi-axis (meters). **********************************************************************/ Math::real MinorRadius() const { return _b; } /** * @return \e L the distance between the equator and a pole along a * meridian (meters). For a sphere \e L = (π/2) \e a. The radius * of a sphere with the same meridian length is \e L / (π/2). **********************************************************************/ Math::real QuarterMeridian() const; /** * @return \e A the total area of the ellipsoid (meters2). For * a sphere \e A = 4π a2. The radius of a sphere * with the same area is sqrt(\e A / (4π)). **********************************************************************/ Math::real Area() const; /** * @return \e V the total volume of the ellipsoid (meters3). * For a sphere \e V = (4π / 3) a3. The radius of * a sphere with the same volume is cbrt(\e V / (4π/3)). **********************************************************************/ Math::real Volume() const { return (4 * Math::pi()) * Math::sq(_a) * _b / 3; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** \name %Ellipsoid shape **********************************************************************/ ///@{ /** * @return \e f = (\e a − \e b) / \e a, the flattening of the * ellipsoid. This is the value used in the constructor. This is zero, * positive, or negative for a sphere, oblate ellipsoid, or prolate * ellipsoid. **********************************************************************/ Math::real Flattening() const { return _f; } /** * @return \e f ' = (\e a − \e b) / \e b, the second flattening of * the ellipsoid. This is zero, positive, or negative for a sphere, * oblate ellipsoid, or prolate ellipsoid. **********************************************************************/ Math::real SecondFlattening() const { return _f / (1 - _f); } /** * @return \e n = (\e a − \e b) / (\e a + \e b), the third flattening * of the ellipsoid. This is zero, positive, or negative for a sphere, * oblate ellipsoid, or prolate ellipsoid. **********************************************************************/ Math::real ThirdFlattening() const { return _n; } /** * @return e2 = (a2 − * b2) / a2, the eccentricity squared * of the ellipsoid. This is zero, positive, or negative for a sphere, * oblate ellipsoid, or prolate ellipsoid. **********************************************************************/ Math::real EccentricitySq() const { return _e2; } /** * @return e' 2 = (a2 − * b2) / b2, the second eccentricity * squared of the ellipsoid. This is zero, positive, or negative for a * sphere, oblate ellipsoid, or prolate ellipsoid. **********************************************************************/ Math::real SecondEccentricitySq() const { return _e12; } /** * @return e'' 2 = (a2 − * b2) / (a2 + b2), * the third eccentricity squared of the ellipsoid. This is zero, * positive, or negative for a sphere, oblate ellipsoid, or prolate * ellipsoid. **********************************************************************/ Math::real ThirdEccentricitySq() const { return _e2 / (2 - _e2); } ///@} /** \name Latitude conversion. **********************************************************************/ ///@{ /** * @param[in] phi the geographic latitude (degrees). * @return β the parametric latitude (degrees). * * The geographic latitude, φ, is the angle between the equatorial * plane and a vector normal to the surface of the ellipsoid. * * The parametric latitude (also called the reduced latitude), β, * allows the cartesian coordinated of a meridian to be expressed * conveniently in parametric form as * - \e R = \e a cos β * - \e Z = \e b sin β * . * where \e a and \e b are the equatorial radius and the polar semi-axis. * For a sphere β = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * β lies in [−90°, 90°]. **********************************************************************/ Math::real ParametricLatitude(real phi) const; /** * @param[in] beta the parametric latitude (degrees). * @return φ the geographic latitude (degrees). * * β must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ Math::real InverseParametricLatitude(real beta) const; /** * @param[in] phi the geographic latitude (degrees). * @return θ the geocentric latitude (degrees). * * The geocentric latitude, θ, is the angle between the equatorial * plane and a line between the center of the ellipsoid and a point on the * ellipsoid. For a sphere θ = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * θ lies in [−90°, 90°]. **********************************************************************/ Math::real GeocentricLatitude(real phi) const; /** * @param[in] theta the geocentric latitude (degrees). * @return φ the geographic latitude (degrees). * * θ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ Math::real InverseGeocentricLatitude(real theta) const; /** * @param[in] phi the geographic latitude (degrees). * @return μ the rectifying latitude (degrees). * * The rectifying latitude, μ, has the property that the distance along * a meridian of the ellipsoid between two points with rectifying latitudes * μ1 and μ2 is equal to * (μ2 - μ1) \e L / 90°, * where \e L = QuarterMeridian(). For a sphere μ = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * μ lies in [−90°, 90°]. **********************************************************************/ Math::real RectifyingLatitude(real phi) const; /** * @param[in] mu the rectifying latitude (degrees). * @return φ the geographic latitude (degrees). * * μ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ Math::real InverseRectifyingLatitude(real mu) const; /** * @param[in] phi the geographic latitude (degrees). * @return ξ the authalic latitude (degrees). * * The authalic latitude, ξ, has the property that the area of the * ellipsoid between two circles with authalic latitudes * ξ1 and ξ2 is equal to (sin * ξ2 - sin ξ1) \e A / 2, where \e A * = Area(). For a sphere ξ = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * ξ lies in [−90°, 90°]. **********************************************************************/ Math::real AuthalicLatitude(real phi) const; /** * @param[in] xi the authalic latitude (degrees). * @return φ the geographic latitude (degrees). * * ξ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ Math::real InverseAuthalicLatitude(real xi) const; /** * @param[in] phi the geographic latitude (degrees). * @return χ the conformal latitude (degrees). * * The conformal latitude, χ, gives the mapping of the ellipsoid to a * sphere which which is conformal (angles are preserved) and in which the * equator of the ellipsoid maps to the equator of the sphere. For a * sphere χ = φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * χ lies in [−90°, 90°]. **********************************************************************/ Math::real ConformalLatitude(real phi) const; /** * @param[in] chi the conformal latitude (degrees). * @return φ the geographic latitude (degrees). * * χ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. The returned value * φ lies in [−90°, 90°]. **********************************************************************/ Math::real InverseConformalLatitude(real chi) const; /** * @param[in] phi the geographic latitude (degrees). * @return ψ the isometric latitude (degrees). * * The isometric latitude gives the mapping of the ellipsoid to a plane * which which is conformal (angles are preserved) and in which the equator * of the ellipsoid maps to a straight line of constant scale; this mapping * defines the Mercator projection. For a sphere ψ = * sinh−1 tan φ. * * φ must lie in the range [−90°, 90°]; the result is * undefined if this condition does not hold. The value returned for φ * = ±90° is some (positive or negative) large but finite value, * such that InverseIsometricLatitude returns the original value of φ. **********************************************************************/ Math::real IsometricLatitude(real phi) const; /** * @param[in] psi the isometric latitude (degrees). * @return φ the geographic latitude (degrees). * * The returned value φ lies in [−90°, 90°]. For a * sphere φ = tan−1 sinh ψ. **********************************************************************/ Math::real InverseIsometricLatitude(real psi) const; ///@} /** \name Other quantities. **********************************************************************/ ///@{ /** * @param[in] phi the geographic latitude (degrees). * @return \e R = \e a cos β the radius of a circle of latitude * φ (meters). \e R (π/180°) gives meters per degree * longitude measured along a circle of latitude. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ Math::real CircleRadius(real phi) const; /** * @param[in] phi the geographic latitude (degrees). * @return \e Z = \e b sin β the distance of a circle of latitude * φ from the equator measured parallel to the ellipsoid axis * (meters). * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ Math::real CircleHeight(real phi) const; /** * @param[in] phi the geographic latitude (degrees). * @return \e s the distance along a meridian * between the equator and a point of latitude φ (meters). \e s is * given by \e s = μ \e L / 90°, where \e L = * QuarterMeridian()). * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ Math::real MeridianDistance(real phi) const; /** * @param[in] phi the geographic latitude (degrees). * @return ρ the meridional radius of curvature of the ellipsoid at * latitude φ (meters); this is the curvature of the meridian. \e * rho is given by ρ = (180°/π) d\e s / dφ, * where \e s = MeridianDistance(); thus ρ (π/180°) * gives meters per degree latitude measured along a meridian. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ Math::real MeridionalCurvatureRadius(real phi) const; /** * @param[in] phi the geographic latitude (degrees). * @return ν the transverse radius of curvature of the ellipsoid at * latitude φ (meters); this is the curvature of a curve on the * ellipsoid which also lies in a plane perpendicular to the ellipsoid * and to the meridian. ν is related to \e R = CircleRadius() by \e * R = ν cos φ. * * φ must lie in the range [−90°, 90°]; the * result is undefined if this condition does not hold. **********************************************************************/ Math::real TransverseCurvatureRadius(real phi) const; /** * @param[in] phi the geographic latitude (degrees). * @param[in] azi the angle between the meridian and the normal section * (degrees). * @return the radius of curvature of the ellipsoid in the normal * section at latitude φ inclined at an angle \e azi to the * meridian (meters). * * φ must lie in the range [−90°, 90°]; the result is * undefined this condition does not hold. **********************************************************************/ Math::real NormalCurvatureRadius(real phi, real azi) const; ///@} /** \name Eccentricity conversions. **********************************************************************/ ///@{ /** * @param[in] fp = \e f ' = (\e a − \e b) / \e b, the second * flattening. * @return \e f = (\e a − \e b) / \e a, the flattening. * * \e f ' should lie in (−1, ∞). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static Math::real SecondFlatteningToFlattening(real fp) { return fp / (1 + fp); } /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return \e f ' = (\e a − \e b) / \e b, the second flattening. * * \e f should lie in (−∞, 1). * The returned value \e f ' lies in (−1, ∞). **********************************************************************/ static Math::real FlatteningToSecondFlattening(real f) { return f / (1 - f); } /** * @param[in] n = (\e a − \e b) / (\e a + \e b), the third * flattening. * @return \e f = (\e a − \e b) / \e a, the flattening. * * \e n should lie in (−1, 1). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static Math::real ThirdFlatteningToFlattening(real n) { return 2 * n / (1 + n); } /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return \e n = (\e a − \e b) / (\e a + \e b), the third * flattening. * * \e f should lie in (−∞, 1). * The returned value \e n lies in (−1, 1). **********************************************************************/ static Math::real FlatteningToThirdFlattening(real f) { return f / (2 - f); } /** * @param[in] e2 = e2 = (a2 − * b2) / a2, the eccentricity * squared. * @return \e f = (\e a − \e b) / \e a, the flattening. * * e2 should lie in (−∞, 1). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static Math::real EccentricitySqToFlattening(real e2) { using std::sqrt; return e2 / (sqrt(1 - e2) + 1); } /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return e2 = (a2 − * b2) / a2, the eccentricity * squared. * * \e f should lie in (−∞, 1). * The returned value e2 lies in (−∞, 1). **********************************************************************/ static Math::real FlatteningToEccentricitySq(real f) { return f * (2 - f); } /** * @param[in] ep2 = e' 2 = (a2 − * b2) / b2, the second eccentricity * squared. * @return \e f = (\e a − \e b) / \e a, the flattening. * * e' 2 should lie in (−1, ∞). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static Math::real SecondEccentricitySqToFlattening(real ep2) { using std::sqrt; return ep2 / (sqrt(1 + ep2) + 1 + ep2); } /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return e' 2 = (a2 − * b2) / b2, the second eccentricity * squared. * * \e f should lie in (−∞, 1). * The returned value e' 2 lies in (−1, ∞). **********************************************************************/ static Math::real FlatteningToSecondEccentricitySq(real f) { return f * (2 - f) / Math::sq(1 - f); } /** * @param[in] epp2 = e'' 2 = (a2 * − b2) / (a2 + * b2), the third eccentricity squared. * @return \e f = (\e a − \e b) / \e a, the flattening. * * e'' 2 should lie in (−1, 1). * The returned value \e f lies in (−∞, 1). **********************************************************************/ static Math::real ThirdEccentricitySqToFlattening(real epp2) { using std::sqrt; return 2 * epp2 / (sqrt((1 - epp2) * (1 + epp2)) + 1 + epp2); } /** * @param[in] f = (\e a − \e b) / \e a, the flattening. * @return e'' 2 = (a2 − * b2) / (a2 + b2), * the third eccentricity squared. * * \e f should lie in (−∞, 1). * The returned value e'' 2 lies in (−1, 1). **********************************************************************/ static Math::real FlatteningToThirdEccentricitySq(real f) { return f * (2 - f) / (1 + Math::sq(1 - f)); } ///@} /** * A global instantiation of Ellipsoid with the parameters for the WGS84 * ellipsoid. **********************************************************************/ static const Ellipsoid& WGS84(); }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_ELLIPSOID_HPP GeographicLib-1.52/include/GeographicLib/EllipticFunction.hpp0000644000771000077100000006441514064202371024135 0ustar ckarneyckarney/** * \file EllipticFunction.hpp * \brief Header for GeographicLib::EllipticFunction class * * Copyright (c) Charles Karney (2008-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP) #define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP 1 #include namespace GeographicLib { /** * \brief Elliptic integrals and functions * * This provides the elliptic functions and integrals needed for Ellipsoid, * GeodesicExact, and TransverseMercatorExact. Two categories of function * are provided: * - \e static functions to compute symmetric elliptic integrals * (https://dlmf.nist.gov/19.16.i) * - \e member functions to compute Legrendre's elliptic * integrals (https://dlmf.nist.gov/19.2.ii) and the * Jacobi elliptic functions (https://dlmf.nist.gov/22.2). * . * In the latter case, an object is constructed giving the modulus \e k (and * optionally the parameter α2). The modulus is always * passed as its square k2 which allows \e k to be pure * imaginary (k2 < 0). (Confusingly, Abramowitz and * Stegun call \e m = k2 the "parameter" and \e n = * α2 the "characteristic".) * * In geodesic applications, it is convenient to separate the incomplete * integrals into secular and periodic components, e.g., * \f[ * E(\phi, k) = (2 E(k) / \pi) [ \phi + \delta E(\phi, k) ] * \f] * where δ\e E(φ, \e k) is an odd periodic function with period * π. * * The computation of the elliptic integrals uses the algorithms given in * - B. C. Carlson, * Computation of real or * complex elliptic integrals, Numerical Algorithms 10, 13--26 (1995) * . * with the additional optimizations given in https://dlmf.nist.gov/19.36.i. * 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 https://dlmf.nist.gov/19 and https://dlmf.nist.gov/22 * * Example of use: * \include example-EllipticFunction.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT EllipticFunction { private: typedef Math::real real; enum { num_ = 13 }; // Max depth required for sncndn; probably 5 is enough. real _k2, _kp2, _alpha2, _alphap2, _eps; real _Kc, _Ec, _Dc, _Pic, _Gc, _Hc; public: /** \name Constructor **********************************************************************/ ///@{ /** * Constructor specifying the modulus and parameter. * * @param[in] k2 the square of the modulus k2. * k2 must lie in (−∞, 1]. * @param[in] alpha2 the parameter α2. * α2 must lie in (−∞, 1]. * @exception GeographicErr if \e k2 or \e alpha2 is out of its legal * range. * * If only elliptic integrals of the first and second kinds are needed, * then set α2 = 0 (the default value); in this case, we * have Π(φ, 0, \e k) = \e F(φ, \e k), \e G(φ, 0, \e k) = \e * E(φ, \e k), and \e H(φ, 0, \e k) = \e F(φ, \e k) - \e * D(φ, \e k). **********************************************************************/ EllipticFunction(real k2 = 0, real alpha2 = 0) { Reset(k2, alpha2); } /** * Constructor specifying the modulus and parameter and their complements. * * @param[in] k2 the square of the modulus k2. * k2 must lie in (−∞, 1]. * @param[in] alpha2 the parameter α2. * α2 must lie in (−∞, 1]. * @param[in] kp2 the complementary modulus squared k'2 = * 1 − k2. This must lie in [0, ∞). * @param[in] alphap2 the complementary parameter α'2 = 1 * − α2. This must lie in [0, ∞). * @exception GeographicErr if \e k2, \e alpha2, \e kp2, or \e alphap2 is * out of its legal range. * * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2 * = 1. (No checking is done that these conditions are met.) This * constructor is provided to enable accuracy to be maintained, e.g., when * \e k is very close to unity. **********************************************************************/ EllipticFunction(real k2, real alpha2, real kp2, real alphap2) { Reset(k2, alpha2, kp2, alphap2); } /** * Reset the modulus and parameter. * * @param[in] k2 the new value of square of the modulus * k2 which must lie in (−∞, ]. * done.) * @param[in] alpha2 the new value of parameter α2. * α2 must lie in (−∞, 1]. * @exception GeographicErr if \e k2 or \e alpha2 is out of its legal * range. **********************************************************************/ void Reset(real k2 = 0, real alpha2 = 0) { Reset(k2, alpha2, 1 - k2, 1 - alpha2); } /** * Reset the modulus and parameter supplying also their complements. * * @param[in] k2 the square of the modulus k2. * k2 must lie in (−∞, 1]. * @param[in] alpha2 the parameter α2. * α2 must lie in (−∞, 1]. * @param[in] kp2 the complementary modulus squared k'2 = * 1 − k2. This must lie in [0, ∞). * @param[in] alphap2 the complementary parameter α'2 = 1 * − α2. This must lie in [0, ∞). * @exception GeographicErr if \e k2, \e alpha2, \e kp2, or \e alphap2 is * out of its legal range. * * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2 * = 1. (No checking is done that these conditions are met.) This * constructor is provided to enable accuracy to be maintained, e.g., when * is very small. **********************************************************************/ void Reset(real k2, real alpha2, real kp2, real alphap2); ///@} /** \name Inspector functions. **********************************************************************/ ///@{ /** * @return the square of the modulus k2. **********************************************************************/ Math::real k2() const { return _k2; } /** * @return the square of the complementary modulus k'2 = * 1 − k2. **********************************************************************/ Math::real kp2() const { return _kp2; } /** * @return the parameter α2. **********************************************************************/ Math::real alpha2() const { return _alpha2; } /** * @return the complementary parameter α'2 = 1 − * α2. **********************************************************************/ Math::real alphap2() const { return _alphap2; } ///@} /** \name Complete elliptic integrals. **********************************************************************/ ///@{ /** * The complete integral of the first kind. * * @return \e K(\e k). * * \e K(\e k) is defined in https://dlmf.nist.gov/19.2.E4 * \f[ * K(k) = \int_0^{\pi/2} \frac1{\sqrt{1-k^2\sin^2\phi}}\,d\phi. * \f] **********************************************************************/ Math::real K() const { return _Kc; } /** * The complete integral of the second kind. * * @return \e E(\e k). * * \e E(\e k) is defined in https://dlmf.nist.gov/19.2.E5 * \f[ * E(k) = \int_0^{\pi/2} \sqrt{1-k^2\sin^2\phi}\,d\phi. * \f] **********************************************************************/ Math::real E() const { return _Ec; } /** * Jahnke's complete integral. * * @return \e D(\e k). * * \e D(\e k) is defined in https://dlmf.nist.gov/19.2.E6 * \f[ * D(k) = * \int_0^{\pi/2} \frac{\sin^2\phi}{\sqrt{1-k^2\sin^2\phi}}\,d\phi. * \f] **********************************************************************/ Math::real D() const { return _Dc; } /** * The difference between the complete integrals of the first and second * kinds. * * @return \e K(\e k) − \e E(\e k). **********************************************************************/ Math::real KE() const { return _k2 * _Dc; } /** * The complete integral of the third kind. * * @return Π(α2, \e k). * * Π(α2, \e k) is defined in * https://dlmf.nist.gov/19.2.E7 * \f[ * \Pi(\alpha^2, k) = \int_0^{\pi/2} * \frac1{\sqrt{1-k^2\sin^2\phi}(1 - \alpha^2\sin^2\phi)}\,d\phi. * \f] **********************************************************************/ Math::real Pi() const { return _Pic; } /** * Legendre's complete geodesic longitude integral. * * @return \e G(α2, \e k). * * \e G(α2, \e k) is given by * \f[ * G(\alpha^2, k) = \int_0^{\pi/2} * \frac{\sqrt{1-k^2\sin^2\phi}}{1 - \alpha^2\sin^2\phi}\,d\phi. * \f] **********************************************************************/ Math::real G() const { return _Gc; } /** * Cayley's complete geodesic longitude difference integral. * * @return \e H(α2, \e k). * * \e H(α2, \e k) is given by * \f[ * H(\alpha^2, k) = \int_0^{\pi/2} * \frac{\cos^2\phi}{(1-\alpha^2\sin^2\phi)\sqrt{1-k^2\sin^2\phi}} * \,d\phi. * \f] **********************************************************************/ Math::real H() const { return _Hc; } ///@} /** \name Incomplete elliptic integrals. **********************************************************************/ ///@{ /** * The incomplete integral of the first kind. * * @param[in] phi * @return \e F(φ, \e k). * * \e F(φ, \e k) is defined in https://dlmf.nist.gov/19.2.E4 * \f[ * F(\phi, k) = \int_0^\phi \frac1{\sqrt{1-k^2\sin^2\theta}}\,d\theta. * \f] **********************************************************************/ Math::real F(real phi) const; /** * The incomplete integral of the second kind. * * @param[in] phi * @return \e E(φ, \e k). * * \e E(φ, \e k) is defined in https://dlmf.nist.gov/19.2.E5 * \f[ * E(\phi, k) = \int_0^\phi \sqrt{1-k^2\sin^2\theta}\,d\theta. * \f] **********************************************************************/ Math::real E(real phi) const; /** * The incomplete integral of the second kind with the argument given in * degrees. * * @param[in] ang in degrees. * @return \e E(π ang/180, \e k). **********************************************************************/ Math::real Ed(real ang) const; /** * The inverse of the incomplete integral of the second kind. * * @param[in] x * @return φ = E−1(\e x, \e k); i.e., the * solution of such that \e E(φ, \e k) = \e x. **********************************************************************/ Math::real Einv(real x) const; /** * The incomplete integral of the third kind. * * @param[in] phi * @return Π(φ, α2, \e k). * * Π(φ, α2, \e k) is defined in * https://dlmf.nist.gov/19.2.E7 * \f[ * \Pi(\phi, \alpha^2, k) = \int_0^\phi * \frac1{\sqrt{1-k^2\sin^2\theta}(1 - \alpha^2\sin^2\theta)}\,d\theta. * \f] **********************************************************************/ Math::real Pi(real phi) const; /** * Jahnke's incomplete elliptic integral. * * @param[in] phi * @return \e D(φ, \e k). * * \e D(φ, \e k) is defined in https://dlmf.nist.gov/19.2.E4 * \f[ * D(\phi, k) = \int_0^\phi * \frac{\sin^2\theta}{\sqrt{1-k^2\sin^2\theta}}\,d\theta. * \f] **********************************************************************/ Math::real D(real phi) const; /** * Legendre's geodesic longitude integral. * * @param[in] phi * @return \e G(φ, α2, \e k). * * \e G(φ, α2, \e k) is defined by * \f[ * \begin{align} * G(\phi, \alpha^2, k) &= * \frac{k^2}{\alpha^2} F(\phi, k) + * \biggl(1 - \frac{k^2}{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\ * &= \int_0^\phi * \frac{\sqrt{1-k^2\sin^2\theta}}{1 - \alpha^2\sin^2\theta}\,d\theta. * \end{align} * \f] * * Legendre expresses the longitude of a point on the geodesic in terms of * this combination of elliptic integrals in Exercices de Calcul * Intégral, Vol. 1 (1811), p. 181, * https://books.google.com/books?id=riIOAAAAQAAJ&pg=PA181. * * See \ref geodellip for the expression for the longitude in terms of this * function. **********************************************************************/ Math::real G(real phi) const; /** * Cayley's geodesic longitude difference integral. * * @param[in] phi * @return \e H(φ, α2, \e k). * * \e H(φ, α2, \e k) is defined by * \f[ * \begin{align} * H(\phi, \alpha^2, k) &= * \frac1{\alpha^2} F(\phi, k) + * \biggl(1 - \frac1{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\ * &= \int_0^\phi * \frac{\cos^2\theta} * {(1-\alpha^2\sin^2\theta)\sqrt{1-k^2\sin^2\theta}} * \,d\theta. * \end{align} * \f] * * Cayley expresses the longitude difference of a point on the geodesic in * terms of this combination of elliptic integrals in Phil. Mag. 40 * (1870), p. 333, https://books.google.com/books?id=Zk0wAAAAIAAJ&pg=PA333. * * See \ref geodellip for the expression for the longitude in terms of this * function. **********************************************************************/ Math::real H(real phi) const; ///@} /** \name Incomplete integrals in terms of Jacobi elliptic functions. **********************************************************************/ ///@{ /** * The incomplete integral of the first kind in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return \e F(φ, \e k) as though φ ∈ (−π, π]. **********************************************************************/ Math::real F(real sn, real cn, real dn) const; /** * The incomplete integral of the second kind in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return \e E(φ, \e k) as though φ ∈ (−π, π]. **********************************************************************/ Math::real E(real sn, real cn, real dn) const; /** * The incomplete integral of the third kind in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return Π(φ, α2, \e k) as though φ ∈ * (−π, π]. **********************************************************************/ Math::real Pi(real sn, real cn, real dn) const; /** * Jahnke's incomplete elliptic integral in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return \e D(φ, \e k) as though φ ∈ (−π, π]. **********************************************************************/ Math::real D(real sn, real cn, real dn) const; /** * Legendre's geodesic longitude integral in terms of Jacobi elliptic * functions. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return \e G(φ, α2, \e k) as though φ ∈ * (−π, π]. **********************************************************************/ Math::real G(real sn, real cn, real dn) const; /** * Cayley's geodesic longitude difference integral in terms of Jacobi * elliptic functions. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return \e H(φ, α2, \e k) as though φ ∈ * (−π, π]. **********************************************************************/ Math::real H(real sn, real cn, real dn) const; ///@} /** \name Periodic versions of incomplete elliptic integrals. **********************************************************************/ ///@{ /** * The periodic incomplete integral of the first kind. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return the periodic function π \e F(φ, \e k) / (2 \e K(\e k)) - * φ. **********************************************************************/ Math::real deltaF(real sn, real cn, real dn) const; /** * The periodic incomplete integral of the second kind. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return the periodic function π \e E(φ, \e k) / (2 \e E(\e k)) - * φ. **********************************************************************/ Math::real deltaE(real sn, real cn, real dn) const; /** * The periodic inverse of the incomplete integral of the second kind. * * @param[in] stau = sinτ. * @param[in] ctau = sinτ. * @return the periodic function E−1(τ (2 \e * E(\e k)/π), \e k) - τ. **********************************************************************/ Math::real deltaEinv(real stau, real ctau) const; /** * The periodic incomplete integral of the third kind. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return the periodic function π Π(φ, α2, * \e k) / (2 Π(α2, \e k)) - φ. **********************************************************************/ Math::real deltaPi(real sn, real cn, real dn) const; /** * The periodic Jahnke's incomplete elliptic integral. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return the periodic function π \e D(φ, \e k) / (2 \e D(\e k)) - * φ. **********************************************************************/ Math::real deltaD(real sn, real cn, real dn) const; /** * Legendre's periodic geodesic longitude integral. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return the periodic function π \e G(φ, \e k) / (2 \e G(\e k)) - * φ. **********************************************************************/ Math::real deltaG(real sn, real cn, real dn) const; /** * Cayley's periodic geodesic longitude difference integral. * * @param[in] sn = sinφ. * @param[in] cn = cosφ. * @param[in] dn = sqrt(1 − k2 * sin2φ). * @return the periodic function π \e H(φ, \e k) / (2 \e H(\e k)) - * φ. **********************************************************************/ Math::real deltaH(real sn, real cn, real dn) const; ///@} /** \name Elliptic functions. **********************************************************************/ ///@{ /** * The Jacobi elliptic functions. * * @param[in] x the argument. * @param[out] sn sn(\e x, \e k). * @param[out] cn cn(\e x, \e k). * @param[out] dn dn(\e x, \e k). **********************************************************************/ void sncndn(real x, real& sn, real& cn, real& dn) const; /** * The Δ amplitude function. * * @param[in] sn sinφ. * @param[in] cn cosφ. * @return Δ = sqrt(1 − k2 * sin2φ). **********************************************************************/ Math::real Delta(real sn, real cn) const { using std::sqrt; return sqrt(_k2 < 0 ? 1 - _k2 * sn*sn : _kp2 + _k2 * cn*cn); } ///@} /** \name Symmetric elliptic integrals. **********************************************************************/ ///@{ /** * Symmetric integral of the first kind RF. * * @param[in] x * @param[in] y * @param[in] z * @return RF(\e x, \e y, \e z). * * RF is defined in https://dlmf.nist.gov/19.16.E1 * \f[ R_F(x, y, z) = \frac12 * \int_0^\infty\frac1{\sqrt{(t + x) (t + y) (t + z)}}\, dt \f] * If one of the arguments is zero, it is more efficient to call the * two-argument version of this function with the non-zero arguments. **********************************************************************/ static real RF(real x, real y, real z); /** * Complete symmetric integral of the first kind, * RF with one argument zero. * * @param[in] x * @param[in] y * @return RF(\e x, \e y, 0). **********************************************************************/ static real RF(real x, real y); /** * Degenerate symmetric integral of the first kind * RC. * * @param[in] x * @param[in] y * @return RC(\e x, \e y) = * RF(\e x, \e y, \e y). * * RC is defined in https://dlmf.nist.gov/19.2.E17 * \f[ R_C(x, y) = \frac12 * \int_0^\infty\frac1{\sqrt{t + x}(t + y)}\,dt \f] **********************************************************************/ static real RC(real x, real y); /** * Symmetric integral of the second kind RG. * * @param[in] x * @param[in] y * @param[in] z * @return RG(\e x, \e y, \e z). * * RG is defined in Carlson, eq 1.5 * \f[ R_G(x, y, z) = \frac14 * \int_0^\infty[(t + x) (t + y) (t + z)]^{-1/2} * \biggl( * \frac x{t + x} + \frac y{t + y} + \frac z{t + z} * \biggr)t\,dt \f] * See also https://dlmf.nist.gov/19.16.E3. * If one of the arguments is zero, it is more efficient to call the * two-argument version of this function with the non-zero arguments. **********************************************************************/ static real RG(real x, real y, real z); /** * Complete symmetric integral of the second kind, * RG with one argument zero. * * @param[in] x * @param[in] y * @return RG(\e x, \e y, 0). **********************************************************************/ static real RG(real x, real y); /** * Symmetric integral of the third kind RJ. * * @param[in] x * @param[in] y * @param[in] z * @param[in] p * @return RJ(\e x, \e y, \e z, \e p). * * RJ is defined in https://dlmf.nist.gov/19.16.E2 * \f[ R_J(x, y, z, p) = \frac32 * \int_0^\infty * [(t + x) (t + y) (t + z)]^{-1/2} (t + p)^{-1}\, dt \f] **********************************************************************/ static real RJ(real x, real y, real z, real p); /** * Degenerate symmetric integral of the third kind * RD. * * @param[in] x * @param[in] y * @param[in] z * @return RD(\e x, \e y, \e z) = * RJ(\e x, \e y, \e z, \e z). * * RD is defined in https://dlmf.nist.gov/19.16.E5 * \f[ R_D(x, y, z) = \frac32 * \int_0^\infty[(t + x) (t + y)]^{-1/2} (t + z)^{-3/2}\, dt \f] **********************************************************************/ static real RD(real x, real y, real z); ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP GeographicLib-1.52/include/GeographicLib/GARS.hpp0000644000771000077100000001214214064202371021404 0ustar ckarneyckarney/** * \file GARS.hpp * \brief Header for GeographicLib::GARS class * * Copyright (c) Charles Karney (2015-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GARS_HPP) #define GEOGRAPHICLIB_GARS_HPP 1 #include #if defined(_MSC_VER) // Squelch warnings about dll vs string # pragma warning (push) # pragma warning (disable: 4251) #endif namespace GeographicLib { /** * \brief Conversions for the Global Area Reference System (GARS) * * The Global Area Reference System is described in * - https://en.wikipedia.org/wiki/Global_Area_Reference_System * - https://earth-info.nga.mil/index.php?dir=coordsys&action=coordsys#tab_gars * . * It provides a compact string representation of a geographic area * (expressed as latitude and longitude). The classes Georef and Geohash * implement similar compact representations. * * Example of use: * \include example-GARS.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT GARS { private: typedef Math::real real; static const char* const digits_; static const char* const letters_; enum { lonorig_ = -180, // Origin for longitude latorig_ = -90, // Origin for latitude baselon_ = 10, // Base for longitude tiles baselat_ = 24, // Base for latitude tiles lonlen_ = 3, latlen_ = 2, baselen_ = lonlen_ + latlen_, mult1_ = 2, // base precision = 1/2 degree mult2_ = 2, // 6th char gives 2x more precision mult3_ = 3, // 7th char gives 3x more precision m_ = mult1_ * mult2_ * mult3_, maxprec_ = 2, maxlen_ = baselen_ + maxprec_, }; GARS(); // Disable constructor public: /** * Convert from geographic coordinates to GARS. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] prec the precision of the resulting GARS. * @param[out] gars the GARS string. * @exception GeographicErr if \e lat is not in [−90°, * 90°]. * @exception std::bad_alloc if memory for \e gars can't be allocated. * * \e prec specifies the precision of \e gars as follows: * - \e prec = 0 (min), 30' precision, e.g., 006AG; * - \e prec = 1, 15' precision, e.g., 006AG3; * - \e prec = 2 (max), 5' precision, e.g., 006AG39. * * If \e lat or \e lon is NaN, then \e gars is set to "INVALID". **********************************************************************/ static void Forward(real lat, real lon, int prec, std::string& gars); /** * Convert from GARS to geographic coordinates. * * @param[in] gars the GARS. * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] prec the precision of \e gars. * @param[in] centerp if true (the default) return the center of the * \e gars, otherwise return the south-west corner. * @exception GeographicErr if \e gars is illegal. * * The case of the letters in \e gars is ignored. \e prec is in the range * [0, 2] and gives the precision of \e gars as follows: * - \e prec = 0 (min), 30' precision, e.g., 006AG; * - \e prec = 1, 15' precision, e.g., 006AG3; * - \e prec = 2 (max), 5' precision, e.g., 006AG39. * * If the first 3 characters of \e gars are "INV", then \e lat and \e lon * are set to NaN and \e prec is unchanged. **********************************************************************/ static void Reverse(const std::string& gars, real& lat, real& lon, int& prec, bool centerp = true); /** * The angular resolution of a GARS. * * @param[in] prec the precision of the GARS. * @return the latitude-longitude resolution (degrees). * * Internally, \e prec is first put in the range [0, 2]. **********************************************************************/ static Math::real Resolution(int prec) { return 1/real(prec <= 0 ? mult1_ : (prec == 1 ? mult1_ * mult2_ : mult1_ * mult2_ * mult3_)); } /** * The GARS precision required to meet a given geographic resolution. * * @param[in] res the minimum of resolution in latitude and longitude * (degrees). * @return GARS precision. * * The returned length is in the range [0, 2]. **********************************************************************/ static int Precision(real res) { using std::abs; res = abs(res); for (int prec = 0; prec < maxprec_; ++prec) if (Resolution(prec) <= res) return prec; return maxprec_; } }; } // namespace GeographicLib #if defined(_MSC_VER) # pragma warning (pop) #endif #endif // GEOGRAPHICLIB_GARS_HPP GeographicLib-1.52/include/GeographicLib/GeoCoords.hpp0000644000771000077100000005420514064202371022542 0ustar ckarneyckarney/** * \file GeoCoords.hpp * \brief Header for GeographicLib::GeoCoords class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEOCOORDS_HPP) #define GEOGRAPHICLIB_GEOCOORDS_HPP 1 #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 GEOGRAPHICLIB_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 { _alt_easting = _easting; _alt_northing = _northing; _alt_gamma = _gamma; _alt_k = _k; _alt_zone = _zone; } static void UTMUPSString(int zone, bool northp, real easting, real northing, int prec, bool abbrev, std::string& utm); void FixHemisphere(); public: /** \name Initializing the GeoCoords object **********************************************************************/ ///@{ /** * The default constructor sets the coordinate as undefined. **********************************************************************/ GeoCoords() : _lat(Math::NaN()) , _long(Math::NaN()) , _easting(Math::NaN()) , _northing(Math::NaN()) , _gamma(Math::NaN()) , _k(Math::NaN()) , _northp(false) , _zone(UTMUPS::INVALID) { 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] longfirst governs the interpretation of geographic * coordinates (see below). * @exception GeographicErr if the \e s is malformed (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 * - 38SLC30 * - 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 longfirst = true (default is false), then * longitude precedes latitude in the absence of a hemisphere designator. * Thus (with \e longfirst = 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. Various alternative symbols for degrees, minutes, * and seconds are allowed. Alternatively, use : to separate these * components. A single addition or subtraction is allowed. (See * DMS::Decode for details.) Thus * - 40d30'30" * - 40d30'30 * - 40°30'30 * - 40d30.5' * - 40d30.5 * - 40:30:30 * - 40:30.5 * - 40.508333333 * - 40:30+0:0:30 * - 40:31-0:0.5 * . * all specify the same angle. The leading sign applies to the following * components so -1d30 is -(1+30/60) = −1.5. However, note * that -1:30-0:0:15 is parsed as (-1:30) + (-0:0:15) = −(1+30/60) * − (15/3600). Latitudes must be in the range [−90°, * 90°]. 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 (38north can also be used). * The latitude band 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 (north or south can also * be used). * * 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 longfirst = false) { Reset(s, centerp, longfirst); } /** * 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. * @exception GeographicErr if \e latitude is not in [−90°, * 90°]. * @exception GeographicErr if \e zone cannot be used for this location. **********************************************************************/ 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). * @exception GeographicErr if \e zone, \e easting, or \e northing is * outside its allowed range. **********************************************************************/ 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 longfirst). * * @param[in] s 1-element, 2-element, or 3-element string representation of * the position. * @param[in] centerp governs the interpretation of MGRS coordinates. * @param[in] longfirst governs the interpretation of geographic * coordinates. * @exception GeographicErr if the \e s is malformed. **********************************************************************/ void Reset(const std::string& s, bool centerp = true, bool longfirst = false); /** * Reset the location in terms of geographic coordinates. See * GeoCoords(real latitude, real longitude, int zone). * * @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. * @exception GeographicErr if \e latitude is not in [−90°, * 90°]. * @exception GeographicErr if \e zone cannot be used for this location. **********************************************************************/ 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; else 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). * * @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). * @exception GeographicErr if \e zone, \e easting, or \e northing is * outside its allowed range. **********************************************************************/ 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 { return _lat; } /** * @return longitude (degrees) **********************************************************************/ Math::real Longitude() const { return _long; } /** * @return easting (meters) **********************************************************************/ Math::real Easting() const { return _easting; } /** * @return northing (meters) **********************************************************************/ Math::real Northing() const { return _northing; } /** * @return meridian convergence (degrees) for the UTM/UPS projection. **********************************************************************/ Math::real Convergence() const { return _gamma; } /** * @return scale for the UTM/UPS projection. **********************************************************************/ Math::real Scale() const { return _k; } /** * @return hemisphere (false means south, true means north). **********************************************************************/ bool Northp() const { return _northp; } /** * @return hemisphere letter n or s. **********************************************************************/ char Hemisphere() const { return _northp ? 'n' : 's'; } /** * @return the zone corresponding to the input (return 0 for UPS). **********************************************************************/ int Zone() const { return _zone; } ///@} /** \name Setting and querying the alternate zone **********************************************************************/ ///@{ /** * Specify alternate zone number. * * @param[in] zone zone number for the alternate representation. * @exception GeographicErr if \e zone cannot be used for this location. * * 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 { return _alt_zone; } /** * @return easting (meters) for alternate zone. **********************************************************************/ Math::real AltEasting() const { return _alt_easting; } /** * @return northing (meters) for alternate zone. **********************************************************************/ Math::real AltNorthing() const { return _alt_northing; } /** * @return meridian convergence (degrees) for alternate zone. **********************************************************************/ Math::real AltConvergence() const { return _alt_gamma; } /** * @return scale for alternate zone. **********************************************************************/ Math::real AltScale() const { 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] longfirst if true give longitude first (default = false) * @exception std::bad_alloc if memory for the string can't be allocated. * @return decimal latitude/longitude string representation. * * Precision specifies accuracy of representation as follows: * - prec = −5 (min), 1° * - prec = 0, 10−5° (about 1m) * - prec = 3, 10−8° * - prec = 9 (max), 10−14° **********************************************************************/ std::string GeoRepresentation(int prec = 0, bool longfirst = false) const; /** * String representation with latitude and longitude as degrees, minutes, * seconds, and hemisphere. * * @param[in] prec precision (relative to about 1m) * @param[in] longfirst if true give longitude first (default = false) * @param[in] dmssep if non-null, use as the DMS separator character * (instead of d, ', " delimiters). * @exception std::bad_alloc if memory for the string can't be allocated. * @return DMS latitude/longitude string representation. * * Precision specifies accuracy of representation as follows: * - prec = −5 (min), 1° * - prec = −4, 0.1° * - 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 = 0, bool longfirst = false, char dmssep = char(0)) const; /** * MGRS string. * * @param[in] prec precision (relative to about 1m). * @exception std::bad_alloc if memory for the string can't be allocated. * @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 = −6 (min), only the grid zone is returned, e.g., 38S * - prec = −5, 100km, e.g., 38SMB * - prec = −4, 10km * - prec = −3, 1km * - prec = −2, 100m * - prec = −1, 10m * - prec = 0, 1m * - prec = 1, 0.1m * - prec = 6 (max), 1μm **********************************************************************/ std::string MGRSRepresentation(int prec = 0) const; /** * UTM/UPS string. * * @param[in] prec precision (relative to about 1m) * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception std::bad_alloc if memory for the string can't be allocated. * @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, 1μm * - prec = 9 (max), 1nm **********************************************************************/ std::string UTMUPSRepresentation(int prec = 0, bool abbrev = true) const; /** * UTM/UPS string with hemisphere override. * * @param[in] northp hemisphere override * @param[in] prec precision (relative to about 1m) * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception GeographicErr if the hemisphere override attempts to change * UPS N to UPS S or vice versa. * @exception std::bad_alloc if memory for the string can't be allocated. * @return UTM/UPS string representation: zone designator, easting, and * northing. **********************************************************************/ std::string UTMUPSRepresentation(bool northp, int prec = 0, bool abbrev = true) const; /** * MGRS string for the alternate zone. See GeoCoords::MGRSRepresentation. * * @param[in] prec precision (relative to about 1m). * @exception std::bad_alloc if memory for the string can't be allocated. * @return MGRS string. **********************************************************************/ std::string AltMGRSRepresentation(int prec = 0) const; /** * UTM/UPS string for the alternate zone. See * GeoCoords::UTMUPSRepresentation. * * @param[in] prec precision (relative to about 1m) * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception std::bad_alloc if memory for the string can't be allocated. * @return UTM/UPS string representation: zone designator, easting, and * northing. **********************************************************************/ std::string AltUTMUPSRepresentation(int prec = 0, bool abbrev = true) const; /** * UTM/UPS string for the alternate zone, with hemisphere override. * * @param[in] northp hemisphere override * @param[in] prec precision (relative to about 1m) * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception GeographicErr if the hemisphere override attempts to change * UPS n to UPS s or vice verse. * @exception std::bad_alloc if memory for the string can't be allocated. * @return UTM/UPS string representation: zone designator, easting, and * northing. **********************************************************************/ std::string AltUTMUPSRepresentation(bool northp, int prec = 0, bool abbrev = true) 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 EquatorialRadius() const { return UTMUPS::EquatorialRadius(); } /** * @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 { return UTMUPS::Flattening(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEOCOORDS_HPP GeographicLib-1.52/include/GeographicLib/Geocentric.hpp0000644000771000077100000002636314064202371022744 0ustar ckarneyckarney/** * \file Geocentric.hpp * \brief Header for GeographicLib::Geocentric class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP) #define GEOGRAPHICLIB_GEOCENTRIC_HPP 1 #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 = 90°. 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. * . * Vermeille similarly updated his method in * - H. Vermeille, * * An analytical method to transform geocentric into * geodetic coordinates, J. Geodesy 85, 105--117 (2011). * . * 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 GEOGRAPHICLIB_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 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_]); static void Rotate(const real M[dim2_], real x, real y, real z, real& X, real& Y, real& Z) { // 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(const real M[dim2_], real X, real Y, real Z, real& x, real& y, real& z) { // 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; void IntReverse(real X, real Y, real Z, real& lat, real& lon, real& h, real M[dim2_]) const; 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. * @exception GeographicErr if \e a or (1 − \e f) \e a is not * 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°]. **********************************************************************/ void Forward(real lat, real lon, real h, real& X, real& Y, real& Z) const { 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 { if (!Init()) return; if (M.end() == M.begin() + dim2_) { real t[dim2_]; IntForward(lat, lon, h, X, Y, Z, t); std::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 minimizes * |h |is returned, i.e., (lat, lon) corresponds to * the closest point on the ellipsoid. 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 { 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 = MT ⋅ \e v0, where * MT is the transpose of \e M. **********************************************************************/ void Reverse(real X, real Y, real Z, real& lat, real& lon, real& h, std::vector& M) const { if (!Init()) return; if (M.end() == M.begin() + dim2_) { real t[dim2_]; IntReverse(X, Y, Z, lat, lon, h, t); std::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 { return _a > 0; } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real EquatorialRadius() const { 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 { return Init() ? _f : Math::NaN(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * A global instantiation of Geocentric with the parameters for the WGS84 * ellipsoid. **********************************************************************/ static const Geocentric& WGS84(); }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEOCENTRIC_HPP GeographicLib-1.52/include/GeographicLib/Geodesic.hpp0000644000771000077100000012763114064202371022404 0ustar ckarneyckarney/** * \file Geodesic.hpp * \brief Header for GeographicLib::Geodesic class * * Copyright (c) Charles Karney (2009-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEODESIC_HPP) #define GEOGRAPHICLIB_GEODESIC_HPP 1 #include #if !defined(GEOGRAPHICLIB_GEODESIC_ORDER) /** * The order of the expansions used by Geodesic. * GEOGRAPHICLIB_GEODESIC_ORDER can be set to any integer in [3, 8]. **********************************************************************/ # define GEOGRAPHICLIB_GEODESIC_ORDER \ (GEOGRAPHICLIB_PRECISION == 2 ? 6 : \ (GEOGRAPHICLIB_PRECISION == 1 ? 3 : \ (GEOGRAPHICLIB_PRECISION == 3 ? 7 : 8))) #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.) In the figure below, latitude if * labeled φ, longitude λ (with λ12 = * λ2 − λ1), and azimuth α. * * spheroidal triangle * * 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 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 provided by * Geodesic::ArcDirect. An arc length in excess of 180° 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 * 90°. * * 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 second point is displaced \e m12 \e dazi1 in * the direction \e azi2 + 90°. 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. The area between the geodesic from point 1 to point 2 and * the equation is represented by \e S12; it is the area, measured * counter-clockwise, of the geodesic quadrilateral with corners * (lat1,lon1), (0,lon1), (0,lon2), and * (lat2,lon2). It can be used to compute the area of any * 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. If points 1, 2, and 3 all lie on a single geodesic, * then the following rules hold: * - \e s13 = \e s12 + \e s23 * - \e a13 = \e a12 + \e a23 * - \e S13 = \e S12 + \e S23 * - \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 shortest distance returned by the solution of the inverse problem is * (obviously) uniquely defined. However, in a few special cases there are * multiple azimuths which yield the same shortest distance. Here is a * catalog of those cases: * - \e lat1 = −\e lat2 (with neither point at a pole). If \e azi1 = * \e azi2, the geodesic is unique. Otherwise there are two geodesics and * the second one is obtained by setting [\e azi1, \e azi2] → [\e * azi2, \e azi1], [\e M12, \e M21] → [\e M21, \e M12], \e S12 → * −\e S12. (This occurs when the longitude difference is near * ±180° for oblate ellipsoids.) * - \e lon2 = \e lon1 ± 180° (with neither point at a pole). If * \e azi1 = 0° or ±180°, the geodesic is unique. Otherwise * there are two geodesics and the second one is obtained by setting [\e * azi1, \e azi2] → [−\e azi1, −\e azi2], \e S12 → * −\e S12. (This occurs when \e lat2 is near −\e lat1 for * prolate ellipsoids.) * - Points 1 and 2 at opposite poles. There are infinitely many geodesics * which can be generated by setting [\e azi1, \e azi2] → [\e azi1, \e * azi2] + [\e d, −\e d], for arbitrary \e d. (For spheres, this * prescription applies when points 1 and 2 are antipodal.) * - \e s12 = 0 (coincident points). There are infinitely many geodesics * which can be generated by setting [\e azi1, \e azi2] → * [\e azi1, \e azi2] + [\e d, \e d], for arbitrary \e d. * * The calculations are accurate to better than 15 nm (15 nanometers) for the * WGS84 ellipsoid. See Sec. 9 of * arXiv:1102.1215v1 for * details. The algorithms used by this class are based on series expansions * using the flattening \e f as a small parameter. These are only accurate * for |f| < 0.02; however reasonably accurate results will be * obtained for |f| < 0.2. Here is a table of the approximate * maximum error (expressed as a distance) for an ellipsoid with the same * equatorial radius as the WGS84 ellipsoid and different values of the * flattening.
   *     |f|      error
   *     0.01     25 nm
   *     0.02     30 nm
   *     0.05     10 um
   *     0.1     1.5 mm
   *     0.2     300 mm
   * 
* For very eccentric ellipsoids, use GeodesicExact instead. * * The algorithms are described in * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * * geod-addenda.html. * . * For more information on geodesics see \ref geodesic. * * Example of use: * \include example-Geodesic.cpp * * GeodSolve is a command-line utility * providing access to the functionality of Geodesic and GeodesicLine. **********************************************************************/ class GEOGRAPHICLIB_EXPORT Geodesic { private: typedef Math::real real; friend class GeodesicLine; static const int nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER; static const int nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER; static const int nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER; static const int nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER; static const int nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER; static const int nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER; static const int nA3x_ = nA3_; static const int nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER; static const int nC3x_ = (nC3_ * (nC3_ - 1)) / 2; static const int nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER; static const int nC4x_ = (nC4_ * (nC4_ + 1)) / 2; // Size for temporary array // nC = max(max(nC1_, nC1p_, nC2_) + 1, max(nC3_, nC4_)) static const int nC_ = GEOGRAPHICLIB_GEODESIC_ORDER + 1; static const unsigned maxit1_ = 20; unsigned maxit2_; real tiny_, tol0_, tol1_, tol2_, tolb_, 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, CAP_MASK = CAP_ALL, OUT_ALL = 0x7F80U, OUT_MASK = 0xFF80U, // Includes LONG_UNROLL }; static real SinCosSeries(bool sinp, real sinx, real cosx, const real c[], int n); static real Astroid(real x, real y); 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 dn1, real ssig2, real csig2, real dn2, real cbet1, real cbet2, unsigned outmask, real& s12s, real& m12a, real& m0, real& M12, real& M21, real Ca[]) const; real InverseStart(real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real lam12, real slam12, real clam12, real& salp1, real& calp1, real& salp2, real& calp2, real& dnm, real Ca[]) const; real Lambda12(real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real salp1, real calp1, real slam120, real clam120, real& salp2, real& calp2, real& sig12, real& ssig1, real& csig1, real& ssig2, real& csig2, real& eps, real& domg12, bool diffp, real& dlam12, real Ca[]) const; real GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real& s12, real& salp1, real& calp1, real& salp2, real& calp2, real& m12, real& M12, real& M21, real& S12) const; // These are Maxima generated functions to provide series approximations to // the integrals for the ellipsoidal geodesic. static real A1m1f(real eps); static void C1f(real eps, real c[]); static void C1pf(real eps, real c[]); static real A2m1f(real eps); static void C2f(real eps, real c[]); void A3coeff(); real A3f(real eps) const; void C3coeff(); void C3f(real eps, real c[]) const; void C4coeff(); void C4f(real k2, real c[]) const; 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, /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, /** * All capabilities, calculate everything. (LONG_UNROLL is not * included in this mask.) * @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. * @exception GeographicErr if \e a or (1 − \e f) \e a is not * positive. **********************************************************************/ Geodesic(real a, real f); ///@} /** \name Direct geodesic problem specified in terms of distance. **********************************************************************/ ///@{ /** * Solve the direct geodesic problem where the length of the geodesic * is specified 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 * negative. * @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°]. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) * * 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 { 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 { 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 { 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 { 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 { 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 { 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. **********************************************************************/ ///@{ /** * Solve the direct geodesic problem where the length of the geodesic * is specified 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 negative. * @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°]. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) * * 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 problem. 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 \e * s12_a12. * @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 negative. * @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; * - \e outmask |= Geodesic::ALL for all of the above; * - \e outmask |= Geodesic::LONG_UNROLL to unroll \e lon2 instead of * wrapping it into the range [−180°, 180°]. * . * 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. * * With the Geodesic::LONG_UNROLL bit set, the quantity \e lon2 − \e * lon1 indicates how many times and in what sense the geodesic encircles * the ellipsoid. **********************************************************************/ 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; ///@} /** \name Inverse geodesic problem. **********************************************************************/ ///@{ /** * Solve the inverse geodesic problem. * * @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°]. * 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. * * The solution to the inverse problem is found using Newton's method. If * this fails to converge (this is very unlikely in geodetic applications * but does occur for very eccentric ellipsoids), then the bisection method * is used to refine the solution. * * 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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; * - \e outmask |= Geodesic::ALL for all of the above. * . * 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; ///@} /** \name Interface to GeodesicLine. **********************************************************************/ ///@{ /** * Set up to compute several points on a single 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 * GeodesicLine::Position. * @return a GeodesicLine object. * * \e lat1 should be in the range [−90°, 90°]. * * 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 azimuth \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; * - \e caps |= Geodesic::ALL for all of the above. * . * The default value of \e caps is Geodesic::ALL. * * If the point is at a pole, the azimuth is defined by keeping \e lon1 * fixed, writing \e lat1 = ±(90 − ε), and taking the * limit ε → 0+. **********************************************************************/ GeodesicLine Line(real lat1, real lon1, real azi1, unsigned caps = ALL) const; /** * Define a GeodesicLine in terms of the inverse geodesic problem. * * @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] 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 * GeodesicLine::Position. * @return a GeodesicLine object. * * This function sets point 3 of the GeodesicLine to correspond to point 2 * of the inverse geodesic problem. * * \e lat1 and \e lat2 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLine InverseLine(real lat1, real lon1, real lat2, real lon2, unsigned caps = ALL) const; /** * Define a GeodesicLine in terms of the direct geodesic problem specified * 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 * negative. * @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 * GeodesicLine::Position. * @return a GeodesicLine object. * * This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLine DirectLine(real lat1, real lon1, real azi1, real s12, unsigned caps = ALL) const; /** * Define a GeodesicLine in terms of the direct geodesic problem specified * 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 negative. * @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 * GeodesicLine::Position. * @return a GeodesicLine object. * * This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLine ArcDirectLine(real lat1, real lon1, real azi1, real a12, unsigned caps = ALL) const; /** * Define a GeodesicLine in terms of the direct geodesic problem specified * in terms of either distance or 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] arcmode boolean flag determining the meaning of the \e * s12_a12. * @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 negative. * @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 * GeodesicLine::Position. * @return a GeodesicLine object. * * This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLine GenDirectLine(real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned caps = ALL) const; ///@} /** \name Inspector functions. **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real EquatorialRadius() const { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ Math::real Flattening() const { return _f; } /** * @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 { return 4 * Math::pi() * _c2; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * A global instantiation of Geodesic with the parameters for the WGS84 * ellipsoid. **********************************************************************/ static const Geodesic& WGS84(); }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEODESIC_HPP GeographicLib-1.52/include/GeographicLib/GeodesicExact.hpp0000644000771000077100000011400014064202371023353 0ustar ckarneyckarney/** * \file GeodesicExact.hpp * \brief Header for GeographicLib::GeodesicExact class * * Copyright (c) Charles Karney (2012-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEODESICEXACT_HPP) #define GEOGRAPHICLIB_GEODESICEXACT_HPP 1 #include #include #if !defined(GEOGRAPHICLIB_GEODESICEXACT_ORDER) /** * The order of the expansions used by GeodesicExact. **********************************************************************/ # define GEOGRAPHICLIB_GEODESICEXACT_ORDER 30 #endif namespace GeographicLib { class GeodesicLineExact; /** * \brief Exact geodesic calculations * * The equations for geodesics on an ellipsoid can be expressed in terms of * incomplete elliptic integrals. The Geodesic class expands these integrals * in a series in the flattening \e f and this provides an accurate solution * for \e f ∈ [-0.01, 0.01]. The GeodesicExact class computes the * ellitpic integrals directly and so provides a solution which is valid for * all \e f. However, in practice, its use should be limited to about * b/\e a ∈ [0.01, 100] or \e f ∈ [−99, 0.99]. * * For the WGS84 ellipsoid, these classes are 2--3 times \e slower than the * series solution and 2--3 times \e less \e accurate (because it's less easy * to control round-off errors with the elliptic integral formulation); i.e., * the error is about 40 nm (40 nanometers) instead of 15 nm. However the * error in the series solution scales as f7 while the * error in the elliptic integral solution depends weakly on \e f. If the * quarter meridian distance is 10000 km and the ratio b/\e a = 1 * − \e f is varied then the approximate maximum error (expressed as a * distance) is
   *       1 - f  error (nm)
   *       1/128     387
   *       1/64      345
   *       1/32      269
   *       1/16      210
   *       1/8       115
   *       1/4        69
   *       1/2        36
   *         1        15
   *         2        25
   *         4        96
   *         8       318
   *        16       985
   *        32      2352
   *        64      6008
   *       128     19024
   * 
* * The computation of the area in these classes is via a 30th order series. * This gives accurate results for b/\e a ∈ [1/2, 2]; the * accuracy is about 8 decimal digits for b/\e a ∈ [1/4, 4]. * * See \ref geodellip for the formulation. See the documentation on the * Geodesic class for additional information on the geodesic problems. * * Example of use: * \include example-GeodesicExact.cpp * * GeodSolve is a command-line utility * providing access to the functionality of GeodesicExact and * GeodesicLineExact (via the -E option). **********************************************************************/ class GEOGRAPHICLIB_EXPORT GeodesicExact { private: typedef Math::real real; friend class GeodesicLineExact; static const int nC4_ = GEOGRAPHICLIB_GEODESICEXACT_ORDER; static const int nC4x_ = (nC4_ * (nC4_ + 1)) / 2; static const unsigned maxit1_ = 20; unsigned maxit2_; real tiny_, tol0_, tol1_, tol2_, tolb_, xthresh_; enum captype { CAP_NONE = 0U, CAP_E = 1U<<0, // Skip 1U<<1 for compatibility with Geodesic (not required) CAP_D = 1U<<2, CAP_H = 1U<<3, CAP_C4 = 1U<<4, CAP_ALL = 0x1FU, CAP_MASK = CAP_ALL, OUT_ALL = 0x7F80U, OUT_MASK = 0xFF80U, // Includes LONG_UNROLL }; static real CosSeries(real sinx, real cosx, const real c[], int n); static real Astroid(real x, real y); real _a, _f, _f1, _e2, _ep2, _n, _b, _c2, _etol2; real _C4x[nC4x_]; void Lengths(const EllipticFunction& E, real sig12, real ssig1, real csig1, real dn1, real ssig2, real csig2, real dn2, real cbet1, real cbet2, unsigned outmask, real& s12s, real& m12a, real& m0, real& M12, real& M21) const; real InverseStart(EllipticFunction& E, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real lam12, real slam12, real clam12, real& salp1, real& calp1, real& salp2, real& calp2, real& dnm) const; real Lambda12(real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real salp1, real calp1, real slam120, real clam120, real& salp2, real& calp2, real& sig12, real& ssig1, real& csig1, real& ssig2, real& csig2, EllipticFunction& E, real& domg12, bool diffp, real& dlam12) const; real GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real& s12, real& salp1, real& calp1, real& salp2, real& calp2, real& m12, real& M12, real& M21, real& S12) const; // These are Maxima generated functions to provide series approximations to // the integrals for the area. void C4coeff(); void C4f(real k2, real c[]) const; // Large coefficients are split so that lo contains the low 52 bits and hi // the rest. This choice avoids double rounding with doubles and higher // precision types. float coefficients will suffer double rounding; // however the accuracy is already lousy for floats. static Math::real reale(long long hi, long long lo) { using std::ldexp; return ldexp(real(hi), 52) + lo; } public: /** * Bit masks for what calculations to do. These masks do double duty. * They signify to the GeodesicLineExact::GeodesicLineExact constructor and * to GeodesicExact::Line what capabilities should be included in the * GeodesicLineExact object. They also specify which results to return in * the general routines GeodesicExact::GenDirect and * GeodesicExact::GenInverse routines. GeodesicLineExact::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 GeodesicLineExact because this is included by default.) * @hideinitializer **********************************************************************/ LATITUDE = 1U<<7 | CAP_NONE, /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8 | CAP_H, /** * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to * include this as a capability to GeodesicLineExact because this is * included by default.) * @hideinitializer **********************************************************************/ AZIMUTH = 1U<<9 | CAP_NONE, /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10 | CAP_E, /** * Allow distance \e s12 to be used as input in the direct geodesic * problem. * @hideinitializer **********************************************************************/ DISTANCE_IN = 1U<<11 | CAP_E, /** * Calculate reduced length \e m12. * @hideinitializer **********************************************************************/ REDUCEDLENGTH = 1U<<12 | CAP_D, /** * Calculate geodesic scales \e M12 and \e M21. * @hideinitializer **********************************************************************/ GEODESICSCALE = 1U<<13 | CAP_D, /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14 | CAP_C4, /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, /** * All capabilities, calculate everything. (LONG_UNROLL is not * included in this mask.) * @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. * @exception GeographicErr if \e a or (1 − \e f) \e a is not * positive. **********************************************************************/ GeodesicExact(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 specified 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°]. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) * * The following functions are overloaded versions of GeodesicExact::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 { 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 GeodesicExact::Direct. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2) const { real t; return GenDirect(lat1, lon1, azi1, false, s12, LATITUDE | LONGITUDE, lat2, lon2, t, t, t, t, t, t); } /** * See the documentation for GeodesicExact::Direct. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2, real& azi2) const { real t; return GenDirect(lat1, lon1, azi1, false, s12, LATITUDE | LONGITUDE | AZIMUTH, lat2, lon2, azi2, t, t, t, t, t); } /** * See the documentation for GeodesicExact::Direct. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2, real& azi2, real& m12) const { 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 GeodesicExact::Direct. **********************************************************************/ Math::real Direct(real lat1, real lon1, real azi1, real s12, real& lat2, real& lon2, real& azi2, real& M12, real& M21) const { 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 GeodesicExact::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 { 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 specified 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°]. 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) * * The following functions are overloaded versions of GeodesicExact::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 { 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 GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2) const { real t; GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE, lat2, lon2, t, t, t, t, t, t); } /** * See the documentation for GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2) const { real t; GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE | AZIMUTH, lat2, lon2, azi2, t, t, t, t, t); } /** * See the documentation for GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2, real& s12) const { real t; GenDirect(lat1, lon1, azi1, true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE, lat2, lon2, azi2, s12, t, t, t, t); } /** * See the documentation for GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2, real& s12, real& m12) const { 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 GeodesicExact::ArcDirect. **********************************************************************/ void ArcDirect(real lat1, real lon1, real azi1, real a12, real& lat2, real& lon2, real& azi2, real& s12, real& M12, real& M21) const { 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 GeodesicExact::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 { 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. GeodesicExact::Direct and * GeodesicExact::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 GeodesicExact::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 GeodesicExact::mask values possible for \e outmask are * - \e outmask |= GeodesicExact::LATITUDE for the latitude \e lat2; * - \e outmask |= GeodesicExact::LONGITUDE for the latitude \e lon2; * - \e outmask |= GeodesicExact::AZIMUTH for the latitude \e azi2; * - \e outmask |= GeodesicExact::DISTANCE for the distance \e s12; * - \e outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length \e * m12; * - \e outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales \e * M12 and \e M21; * - \e outmask |= GeodesicExact::AREA for the area \e S12; * - \e outmask |= GeodesicExact::ALL for all of the above; * - \e outmask |= GeodesicExact::LONG_UNROLL to unroll \e lon2 instead of * wrapping it into the range [−180°, 180°]. * . * 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 * GeodesicExact::DISTANCE and \e arcmode is false, then \e s12 = \e * s12_a12. It is not necessary to include GeodesicExact::DISTANCE_IN in * \e outmask; this is automatically included is \e arcmode is false. * * With the GeodesicExact::LONG_UNROLL bit set, the quantity \e lon2 * − \e lon1 indicates how many times and in what sense the geodesic * encircles the ellipsoid. **********************************************************************/ 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; ///@} /** \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°]. * 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, writing \e lat = ±(90° − ε), * and taking the limit ε → 0+. * * The following functions are overloaded versions of * GeodesicExact::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 { return GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH | REDUCEDLENGTH | GEODESICSCALE | AREA, s12, azi1, azi2, m12, M12, M21, S12); } /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12) const { real t; return GenInverse(lat1, lon1, lat2, lon2, DISTANCE, s12, t, t, t, t, t, t); } /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& azi1, real& azi2) const { real t; return GenInverse(lat1, lon1, lat2, lon2, AZIMUTH, t, azi1, azi2, t, t, t, t); } /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi1, real& azi2) const { real t; return GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH, s12, azi1, azi2, t, t, t, t); } /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi1, real& azi2, real& m12) const { real t; return GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH | REDUCEDLENGTH, s12, azi1, azi2, m12, t, t, t); } /** * See the documentation for GeodesicExact::Inverse. **********************************************************************/ Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi1, real& azi2, real& M12, real& M21) const { real t; return GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH | GEODESICSCALE, s12, azi1, azi2, t, M12, M21, t); } /** * See the documentation for GeodesicExact::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 { 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. GeodesicExact::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 GeodesicExact::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 GeodesicExact::mask values possible for \e outmask are * - \e outmask |= GeodesicExact::DISTANCE for the distance \e s12; * - \e outmask |= GeodesicExact::AZIMUTH for the latitude \e azi2; * - \e outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length \e * m12; * - \e outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales \e * M12 and \e M21; * - \e outmask |= GeodesicExact::AREA for the area \e S12; * - \e outmask |= GeodesicExact::ALL for all of the above. * . * 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; ///@} /** \name Interface to GeodesicLineExact. **********************************************************************/ ///@{ /** * Set up to compute several points on a single 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 GeodesicExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * \e lat1 should be in the range [−90°, 90°]. * * The GeodesicExact::mask values are * - \e caps |= GeodesicExact::LATITUDE for the latitude \e lat2; this is * added automatically; * - \e caps |= GeodesicExact::LONGITUDE for the latitude \e lon2; * - \e caps |= GeodesicExact::AZIMUTH for the azimuth \e azi2; this is * added automatically; * - \e caps |= GeodesicExact::DISTANCE for the distance \e s12; * - \e caps |= GeodesicExact::REDUCEDLENGTH for the reduced length \e m12; * - \e caps |= GeodesicExact::GEODESICSCALE for the geodesic scales \e M12 * and \e M21; * - \e caps |= GeodesicExact::AREA for the area \e S12; * - \e caps |= GeodesicExact::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; * - \e caps |= GeodesicExact::ALL for all of the above. * . * The default value of \e caps is GeodesicExact::ALL which turns on all * the capabilities. * * If the point is at a pole, the azimuth is defined by keeping \e lon1 * fixed, writing \e lat1 = ±(90 − ε), and taking the * limit ε → 0+. **********************************************************************/ GeodesicLineExact Line(real lat1, real lon1, real azi1, unsigned caps = ALL) const; /** * Define a GeodesicLineExact in terms of the inverse geodesic problem. * * @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] caps bitor'ed combination of GeodesicExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * This function sets point 3 of the GeodesicLineExact to correspond to * point 2 of the inverse geodesic problem. * * \e lat1 and \e lat2 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLineExact InverseLine(real lat1, real lon1, real lat2, real lon2, unsigned caps = ALL) const; /** * Define a GeodesicLineExact in terms of the direct geodesic problem * specified 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 * negative. * @param[in] caps bitor'ed combination of GeodesicExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * This function sets point 3 of the GeodesicLineExact to correspond to * point 2 of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLineExact DirectLine(real lat1, real lon1, real azi1, real s12, unsigned caps = ALL) const; /** * Define a GeodesicLineExact in terms of the direct geodesic problem * specified 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 negative. * @param[in] caps bitor'ed combination of GeodesicExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * This function sets point 3 of the GeodesicLineExact to correspond to * point 2 of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLineExact ArcDirectLine(real lat1, real lon1, real azi1, real a12, unsigned caps = ALL) const; /** * Define a GeodesicLineExact in terms of the direct geodesic problem * specified in terms of either distance or 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] arcmode boolean flag determining the meaning of the \e * s12_a12. * @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 negative. * @param[in] caps bitor'ed combination of GeodesicExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLineExact::Position. * @return a GeodesicLineExact object. * * This function sets point 3 of the GeodesicLineExact to correspond to * point 2 of the direct geodesic problem. * * \e lat1 should be in the range [−90°, 90°]. **********************************************************************/ GeodesicLineExact GenDirectLine(real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned caps = ALL) const; ///@} /** \name Inspector functions. **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real EquatorialRadius() const { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ Math::real Flattening() const { return _f; } /** * @return total area of ellipsoid in meters2. The area of a * polygon encircling a pole can be found by adding * GeodesicExact::EllipsoidArea()/2 to the sum of \e S12 for each side of * the polygon. **********************************************************************/ Math::real EllipsoidArea() const { return 4 * Math::pi() * _c2; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * A global instantiation of GeodesicExact with the parameters for the * WGS84 ellipsoid. **********************************************************************/ static const GeodesicExact& WGS84(); }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEODESICEXACT_HPP GeographicLib-1.52/include/GeographicLib/GeodesicLine.hpp0000644000771000077100000007371714064202371023221 0ustar ckarneyckarney/** * \file GeodesicLine.hpp * \brief Header for GeographicLib::GeodesicLine class * * Copyright (c) Charles Karney (2009-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) #define GEOGRAPHICLIB_GEODESICLINE_HPP 1 #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; alternatively, the Geodesic::Line * method can be used to create a GeodesicLine. GeodesicLine.Position * returns the location of point 2 a distance \e s12 along the geodesic. In * addition, GeodesicLine.ArcPosition gives the position of point 2 an arc * length \e a12 along the geodesic. * * You can register the position of a reference point 3 a distance (arc * length), \e s13 (\e a13) along the geodesic with the * GeodesicLine.SetDistance (GeodesicLine.SetArc) functions. Points a * fractional distance along the line can be found by providing, for example, * 0.5 * Distance() as an argument to GeodesicLine.Position. The * Geodesic::InverseLine or Geodesic::DirectLine methods return GeodesicLine * objects with point 3 set to the point 2 of the corresponding geodesic * problem. GeodesicLine objects created with the public constructor or with * Geodesic::Line have \e s13 and \e a13 set to NaNs. * * 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 used by this class are based on series expansions * using the flattening \e f as a small parameter. These are only accurate * for |f| < 0.02; however reasonably accurate results will be * obtained for |f| < 0.2. For very eccentric ellipsoids, use * GeodesicLineExact instead. * * The algorithms are described in * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * * geod-addenda.html. * . * For more information on geodesics see \ref geodesic. * * Example of use: * \include example-GeodesicLine.cpp * * GeodSolve is a command-line utility * providing access to the functionality of Geodesic and GeodesicLine. **********************************************************************/ class GEOGRAPHICLIB_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 tiny_; real _lat1, _lon1, _azi1; real _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2, _salp1, _calp1, _ssig1, _csig1, _dn1, _stau1, _ctau1, _somg1, _comg1, _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41; real _a13, _s13; // 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; void LineInit(const Geodesic& g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps); GeodesicLine(const Geodesic& g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps, bool arcmode, real s13_a13); 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, CAP_MASK = Geodesic::CAP_MASK, OUT_ALL = Geodesic::OUT_ALL, OUT_MASK = Geodesic::OUT_MASK, }; 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, /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = Geodesic::LONG_UNROLL, /** * All capabilities, calculate everything. (LONG_UNROLL is not * included in this mask.) * @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 * GeodesicLine::Position. * * \e lat1 should be in the range [−90°, 90°]. * * 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; * - \e caps |= GeodesicLine::ALL for all of the above. * . * The default value of \e caps is GeodesicLine::ALL. * * If the point is at a pole, the azimuth is defined by keeping \e lon1 * fixed, writing \e lat1 = ±(90° − ε), and taking * the limit ε → 0+. **********************************************************************/ GeodesicLine(const Geodesic& g, real lat1, real lon1, real azi1, unsigned caps = ALL); /** * 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() : _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 from point 1 to point 2 (meters); it can be * negative. * @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 from point 1 to 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 { 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 { 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 { 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 { 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 { 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 { 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 from point 1 to point 2 (degrees); it can * be negative. * @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 from point 1 to 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 \e 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 negative. * @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 from point 1 to 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 from point 1 to 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; * - \e outmask |= GeodesicLine::ALL for all of the above; * - \e outmask |= GeodesicLine::LONG_UNROLL to unroll \e lon2 instead of * reducing it into 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. Note, however, that the arc length is always computed and * returned as the function value. * * With the GeodesicLine::LONG_UNROLL bit set, the quantity \e lon2 − * \e lon1 indicates how many times and in what sense the geodesic * encircles the ellipsoid. **********************************************************************/ 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; ///@} /** \name Setting point 3 **********************************************************************/ ///@{ /** * Specify position of point 3 in terms of distance. * * @param[in] s13 the distance from point 1 to point 3 (meters); it * can be negative. * * This is only useful if the GeodesicLine object has been constructed * with \e caps |= GeodesicLine::DISTANCE_IN. **********************************************************************/ void SetDistance(real s13); /** * Specify position of point 3 in terms of arc length. * * @param[in] a13 the arc length from point 1 to point 3 (degrees); it * can be negative. * * The distance \e s13 is only set if the GeodesicLine object has been * constructed with \e caps |= GeodesicLine::DISTANCE. **********************************************************************/ void SetArc(real a13); /** * Specify position of point 3 in terms of either distance or arc length. * * @param[in] arcmode boolean flag determining the meaning of the second * parameter; if \e arcmode is false, then the GeodesicLine object must * have been constructed with \e caps |= GeodesicLine::DISTANCE_IN. * @param[in] s13_a13 if \e arcmode is false, this is the distance from * point 1 to point 3 (meters); otherwise it is the arc length from * point 1 to point 3 (degrees); it can be negative. **********************************************************************/ void GenSetDistance(bool arcmode, real s13_a13); ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const { return _caps != 0U; } /** * @return \e lat1 the latitude of point 1 (degrees). **********************************************************************/ Math::real Latitude() const { return Init() ? _lat1 : Math::NaN(); } /** * @return \e lon1 the longitude of point 1 (degrees). **********************************************************************/ Math::real Longitude() const { return Init() ? _lon1 : Math::NaN(); } /** * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1. **********************************************************************/ Math::real Azimuth() const { return Init() ? _azi1 : Math::NaN(); } /** * The sine and cosine of \e azi1. * * @param[out] sazi1 the sine of \e azi1. * @param[out] cazi1 the cosine of \e azi1. **********************************************************************/ void Azimuth(real& sazi1, real& cazi1) const { if (Init()) { sazi1 = _salp1; cazi1 = _calp1; } } /** * @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses * the equator in a northward direction. * * The result lies in [−90°, 90°]. **********************************************************************/ Math::real EquatorialAzimuth() const { return Init() ? Math::atan2d(_salp0, _calp0) : Math::NaN(); } /** * The sine and cosine of \e azi0. * * @param[out] sazi0 the sine of \e azi0. * @param[out] cazi0 the cosine of \e azi0. **********************************************************************/ void EquatorialAzimuth(real& sazi0, real& cazi0) const { if (Init()) { sazi0 = _salp0; cazi0 = _calp0; } } /** * @return \e a1 the arc length (degrees) between the northward equatorial * crossing and point 1. * * The result lies in (−180°, 180°]. **********************************************************************/ Math::real EquatorialArc() const { return Init() ? Math::atan2d(_ssig1, _csig1) : 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 EquatorialRadius() const { 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 { return Init() ? _f : Math::NaN(); } /** * @return \e caps the computational capabilities that this object was * constructed with. LATITUDE and AZIMUTH are always included. **********************************************************************/ unsigned Capabilities() const { return _caps; } /** * Test what capabilities are available. * * @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 { testcaps &= OUT_ALL; return (_caps & testcaps) == testcaps; } /** * The distance or arc length to point 3. * * @param[in] arcmode boolean flag determining the meaning of returned * value. * @return \e s13 if \e arcmode is false; \e a13 if \e arcmode is true. **********************************************************************/ Math::real GenDistance(bool arcmode) const { return Init() ? (arcmode ? _a13 : _s13) : Math::NaN(); } /** * @return \e s13, the distance to point 3 (meters). **********************************************************************/ Math::real Distance() const { return GenDistance(false); } /** * @return \e a13, the arc length to point 3 (degrees). **********************************************************************/ Math::real Arc() const { return GenDistance(true); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEODESICLINE_HPP GeographicLib-1.52/include/GeographicLib/GeodesicLineExact.hpp0000644000771000077100000007076314064202371024204 0ustar ckarneyckarney/** * \file GeodesicLineExact.hpp * \brief Header for GeographicLib::GeodesicLineExact class * * Copyright (c) Charles Karney (2012-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEODESICLINEEXACT_HPP) #define GEOGRAPHICLIB_GEODESICLINEEXACT_HPP 1 #include #include #include namespace GeographicLib { /** * \brief An exact geodesic line * * GeodesicLineExact facilitates the determination of a series of points on a * single geodesic. This is a companion to the GeodesicExact class. For * additional information on this class see the documentation on the * GeodesicLine class. * * Example of use: * \include example-GeodesicLineExact.cpp * * GeodSolve is a command-line utility * providing access to the functionality of GeodesicExact and * GeodesicLineExact (via the -E option). **********************************************************************/ class GEOGRAPHICLIB_EXPORT GeodesicLineExact { private: typedef Math::real real; friend class GeodesicExact; static const int nC4_ = GeodesicExact::nC4_; real tiny_; real _lat1, _lon1, _azi1; real _a, _f, _b, _c2, _f1, _e2, _salp0, _calp0, _k2, _salp1, _calp1, _ssig1, _csig1, _dn1, _stau1, _ctau1, _somg1, _comg1, _cchi1, _A4, _B41, _E0, _D0, _H0, _E1, _D1, _H1; real _a13, _s13; real _C4a[nC4_]; // all the elements of _C4a are used EllipticFunction _E; unsigned _caps; void LineInit(const GeodesicExact& g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps); GeodesicLineExact(const GeodesicExact& g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps, bool arcmode, real s13_a13); enum captype { CAP_NONE = GeodesicExact::CAP_NONE, CAP_E = GeodesicExact::CAP_E, CAP_D = GeodesicExact::CAP_D, CAP_H = GeodesicExact::CAP_H, CAP_C4 = GeodesicExact::CAP_C4, CAP_ALL = GeodesicExact::CAP_ALL, CAP_MASK = GeodesicExact::CAP_MASK, OUT_ALL = GeodesicExact::OUT_ALL, OUT_MASK = GeodesicExact::OUT_MASK, }; public: /** * Bit masks for what calculations to do. They signify to the * GeodesicLineExact::GeodesicLineExact constructor and to * GeodesicExact::Line what capabilities should be included in the * GeodesicLineExact object. This is merely a duplication of * GeodesicExact::mask. **********************************************************************/ enum mask { /** * No capabilities, no output. * @hideinitializer **********************************************************************/ NONE = GeodesicExact::NONE, /** * Calculate latitude \e lat2. (It's not necessary to include this as a * capability to GeodesicLineExact because this is included by default.) * @hideinitializer **********************************************************************/ LATITUDE = GeodesicExact::LATITUDE, /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = GeodesicExact::LONGITUDE, /** * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to * include this as a capability to GeodesicLineExact because this is * included by default.) * @hideinitializer **********************************************************************/ AZIMUTH = GeodesicExact::AZIMUTH, /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = GeodesicExact::DISTANCE, /** * Allow distance \e s12 to be used as input in the direct geodesic * problem. * @hideinitializer **********************************************************************/ DISTANCE_IN = GeodesicExact::DISTANCE_IN, /** * Calculate reduced length \e m12. * @hideinitializer **********************************************************************/ REDUCEDLENGTH = GeodesicExact::REDUCEDLENGTH, /** * Calculate geodesic scales \e M12 and \e M21. * @hideinitializer **********************************************************************/ GEODESICSCALE = GeodesicExact::GEODESICSCALE, /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = GeodesicExact::AREA, /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = GeodesicExact::LONG_UNROLL, /** * All capabilities, calculate everything. (LONG_UNROLL is not * included in this mask.) * @hideinitializer **********************************************************************/ ALL = GeodesicExact::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 GeodesicExact object used to compute the necessary * information about the GeodesicLineExact. * @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 GeodesicLineExact::mask values * specifying the capabilities the GeodesicLineExact object should * possess, i.e., which quantities can be returned in calls to * GeodesicLine::Position. * * \e lat1 should be in the range [−90°, 90°]. * * The GeodesicLineExact::mask values are * - \e caps |= GeodesicLineExact::LATITUDE for the latitude \e lat2; this * is added automatically; * - \e caps |= GeodesicLineExact::LONGITUDE for the latitude \e lon2; * - \e caps |= GeodesicLineExact::AZIMUTH for the latitude \e azi2; this * is added automatically; * - \e caps |= GeodesicLineExact::DISTANCE for the distance \e s12; * - \e caps |= GeodesicLineExact::REDUCEDLENGTH for the reduced length \e m12; * - \e caps |= GeodesicLineExact::GEODESICSCALE for the geodesic scales \e * M12 and \e M21; * - \e caps |= GeodesicLineExact::AREA for the area \e S12; * - \e caps |= GeodesicLineExact::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; * - \e caps |= GeodesicLineExact::ALL for all of the above. * . * The default value of \e caps is GeodesicLineExact::ALL. * * If the point is at a pole, the azimuth is defined by keeping \e lon1 * fixed, writing \e lat1 = ±(90° − ε), and taking * the limit ε → 0+. **********************************************************************/ GeodesicLineExact(const GeodesicExact& g, real lat1, real lon1, real azi1, unsigned caps = ALL); /** * A default constructor. If GeodesicLineExact::Position is called on the * resulting object, it returns immediately (without doing any * calculations). The object can be set with a call to * GeodesicExact::Line. Use Init() to test whether object is still in this * uninitialized state. **********************************************************************/ GeodesicLineExact() : _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 from point 1 to 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 * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::LONGITUDE. * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::AREA. * @return \e a12 arc length from point 1 to point 2 (degrees). * * The values of \e lon2 and \e azi2 returned are in the range * [−180°, 180°]. * * The GeodesicLineExact object \e must have been constructed with \e caps * |= GeodesicLineExact::DISTANCE_IN; otherwise Math::NaN() is returned and * no parameters are set. Requesting a value which the GeodesicLineExact * object is not capable of computing is not an error; the corresponding * argument will not be altered. * * The following functions are overloaded versions of * GeodesicLineExact::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 { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH | GEODESICSCALE | AREA, lat2, lon2, azi2, t, m12, M12, M21, S12); } /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2) const { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE, lat2, lon2, t, t, t, t, t, t); } /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2, real& azi2) const { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE | AZIMUTH, lat2, lon2, azi2, t, t, t, t, t); } /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2, real& azi2, real& m12) const { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH, lat2, lon2, azi2, t, m12, t, t, t); } /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2, real& azi2, real& M12, real& M21) const { real t; return GenPosition(false, s12, LATITUDE | LONGITUDE | AZIMUTH | GEODESICSCALE, lat2, lon2, azi2, t, t, M12, M21, t); } /** * See the documentation for GeodesicLineExact::Position. **********************************************************************/ Math::real Position(real s12, real& lat2, real& lon2, real& azi2, real& m12, real& M12, real& M21) const { 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 from point 1 to 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 * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::LONGITUDE. * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] s12 distance from point 1 to point 2 (meters); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::DISTANCE. * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::AREA. * * The values of \e lon2 and \e azi2 returned are in the range * [−180°, 180°]. * * Requesting a value which the GeodesicLineExact object is not capable of * computing is not an error; the corresponding argument will not be * altered. * * The following functions are overloaded versions of * GeodesicLineExact::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 { GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | REDUCEDLENGTH | GEODESICSCALE | AREA, lat2, lon2, azi2, s12, m12, M12, M21, S12); } /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2) const { real t; GenPosition(true, a12, LATITUDE | LONGITUDE, lat2, lon2, t, t, t, t, t, t); } /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2) const { real t; GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH, lat2, lon2, azi2, t, t, t, t, t); } /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, real& s12) const { real t; GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE, lat2, lon2, azi2, s12, t, t, t, t); } /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, real& s12, real& m12) const { real t; GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | REDUCEDLENGTH, lat2, lon2, azi2, s12, m12, t, t, t); } /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, real& s12, real& M12, real& M21) const { real t; GenPosition(true, a12, LATITUDE | LONGITUDE | AZIMUTH | DISTANCE | GEODESICSCALE, lat2, lon2, azi2, s12, t, M12, M21, t); } /** * See the documentation for GeodesicLineExact::ArcPosition. **********************************************************************/ void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, real& s12, real& m12, real& M12, real& M21) const { 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. GeodesicLineExact::Position and * GeodesicLineExact::ArcPosition are defined in terms of this function. * * @param[in] arcmode boolean flag determining the meaning of the second * parameter; if \e arcmode is false, then the GeodesicLineExact object * must have been constructed with \e caps |= * GeodesicLineExact::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 GeodesicLineExact::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 * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::LONGITUDE. * @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] s12 distance from point 1 to point 2 (meters); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::DISTANCE. * @param[out] m12 reduced length of geodesic (meters); requires that the * GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::REDUCEDLENGTH. * @param[out] M12 geodesic scale of point 2 relative to point 1 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] M21 geodesic scale of point 1 relative to point 2 * (dimensionless); requires that the GeodesicLineExact object was * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. * @param[out] S12 area under the geodesic (meters2); requires * that the GeodesicLineExact object was constructed with \e caps |= * GeodesicLineExact::AREA. * @return \e a12 arc length from point 1 to point 2 (degrees). * * The GeodesicLineExact::mask values possible for \e outmask are * - \e outmask |= GeodesicLineExact::LATITUDE for the latitude \e lat2; * - \e outmask |= GeodesicLineExact::LONGITUDE for the latitude \e lon2; * - \e outmask |= GeodesicLineExact::AZIMUTH for the latitude \e azi2; * - \e outmask |= GeodesicLineExact::DISTANCE for the distance \e s12; * - \e outmask |= GeodesicLineExact::REDUCEDLENGTH for the reduced length * \e m12; * - \e outmask |= GeodesicLineExact::GEODESICSCALE for the geodesic scales * \e M12 and \e M21; * - \e outmask |= GeodesicLineExact::AREA for the area \e S12; * - \e outmask |= GeodesicLineExact::ALL for all of the above; * - \e outmask |= GeodesicLineExact::LONG_UNROLL to unroll \e lon2 instead * of wrapping it into the range [−180°, 180°]. * . * Requesting a value which the GeodesicLineExact 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. * * With the GeodesicLineExact::LONG_UNROLL bit set, the quantity \e lon2 * − \e lon1 indicates how many times and in what sense the geodesic * encircles the ellipsoid. **********************************************************************/ 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; ///@} /** \name Setting point 3 **********************************************************************/ ///@{ /** * Specify position of point 3 in terms of distance. * * @param[in] s13 the distance from point 1 to point 3 (meters); it * can be negative. * * This is only useful if the GeodesicLineExact object has been constructed * with \e caps |= GeodesicLineExact::DISTANCE_IN. **********************************************************************/ void SetDistance(real s13); /** * Specify position of point 3 in terms of arc length. * * @param[in] a13 the arc length from point 1 to point 3 (degrees); it * can be negative. * * The distance \e s13 is only set if the GeodesicLineExact object has been * constructed with \e caps |= GeodesicLineExact::DISTANCE. **********************************************************************/ void SetArc(real a13); /** * Specify position of point 3 in terms of either distance or arc length. * * @param[in] arcmode boolean flag determining the meaning of the second * parameter; if \e arcmode is false, then the GeodesicLineExact object * must have been constructed with \e caps |= * GeodesicLineExact::DISTANCE_IN. * @param[in] s13_a13 if \e arcmode is false, this is the distance from * point 1 to point 3 (meters); otherwise it is the arc length from * point 1 to point 3 (degrees); it can be negative. **********************************************************************/ void GenSetDistance(bool arcmode, real s13_a13); /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const { return _caps != 0U; } /** * @return \e lat1 the latitude of point 1 (degrees). **********************************************************************/ Math::real Latitude() const { return Init() ? _lat1 : Math::NaN(); } /** * @return \e lon1 the longitude of point 1 (degrees). **********************************************************************/ Math::real Longitude() const { return Init() ? _lon1 : Math::NaN(); } /** * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1. **********************************************************************/ Math::real Azimuth() const { return Init() ? _azi1 : Math::NaN(); } /** * The sine and cosine of \e azi1. * * @param[out] sazi1 the sine of \e azi1. * @param[out] cazi1 the cosine of \e azi1. **********************************************************************/ void Azimuth(real& sazi1, real& cazi1) const { if (Init()) { sazi1 = _salp1; cazi1 = _calp1; } } /** * @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses * the equator in a northward direction. * * The result lies in [−90°, 90°]. **********************************************************************/ Math::real EquatorialAzimuth() const { return Init() ? Math::atan2d(_salp0, _calp0) : Math::NaN(); } /** * The sine and cosine of \e azi0. * * @param[out] sazi0 the sine of \e azi0. * @param[out] cazi0 the cosine of \e azi0. **********************************************************************/ void EquatorialAzimuth(real& sazi0, real& cazi0) const { if (Init()) { sazi0 = _salp0; cazi0 = _calp0; } } /** * @return \e a1 the arc length (degrees) between the northward equatorial * crossing and point 1. * * The result lies in (−180°, 180°]. **********************************************************************/ Math::real EquatorialArc() const { using std::atan2; 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 GeodesicExact object used in the * constructor. **********************************************************************/ Math::real EquatorialRadius() const { return Init() ? _a : Math::NaN(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the GeodesicExact object used in the constructor. **********************************************************************/ Math::real Flattening() const { return Init() ? _f : Math::NaN(); } /** * @return \e caps the computational capabilities that this object was * constructed with. LATITUDE and AZIMUTH are always included. **********************************************************************/ unsigned Capabilities() const { return _caps; } /** * Test what capabilities are available. * * @param[in] testcaps a set of bitor'ed GeodesicLineExact::mask values. * @return true if the GeodesicLineExact object has all these capabilities. **********************************************************************/ bool Capabilities(unsigned testcaps) const { testcaps &= OUT_ALL; return (_caps & testcaps) == testcaps; } /** * The distance or arc length to point 3. * * @param[in] arcmode boolean flag determining the meaning of returned * value. * @return \e s13 if \e arcmode is false; \e a13 if \e arcmode is true. **********************************************************************/ Math::real GenDistance(bool arcmode) const { return Init() ? (arcmode ? _a13 : _s13) : Math::NaN(); } /** * @return \e s13, the distance to point 3 (meters). **********************************************************************/ Math::real Distance() const { return GenDistance(false); } /** * @return \e a13, the arc length to point 3 (degrees). **********************************************************************/ Math::real Arc() const { return GenDistance(true); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GEODESICLINEEXACT_HPP GeographicLib-1.52/include/GeographicLib/Geohash.hpp0000644000771000077100000001455414064202371022237 0ustar ckarneyckarney/** * \file Geohash.hpp * \brief Header for GeographicLib::Geohash class * * Copyright (c) Charles Karney (2012-2017) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEOHASH_HPP) #define GEOGRAPHICLIB_GEOHASH_HPP 1 #include #if defined(_MSC_VER) // Squelch warnings about dll vs string # pragma warning (push) # pragma warning (disable: 4251) #endif namespace GeographicLib { /** * \brief Conversions for geohashes * * Geohashes are described in * - https://en.wikipedia.org/wiki/Geohash * - http://geohash.org/ * . * They provide a compact string representation of a particular geographic * location (expressed as latitude and longitude), with the property that if * trailing characters are dropped from the string the geographic location * remains nearby. The classes Georef and GARS implement similar compact * representations. * * Example of use: * \include example-Geohash.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT Geohash { private: typedef Math::real real; static const int maxlen_ = 18; static const unsigned long long mask_ = 1ULL << 45; static const char* const lcdigits_; static const char* const ucdigits_; Geohash(); // Disable constructor public: /** * Convert from geographic coordinates to a geohash. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] len the length of the resulting geohash. * @param[out] geohash the geohash. * @exception GeographicErr if \e lat is not in [−90°, * 90°]. * @exception std::bad_alloc if memory for \e geohash can't be allocated. * * Internally, \e len is first put in the range [0, 18]. (\e len = 18 * provides approximately 1μm precision.) * * If \e lat or \e lon is NaN, the returned geohash is "invalid". **********************************************************************/ static void Forward(real lat, real lon, int len, std::string& geohash); /** * Convert from a geohash to geographic coordinates. * * @param[in] geohash the geohash. * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] len the length of the geohash. * @param[in] centerp if true (the default) return the center of the * geohash location, otherwise return the south-west corner. * @exception GeographicErr if \e geohash contains illegal characters. * * Only the first 18 characters for \e geohash are considered. (18 * characters provides approximately 1μm precision.) The case of the * letters in \e geohash is ignored. * * If the first 3 characters of \e geohash are "inv", then \e lat and \e * lon are set to NaN and \e len is unchanged. ("nan" is treated * similarly.) **********************************************************************/ static void Reverse(const std::string& geohash, real& lat, real& lon, int& len, bool centerp = true); /** * The latitude resolution of a geohash. * * @param[in] len the length of the geohash. * @return the latitude resolution (degrees). * * Internally, \e len is first put in the range [0, 18]. **********************************************************************/ static Math::real LatitudeResolution(int len) { using std::ldexp; len = (std::max)(0, (std::min)(int(maxlen_), len)); return ldexp(real(180), -(5 * len / 2)); } /** * The longitude resolution of a geohash. * * @param[in] len the length of the geohash. * @return the longitude resolution (degrees). * * Internally, \e len is first put in the range [0, 18]. **********************************************************************/ static Math::real LongitudeResolution(int len) { using std::ldexp; len = (std::max)(0, (std::min)(int(maxlen_), len)); return ldexp(real(360), -(5 * len - 5 * len / 2)); } /** * The geohash length required to meet a given geographic resolution. * * @param[in] res the minimum of resolution in latitude and longitude * (degrees). * @return geohash length. * * The returned length is in the range [0, 18]. **********************************************************************/ static int GeohashLength(real res) { using std::abs; res = abs(res); for (int len = 0; len < maxlen_; ++len) if (LongitudeResolution(len) <= res) return len; return maxlen_; } /** * The geohash length required to meet a given geographic resolution. * * @param[in] latres the resolution in latitude (degrees). * @param[in] lonres the resolution in longitude (degrees). * @return geohash length. * * The returned length is in the range [0, 18]. **********************************************************************/ static int GeohashLength(real latres, real lonres) { using std::abs; latres = abs(latres); lonres = abs(lonres); for (int len = 0; len < maxlen_; ++len) if (LatitudeResolution(len) <= latres && LongitudeResolution(len) <= lonres) return len; return maxlen_; } /** * The decimal geographic precision required to match a given geohash * length. This is the number of digits needed after decimal point in a * decimal degrees representation. * * @param[in] len the length of the geohash. * @return the decimal precision (may be negative). * * Internally, \e len is first put in the range [0, 18]. The returned * decimal precision is in the range [−2, 12]. **********************************************************************/ static int DecimalPrecision(int len) { using std::floor; using std::log; return -int(floor(log(LatitudeResolution(len))/log(Math::real(10)))); } }; } // namespace GeographicLib #if defined(_MSC_VER) # pragma warning (pop) #endif #endif // GEOGRAPHICLIB_GEOHASH_HPP GeographicLib-1.52/include/GeographicLib/Geoid.hpp0000644000771000077100000004612514064202371021707 0ustar ckarneyckarney/** * \file Geoid.hpp * \brief Header for GeographicLib::Geoid class * * Copyright (c) Charles Karney (2009-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEOID_HPP) #define GEOGRAPHICLIB_GEOID_HPP 1 #include #include #include #if defined(_MSC_VER) // Squelch warnings about dll vs vector and constant conditional expressions # pragma warning (push) # pragma warning (disable: 4251 4127) #endif #if !defined(GEOGRAPHICLIB_GEOID_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 216−1. Setting it * to 4 uses a maxval of 232−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 GEOGRAPHICLIB_GEOID_PGM_PIXEL_WIDTH 2 #endif namespace GeographicLib { /** * \brief Looking up the height of the geoid above the ellipsoid * * This class evaluates 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: * https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm84 * - EGM96: * https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm96 * - EGM2008: * https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_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. * * The height of the geoid above the ellipsoid, \e N, is sometimes called the * geoid undulation. It can be used to convert a height above the ellipsoid, * \e h, to the corresponding height above the geoid (the orthometric height, * roughly the height above mean sea level), \e H, using the relations * *    \e h = \e N + \e H; *   \e H = −\e N + \e h. * * 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. * * 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 GEOGRAPHICLIB_EXPORT Geoid { private: typedef Math::real real; #if GEOGRAPHICLIB_GEOID_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 int c0_; static const int c0n_; static const int c0s_; static const int c3_[stencilsize_ * nterms_]; static const int c3n_[stencilsize_ * nterms_]; static const int 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(std::streamoff (_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); // initial values to suppress warnings in case get fails char a = 0, b = 0; _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) const; Geoid(const Geoid&) = delete; // copy constructor not allowed Geoid& operator=(const Geoid&) = delete; // 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 * @exception GeographicErr if the data file cannot be found, is * unreadable, or is corrupt. * @exception GeographicErr if \e threadsafe is true but the memory * necessary for caching the data can't be allocated. * * 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(). If the \e * threadsafe parameter is true, the data set is read into memory, 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. * @exception GeographicErr if the memory necessary for caching the data * can't be allocated (in this case, you will have no cache and can try * again with a smaller area). * @exception GeographicErr if there's a problem reading the data. * @exception GeographicErr if this is called on a threadsafe Geoid. * * 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 360° to its value. \e south and \e north should be in * the range [−90°, 90°]. **********************************************************************/ void CacheArea(real south, real west, real north, real east) const; /** * Cache all the data. * * @exception GeographicErr if the memory necessary for caching the data * can't be allocated (in this case, you will have no cache and can try * again with a smaller area). * @exception GeographicErr if there's a problem reading the data. * @exception GeographicErr if this is called on a threadsafe Geoid. * * 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. **********************************************************************/ 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; ///@} /** \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). * @exception GeographicErr if there's a problem reading the data; this * never happens if (\e lat, \e lon) is within a successfully cached * area. * @return the height of the geoid above the ellipsoid (meters). * * The latitude should be in [−90°, 90°]. **********************************************************************/ Math::real operator()(real lat, real lon) const { return height(lat, lon); } /** * 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. * @exception GeographicErr if there's a problem reading the data; this * never happens if (\e lat, \e lon) is within a successfully cached * area. * @return converted height (meters). **********************************************************************/ Math::real ConvertHeight(real lat, real lon, real h, convertflag d) const { return h + real(d) * height(lat, lon); } ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return geoid description, if available, in the data file; if * absent, return "NONE". **********************************************************************/ const std::string& Description() const { return _description; } /** * @return date of the data file; if absent, return "UNKNOWN". **********************************************************************/ const std::string& DateTime() const { return _datetime; } /** * @return full file name used to load the geoid data. **********************************************************************/ const std::string& GeoidFile() const { return _filename; } /** * @return "name" used to load the geoid data (from the first argument of * the constructor). **********************************************************************/ const std::string& GeoidName() const { return _name; } /** * @return directory used to load the geoid data. **********************************************************************/ const std::string& GeoidDirectory() const { 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 { 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 { 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 { 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 { return _scale; } /** * @return true if the object is constructed to be thread safe. **********************************************************************/ bool ThreadSafe() const { return _threadsafe; } /** * @return true if a data cache is active. **********************************************************************/ bool Cache() const { return _cache; } /** * @return west edge of the cached area; the cache includes this edge. **********************************************************************/ Math::real CacheWest() const { 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 { 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 { 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 { 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 EquatorialRadius() const { 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 { return Constants::WGS84_f(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * @return the default path for geoid data files. * * This is the value of the environment variable GEOGRAPHICLIB_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:/ProgramData/GeographicLib/geoids on Windows systems). **********************************************************************/ static std::string DefaultGeoidPath(); /** * @return the default name for the geoid. * * This is the value of the environment variable GEOGRAPHICLIB_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.52/include/GeographicLib/Georef.hpp0000644000771000077100000001302114064202371022054 0ustar ckarneyckarney/** * \file Georef.hpp * \brief Header for GeographicLib::Georef class * * Copyright (c) Charles Karney (2015-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GEOREF_HPP) #define GEOGRAPHICLIB_GEOREF_HPP 1 #include #if defined(_MSC_VER) // Squelch warnings about dll vs string # pragma warning (push) # pragma warning (disable: 4251) #endif namespace GeographicLib { /** * \brief Conversions for the World Geographic Reference System (georef) * * The World Geographic Reference System is described in * - https://en.wikipedia.org/wiki/Georef * - https://web.archive.org/web/20161214054445/http://earth-info.nga.mil/GandG/coordsys/grids/georef.pdf * . * It provides a compact string representation of a geographic area * (expressed as latitude and longitude). The classes GARS and Geohash * implement similar compact representations. * * Example of use: * \include example-Georef.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT Georef { private: typedef Math::real real; static const char* const digits_; static const char* const lontile_; static const char* const lattile_; static const char* const degrees_; enum { tile_ = 15, // The size of tile in degrees lonorig_ = -180, // Origin for longitude latorig_ = -90, // Origin for latitude base_ = 10, // Base for minutes baselen_ = 4, maxprec_ = 11, // approximately equivalent to MGRS class maxlen_ = baselen_ + 2 * maxprec_, }; Georef(); // Disable constructor public: /** * Convert from geographic coordinates to georef. * * @param[in] lat latitude of point (degrees). * @param[in] lon longitude of point (degrees). * @param[in] prec the precision of the resulting georef. * @param[out] georef the georef string. * @exception GeographicErr if \e lat is not in [−90°, * 90°]. * @exception std::bad_alloc if memory for \e georef can't be allocated. * * \e prec specifies the precision of \e georef as follows: * - \e prec = −1 (min), 15° * - \e prec = 0, 1° * - \e prec = 1, converted to \e prec = 2 * - \e prec = 2, 1' * - \e prec = 3, 0.1' * - \e prec = 4, 0.01' * - \e prec = 5, 0.001' * - … * - \e prec = 11 (max), 10−9' * * If \e lat or \e lon is NaN, then \e georef is set to "INVALID". **********************************************************************/ static void Forward(real lat, real lon, int prec, std::string& georef); /** * Convert from Georef to geographic coordinates. * * @param[in] georef the Georef. * @param[out] lat latitude of point (degrees). * @param[out] lon longitude of point (degrees). * @param[out] prec the precision of \e georef. * @param[in] centerp if true (the default) return the center * \e georef, otherwise return the south-west corner. * @exception GeographicErr if \e georef is illegal. * * The case of the letters in \e georef is ignored. \e prec is in the * range [−1, 11] and gives the precision of \e georef as follows: * - \e prec = −1 (min), 15° * - \e prec = 0, 1° * - \e prec = 1, not returned * - \e prec = 2, 1' * - \e prec = 3, 0.1' * - \e prec = 4, 0.01' * - \e prec = 5, 0.001' * - … * - \e prec = 11 (max), 10−9' * * If the first 3 characters of \e georef are "INV", then \e lat and \e lon * are set to NaN and \e prec is unchanged. **********************************************************************/ static void Reverse(const std::string& georef, real& lat, real& lon, int& prec, bool centerp = true); /** * The angular resolution of a Georef. * * @param[in] prec the precision of the Georef. * @return the latitude-longitude resolution (degrees). * * Internally, \e prec is first put in the range [−1, 11]. **********************************************************************/ static Math::real Resolution(int prec) { if (prec < 1) return real(prec < 0 ? 15 : 1); else { using std::pow; // Treat prec = 1 as 2. prec = (std::max)(2, (std::min)(int(maxprec_), prec)); // Need extra real because, since C++11, pow(float, int) returns double return 1/(60 * real(pow(real(base_), prec - 2))); } } /** * The Georef precision required to meet a given geographic resolution. * * @param[in] res the minimum of resolution in latitude and longitude * (degrees). * @return Georef precision. * * The returned length is in the range [0, 11]. **********************************************************************/ static int Precision(real res) { using std::abs; res = abs(res); for (int prec = 0; prec < maxprec_; ++prec) { if (prec == 1) continue; if (Resolution(prec) <= res) return prec; } return maxprec_; } }; } // namespace GeographicLib #if defined(_MSC_VER) # pragma warning (pop) #endif #endif // GEOGRAPHICLIB_GEOREF_HPP GeographicLib-1.52/include/GeographicLib/Gnomonic.hpp0000644000771000077100000002477614064202371022441 0ustar ckarneyckarney/** * \file Gnomonic.hpp * \brief Header for GeographicLib::Gnomonic class * * Copyright (c) Charles Karney (2010-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GNOMONIC_HPP) #define GEOGRAPHICLIB_GNOMONIC_HPP 1 #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 8 of * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * * geod-addenda.html. * . * 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 ρ = m12/\e M12; finally \e x = ρ sin \e azi1; \e * y = ρ 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, ρ 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 45°, when endpoints are a distance \e r away, and when their * azimuths from the center are ± 45° or ± 135°. * 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. * * \warning 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 GEOGRAPHICLIB_EXPORT Gnomonic { private: typedef Math::real real; real eps0_, eps_; Geodesic _earth; real _a, _f; // numit_ increased from 10 to 20 to fix convergence failure with high // precision (e.g., GEOGRAPHICLIB_DIGITS=2000) calculations. Reverse uses // Newton's method which converges quadratically and so numit_ = 10 would // normally be big enough. However, since the Geodesic class is based on a // series it is of limited accuracy; in particular, the derivative rules // used by Reverse only hold approximately. Consequently, after a few // iterations, the convergence in the Reverse falls back to improvements in // each step by a constant (albeit small) factor. static const int numit_ = 20; 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()); /** * 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°]. * 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; /** * 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°]. \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/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; /** * Gnomonic::Forward without returning the azimuth and scale. **********************************************************************/ void Forward(real lat0, real lon0, real lat, real lon, real& x, real& y) const { 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 { 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 EquatorialRadius() const { return _earth.EquatorialRadius(); } /** * @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 { return _earth.Flattening(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GNOMONIC_HPP GeographicLib-1.52/include/GeographicLib/GravityCircle.hpp0000644000771000077100000002706614064202371023432 0ustar ckarneyckarney/** * \file GravityCircle.hpp * \brief Header for GeographicLib::GravityCircle class * * Copyright (c) Charles Karney (2011-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GRAVITYCIRCLE_HPP) #define GEOGRAPHICLIB_GRAVITYCIRCLE_HPP 1 #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 CircularEngine 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 GEOGRAPHICLIB_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, _Px, _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); friend class GravityModel; // GravityModel calls the private constructor Math::real W(real slam, real clam, real& gX, real& gY, real& gZ) const; Math::real V(real slam, real clam, real& gX, real& gY, real& gZ) const; Math::real InternalT(real slam, real clam, real& deltaX, real& deltaY, real& deltaZ, bool gradp, bool correct) const; 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 * (m2 s−2). * * The function includes the effects of the earth's rotation. **********************************************************************/ Math::real Gravity(real lon, real& gx, real& gy, real& gz) const; /** * 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 * (m2 s−2). **********************************************************************/ Math::real Disturbance(real lon, real& deltax, real& deltay, real& deltaz) const; /** * 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; /** * 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; /** * 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 + Φ the sum of the gravitational and * centrifugal potentials (m2 s−2). **********************************************************************/ Math::real W(real lon, real& gX, real& gY, real& gZ) const { real slam, clam; Math::sincosd(lon, slam, clam); return W(slam, clam, 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 - Φ the gravitational potential * (m2 s−2). **********************************************************************/ Math::real V(real lon, real& GX, real& GY, real& GZ) const { real slam, clam; Math::sincosd(lon, slam, clam); return V(slam, clam, 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 { real slam, clam; Math::sincosd(lon, slam, clam); return InternalT(slam, clam, 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 { real slam, clam, dummy; Math::sincosd(lon, slam, clam); return InternalT(slam, clam, dummy, dummy, dummy, false, true); } ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const { 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 EquatorialRadius() const { 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 { return Init() ? _f : Math::NaN(); } /** * @return the latitude of the circle (degrees). **********************************************************************/ Math::real Latitude() const { return Init() ? _lat : Math::NaN(); } /** * @return the height of the circle (meters). **********************************************************************/ Math::real Height() const { return Init() ? _h : Math::NaN(); } /** * @return \e caps the computational capabilities that this object was * constructed with. **********************************************************************/ unsigned Capabilities() const { return _caps; } /** * @param[in] testcaps a set of bitor'ed GravityModel::mask values. * @return true if the GravityCircle object has all these capabilities. **********************************************************************/ bool Capabilities(unsigned testcaps) const { return (_caps & testcaps) == testcaps; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_GRAVITYCIRCLE_HPP GeographicLib-1.52/include/GeographicLib/GravityModel.hpp0000644000771000077100000005747014064202371023273 0ustar ckarneyckarney/** * \file GravityModel.hpp * \brief Header for GeographicLib::GravityModel class * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_GRAVITYMODEL_HPP) #define GEOGRAPHICLIB_GRAVITYMODEL_HPP 1 #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 * atmosphere above the point in question; see \ref gravityatmos. * Determining the height of the geoid above the ellipsoid 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; * - Φ = rotational potential; * - \e W = \e V + Φ = \e T + \e U = total potential; * - V0 = normal gravitation potential; * - \e U = V0 + Φ = total normal potential; * - \e T = \e W − \e U = \e V − V0 = anomalous * or disturbing potential; * - g = ∇\e W = γ + δ; * - f = ∇Φ; * - Γ = ∇V0; * - γ = ∇\e U; * - δ = ∇\e T = gravity disturbance vector * = gPγP; * - δ\e g = gravity disturbance = gP − * γP; * - Δg = gravity anomaly vector = gP * − γQ; here the line \e PQ is * perpendicular to ellipsoid and the potential at \e P equals the normal * potential at \e Q; * - Δ\e g = gravity anomaly = gP − * γQ; * - (ξ, η) deflection of the vertical, the difference in * directions of gP and * γQ, ξ = NS, η = 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 models 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 GEOGRAPHICLIB_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; int _nmx, _mmx; SphericalHarmonic::normalization _norm; NormalGravity _earth; std::vector _Cx, _Sx, _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; GravityModel(const GravityModel&) = delete; // copy constructor not allowed // nor copy assignment GravityModel& operator=(const GravityModel&) = delete; 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. * @param[in] Nmax (optional) if non-negative, truncate the degree of the * model this value. * @param[in] Mmax (optional) if non-negative, truncate the order of the * model this value. * @exception GeographicErr if the data file cannot be found, is * unreadable, or is corrupt, or if \e Mmax > \e Nmax. * @exception std::bad_alloc if the memory necessary for storing the model * can't be allocated. * * 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 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"). * * If \e Nmax ≥ 0 and \e Mmax < 0, then \e Mmax is set to \e Nmax. * After the model is loaded, the maximum degree and order of the model can * be found by the Degree() and Order() methods. **********************************************************************/ explicit GravityModel(const std::string& name, const std::string& path = "", int Nmax = -1, int Mmax = -1); ///@} /** \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 * (m2 s−2). * * 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; /** * 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 * (m2 s−2). **********************************************************************/ Math::real Disturbance(real lat, real lon, real h, real& deltax, real& deltay, real& deltaz) const; /** * 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; /** * 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; ///@} /** \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 + Φ 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; /** * 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 - Φ the gravitational potential * (m2 s−2). **********************************************************************/ Math::real V(real X, real Y, real Z, real& GX, real& GY, real& GZ) const; /** * 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 { 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 { 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 + Φ 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 { 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 Φ the centrifugal potential (m2 * s−2). * * This calls NormalGravity::Phi for ReferenceEllipsoid(). **********************************************************************/ Math::real Phi(real X, real Y, real& fX, real& fY) const { 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. * @exception std::bad_alloc if the memory necessary for creating a * GravityCircle can't be allocated. * @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 { return _earth; } /** * @return the description of the gravity model, if available, in the data * file; if absent, return "NONE". **********************************************************************/ const std::string& Description() const { return _description; } /** * @return date of the model; if absent, return "UNKNOWN". **********************************************************************/ const std::string& DateTime() const { return _date; } /** * @return full file name used to load the gravity model. **********************************************************************/ const std::string& GravityFile() const { 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 { return _name; } /** * @return directory used to load the gravity model. **********************************************************************/ const std::string& GravityModelDirectory() const { return _dir; } /** * @return \e a the equatorial radius of the ellipsoid (meters). **********************************************************************/ Math::real EquatorialRadius() const { return _earth.EquatorialRadius(); } /** * @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 { return _GMmodel; } /** * @return \e GM the mass constant of the ReferenceEllipsoid() * (m3 s−2). **********************************************************************/ Math::real ReferenceMassConstant() const { return _earth.MassConstant(); } /** * @return ω the angular velocity of the model and the * ReferenceEllipsoid() (rad s−1). **********************************************************************/ Math::real AngularVelocity() const { return _earth.AngularVelocity(); } /** * @return \e f the flattening of the ellipsoid. **********************************************************************/ Math::real Flattening() const { return _earth.Flattening(); } /** * @return \e Nmax the maximum degree of the components of the model. **********************************************************************/ int Degree() const { return _nmx; } /** * @return \e Mmax the maximum order of the components of the model. **********************************************************************/ int Order() const { return _mmx; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * @return the default path for gravity model data files. * * This is the value of the environment variable * GEOGRAPHICLIB_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:/ProgramData/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 * GEOGRAPHICLIB_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.52/include/GeographicLib/LambertConformalConic.hpp0000644000771000077100000003531214064202371025057 0ustar ckarneyckarney/** * \file LambertConformalConic.hpp * \brief Header for GeographicLib::LambertConformalConic class * * Copyright (c) Charles Karney (2010-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP) #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP 1 #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. * * This class also returns the meridian convergence \e gamma and scale \e k. * The meridian convergence is the bearing of grid north (the \e y axis) * measured clockwise from true north. * * 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 GEOGRAPHICLIB_EXPORT LambertConformalConic { private: typedef Math::real real; real eps_, epsx_, ahypover_; real _a, _f, _fm, _e2, _es; real _sign, _n, _nc, _t0nm1, _scale, _lat0, _k0; real _scbet0, _tchi0, _scchi0, _psi0, _nrho0, _drhomax; static const int numit_ = 5; static real hyp(real x) { using std::hypot; return hypot(real(1), 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) // https://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 real Dhyp(real x, real y, real hx, real hy) // 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 real Dsn(real x, real y, real sx, real sy) { // 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 real Dlog1p(real x, real y) { using std::log1p; real t = x - y; if (t < 0) { t = -t; y = x; } return t != 0 ? log1p(t / (1 + y)) / t : 1 / (1 + x); } // Dexp(x,y) = exp((x+y)/2) * 2*sinh((x-y)/2)/(x-y) static real Dexp(real x, real y) { using std::sinh; using std::exp; real t = (x - y)/2; return (t != 0 ? sinh(t)/t : 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 real Dsinh(real x, real y, real sx, real sy, real cx, real cy) // sx = sinh(x), cx = cosh(x) { // real t = (x - y)/2, c = sqrt((1 + cx) * (1 + cy)); // return (t ? sinh(t)/t : real(1)) * (c + sx * sy / c) /2; using std::sinh; using std::sqrt; real t = (x - y)/2; return (t != 0 ? sinh(t)/t : 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 real Dasinh(real x, real y, real hx, real hy) { // hx = hyp(x) using std::asinh; real t = x - y; return t != 0 ? 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) real Deatanhe(real x, real y) const { real t = x - y, d = 1 - _e2 * x * y; return t != 0 ? Math::eatanhe(t / d, _es) / t : _e2 / d; } void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1); 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. * @param[in] stdlat standard parallel (degrees), the circle of tangency. * @param[in] k0 scale on the standard parallel. * @exception GeographicErr if \e a, (1 − \e f) \e a, or \e k0 is * not positive. * @exception GeographicErr if \e stdlat is not in [−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. * @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees). * @param[in] k1 scale on the standard parallels. * @exception GeographicErr if \e a, (1 − \e f) \e a, or \e k1 is * not positive. * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * [−90°, 90°], or if either \e stdlat1 or \e * stdlat2 is a pole and \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. * @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. * @exception GeographicErr if \e a, (1 − \e f) \e a, or \e k1 is * not positive. * @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in * [−90°, 90°], or if either \e stdlat1 or \e * stdlat2 is a pole and \e stdlat1 is not equal \e stdlat2. * * 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) ≤ 160° and max(abs(\e lat1), abs(\e lat2)) ≤ 90 * − min(0.0002, 2.2 × 10−6(180 − \e * dlat), 6 × 10−8 dlat2) (in * degrees), then the error in the latitude of origin is less than 4.5 * × 10−14d and the relative error in the scale is * less than 7 × 10−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). * @exception GeographicErr \e k is not positive. * @exception GeographicErr if \e lat is not in [−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°]. 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; /** * 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. 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; /** * LambertConformalConic::Forward without returning the convergence and * scale. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y) const { 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 { 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 EquatorialRadius() const { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ Math::real Flattening() const { return _f; } /** * @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 { return _lat0; } /** * @return central scale for the projection. This is the scale on the * latitude of origin. **********************************************************************/ Math::real CentralScale() const { return _k0; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * 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.52/include/GeographicLib/LocalCartesian.hpp0000644000771000077100000002357314064202371023546 0ustar ckarneyckarney/** * \file LocalCartesian.hpp * \brief Header for GeographicLib::LocalCartesian class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP 1 #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 GEOGRAPHICLIB_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; void IntReverse(real x, real y, real z, real& lat, real& lon, real& h, real M[dim2_]) const; void MatrixMultiply(real M[dim2_]) const; 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(). * * \e lat0 should be in the range [−90°, 90°]. **********************************************************************/ LocalCartesian(real lat0, real lon0, real h0 = 0, const Geocentric& earth = Geocentric::WGS84()) : _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()) : _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. * * \e lat0 should be in the range [−90°, 90°]. **********************************************************************/ void Reset(real lat0, real lon0, real h0 = 0); /** * 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°]. **********************************************************************/ void Forward(real lat, real lon, real h, real& x, real& y, real& z) const { 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. * * \e lat should be in the range [−90°, 90°]. * * 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 { if (M.end() == M.begin() + dim2_) { real t[dim2_]; IntForward(lat, lon, h, x, y, z, t); std::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). * * In general, there are multiple solutions and the result which minimizes * |h |is returned, i.e., (lat, lon) corresponds to * the closest point on the ellipsoid. 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 { 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 = MT ⋅ \e v0, where * MT is the transpose of \e M. **********************************************************************/ void Reverse(real x, real y, real z, real& lat, real& lon, real& h, std::vector& M) const { if (M.end() == M.begin() + dim2_) { real t[dim2_]; IntReverse(x, y, z, lat, lon, h, t); std::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 { return _lat0; } /** * @return longitude of the origin (degrees). **********************************************************************/ Math::real LongitudeOrigin() const { return _lon0; } /** * @return height of the origin (meters). **********************************************************************/ Math::real HeightOrigin() const { 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 EquatorialRadius() const { return _earth.EquatorialRadius(); } /** * @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 { return _earth.Flattening(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_LOCALCARTESIAN_HPP GeographicLib-1.52/include/GeographicLib/MGRS.hpp0000644000771000077100000004020714064202371021423 0ustar ckarneyckarney/** * \file MGRS.hpp * \brief Header for GeographicLib::MGRS class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_MGRS_HPP) #define GEOGRAPHICLIB_MGRS_HPP 1 #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 document has been updated by the two NGA documents * - * Universal Grids and Grid Reference Systems, * NGA.STND.0037 (2014). * - * The Universal Grids and the Transverse Mercator and Polar Stereographic * Map Projections, NGA.SIG.0012 (2014). * * 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.) * - The trailing digits produced by Forward are consistent as the precision * is varied. Specifically, the digits are obtained by operating on the * easting with ⌊106 x⌋ and extracting the * required digits from the resulting number (and similarly for the * northing). * - 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 GEOGRAPHICLIB_EXPORT MGRS { private: typedef Math::real real; static const char* const hemispheres_; static const char* const utmcols_[3]; static const char* const utmrow_; static const char* const upscols_[4]; static const char* const upsrows_[2]; static const char* const latband_; static const char* const upsband_; static const char* const 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, // For generating digits at maxprec mult_ = 1000000, }; static void CheckCoords(bool utmp, bool& northp, real& x, real& y); static int UTMRow(int iband, int icol, int irow); friend class UTMUPS; // UTMUPS::StandardZone calls LatitudeBand // Return latitude band number [-10, 10) for the given latitude (degrees). // The bands are reckoned in include their southern edges. static int LatitudeBand(real lat) { using std::floor; int ilat = int(floor(lat)); return (std::max)(-10, (std::min)(9, (ilat + 80)/8 - 10)); } // Return approximate latitude band number [-10, 10) for the given northing // (meters). With this rule, each 100km tile would have a unique band // letter corresponding to the latitude at the center of the tile. This // function isn't currently used. static int ApproxLatitudeBand(real y) { // northing at tile center in units of tile = 100km using std::floor; using std::abs; real ya = floor( (std::min)(real(88), abs(y/tile_)) ) + real(0.5); // convert to lat (mult by 90/100) and then to band (divide by 8) // the +1 fine tunes the boundary between bands 3 and 4 int b = int(floor( ((ya * 9 + 1) / 10) / 8 )); // For the northern hemisphere we have // band rows num // N 0 0:8 9 // P 1 9:17 9 // Q 2 18:26 9 // R 3 27:34 8 // S 4 35:43 9 // T 5 44:52 9 // U 6 53:61 9 // V 7 62:70 9 // W 8 71:79 9 // X 9 80:94 15 return y >= 0 ? b : -(b + 1); } // 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. * @exception GeographicErr if \e zone, \e x, or \e y is outside its * allowed range. * @exception GeographicErr if the memory for the MGRS string can't be * allocated. * * \e prec specifies the precision of the MGRS string as follows: * - \e prec = −1 (min), only the grid zone is returned * - \e prec = 0, 100 km * - \e prec = 1, 10 km * - \e prec = 2, 1 km * - \e prec = 3, 100 m * - \e prec = 4, 10 m * - \e prec = 5, 1 m * - \e prec = 6, 0.1 m * - … * - \e prec = 11 (max), 1 μm * * 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 than 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 prec = −1, then the "grid zone designation", e.g., 18T, is * returned. This consists of the UTM zone number (absent for UPS) and the * first letter of the MGRS string which labels the latitude band for UTM * and the hemisphere for UPS. * * 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. * @exception GeographicErr if \e zone, \e x, or \e y is outside its * allowed range. * @exception GeographicErr if \e lat is inconsistent with the given UTM * coordinates. * @exception std::bad_alloc if the memory for \e mgrs can't be allocated. * * 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. * @exception GeographicErr if \e mgrs is illegal. * * 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 38WMS 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 * \e centerp = true, the conversion from MGRS to geographic and back is * stable. This is not assured if \e centerp = false. * * If a "grid zone designation" (for example, 18T or A) is given, then some * suitable (but essentially arbitrary) point within that grid zone is * returned. The main utility of the conversion is to allow \e zone and \e * northp to be determined. In this case, the \e centerp parameter is * ignored and \e prec is set to −1. * * If the first 3 characters of \e mgrs are "INV", then \e x and \e y are * set to NaN, \e zone is set to UTMUPS::INVALID, and \e prec is set to * −2. * * If an exception 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 EquatorialRadius() { return UTMUPS::EquatorialRadius(); } /** * @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() { return UTMUPS::Flattening(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") static Math::real MajorRadius() { return EquatorialRadius(); } ///@} /** * Perform some checks on the UTMUPS coordinates on this ellipsoid. Throw * an error if any of the assumptions made in the MGRS class is not true. * This check needs to be carried out if the ellipsoid parameters (or the * UTM/UPS scales) are ever changed. **********************************************************************/ static void Check(); }; } // namespace GeographicLib #if defined(_MSC_VER) # pragma warning (pop) #endif #endif // GEOGRAPHICLIB_MGRS_HPP GeographicLib-1.52/include/GeographicLib/MagneticCircle.hpp0000644000771000077100000001701514064202371023525 0ustar ckarneyckarney/** * \file MagneticCircle.hpp * \brief Header for GeographicLib::MagneticCircle class * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_MAGNETICCIRCLE_HPP) #define GEOGRAPHICLIB_MAGNETICCIRCLE_HPP 1 #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 CircularEngine 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 GEOGRAPHICLIB_EXPORT MagneticCircle { private: typedef Math::real real; real _a, _f, _lat, _h, _t, _cphi, _sphi, _t1, _dt0; bool _interpolate, _constterm; CircularEngine _circ0, _circ1, _circ2; 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(Math::LatFix(lat)) , _h(h) , _t(t) , _cphi(cphi) , _sphi(sphi) , _t1(t1) , _dt0(dt0) , _interpolate(interpolate) , _constterm(false) , _circ0(circ0) , _circ1(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, const CircularEngine& circ2) : _a(a) , _f(f) , _lat(lat) , _h(h) , _t(t) , _cphi(cphi) , _sphi(sphi) , _t1(t1) , _dt0(dt0) , _interpolate(interpolate) , _constterm(true) , _circ0(circ0) , _circ1(circ1) , _circ2(circ2) {} void Field(real lon, bool diffp, real& Bx, real& By, real& Bz, real& Bxt, real& Byt, real& Bzt) const; void FieldGeocentric(real slam, real clam, real& BX, real& BY, real& BZ, real& BXt, real& BYt, real& BZt) const; 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 { 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 { Field(lon, true, Bx, By, Bz, Bxt, Byt, Bzt); } /** * 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 \e X component of the magnetic field (nT). * @param[out] BY the \e Y component of the magnetic field (nT). * @param[out] BZ the \e Z component of the magnetic field (nT). * @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 FieldGeocentric(real lon, real& BX, real& BY, real& BZ, real& BXt, real& BYt, real& BZt) const; ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const { 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 EquatorialRadius() const { 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 { return Init() ? _f : Math::NaN(); } /** * @return the latitude of the circle (degrees). **********************************************************************/ Math::real Latitude() const { return Init() ? _lat : Math::NaN(); } /** * @return the height of the circle (meters). **********************************************************************/ Math::real Height() const { return Init() ? _h : Math::NaN(); } /** * @return the time (fractional years). **********************************************************************/ Math::real Time() const { return Init() ? _t : Math::NaN(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_MAGNETICCIRCLE_HPP GeographicLib-1.52/include/GeographicLib/MagneticModel.hpp0000644000771000077100000004335514064202371023372 0ustar ckarneyckarney/** * \file MagneticModel.hpp * \brief Header for GeographicLib::MagneticModel class * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_MAGNETICMODEL_HPP) #define GEOGRAPHICLIB_MAGNETICMODEL_HPP 1 #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 models and * the data format. * * See * - General information: * - http://geomag.org/models/index.html * - WMM2010: * - https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml * - https://ngdc.noaa.gov/geomag/WMM/data/WMM2010/WMM2010COF.zip * - WMM2015 (deprecated): * - https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml * - https://ngdc.noaa.gov/geomag/WMM/data/WMM2015/WMM2015COF.zip * - WMM2015V2: * - https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml * - https://ngdc.noaa.gov/geomag/WMM/data/WMM2015/WMM2015v2COF.zip * - WMM2020: * - https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml * - https://ngdc.noaa.gov/geomag/WMM/data/WMM2020/WMM2020COF.zip * - IGRF11: * - https://ngdc.noaa.gov/IAGA/vmod/igrf.html * - https://ngdc.noaa.gov/IAGA/vmod/igrf11coeffs.txt * - https://ngdc.noaa.gov/IAGA/vmod/geomag70_linux.tar.gz * - EMM2010: * - https://ngdc.noaa.gov/geomag/EMM/index.html * - https://ngdc.noaa.gov/geomag/EMM/data/geomag/EMM2010_Sph_Windows_Linux.zip * - EMM2015: * - https://ngdc.noaa.gov/geomag/EMM/index.html * - https://www.ngdc.noaa.gov/geomag/EMM/data/geomag/EMM2015_Sph_Linux.zip * - EMM2017: * - https://ngdc.noaa.gov/geomag/EMM/index.html * - https://www.ngdc.noaa.gov/geomag/EMM/data/geomag/EMM2017_Sph_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 GEOGRAPHICLIB_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, _Nconstants, _nmx, _mmx; 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; void ReadMetadata(const std::string& name); // copy constructor not allowed MagneticModel(const MagneticModel&) = delete; // nor copy assignment MagneticModel& operator=(const MagneticModel&) = delete; 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(). * @param[in] Nmax (optional) if non-negative, truncate the degree of the * model this value. * @param[in] Mmax (optional) if non-negative, truncate the order of the * model this value. * @exception GeographicErr if the data file cannot be found, is * unreadable, or is corrupt, or if \e Mmax > \e Nmax. * @exception std::bad_alloc if the memory necessary for storing the model * can't be allocated. * * 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 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 specifies an ellipsoid to * allow geodetic coordinates to the transformed into the spherical * coordinates used in the spherical harmonic sum. * * If \e Nmax ≥ 0 and \e Mmax < 0, then \e Mmax is set to \e Nmax. * After the model is loaded, the maximum degree and order of the model can * be found by the Degree() and Order() methods. **********************************************************************/ explicit MagneticModel(const std::string& name, const std::string& path = "", const Geocentric& earth = Geocentric::WGS84(), int Nmax = -1, int Mmax = -1); ///@} /** \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 { 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 { 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). * @exception std::bad_alloc if the memory necessary for creating a * MagneticCircle can't be allocated. * @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 the magnetic field in geocentric coordinate. * * @param[in] t the time (years). * @param[in] X geocentric coordinate (meters). * @param[in] Y geocentric coordinate (meters). * @param[in] Z geocentric coordinate (meters). * @param[out] BX the \e X component of the magnetic field (nT). * @param[out] BY the \e Y component of the magnetic field (nT). * @param[out] BZ the \e Z component of the magnetic field (nT). * @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 FieldGeocentric(real t, real X, real Y, real Z, real& BX, real& BY, real& BZ, real& BXt, real& BYt, real& BZt) 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) { 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); ///@} /** \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 { 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 { return _date; } /** * @return full file name used to load the magnetic model. **********************************************************************/ const std::string& MagneticFile() const { 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 { return _name; } /** * @return directory used to load the magnetic model. **********************************************************************/ const std::string& MagneticModelDirectory() const { 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 { 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 { 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 { 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 { 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 EquatorialRadius() const { return _earth.EquatorialRadius(); } /** * @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 { return _earth.Flattening(); } /** * @return \e Nmax the maximum degree of the components of the model. **********************************************************************/ int Degree() const { return _nmx; } /** * @return \e Mmax the maximum order of the components of the model. **********************************************************************/ int Order() const { return _mmx; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * @return the default path for magnetic model data files. * * This is the value of the environment variable * GEOGRAPHICLIB_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:/ProgramData/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 * GEOGRAPHICLIB_MAGNETIC_NAME, if set; otherwise, it is "wmm2020". 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.52/include/GeographicLib/Math.hpp0000644000771000077100000006102614064202371021546 0ustar ckarneyckarney/** * \file Math.hpp * \brief Header for GeographicLib::Math class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ // 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 1 #if !defined(GEOGRAPHICLIB_WORDS_BIGENDIAN) # define GEOGRAPHICLIB_WORDS_BIGENDIAN 0 #endif #if !defined(GEOGRAPHICLIB_HAVE_LONG_DOUBLE) # define GEOGRAPHICLIB_HAVE_LONG_DOUBLE 0 #endif #if !defined(GEOGRAPHICLIB_PRECISION) /** * The precision of floating point numbers used in %GeographicLib. 1 means * float (single precision); 2 (the default) means double; 3 means long double; * 4 is reserved for quadruple precision. Nearly all the testing has been * carried out with doubles and that's the recommended configuration. In order * for long double to be used, GEOGRAPHICLIB_HAVE_LONG_DOUBLE needs to be * defined. Note that with Microsoft Visual Studio, long double is the same as * double. **********************************************************************/ # define GEOGRAPHICLIB_PRECISION 2 #endif #include #include #include #if GEOGRAPHICLIB_PRECISION == 4 #include #include #include #elif GEOGRAPHICLIB_PRECISION == 5 #include #endif #if GEOGRAPHICLIB_PRECISION > 3 // volatile keyword makes no sense for multiprec types #define GEOGRAPHICLIB_VOLATILE // Signal a convergence failure with multiprec types by throwing an exception // at loop exit. #define GEOGRAPHICLIB_PANIC \ (throw GeographicLib::GeographicErr("Convergence failure"), false) #else #define GEOGRAPHICLIB_VOLATILE volatile // Ignore convergence failures with standard floating points types by allowing // loop to exit cleanly. #define GEOGRAPHICLIB_PANIC false #endif 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 GEOGRAPHICLIB_EXPORT Math { private: void dummy(); // Static check for GEOGRAPHICLIB_PRECISION Math(); // Disable constructor public: #if GEOGRAPHICLIB_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_PRECISION == 2 /** * 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_PRECISION == 1 typedef float real; #elif GEOGRAPHICLIB_PRECISION == 3 typedef extended real; #elif GEOGRAPHICLIB_PRECISION == 4 typedef boost::multiprecision::float128 real; #elif GEOGRAPHICLIB_PRECISION == 5 typedef mpfr::mpreal real; #else typedef double real; #endif /** * @return the number of bits of precision in a real number. **********************************************************************/ static int digits(); /** * Set the binary precision of a real number. * * @param[in] ndigits the number of bits of precision. * @return the resulting number of bits of precision. * * This only has an effect when GEOGRAPHICLIB_PRECISION = 5. See also * Utility::set_digits for caveats about when this routine should be * called. **********************************************************************/ static int set_digits(int ndigits); /** * @return the number of decimal digits of precision in a real number. **********************************************************************/ static int digits10(); /** * Number of additional decimal digits of precision for real relative to * double (0 for float). **********************************************************************/ static int extra_digits(); /** * true if the machine is big-endian. **********************************************************************/ static const bool bigendian = GEOGRAPHICLIB_WORDS_BIGENDIAN; /** * @tparam T the type of the returned value. * @return π. **********************************************************************/ template static T pi() { using std::atan2; static const T pi = atan2(T(0), T(-1)); return pi; } /** * @tparam T the type of the returned value. * @return the number of radians in a degree. **********************************************************************/ template static T degree() { static const T degree = pi() / 180; return degree; } /** * Square a number. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return x2. **********************************************************************/ template static T sq(T x) { return x * x; } /** * 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). * * \deprecated Use std::hypot(x, y). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::hypot(x, y)") static T hypot(T x, T y); /** * exp(\e x) − 1 accurate near \e x = 0. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return exp(\e x) − 1. * * \deprecated Use std::expm1(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::expm1(x)") static T expm1(T x); /** * log(1 + \e x) accurate near \e x = 0. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return log(1 + \e x). * * \deprecated Use std::log1p(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::log1p(x)") static T log1p(T x); /** * The inverse hyperbolic sine function. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return asinh(\e x). * * \deprecated Use std::asinh(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::asinh(x)") static T asinh(T x); /** * The inverse hyperbolic tangent function. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return atanh(\e x). * * \deprecated Use std::atanh(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::atanh(x)") static T atanh(T x); /** * Copy the sign. * * @tparam T the type of the argument. * @param[in] x gives the magitude of the result. * @param[in] y gives the sign of the result. * @return value with the magnitude of \e x and with the sign of \e y. * * This routine correctly handles the case \e y = −0, returning * &minus|x|. * * \deprecated Use std::copysign(x, y). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::copysign(x, y)") static T copysign(T x, T y); /** * 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. * * \deprecated Use std::cbrt(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::cbrt(x)") static T cbrt(T x); /** * The remainder function. * * @tparam T the type of the arguments and the returned value. * @param[in] x * @param[in] y * @return the remainder of \e x/\e y in the range [−\e y/2, \e y/2]. * * \deprecated Use std::remainder(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::remainder(x)") static T remainder(T x, T y); /** * The remquo function. * * @tparam T the type of the arguments and the returned value. * @param[in] x * @param[in] y * @param[out] n the low 3 bits of the quotient * @return the remainder of \e x/\e y in the range [−\e y/2, \e y/2]. * * \deprecated Use std::remquo(x, y, n). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::remquo(x, y, n)") static T remquo(T x, T y, int* n); /** * The round function. * * @tparam T the type of the argument and the returned value. * @param[in] x * @return \e x round to the nearest integer (ties round away from 0). * * \deprecated Use std::round(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::round(x)") static T round(T x); /** * The lround function. * * @tparam T the type of the argument. * @param[in] x * @return \e x round to the nearest integer as a long int (ties round away * from 0). * * If the result does not fit in a long int, the return value is undefined. * * \deprecated Use std::lround(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::lround(x)") static long lround(T x); /** * Fused multiply and add. * * @tparam T the type of the arguments and the returned value. * @param[in] x * @param[in] y * @param[in] z * @return xy + z, correctly rounded (on those platforms with * support for the fma instruction). * * On platforms without the fma instruction, no attempt is * made to improve on the result of a rounded multiplication followed by a * rounded addition. * * \deprecated Use std::fma(x, y, z). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::fma(x, y, z)") static T fma(T x, T y, T z); /** * Normalize a two-vector. * * @tparam T the type of the argument and the returned value. * @param[in,out] x on output set to x/hypot(x, y). * @param[in,out] y on output set to y/hypot(x, y). **********************************************************************/ template static void norm(T& x, T& y) { #if defined(_MSC_VER) && defined(_M_IX86) // hypot for Visual Studio (A=win32) fails monotonicity, e.g., with // x = 0.6102683302836215 // y1 = 0.7906090004346522 // y2 = y1 + 1e-16 // the test // hypot(x, y2) >= hypot(x, y1) // fails. Reported 2021-03-14: // https://developercommunity.visualstudio.com/t/1369259 // See also: // https://bugs.python.org/issue43088 using std::sqrt; T h = sqrt(x * x + y * y); #else using std::hypot; T h = hypot(x, y); #endif x /= h; y /= h; } /** * The error-free sum of two numbers. * * @tparam T the type of the argument and the returned value. * @param[in] u * @param[in] v * @param[out] t the exact error given by (\e u + \e v) - \e s. * @return \e s = round(\e u + \e v). * * See D. E. Knuth, TAOCP, Vol 2, 4.2.2, Theorem B. (Note that \e t can be * the same as one of the first two arguments.) **********************************************************************/ template static T sum(T u, T v, T& t); /** * Evaluate a polynomial. * * @tparam T the type of the arguments and returned value. * @param[in] N the order of the polynomial. * @param[in] p the coefficient array (of size \e N + 1). * @param[in] x the variable. * @return the value of the polynomial. * * Evaluate y = ∑n=0..N * pn xNn. * Return 0 if \e N < 0. Return p0, if \e N = 0 (even * if \e x is infinite or a nan). The evaluation uses Horner's method. **********************************************************************/ template static T polyval(int N, const T p[], T x) { // This used to employ Math::fma; but that's too slow and it seemed not to // improve the accuracy noticeably. This might change when there's direct // hardware support for fma. T y = N < 0 ? 0 : *p++; while (--N >= 0) y = y * x + *p++; return y; } /** * Normalize an angle. * * @tparam T the type of the argument and returned value. * @param[in] x the angle in degrees. * @return the angle reduced to the range (−180°, 180°]. * * The range of \e x is unrestricted. **********************************************************************/ template static T AngNormalize(T x) { using std::remainder; x = remainder(x, T(360)); return x != -180 ? x : 180; } /** * Normalize a latitude. * * @tparam T the type of the argument and returned value. * @param[in] x the angle in degrees. * @return x if it is in the range [−90°, 90°], otherwise * return NaN. **********************************************************************/ template static T LatFix(T x) { using std::abs; return abs(x) > 90 ? NaN() : x; } /** * The exact difference of two angles reduced to * (−180°, 180°]. * * @tparam T the type of the arguments and returned value. * @param[in] x the first angle in degrees. * @param[in] y the second angle in degrees. * @param[out] e the error term in degrees. * @return \e d, the truncated value of \e y − \e x. * * This computes \e z = \e y − \e x exactly, reduced to * (−180°, 180°]; and then sets \e z = \e d + \e e where \e d * is the nearest representable number to \e z and \e e is the truncation * error. If \e d = −180, then \e e > 0; If \e d = 180, then \e e * ≤ 0. **********************************************************************/ template static T AngDiff(T x, T y, T& e) { using std::remainder; T t, d = AngNormalize(sum(remainder(-x, T(360)), remainder( y, T(360)), t)); // Here y - x = d + t (mod 360), exactly, where d is in (-180,180] and // abs(t) <= eps (eps = 2^-45 for doubles). The only case where the // addition of t takes the result outside the range (-180,180] is d = 180 // and t > 0. The case, d = -180 + eps, t = -eps, can't happen, since // sum would have returned the exact result in such a case (i.e., given t // = 0). return sum(d == 180 && t > 0 ? -180 : d, t, e); } /** * Difference of two angles reduced to [−180°, 180°] * * @tparam T the type of the arguments and returned value. * @param[in] x the first angle in degrees. * @param[in] y the second angle in degrees. * @return \e y − \e x, reduced to the range [−180°, * 180°]. * * The result is equivalent to computing the difference exactly, reducing * it to (−180°, 180°] and rounding the result. Note that * this prescription allows −180° to be returned (e.g., if \e x * is tiny and negative and \e y = 180°). **********************************************************************/ template static T AngDiff(T x, T y) { T e; return AngDiff(x, y, e); } /** * Coarsen a value close to zero. * * @tparam T the type of the argument and returned value. * @param[in] x * @return the coarsened value. * * The makes the smallest gap in \e x = 1/16 − nextafter(1/16, 0) = * 1/257 for reals = 0.7 pm on the earth if \e x is an angle in * degrees. (This is about 1000 times more resolution than we get with * angles around 90°.) We use this to avoid having to deal with near * singular cases when \e x is non-zero but tiny (e.g., * 10−200). This converts −0 to +0; however tiny * negative numbers get converted to −0. **********************************************************************/ template static T AngRound(T x); /** * Evaluate the sine and cosine function with the argument in degrees * * @tparam T the type of the arguments. * @param[in] x in degrees. * @param[out] sinx sin(x). * @param[out] cosx cos(x). * * The results obey exactly the elementary properties of the trigonometric * functions, e.g., sin 9° = cos 81° = − sin 123456789°. * If x = −0, then \e sinx = −0; this is the only case where * −0 is returned. **********************************************************************/ template static void sincosd(T x, T& sinx, T& cosx); /** * Evaluate the sine function with the argument in degrees * * @tparam T the type of the argument and the returned value. * @param[in] x in degrees. * @return sin(x). **********************************************************************/ template static T sind(T x); /** * Evaluate the cosine function with the argument in degrees * * @tparam T the type of the argument and the returned value. * @param[in] x in degrees. * @return cos(x). **********************************************************************/ template static T cosd(T x); /** * Evaluate the tangent function with the argument in degrees * * @tparam T the type of the argument and the returned value. * @param[in] x in degrees. * @return tan(x). * * If \e x = ±90°, then a suitably large (but finite) value is * returned. **********************************************************************/ template static T tand(T x); /** * Evaluate the atan2 function with the result in degrees * * @tparam T the type of the arguments and the returned value. * @param[in] y * @param[in] x * @return atan2(y, x) in degrees. * * The result is in the range (−180° 180°]. N.B., * atan2d(±0, −1) = +180°; atan2d(−ε, * −1) = −180°, for ε positive and tiny; * atan2d(±0, +1) = ±0°. **********************************************************************/ template static T atan2d(T y, T x); /** * Evaluate the atan function with the result in degrees * * @tparam T the type of the argument and the returned value. * @param[in] x * @return atan(x) in degrees. **********************************************************************/ template static T atand(T x); /** * Evaluate e atanh(e x) * * @tparam T the type of the argument and the returned value. * @param[in] x * @param[in] es the signed eccentricity = sign(e2) * sqrt(|e2|) * @return e atanh(e x) * * If e2 is negative (e is imaginary), the * expression is evaluated in terms of atan. **********************************************************************/ template static T eatanhe(T x, T es); /** * tanχ in terms of tanφ * * @tparam T the type of the argument and the returned value. * @param[in] tau τ = tanφ * @param[in] es the signed eccentricity = sign(e2) * sqrt(|e2|) * @return τ′ = tanχ * * See Eqs. (7--9) of * 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). **********************************************************************/ template static T taupf(T tau, T es); /** * tanφ in terms of tanχ * * @tparam T the type of the argument and the returned value. * @param[in] taup τ′ = tanχ * @param[in] es the signed eccentricity = sign(e2) * sqrt(|e2|) * @return τ = tanφ * * See Eqs. (19--21) of * 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). **********************************************************************/ template static T tauf(T taup, T es); /** * Test for finiteness. * * @tparam T the type of the argument. * @param[in] x * @return true if number is finite, false if NaN or infinite. * * \deprecated Use std::isfinite(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::isfinite(x)") static bool isfinite(T x); /** * The NaN (not a number) * * @tparam T the type of the returned value. * @return NaN if available, otherwise return the max real of type T. **********************************************************************/ template static T NaN(); /** * Test for NaN. * * @tparam T the type of the argument. * @param[in] x * @return true if argument is a NaN. * * \deprecated Use std::isnan(x). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use std::isnan(x)") static bool isnan(T x); /** * Infinity * * @tparam T the type of the returned value. * @return infinity if available, otherwise return the max real. **********************************************************************/ template static T 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 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.52/include/GeographicLib/NearestNeighbor.hpp0000644000771000077100000010560514064202371023736 0ustar ckarneyckarney/** * \file NearestNeighbor.hpp * \brief Header for GeographicLib::NearestNeighbor class * * Copyright (c) Charles Karney (2016-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_NEARESTNEIGHBOR_HPP) #define GEOGRAPHICLIB_NEARESTNEIGHBOR_HPP 1 #include // for nth_element, max_element, etc. #include #include // for priority_queue #include // for swap + pair #include #include #include #include #include // Only for GeographicLib::GeographicErr #include #if defined(GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION) && \ GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION #include #include #include #include #endif #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (push) # pragma warning (disable: 4127) #endif namespace GeographicLib { /** * \brief Nearest-neighbor calculations * * This class solves the nearest-neighbor problm using a vantage-point tree * as described in \ref nearest. * * This class is templated so that it can handle arbitrary metric spaces as * follows: * * @tparam dist_t the type used for measuring distances; it can be a real or * signed integer type; in typical geodetic applications, \e dist_t might * be double. * @tparam pos_t the type for specifying the positions of points; geodetic * application might bundled the latitude and longitude into a * std::pair. * @tparam distfun_t the type of a function object which takes takes two * positions (of type \e pos_t) and returns the distance (of type \e * dist_t); in geodetic applications, this might be a class which is * constructed with a Geodesic object and which implements a member * function with a signature dist_t operator() (const pos_t&, const * pos_t&) const, which returns the geodesic distance between two * points. * * \note The distance measure must satisfy the triangle inequality, \f$ * d(a,c) \le d(a,b) + d(b,c) \f$ for all points \e a, \e b, \e c. The * geodesic distance (given by Geodesic::Inverse) does, while the great * ellipse distance and the rhumb line distance do not. If you use * the ordinary Euclidean distance, i.e., \f$ \sqrt{(x_a-x_b)^2 + * (y_a-y_b)^2} \f$ for two dimensions, don't be tempted to leave out the * square root in the interests of "efficiency"; the squared distance does * not satisfy the triangle inequality! * * \note This is a "header-only" implementation and, as such, depends in a * minimal way on the rest of GeographicLib (the only dependency is through * the use of GeographicLib::GeographicErr for handling compile-time and * run-time exceptions). Therefore, it is easy to extract this class from * the rest of GeographicLib and use it as a stand-alone facility. * * The \e dist_t type must support numeric_limits queries (specifically: * is_signed, is_integer, max(), digits). * * The NearestNeighbor object is constructed with a vector of points (type \e * pos_t) and a distance function (type \e distfun_t). However the object * does \e not store the points. When querying the object with Search(), * it's necessary to supply the same vector of points and the same distance * function. * * There's no capability in this implementation to add or remove points from * the set. Instead Initialize() should be called to re-initialize the * object with the modified vector of points. * * Because of the overhead in constructing a NearestNeighbor object for a * large set of points, functions Save() and Load() are provided to save the * object to an external file. operator<<(), operator>>() and Boost * serialization can also be used to save and restore a NearestNeighbor * object. This is illustrated in the example. * * Example of use: * \include example-NearestNeighbor.cpp **********************************************************************/ template class NearestNeighbor { // For tracking changes to the I/O format static const int version = 1; // This is what we get "free"; but if sizeof(dist_t) = 1 (unlikely), allow // 4 slots (and this accommodates the default value bucket = 4). static const int maxbucket = (2 + ((4 * sizeof(dist_t)) / sizeof(int) >= 2 ? (4 * sizeof(dist_t)) / sizeof(int) : 2)); public: /** * Default constructor for NearestNeighbor. * * This is equivalent to specifying an empty set of points. **********************************************************************/ NearestNeighbor() : _numpoints(0), _bucket(0), _cost(0) {} /** * Constructor for NearestNeighbor. * * @param[in] pts a vector of points to include in the set. * @param[in] dist the distance function object. * @param[in] bucket the size of the buckets at the leaf nodes; this must * lie in [0, 2 + 4*sizeof(dist_t)/sizeof(int)] (default 4). * @exception GeographicErr if the value of \e bucket is out of bounds or * the size of \e pts is too big for an int. * @exception std::bad_alloc if memory for the tree can't be allocated. * * \e pts may contain coincident points (i.e., the distance between them * vanishes); these are treated as distinct. * * The choice of \e bucket is a tradeoff between space and efficiency. A * larger \e bucket decreases the size of the NearestNeighbor object which * scales as pts.size() / max(1, bucket) and reduces the number of distance * calculations to construct the object by log2(bucket) * pts.size(). * However each search then requires about bucket additional distance * calculations. * * \warning The distances computed by \e dist must satisfy the standard * metric conditions. If not, the results are undefined. Neither the data * in \e pts nor the query points should contain NaNs or infinities because * such data violates the metric conditions. * * \warning The same arguments \e pts and \e dist must be provided * to the Search() function. **********************************************************************/ NearestNeighbor(const std::vector& pts, const distfun_t& dist, int bucket = 4) { Initialize(pts, dist, bucket); } /** * Initialize or re-initialize NearestNeighbor. * * @param[in] pts a vector of points to include in the tree. * @param[in] dist the distance function object. * @param[in] bucket the size of the buckets at the leaf nodes; this must * lie in [0, 2 + 4*sizeof(dist_t)/sizeof(int)] (default 4). * @exception GeographicErr if the value of \e bucket is out of bounds or * the size of \e pts is too big for an int. * @exception std::bad_alloc if memory for the tree can't be allocated. * * See also the documentation on the constructor. * * If an exception is thrown, the state of the NearestNeighbor is * unchanged. **********************************************************************/ void Initialize(const std::vector& pts, const distfun_t& dist, int bucket = 4) { static_assert(std::numeric_limits::is_signed, "dist_t must be a signed type"); if (!( 0 <= bucket && bucket <= maxbucket )) throw GeographicLib::GeographicErr ("bucket must lie in [0, 2 + 4*sizeof(dist_t)/sizeof(int)]"); if (pts.size() > size_t(std::numeric_limits::max())) throw GeographicLib::GeographicErr("pts array too big"); // the pair contains distance+id std::vector ids(pts.size()); for (int k = int(ids.size()); k--;) ids[k] = std::make_pair(dist_t(0), k); int cost = 0; std::vector tree; init(pts, dist, bucket, tree, ids, cost, 0, int(ids.size()), int(ids.size()/2)); _tree.swap(tree); _numpoints = int(pts.size()); _bucket = bucket; _mc = _sc = 0; _cost = cost; _c1 = _k = _cmax = 0; _cmin = std::numeric_limits::max(); } /** * Search the NearestNeighbor. * * @param[in] pts the vector of points used for initialization. * @param[in] dist the distance function object used for initialization. * @param[in] query the query point. * @param[out] ind a vector of indices to the closest points found. * @param[in] k the number of points to search for (default = 1). * @param[in] maxdist only return points with distances of \e maxdist or * less from \e query (default is the maximum \e dist_t). * @param[in] mindist only return points with distances of more than * \e mindist from \e query (default = −1). * @param[in] exhaustive whether to do an exhaustive search (default true). * @param[in] tol the tolerance on the results (default 0). * @return the distance to the closest point found (−1 if no points * are found). * @exception GeographicErr if \e pts has a different size from that used * to construct the object. * * The indices returned in \e ind are sorted by distance from \e query * (closest first). * * The simplest invocation is with just the 4 non-optional arguments. This * returns the closest distance and the index to the closest point in * ind0. If there are several points equally close, then * ind0 gives the index of an arbirary one of them. If * there's no closest point (because the set of points is empty), then \e * ind is empty and −1 is returned. * * With \e exhaustive = true and \e tol = 0 (their default values), this * finds the indices of \e k closest neighbors to \e query whose distances * to \e query are in (\e mindist, \e maxdist]. If \e mindist and \e * maxdist have their default values, then these bounds have no effect. If * \e query is one of the points in the tree, then set \e mindist = 0 to * prevent this point (and other coincident points) from being returned. * * If \e exhaustive = false, exit as soon as \e k results satisfying the * distance criteria are found. If less than \e k results are returned * then the search was exhaustive even if \e exhaustive = false. * * If \e tol is positive, do an approximate search; in this case the * results are to be interpreted as follows: if the k'th distance is * \e dk, then all results with distances less than or equal \e dk − * \e tol are correct; all others are suspect — there may be other * closer results with distances greater or equal to \e dk − \e tol. * If less than \e k results are found, then the search is exact. * * \e mindist should be used to exclude a "small" neighborhood of the query * point (relative to the average spacing of the data). If \e mindist is * large, the efficiency of the search deteriorates. * * \note Only the shortest distance is returned (as as the function value). * The distances to other points (indexed by indj * for \e j > 0) can be found by invoking \e dist again. * * \warning The arguments \e pts and \e dist must be identical to those * used to initialize the NearestNeighbor; if not, this function will * return some meaningless result (however, if the size of \e pts is wrong, * this function throw an exception). * * \warning The query point cannot be a NaN or infinite because then the * metric conditions are violated. **********************************************************************/ dist_t Search(const std::vector& pts, const distfun_t& dist, const pos_t& query, std::vector& ind, int k = 1, dist_t maxdist = std::numeric_limits::max(), dist_t mindist = -1, bool exhaustive = true, dist_t tol = 0) const { if (_numpoints != int(pts.size())) throw GeographicLib::GeographicErr("pts array has wrong size"); std::priority_queue results; if (_numpoints > 0 && k > 0 && maxdist > mindist) { // distance to the kth closest point so far dist_t tau = maxdist; // first is negative of how far query is outside boundary of node // +1 if on boundary or inside // second is node index std::priority_queue todo; todo.push(std::make_pair(dist_t(1), int(_tree.size()) - 1)); int c = 0; while (!todo.empty()) { int n = todo.top().second; dist_t d = -todo.top().first; todo.pop(); dist_t tau1 = tau - tol; // compare tau and d again since tau may have become smaller. if (!( n >= 0 && tau1 >= d )) continue; const Node& current = _tree[n]; dist_t dst = 0; // to suppress warning about uninitialized variable bool exitflag = false, leaf = current.index < 0; for (int i = 0; i < (leaf ? _bucket : 1); ++i) { int index = leaf ? current.leaves[i] : current.index; if (index < 0) break; dst = dist(pts[index], query); ++c; if (dst > mindist && dst <= tau) { if (int(results.size()) == k) results.pop(); results.push(std::make_pair(dst, index)); if (int(results.size()) == k) { if (exhaustive) tau = results.top().first; else { exitflag = true; break; } if (tau <= tol) { exitflag = true; break; } } } } if (exitflag) break; if (current.index < 0) continue; tau1 = tau - tol; for (int l = 0; l < 2; ++l) { if (current.data.child[l] >= 0 && dst + current.data.upper[l] >= mindist) { if (dst < current.data.lower[l]) { d = current.data.lower[l] - dst; if (tau1 >= d) todo.push(std::make_pair(-d, current.data.child[l])); } else if (dst > current.data.upper[l]) { d = dst - current.data.upper[l]; if (tau1 >= d) todo.push(std::make_pair(-d, current.data.child[l])); } else todo.push(std::make_pair(dist_t(1), current.data.child[l])); } } } ++_k; _c1 += c; double omc = _mc; _mc += (c - omc) / _k; _sc += (c - omc) * (c - _mc); if (c > _cmax) _cmax = c; if (c < _cmin) _cmin = c; } dist_t d = -1; ind.resize(results.size()); for (int i = int(ind.size()); i--;) { ind[i] = int(results.top().second); if (i == 0) d = results.top().first; results.pop(); } return d; } /** * @return the total number of points in the set. **********************************************************************/ int NumPoints() const { return _numpoints; } /** * Write the object to an I/O stream. * * @param[in,out] os the stream to write to. * @param[in] bin if true (the default) save in binary mode. * @exception std::bad_alloc if memory for the string representation of the * object can't be allocated. * * The counters tracking the statistics of searches are not saved; however * the initializtion cost is saved. The format of the binary saves is \e * not portable. * * \note * Boost serialization can also be used to save and restore a * NearestNeighbor object. This requires that the * GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION macro be defined. **********************************************************************/ void Save(std::ostream& os, bool bin = true) const { int realspec = std::numeric_limits::digits * (std::numeric_limits::is_integer ? -1 : 1); if (bin) { char id[] = "NearestNeighbor_"; os.write(id, 16); int buf[6]; buf[0] = version; buf[1] = realspec; buf[2] = _bucket; buf[3] = _numpoints; buf[4] = int(_tree.size()); buf[5] = _cost; os.write(reinterpret_cast(buf), 6 * sizeof(int)); for (int i = 0; i < int(_tree.size()); ++i) { const Node& node = _tree[i]; os.write(reinterpret_cast(&node.index), sizeof(int)); if (node.index >= 0) { os.write(reinterpret_cast(node.data.lower), 2 * sizeof(dist_t)); os.write(reinterpret_cast(node.data.upper), 2 * sizeof(dist_t)); os.write(reinterpret_cast(node.data.child), 2 * sizeof(int)); } else { os.write(reinterpret_cast(node.leaves), _bucket * sizeof(int)); } } } else { std::stringstream ostring; // Ensure enough precision for type dist_t. With C++11, max_digits10 // can be used instead. if (!std::numeric_limits::is_integer) { static const int prec = int(std::ceil(std::numeric_limits::digits * std::log10(2.0) + 1)); ostring.precision(prec); } ostring << version << " " << realspec << " " << _bucket << " " << _numpoints << " " << _tree.size() << " " << _cost; for (int i = 0; i < int(_tree.size()); ++i) { const Node& node = _tree[i]; ostring << "\n" << node.index; if (node.index >= 0) { for (int l = 0; l < 2; ++l) ostring << " " << node.data.lower[l] << " " << node.data.upper[l] << " " << node.data.child[l]; } else { for (int l = 0; l < _bucket; ++l) ostring << " " << node.leaves[l]; } } os << ostring.str(); } } /** * Read the object from an I/O stream. * * @param[in,out] is the stream to read from * @param[in] bin if true (the default) load in binary mode. * @exception GeographicErr if the state read from \e is is illegal. * @exception std::bad_alloc if memory for the tree can't be allocated. * * The counters tracking the statistics of searches are reset by this * operation. Binary data must have been saved on a machine with the same * architecture. If an exception is thrown, the state of the * NearestNeighbor is unchanged. * * \note * Boost serialization can also be used to save and restore a * NearestNeighbor object. This requires that the * GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION macro be defined. * * \warning The same arguments \e pts and \e dist used for * initialization must be provided to the Search() function. **********************************************************************/ void Load(std::istream& is, bool bin = true) { int version1, realspec, bucket, numpoints, treesize, cost; if (bin) { char id[17]; is.read(id, 16); id[16] = '\0'; if (!(std::strcmp(id, "NearestNeighbor_") == 0)) throw GeographicLib::GeographicErr("Bad ID"); is.read(reinterpret_cast(&version1), sizeof(int)); is.read(reinterpret_cast(&realspec), sizeof(int)); is.read(reinterpret_cast(&bucket), sizeof(int)); is.read(reinterpret_cast(&numpoints), sizeof(int)); is.read(reinterpret_cast(&treesize), sizeof(int)); is.read(reinterpret_cast(&cost), sizeof(int)); } else { if (!( is >> version1 >> realspec >> bucket >> numpoints >> treesize >> cost )) throw GeographicLib::GeographicErr("Bad header"); } if (!( version1 == version )) throw GeographicLib::GeographicErr("Incompatible version"); if (!( realspec == std::numeric_limits::digits * (std::numeric_limits::is_integer ? -1 : 1) )) throw GeographicLib::GeographicErr("Different dist_t types"); if (!( 0 <= bucket && bucket <= maxbucket )) throw GeographicLib::GeographicErr("Bad bucket size"); if (!( 0 <= treesize && treesize <= numpoints )) throw GeographicLib::GeographicErr("Bad number of points or tree size"); if (!( 0 <= cost )) throw GeographicLib::GeographicErr("Bad value for cost"); std::vector tree; tree.reserve(treesize); for (int i = 0; i < treesize; ++i) { Node node; if (bin) { is.read(reinterpret_cast(&node.index), sizeof(int)); if (node.index >= 0) { is.read(reinterpret_cast(node.data.lower), 2 * sizeof(dist_t)); is.read(reinterpret_cast(node.data.upper), 2 * sizeof(dist_t)); is.read(reinterpret_cast(node.data.child), 2 * sizeof(int)); } else { is.read(reinterpret_cast(node.leaves), bucket * sizeof(int)); for (int l = bucket; l < maxbucket; ++l) node.leaves[l] = 0; } } else { if (!( is >> node.index )) throw GeographicLib::GeographicErr("Bad index"); if (node.index >= 0) { for (int l = 0; l < 2; ++l) { if (!( is >> node.data.lower[l] >> node.data.upper[l] >> node.data.child[l] )) throw GeographicLib::GeographicErr("Bad node data"); } } else { // Must be at least one valid leaf followed by a sequence end // markers (-1). for (int l = 0; l < bucket; ++l) { if (!( is >> node.leaves[l] )) throw GeographicLib::GeographicErr("Bad leaf data"); } for (int l = bucket; l < maxbucket; ++l) node.leaves[l] = 0; } } node.Check(numpoints, treesize, bucket); tree.push_back(node); } _tree.swap(tree); _numpoints = numpoints; _bucket = bucket; _mc = _sc = 0; _cost = cost; _c1 = _k = _cmax = 0; _cmin = std::numeric_limits::max(); } /** * Write the object to stream \e os as text. * * @param[in,out] os the output stream. * @param[in] t the NearestNeighbor object to be saved. * @exception std::bad_alloc if memory for the string representation of the * object can't be allocated. **********************************************************************/ friend std::ostream& operator<<(std::ostream& os, const NearestNeighbor& t) { t.Save(os, false); return os; } /** * Read the object from stream \e is as text. * * @param[in,out] is the input stream. * @param[out] t the NearestNeighbor object to be loaded. * @exception GeographicErr if the state read from \e is is illegal. * @exception std::bad_alloc if memory for the tree can't be allocated. **********************************************************************/ friend std::istream& operator>>(std::istream& is, NearestNeighbor& t) { t.Load(is, false); return is; } /** * Swap with another NearestNeighbor object. * * @param[in,out] t the NearestNeighbor object to swap with. **********************************************************************/ void swap(NearestNeighbor& t) { std::swap(_numpoints, t._numpoints); std::swap(_bucket, t._bucket); std::swap(_cost, t._cost); _tree.swap(t._tree); std::swap(_mc, t._mc); std::swap(_sc, t._sc); std::swap(_c1, t._c1); std::swap(_k, t._k); std::swap(_cmin, t._cmin); std::swap(_cmax, t._cmax); } /** * The accumulated statistics on the searches so far. * * @param[out] setupcost the cost of initializing the NearestNeighbor. * @param[out] numsearches the number of calls to Search(). * @param[out] searchcost the total cost of the calls to Search(). * @param[out] mincost the minimum cost of a Search(). * @param[out] maxcost the maximum cost of a Search(). * @param[out] mean the mean cost of a Search(). * @param[out] sd the standard deviation in the cost of a Search(). * * Here "cost" measures the number of distance calculations needed. Note * that the accumulation of statistics is \e not thread safe. **********************************************************************/ void Statistics(int& setupcost, int& numsearches, int& searchcost, int& mincost, int& maxcost, double& mean, double& sd) const { setupcost = _cost; numsearches = _k; searchcost = _c1; mincost = _cmin; maxcost = _cmax; mean = _mc; sd = std::sqrt(_sc / (_k - 1)); } /** * Reset the counters for the accumulated statistics on the searches so * far. **********************************************************************/ void ResetStatistics() const { _mc = _sc = 0; _c1 = _k = _cmax = 0; _cmin = std::numeric_limits::max(); } private: // Package up a dist_t and an int. We will want to sort on the dist_t so // put it first. typedef std::pair item; // \cond SKIP class Node { public: struct bounds { dist_t lower[2], upper[2]; // bounds on inner/outer distances int child[2]; }; union { bounds data; int leaves[maxbucket]; }; int index; Node() : index(-1) { for (int i = 0; i < 2; ++i) { data.lower[i] = data.upper[i] = 0; data.child[i] = -1; } } // Sanity check on a Node void Check(int numpoints, int treesize, int bucket) const { if (!( -1 <= index && index < numpoints )) throw GeographicLib::GeographicErr("Bad index"); if (index >= 0) { if (!( -1 <= data.child[0] && data.child[0] < treesize && -1 <= data.child[1] && data.child[1] < treesize )) throw GeographicLib::GeographicErr("Bad child pointers"); if (!( 0 <= data.lower[0] && data.lower[0] <= data.upper[0] && data.upper[0] <= data.lower[1] && data.lower[1] <= data.upper[1] )) throw GeographicLib::GeographicErr("Bad bounds"); } else { // Must be at least one valid leaf followed by a sequence end markers // (-1). bool start = true; for (int l = 0; l < bucket; ++l) { if (!( (start ? ((l == 0 ? 0 : -1) <= leaves[l] && leaves[l] < numpoints) : leaves[l] == -1) )) throw GeographicLib::GeographicErr("Bad leaf data"); start = leaves[l] >= 0; } for (int l = bucket; l < maxbucket; ++l) { if (leaves[l] != 0) throw GeographicLib::GeographicErr("Bad leaf data"); } } } #if defined(GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION) && \ GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION friend class boost::serialization::access; template void save(Archive& ar, const unsigned int) const { ar & boost::serialization::make_nvp("index", index); if (index < 0) ar & boost::serialization::make_nvp("leaves", leaves); else ar & boost::serialization::make_nvp("lower", data.lower) & boost::serialization::make_nvp("upper", data.upper) & boost::serialization::make_nvp("child", data.child); } template void load(Archive& ar, const unsigned int) { ar & boost::serialization::make_nvp("index", index); if (index < 0) ar & boost::serialization::make_nvp("leaves", leaves); else ar & boost::serialization::make_nvp("lower", data.lower) & boost::serialization::make_nvp("upper", data.upper) & boost::serialization::make_nvp("child", data.child); } template void serialize(Archive& ar, const unsigned int file_version) { boost::serialization::split_member(ar, *this, file_version); } #endif }; // \endcond #if defined(GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION) && \ GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION friend class boost::serialization::access; template void save(Archive& ar, const unsigned) const { int realspec = std::numeric_limits::digits * (std::numeric_limits::is_integer ? -1 : 1); // Need to use version1, otherwise load error in debug mode on Linux: // undefined reference to GeographicLib::NearestNeighbor<...>::version. int version1 = version; ar & boost::serialization::make_nvp("version", version1) & boost::serialization::make_nvp("realspec", realspec) & boost::serialization::make_nvp("bucket", _bucket) & boost::serialization::make_nvp("numpoints", _numpoints) & boost::serialization::make_nvp("cost", _cost) & boost::serialization::make_nvp("tree", _tree); } template void load(Archive& ar, const unsigned) { int version1, realspec, bucket, numpoints, cost; ar & boost::serialization::make_nvp("version", version1); if (version1 != version) throw GeographicLib::GeographicErr("Incompatible version"); std::vector tree; ar & boost::serialization::make_nvp("realspec", realspec); if (!( realspec == std::numeric_limits::digits * (std::numeric_limits::is_integer ? -1 : 1) )) throw GeographicLib::GeographicErr("Different dist_t types"); ar & boost::serialization::make_nvp("bucket", bucket); if (!( 0 <= bucket && bucket <= maxbucket )) throw GeographicLib::GeographicErr("Bad bucket size"); ar & boost::serialization::make_nvp("numpoints", numpoints) & boost::serialization::make_nvp("cost", cost) & boost::serialization::make_nvp("tree", tree); if (!( 0 <= int(tree.size()) && int(tree.size()) <= numpoints )) throw GeographicLib::GeographicErr("Bad number of points or tree size"); for (int i = 0; i < int(tree.size()); ++i) tree[i].Check(numpoints, int(tree.size()), bucket); _tree.swap(tree); _numpoints = numpoints; _bucket = bucket; _mc = _sc = 0; _cost = cost; _c1 = _k = _cmax = 0; _cmin = std::numeric_limits::max(); } template void serialize(Archive& ar, const unsigned int file_version) { boost::serialization::split_member(ar, *this, file_version); } #endif int _numpoints, _bucket, _cost; std::vector _tree; // Counters to track stastistics on the cost of searches mutable double _mc, _sc; mutable int _c1, _k, _cmin, _cmax; int init(const std::vector& pts, const distfun_t& dist, int bucket, std::vector& tree, std::vector& ids, int& cost, int l, int u, int vp) { if (u == l) return -1; Node node; if (u - l > (bucket == 0 ? 1 : bucket)) { // choose a vantage point and move it to the start int i = vp; std::swap(ids[l], ids[i]); int m = (u + l + 1) / 2; for (int k = l + 1; k < u; ++k) { ids[k].first = dist(pts[ids[l].second], pts[ids[k].second]); ++cost; } // partition around the median distance std::nth_element(ids.begin() + l + 1, ids.begin() + m, ids.begin() + u); node.index = ids[l].second; if (m > l + 1) { // node.child[0] is possibly empty typename std::vector::iterator t = std::min_element(ids.begin() + l + 1, ids.begin() + m); node.data.lower[0] = t->first; t = std::max_element(ids.begin() + l + 1, ids.begin() + m); node.data.upper[0] = t->first; // Use point with max distance as vantage point; this point act as a // "corner" point and leads to a good partition. node.data.child[0] = init(pts, dist, bucket, tree, ids, cost, l + 1, m, int(t - ids.begin())); } typename std::vector::iterator t = std::max_element(ids.begin() + m, ids.begin() + u); node.data.lower[1] = ids[m].first; node.data.upper[1] = t->first; // Use point with max distance as vantage point here too node.data.child[1] = init(pts, dist, bucket, tree, ids, cost, m, u, int(t - ids.begin())); } else { if (bucket == 0) node.index = ids[l].second; else { node.index = -1; // Sort the bucket entries so that the tree is independent of the // implementation of nth_element. std::sort(ids.begin() + l, ids.begin() + u); for (int i = l; i < u; ++i) node.leaves[i-l] = ids[i].second; for (int i = u - l; i < bucket; ++i) node.leaves[i] = -1; for (int i = bucket; i < maxbucket; ++i) node.leaves[i] = 0; } } tree.push_back(node); return int(tree.size()) - 1; } }; } // namespace GeographicLib namespace std { /** * Swap two GeographicLib::NearestNeighbor objects. * * @tparam dist_t the type used for measuring distances. * @tparam pos_t the type for specifying the positions of points. * @tparam distfun_t the type for a function object which calculates * distances between points. * @param[in,out] a the first GeographicLib::NearestNeighbor to swap. * @param[in,out] b the second GeographicLib::NearestNeighbor to swap. **********************************************************************/ template void swap(GeographicLib::NearestNeighbor& a, GeographicLib::NearestNeighbor& b) { a.swap(b); } } // namespace std #if defined(_MSC_VER) # pragma warning (pop) #endif #endif // GEOGRAPHICLIB_NEARESTNEIGHBOR_HPP GeographicLib-1.52/include/GeographicLib/NormalGravity.hpp0000644000771000077100000004446014064202371023456 0ustar ckarneyckarney/** * \file NormalGravity.hpp * \brief Header for GeographicLib::NormalGravity class * * Copyright (c) Charles Karney (2011-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_NORMALGRAVITY_HPP) #define GEOGRAPHICLIB_NORMALGRAVITY_HPP 1 #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 * ellipsoid is a "level ellipoid", a surface of constant potential * (gravitational plus centrifugal). The acceleration due to gravity is * therefore perpendicular to the surface of the ellipsoid. * * Because the distribution of mass within the ellipsoid is unspecified, only * the potential exterior to the ellipsoid is well defined. In this class, * the mass is assumed to be to concentrated on a "focal disc" of radius, * (a2b2)1/2, where * \e a is the equatorial radius of the ellipsoid and \e b is its polar * semi-axis. In the case of an oblate ellipsoid, the mass is concentrated * on a "focal rod" of length 2(b2 − * a2)1/2. As a result the potential is well * defined everywhere. * * 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 leading terms. * However these series include sufficient terms to give full machine * precision. * * Although the formulation used in this class applies to ellipsoids with * arbitrary flattening, in practice, its use should be limited to about * b/\e a ∈ [0.01, 100] or \e f ∈ [−99, 0.99]. * * Definitions: * - V0, the gravitational contribution to the normal * potential; * - Φ, the rotational contribution to the normal potential; * - \e U = V0 + Φ, the total potential; * - Γ = ∇V0, the acceleration due to * mass of the earth; * - f = ∇Φ, the centrifugal acceleration; * - γ = ∇\e U = Γ + 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: * - C. Somigliana, Teoria generale del campo gravitazionale dell'ellissoide * di rotazione, Mem. Soc. Astron. Ital, 4, 541--599 (1929). * - 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). * - B. Hofmann-Wellenhof, H. Moritz, Physical Geodesy (Second edition, * Springer, 2006) https://doi.org/10.1007/978-3-211-33545-1 * - H. Moritz, Geodetic Reference System 1980, J. Geodesy 54(3), 395-405 * (1980) https://doi.org/10.1007/BF02521480 * * For more information on normal gravity see \ref normalgravity. * * Example of use: * \include example-NormalGravity.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT NormalGravity { private: static const int maxit_ = 20; typedef Math::real real; friend class GravityModel; real _a, _GM, _omega, _f, _J2, _omega2, _aomega2; real _e2, _ep2, _b, _E, _U0, _gammae, _gammap, _Q0, _k, _fstar; Geocentric _earth; static real atanzz(real x, bool alt) { // This routine obeys the identity // atanzz(x, alt) = atanzz(-x/(1+x), !alt) // // Require x >= -1. Best to call with alt, s.t. x >= 0; this results in // a call to atan, instead of asin, or to asinh, instead of atanh. using std::sqrt; using std::abs; using std::atan; using std::asin; using std::asinh; using std::atanh; real z = sqrt(abs(x)); return x == 0 ? 1 : (alt ? (!(x < 0) ? asinh(z) : asin(z)) / sqrt(abs(x) / (1 + x)) : (!(x < 0) ? atan(z) : atanh(z)) / z); } static real atan7series(real x); static real atan5series(real x); static real Qf(real x, bool alt); static real Hf(real x, bool alt); static real QH3f(real x, bool alt); real Jn(int n) const; void Initialize(real a, real GM, real omega, real f_J2, bool geometricp); 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_J2 either the flattening of the ellipsoid \e f or the * the dynamical form factor \e J2. * @param[out] geometricp if true (the default), then \e f_J2 denotes the * flattening, else it denotes the dynamical form factor \e J2. * @exception if \e a is not positive or if the other parameters do not * obey the restrictions given below. * * The shape of the ellipsoid can be given in one of two ways: * - geometrically (\e geomtricp = true), 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. The parameters should * obey \e a > 0, \e f < 1. There are no restrictions on \e GM or * \e omega, in particular, \e GM need not be positive. * - physically (\e geometricp = false), 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. The * parameters should obey \e a > 0, \e GM > 0 and \e J2 < 1/3 * − (omega2a3/GM) * 8/(45π). There is no restriction on \e omega. **********************************************************************/ NormalGravity(real a, real GM, real omega, real f_J2, bool geometricp = true); /** * 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 γ 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; /** * 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 * (m2 s−2). * * 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; /** * 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 + Φ the sum of the * gravitational and centrifugal potentials * (m2 s−2). * * The acceleration given by γ = ∇\e U = * ∇V0 + ∇Φ = Γ + f. **********************************************************************/ Math::real U(real X, real Y, real Z, real& gammaX, real& gammaY, real& gammaZ) const; /** * Evaluate the components of the acceleration due to the gravitational * force 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 the * gravitational force (m s−2). * @param[out] GammaY the \e Y component of the acceleration due to the * @param[out] GammaZ the \e Z component of the acceleration due to the * gravitational force (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; /** * 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 Φ the centrifugal potential (m2 * s−2). * * Φ 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; ///@} /** \name Inspector functions **********************************************************************/ ///@{ /** * @return true if the object has been initialized. **********************************************************************/ bool Init() const { return _a > 0; } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real EquatorialRadius() const { 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 { return Init() ? _GM : Math::NaN(); } /** * @return 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 * Jn = 0 if \e n is odd. In most gravity * applications, fully normalized Legendre functions are used and the * corresponding coefficient is Cn0 = * −Jn / sqrt(2 \e n + 1). **********************************************************************/ Math::real DynamicalFormFactor(int n = 2) const { return Init() ? ( n == 2 ? _J2 : Jn(n)) : Math::NaN(); } /** * @return ω the angular velocity of the ellipsoid (rad * s−1). This is the value used in the constructor. **********************************************************************/ Math::real AngularVelocity() const { return Init() ? _omega : Math::NaN(); } /** * @return f the flattening of the ellipsoid (\e a − \e b)/\e * a. **********************************************************************/ Math::real Flattening() const { return Init() ? _f : Math::NaN(); } /** * @return γe the normal gravity at equator (m * s−2). **********************************************************************/ Math::real EquatorialGravity() const { return Init() ? _gammae : Math::NaN(); } /** * @return γp the normal gravity at poles (m * s−2). **********************************************************************/ Math::real PolarGravity() const { return Init() ? _gammap : Math::NaN(); } /** * @return f* the gravity flattening (γp − * γe) / γe. **********************************************************************/ Math::real GravityFlattening() const { return Init() ? _fstar : Math::NaN(); } /** * @return U0 the constant normal potential for the * surface of the ellipsoid (m2 s−2). **********************************************************************/ Math::real SurfacePotential() const { return Init() ? _U0 : Math::NaN(); } /** * @return the Geocentric object used by this instance. **********************************************************************/ const Geocentric& Earth() const { return _earth; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * 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(); /** * Compute the flattening from the dynamical form factor. * * @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] J2 the dynamical form factor. * @return \e f the flattening of the ellipsoid. * * This routine requires \e a > 0, \e GM > 0, \e J2 < 1/3 − * omega2a3/GM 8/(45π). A * NaN is returned if these conditions do not hold. The restriction to * positive \e GM is made because for negative \e GM two solutions are * possible. **********************************************************************/ static Math::real J2ToFlattening(real a, real GM, real omega, real J2); /** * Compute the dynamical form factor from the flattening. * * @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. * @return \e J2 the dynamical form factor. * * This routine requires \e a > 0, \e GM ≠ 0, \e f < 1. The * values of these parameters are not checked. **********************************************************************/ static Math::real FlatteningToJ2(real a, real GM, real omega, real f); }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_NORMALGRAVITY_HPP GeographicLib-1.52/include/GeographicLib/OSGB.hpp0000644000771000077100000002325414064202371021410 0ustar ckarneyckarney/** * \file OSGB.hpp * \brief Header for GeographicLib::OSGB class * * Copyright (c) Charles Karney (2010-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_OSGB_HPP) #define GEOGRAPHICLIB_OSGB_HPP 1 #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 the National Grid * * \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 GEOGRAPHICLIB_EXPORT OSGB { private: typedef Math::real real; static const char* const letters_; static const char* const digits_; static const TransverseMercator& OSGBTM(); 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(); 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°]. **********************************************************************/ static void Forward(real lat, real lon, real& x, real& y, real& gamma, real& k) { OSGBTM().Forward(OriginLongitude(), lat, lon, x, y, gamma, k); x += FalseEasting(); y += computenorthoffset(); } /** * 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) { x -= FalseEasting(); y -= computenorthoffset(); 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) { 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) { 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. * @exception GeographicErr if \e prec, \e x, or \e y is outside its * allowed range. * @exception std::bad_alloc if the memory for \e gridref can't be * allocatied. * * \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), 1μm * * The easting must be in the range [−1000 km, 1500 km) and the * northing must be in the range [−500 km, 2000 km). These bounds * are consistent with rules for the letter designations for the grid * system. * * If \e x or \e y is NaN, the returned grid reference is "INVALID". **********************************************************************/ 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. * @exception GeographicErr if \e gridref is illegal. * * The grid reference must be of the form: two letters (not including I) * followed by an even number of digits (up to 22). * * If the first 2 characters of \e gridref are "IN", then \e x and \e y are * set to NaN and \e prec is set to −2. **********************************************************************/ 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 = * 109.48401603−10 m. The Airy 1830 value is returned * because the OSGB projection is based on this ellipsoid. The conversion * factor from feet to meters is the one used for the 1936 retriangulation * of Britain; see Section A.1 (p. 37) of A guide to coordinate systems * in Great Britain, v2.2 (Dec. 2013). **********************************************************************/ static Math::real EquatorialRadius() { // result is about 6377563.3960320664406 m using std::pow; return pow(real(10), real(48401603 - 100000000) / 100000000) * real(20923713); } /** * @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() { return real(20923713 - 20853810) / real(20923713); } /** * @return \e k0 central scale for the OSGB projection (0.9996012717...). * * C. J. Mugnier, Grids & Datums, PE&RS, Oct. 2003, states that * this is defined as 109.9998268−10. **********************************************************************/ static Math::real CentralScale() { using std::pow; return pow(real(10), real(9998268 - 10000000) / 10000000); } /** * @return latitude of the origin for the OSGB projection (49 degrees). **********************************************************************/ static Math::real OriginLatitude() { return real(49); } /** * @return longitude of the origin for the OSGB projection (−2 * degrees). **********************************************************************/ static Math::real OriginLongitude() { return real(-2); } /** * @return false northing the OSGB projection (−100000 meters). **********************************************************************/ static Math::real FalseNorthing() { return real(-100000); } /** * @return false easting the OSGB projection (400000 meters). **********************************************************************/ static Math::real FalseEasting() { return real(400000); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") static Math::real MajorRadius() { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #if defined(_MSC_VER) # pragma warning (pop) #endif #endif // GEOGRAPHICLIB_OSGB_HPP GeographicLib-1.52/include/GeographicLib/PolarStereographic.hpp0000644000771000077100000001443614064202371024455 0ustar ckarneyckarney/** * \file PolarStereographic.hpp * \brief Header for GeographicLib::PolarStereographic class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP) #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP 1 #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. * * This class also returns the meridian convergence \e gamma and scale \e k. * The meridian convergence is the bearing of grid north (the \e y axis) * measured clockwise from true north. * * Example of use: * \include example-PolarStereographic.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT PolarStereographic { private: typedef Math::real real; real _a, _f, _e2, _es, _e2m, _c; real _k0; 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. * @param[in] k0 central scale factor. * @exception GeographicErr if \e a, (1 − \e f) \e a, or \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). * @exception GeographicErr \e k is not positive. * @exception GeographicErr if \e lat is not in (−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. **********************************************************************/ void Forward(bool northp, real lat, real lon, real& x, real& y, real& gamma, real& k) const; /** * 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; /** * PolarStereographic::Forward without returning the convergence and scale. **********************************************************************/ void Forward(bool northp, real lat, real lon, real& x, real& y) const { 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 { 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 EquatorialRadius() const { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ Math::real Flattening() const { return _f; } /** * 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 { return _k0; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * 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.52/include/GeographicLib/PolygonArea.hpp0000644000771000077100000003352014064202371023073 0ustar ckarneyckarney/** * \file PolygonArea.hpp * \brief Header for GeographicLib::PolygonAreaT class * * Copyright (c) Charles Karney (2010-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP) #define GEOGRAPHICLIB_POLYGONAREA_HPP 1 #include #include #include #include namespace GeographicLib { /** * \brief Polygon areas * * This computes the area of a polygon whose edges are geodesics using the * method given in Section 6 of * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * * geod-addenda.html. * * Arbitrarily complex polygons are allowed. In the case self-intersecting * of polygons the area is accumulated "algebraically", e.g., the areas of * the 2 loops in a figure-8 polygon will partially cancel. * * This class lets you add vertices and edges one at a time to the polygon. * The sequence must start with a vertex and thereafter vertices and edges * can be added in any order. Any vertex after the first creates a new edge * which is the \e shortest geodesic from the previous vertex. In some * cases there may be two or many such shortest geodesics and the area is * then not uniquely defined. In this case, either add an intermediate * vertex or add the edge \e as an edge (by defining its direction and * length). * * The area and perimeter are accumulated at 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. * * This is a templated class to allow it to be used with Geodesic, * GeodesicExact, and Rhumb. GeographicLib::PolygonArea, * GeographicLib::PolygonAreaExact, and GeographicLib::PolygonAreaRhumb are * typedefs for these cases. * * For GeographicLib::PolygonArea (edges defined by Geodesic), an upper bound * on the error is about 0.1 m2 per vertex. However this is a * wildly pessimistic estimate in most cases. A more realistic estimate of * the error is given by a test involving 107 approximately * regular polygons on the WGS84 ellipsoid. The centers and the orientations * of the polygons were uniformly distributed, the number of vertices was * log-uniformly distributed in [3, 300], and the center to vertex distance * log-uniformly distributed in [0.1 m, 9000 km]. * * Using double precision (the standard precision for GeographicLib), the * maximum error in the perimeter was 200 nm, and the maximum error in the * area was
   *     0.0013 m^2 for perimeter < 10 km
   *     0.0070 m^2 for perimeter < 100 km
   *     0.070 m^2 for perimeter < 1000 km
   *     0.11 m^2 for all perimeters
   * 
* The errors are given in terms of the perimeter, because it is expected * that the errors depend mainly on the number of edges and the edge lengths. * * Using long doubles (GEOGRPAHICLIB_PRECISION = 3), the maximum error in the * perimeter was 200 pm, and the maximum error in the area was
   *     0.7 mm^2 for perim < 10 km
   *     3.2 mm^2 for perimeter < 100 km
   *     21 mm^2 for perimeter < 1000 km
   *     45 mm^2 for all perimeters
   * 
* * @tparam GeodType the geodesic class to use. * * Example of use: * \include example-PolygonArea.cpp * * Planimeter is a command-line utility * providing access to the functionality of PolygonAreaT. **********************************************************************/ template class PolygonAreaT { private: typedef Math::real real; GeodType _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; static int transit(real lon1, real lon2) { // Return 1 or -1 if crossing prime meridian in east or west direction. // Otherwise return zero. // Compute lon12 the same way as Geodesic::Inverse. lon1 = Math::AngNormalize(lon1); lon2 = Math::AngNormalize(lon2); real lon12 = Math::AngDiff(lon1, lon2); // Treat 0 as negative in these tests. This balances +/- 180 being // treated as positive, i.e., +180. int cross = lon1 <= 0 && lon2 > 0 && lon12 > 0 ? 1 : (lon2 <= 0 && lon1 > 0 && lon12 < 0 ? -1 : 0); return cross; } // an alternate version of transit to deal with longitudes in the direct // problem. static int transitdirect(real lon1, real lon2) { // Compute exactly the parity of // int(ceil(lon2 / 360)) - int(ceil(lon1 / 360)) using std::remainder; lon1 = remainder(lon1, real(720)); lon2 = remainder(lon2, real(720)); return ( (lon2 <= 0 && lon2 > -360 ? 1 : 0) - (lon1 <= 0 && lon1 > -360 ? 1 : 0) ); } void Remainder(Accumulator<>& a) const { a.remainder(_area0); } void Remainder(real& a) const { using std::remainder; a = remainder(a, _area0); } template void AreaReduce(T& area, int crossings, bool reverse, bool sign) const; public: /** * Constructor for PolygonAreaT. * * @param[in] earth the Geodesic object to use for geodesic calculations. * @param[in] polyline if true that treat the points as defining a polyline * instead of a polygon (default = false). **********************************************************************/ PolygonAreaT(const GeodType& earth, bool polyline = false) : _earth(earth) , _area0(_earth.EllipsoidArea()) , _polyline(polyline) , _mask(GeodType::LATITUDE | GeodType::LONGITUDE | GeodType::DISTANCE | (_polyline ? GeodType::NONE : GeodType::AREA | GeodType::LONG_UNROLL)) { Clear(); } /** * Clear PolygonAreaT, allowing a new polygon to be started. **********************************************************************/ void Clear() { _num = 0; _crossings = 0; _areasum = 0; _perimetersum = 0; _lat0 = _lon0 = _lat1 = _lon1 = Math::NaN(); } /** * Add a point to the polygon or polyline. * * @param[in] lat the latitude of the point (degrees). * @param[in] lon the longitude of the point (degrees). * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ void AddPoint(real lat, real lon); /** * Add an edge to the polygon or polyline. * * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to next point (meters). * * This does nothing if no points have been added yet. Use * PolygonAreaT::CurrentPoint to determine the position of the new vertex. **********************************************************************/ void AddEdge(real azi, real s); /** * 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 (meters2); only set * if \e polyline is false in the constructor. * @return the number of points. * * More points can be added to the polygon after this call. **********************************************************************/ unsigned Compute(bool reverse, bool sign, real& perimeter, real& area) const; /** * 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 PolygonAreaT::AddPoint and PolygonAreaT::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 * (meters2); only set if polyline is false in the * constructor. * @return the number of points. * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ unsigned TestPoint(real lat, real lon, bool reverse, bool sign, real& perimeter, real& area) const; /** * Return the results assuming a tentative final test point is added via an * azimuth and distance; 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 PolygonAreaT::AddEdge and * PolygonAreaT::Compute are used. * * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to final test point (meters). * @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 * (meters2); only set if polyline is false in the * constructor. * @return the number of points. **********************************************************************/ unsigned TestEdge(real azi, real s, bool reverse, bool sign, real& perimeter, real& area) const; /** \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 EquatorialRadius() const { return _earth.EquatorialRadius(); } /** * @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 { return _earth.Flattening(); } /** * Report the previous vertex added to the polygon or polyline. * * @param[out] lat the latitude of the point (degrees). * @param[out] lon the longitude of the point (degrees). * * If no points have been added, then NaNs are returned. Otherwise, \e lon * will be in the range [−180°, 180°]. **********************************************************************/ void CurrentPoint(real& lat, real& lon) const { lat = _lat1; lon = _lon1; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} }; /** * @relates PolygonAreaT * * Polygon areas using Geodesic. This should be used if the flattening is * small. **********************************************************************/ typedef PolygonAreaT PolygonArea; /** * @relates PolygonAreaT * * Polygon areas using GeodesicExact. (But note that the implementation of * areas in GeodesicExact uses a high order series and this is only accurate * for modest flattenings.) **********************************************************************/ typedef PolygonAreaT PolygonAreaExact; /** * @relates PolygonAreaT * * Polygon areas using Rhumb. **********************************************************************/ typedef PolygonAreaT PolygonAreaRhumb; } // namespace GeographicLib #endif // GEOGRAPHICLIB_POLYGONAREA_HPP GeographicLib-1.52/include/GeographicLib/Rhumb.hpp0000644000771000077100000006342014064202371021732 0ustar ckarneyckarney/** * \file Rhumb.hpp * \brief Header for GeographicLib::Rhumb and GeographicLib::RhumbLine classes * * Copyright (c) Charles Karney (2014-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_RHUMB_HPP) #define GEOGRAPHICLIB_RHUMB_HPP 1 #include #include #if !defined(GEOGRAPHICLIB_RHUMBAREA_ORDER) /** * The order of the series approximation used in rhumb area calculations. * GEOGRAPHICLIB_RHUMBAREA_ORDER can be set to any integer in [4, 8]. **********************************************************************/ # define GEOGRAPHICLIB_RHUMBAREA_ORDER \ (GEOGRAPHICLIB_PRECISION == 2 ? 6 : \ (GEOGRAPHICLIB_PRECISION == 1 ? 4 : 8)) #endif namespace GeographicLib { class RhumbLine; template class PolygonAreaT; /** * \brief Solve of the direct and inverse rhumb problems. * * The path of constant azimuth between two points on a ellipsoid at (\e * lat1, \e lon1) and (\e lat2, \e lon2) is called the rhumb line (also * called the loxodrome). Its length is \e s12 and its azimuth is \e azi12. * (The azimuth is the heading measured clockwise from north.) * * Given \e lat1, \e lon1, \e azi12, and \e s12, we can determine \e lat2, * and \e lon2. This is the \e direct rhumb problem and its solution is * given by the function Rhumb::Direct. * * Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi12 * and \e s12. This is the \e inverse rhumb problem, whose solution is given * by Rhumb::Inverse. This finds the shortest such rhumb line, i.e., the one * that wraps no more than half way around the earth. If the end points are * on opposite meridians, there are two shortest rhumb lines and the * east-going one is chosen. * * These routines also optionally calculate the area under the rhumb line, \e * S12. This is the area, measured counter-clockwise, of the rhumb line * quadrilateral with corners (lat1,lon1), (0,lon1), * (0,lon2), and (lat2,lon2). * * Note that rhumb lines may be appreciably longer (up to 50%) than the * corresponding Geodesic. For example the distance between London Heathrow * and Tokyo Narita via the rhumb line is 11400 km which is 18% longer than * the geodesic distance 9600 km. * * For more information on rhumb lines see \ref rhumb. * * Example of use: * \include example-Rhumb.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT Rhumb { private: typedef Math::real real; friend class RhumbLine; template friend class PolygonAreaT; Ellipsoid _ell; bool _exact; real _c2; static const int tm_maxord = GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER; static const int maxpow_ = GEOGRAPHICLIB_RHUMBAREA_ORDER; // _R[0] unused real _R[maxpow_ + 1]; static real gd(real x) { using std::atan; using std::sinh; return atan(sinh(x)); } // Use divided differences to determine (mu2 - mu1) / (psi2 - psi1) // accurately // // Definition: Df(x,y,d) = (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) // https://doi.org/10.1145/334714.334716 // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf static real Dlog(real x, real y) { using std::sqrt; using std::asinh; real t = x - y; // Change // // atanh(t / (x + y)) // // to // // asinh(t / (2 * sqrt(x*y))) // // to avoid taking atanh(1) when x is large and y is 1. N.B., this // routine is invoked with positive x and y, so no need to guard against // taking the sqrt of a negative quantity. This fixes bogus results for // the area being returning when an endpoint is at a pole. return t != 0 ? 2 * asinh(t / (2 * sqrt(x*y))) / t : 1 / x; } // N.B., x and y are in degrees static real Dtan(real x, real y) { real d = x - y, tx = Math::tand(x), ty = Math::tand(y), txy = tx * ty; return d != 0 ? (2 * txy > -1 ? (1 + txy) * Math::tand(d) : tx - ty) / (d * Math::degree()) : 1 + txy; } static real Datan(real x, real y) { using std::atan; real d = x - y, xy = x * y; return d != 0 ? (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(x) - atan(y)) / d : 1 / (1 + xy); } static real Dsin(real x, real y) { using std::sin; using std::cos; real d = (x - y) / 2; return cos((x + y)/2) * (d != 0 ? sin(d) / d : 1); } static real Dsinh(real x, real y) { using std::sinh; using std::cosh; real d = (x - y) / 2; return cosh((x + y) / 2) * (d != 0 ? sinh(d) / d : 1); } static real Dcosh(real x, real y) { using std::sinh; real d = (x - y) / 2; return sinh((x + y) / 2) * (d != 0 ? sinh(d) / d : 1); } static real Dasinh(real x, real y) { using std::asinh; using std::hypot; real d = x - y, hx = hypot(real(1), x), hy = hypot(real(1), y); return d != 0 ? asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) : x*hy - y*hx) / d : 1 / hx; } static real Dgd(real x, real y) { using std::sinh; return Datan(sinh(x), sinh(y)) * Dsinh(x, y); } // N.B., x and y are the tangents of the angles static real Dgdinv(real x, real y) { return Dasinh(x, y) / Datan(x, y); } // Copied from LambertConformalConic... // Deatanhe(x,y) = eatanhe((x-y)/(1-e^2*x*y))/(x-y) real Deatanhe(real x, real y) const { real t = x - y, d = 1 - _ell._e2 * x * y; return t != 0 ? Math::eatanhe(t / d, _ell._es) / t : _ell._e2 / d; } // (E(x) - E(y)) / (x - y) -- E = incomplete elliptic integral of 2nd kind real DE(real x, real y) const; // (mux - muy) / (phix - phiy) using elliptic integrals real DRectifying(real latx, real laty) const; // (psix - psiy) / (phix - phiy) real DIsometric(real latx, real laty) const; // (sum(c[j]*sin(2*j*x),j=1..n) - sum(c[j]*sin(2*j*x),j=1..n)) / (x - y) static real SinCosSeries(bool sinp, real x, real y, const real c[], int n); // (mux - muy) / (chix - chiy) using Krueger's series real DConformalToRectifying(real chix, real chiy) const; // (chix - chiy) / (mux - muy) using Krueger's series real DRectifyingToConformal(real mux, real muy) const; // (mux - muy) / (psix - psiy) // N.B., psix and psiy are in degrees real DIsometricToRectifying(real psix, real psiy) const; // (psix - psiy) / (mux - muy) real DRectifyingToIsometric(real mux, real muy) const; real MeanSinXi(real psi1, real psi2) const; // The following two functions (with lots of ignored arguments) mimic the // interface to the corresponding Geodesic function. These are needed by // PolygonAreaT. void GenDirect(real lat1, real lon1, real azi12, bool, real s12, unsigned outmask, real& lat2, real& lon2, real&, real&, real&, real&, real&, real& S12) const { GenDirect(lat1, lon1, azi12, s12, outmask, lat2, lon2, S12); } void GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real& s12, real& azi12, real&, real& , real& , real& , real& S12) const { GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi12, S12); } public: /** * Bit masks for what calculations to do. They specify which results to * return in the general routines Rhumb::GenDirect and Rhumb::GenInverse * routines. RhumbLine::mask is a duplication of this enum. **********************************************************************/ enum mask { /** * No output. * @hideinitializer **********************************************************************/ NONE = 0U, /** * Calculate latitude \e lat2. * @hideinitializer **********************************************************************/ LATITUDE = 1U<<7, /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = 1U<<8, /** * Calculate azimuth \e azi12. * @hideinitializer **********************************************************************/ AZIMUTH = 1U<<9, /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = 1U<<10, /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = 1U<<14, /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = 1U<<15, /** * Calculate everything. (LONG_UNROLL is not included in this mask.) * @hideinitializer **********************************************************************/ ALL = 0x7F80U, }; /** * 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. * @param[in] exact if true (the default) use an addition theorem for * elliptic integrals to compute divided differences; otherwise use * series expansion (accurate for |f| < 0.01). * @exception GeographicErr if \e a or (1 − \e f) \e a is not * positive. * * See \ref rhumb, for a detailed description of the \e exact parameter. **********************************************************************/ Rhumb(real a, real f, bool exact = true); /** * Solve the direct rhumb problem returning also the area. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi12 azimuth of the rhumb line (degrees). * @param[in] s12 distance between point 1 and point 2 (meters); it can be * negative. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees). * @param[out] S12 area under the rhumb line (meters2). * * \e lat1 should be in the range [−90°, 90°]. The value of * \e lon2 returned is in the range [−180°, 180°]. * * If point 1 is a pole, the cosine of its latitude is taken to be * 1/ε2 (where ε is 2-52). This * position, which is extremely close to the actual pole, allows the * calculation to be carried out in finite terms. If \e s12 is large * enough that the rhumb line crosses a pole, the longitude of point 2 * is indeterminate (a NaN is returned for \e lon2 and \e S12). **********************************************************************/ void Direct(real lat1, real lon1, real azi12, real s12, real& lat2, real& lon2, real& S12) const { GenDirect(lat1, lon1, azi12, s12, LATITUDE | LONGITUDE | AREA, lat2, lon2, S12); } /** * Solve the direct rhumb problem without the area. **********************************************************************/ void Direct(real lat1, real lon1, real azi12, real s12, real& lat2, real& lon2) const { real t; GenDirect(lat1, lon1, azi12, s12, LATITUDE | LONGITUDE, lat2, lon2, t); } /** * The general direct rhumb problem. Rhumb::Direct 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] azi12 azimuth of the rhumb line (degrees). * @param[in] s12 distance between point 1 and point 2 (meters); it can be * negative. * @param[in] outmask a bitor'ed combination of Rhumb::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] S12 area under the rhumb line (meters2). * * The Rhumb::mask values possible for \e outmask are * - \e outmask |= Rhumb::LATITUDE for the latitude \e lat2; * - \e outmask |= Rhumb::LONGITUDE for the latitude \e lon2; * - \e outmask |= Rhumb::AREA for the area \e S12; * - \e outmask |= Rhumb::ALL for all of the above; * - \e outmask |= Rhumb::LONG_UNROLL to unroll \e lon2 instead of wrapping * it into the range [−180°, 180°]. * . * With the Rhumb::LONG_UNROLL bit set, the quantity \e lon2 − * \e lon1 indicates how many times and in what sense the rhumb line * encircles the ellipsoid. **********************************************************************/ void GenDirect(real lat1, real lon1, real azi12, real s12, unsigned outmask, real& lat2, real& lon2, real& S12) const; /** * Solve the inverse rhumb problem returning also the area. * * @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 rhumb distance between point 1 and point 2 (meters). * @param[out] azi12 azimuth of the rhumb line (degrees). * @param[out] S12 area under the rhumb line (meters2). * * The shortest rhumb line is found. If the end points are on opposite * meridians, there are two shortest rhumb lines and the east-going one is * chosen. \e lat1 and \e lat2 should be in the range [−90°, * 90°]. The value of \e azi12 returned is in the range * [−180°, 180°]. * * If either point is a pole, the cosine of its latitude is taken to be * 1/ε2 (where ε is 2-52). This * position, which is extremely close to the actual pole, allows the * calculation to be carried out in finite terms. **********************************************************************/ void Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi12, real& S12) const { GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH | AREA, s12, azi12, S12); } /** * Solve the inverse rhumb problem without the area. **********************************************************************/ void Inverse(real lat1, real lon1, real lat2, real lon2, real& s12, real& azi12) const { real t; GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH, s12, azi12, t); } /** * The general inverse rhumb problem. Rhumb::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 Rhumb::mask values * specifying which of the following parameters should be set. * @param[out] s12 rhumb distance between point 1 and point 2 (meters). * @param[out] azi12 azimuth of the rhumb line (degrees). * @param[out] S12 area under the rhumb line (meters2). * * The Rhumb::mask values possible for \e outmask are * - \e outmask |= Rhumb::DISTANCE for the latitude \e s12; * - \e outmask |= Rhumb::AZIMUTH for the latitude \e azi12; * - \e outmask |= Rhumb::AREA for the area \e S12; * - \e outmask |= Rhumb::ALL for all of the above; **********************************************************************/ void GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real& s12, real& azi12, real& S12) const; /** * Set up to compute several points on a single rhumb line. * * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi12 azimuth of the rhumb line (degrees). * @return a RhumbLine object. * * \e lat1 should be in the range [−90°, 90°]. * * If point 1 is a pole, the cosine of its latitude is taken to be * 1/ε2 (where ε is 2-52). This * position, which is extremely close to the actual pole, allows the * calculation to be carried out in finite terms. **********************************************************************/ RhumbLine Line(real lat1, real lon1, real azi12) const; /** \name Inspector functions. **********************************************************************/ ///@{ /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ Math::real EquatorialRadius() const { return _ell.EquatorialRadius(); } /** * @return \e f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ Math::real Flattening() const { return _ell.Flattening(); } /** * @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 { return _ell.Area(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * A global instantiation of Rhumb with the parameters for the WGS84 * ellipsoid. **********************************************************************/ static const Rhumb& WGS84(); }; /** * \brief Find a sequence of points on a single rhumb line. * * RhumbLine facilitates the determination of a series of points on a single * rhumb line. The starting point (\e lat1, \e lon1) and the azimuth \e * azi12 are specified in the call to Rhumb::Line which returns a RhumbLine * object. RhumbLine.Position returns the location of point 2 (and, * optionally, the corresponding area, \e S12) a distance \e s12 along the * rhumb line. * * There is no public constructor for this class. (Use Rhumb::Line to create * an instance.) The Rhumb object used to create a RhumbLine must stay in * scope as long as the RhumbLine. * * Example of use: * \include example-RhumbLine.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT RhumbLine { private: typedef Math::real real; friend class Rhumb; const Rhumb& _rh; bool _exact; // TODO: RhumbLine::_exact is unused; retire real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1; // copy assignment not allowed RhumbLine& operator=(const RhumbLine&) = delete; RhumbLine(const Rhumb& rh, real lat1, real lon1, real azi12, bool exact); public: /** * Construction is via default copy constructor. **********************************************************************/ RhumbLine(const RhumbLine&) = default; /** * This is a duplication of Rhumb::mask. **********************************************************************/ enum mask { /** * No output. * @hideinitializer **********************************************************************/ NONE = Rhumb::NONE, /** * Calculate latitude \e lat2. * @hideinitializer **********************************************************************/ LATITUDE = Rhumb::LATITUDE, /** * Calculate longitude \e lon2. * @hideinitializer **********************************************************************/ LONGITUDE = Rhumb::LONGITUDE, /** * Calculate azimuth \e azi12. * @hideinitializer **********************************************************************/ AZIMUTH = Rhumb::AZIMUTH, /** * Calculate distance \e s12. * @hideinitializer **********************************************************************/ DISTANCE = Rhumb::DISTANCE, /** * Calculate area \e S12. * @hideinitializer **********************************************************************/ AREA = Rhumb::AREA, /** * Unroll \e lon2 in the direct calculation. * @hideinitializer **********************************************************************/ LONG_UNROLL = Rhumb::LONG_UNROLL, /** * Calculate everything. (LONG_UNROLL is not included in this mask.) * @hideinitializer **********************************************************************/ ALL = Rhumb::ALL, }; /** * Compute the position of point 2 which is a distance \e s12 (meters) from * point 1. The area is also computed. * * @param[in] s12 distance between point 1 and point 2 (meters); it can be * negative. * @param[out] lat2 latitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees). * @param[out] S12 area under the rhumb line (meters2). * * The value of \e lon2 returned is in the range [−180°, * 180°]. * * If \e s12 is large enough that the rhumb line crosses a pole, the * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 and * \e S12). **********************************************************************/ void Position(real s12, real& lat2, real& lon2, real& S12) const { GenPosition(s12, LATITUDE | LONGITUDE | AREA, lat2, lon2, S12); } /** * Compute the position of point 2 which is a distance \e s12 (meters) from * point 1. The area is not computed. **********************************************************************/ void Position(real s12, real& lat2, real& lon2) const { real t; GenPosition(s12, LATITUDE | LONGITUDE, lat2, lon2, t); } /** * The general position routine. RhumbLine::Position is defined in term so * this function. * * @param[in] s12 distance between point 1 and point 2 (meters); it can be * negative. * @param[in] outmask a bitor'ed combination of RhumbLine::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] S12 area under the rhumb line (meters2). * * The RhumbLine::mask values possible for \e outmask are * - \e outmask |= RhumbLine::LATITUDE for the latitude \e lat2; * - \e outmask |= RhumbLine::LONGITUDE for the latitude \e lon2; * - \e outmask |= RhumbLine::AREA for the area \e S12; * - \e outmask |= RhumbLine::ALL for all of the above; * - \e outmask |= RhumbLine::LONG_UNROLL to unroll \e lon2 instead of * wrapping it into the range [−180°, 180°]. * . * With the RhumbLine::LONG_UNROLL bit set, the quantity \e lon2 − \e * lon1 indicates how many times and in what sense the rhumb line encircles * the ellipsoid. * * If \e s12 is large enough that the rhumb line crosses a pole, the * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 and * \e S12). **********************************************************************/ void GenPosition(real s12, unsigned outmask, real& lat2, real& lon2, real& S12) const; /** \name Inspector functions **********************************************************************/ ///@{ /** * @return \e lat1 the latitude of point 1 (degrees). **********************************************************************/ Math::real Latitude() const { return _lat1; } /** * @return \e lon1 the longitude of point 1 (degrees). **********************************************************************/ Math::real Longitude() const { return _lon1; } /** * @return \e azi12 the azimuth of the rhumb line (degrees). **********************************************************************/ Math::real Azimuth() const { return _azi12; } /** * @return \e a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Rhumb object used in the constructor. **********************************************************************/ Math::real EquatorialRadius() const { return _rh.EquatorialRadius(); } /** * @return \e f the flattening of the ellipsoid. This is the value * inherited from the Rhumb object used in the constructor. **********************************************************************/ Math::real Flattening() const { return _rh.Flattening(); } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_RHUMB_HPP GeographicLib-1.52/include/GeographicLib/SphericalEngine.hpp0000644000771000077100000004047714064202371023724 0ustar ckarneyckarney/** * \file SphericalEngine.hpp * \brief Header for GeographicLib::SphericalEngine class * * Copyright (c) Charles Karney (2011-2019) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_SPHERICALENGINE_HPP) #define GEOGRAPHICLIB_SPHERICALENGINE_HPP 1 #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 GEOGRAPHICLIB_EXPORT SphericalEngine { private: typedef Math::real real; // CircularEngine needs access to sqrttable, scale friend class CircularEngine; // Return the table of the square roots of integers static std::vector& sqrttable(); // An internal scaling of the coefficients to avoid overflow in // intermediate calculations. static real scale() { using std::pow; static const real // Need extra real because, since C++11, pow(float, int) returns double s = real(pow(real(std::numeric_limits::radix), -3 * (std::numeric_limits::max_exponent < (1<<14) ? std::numeric_limits::max_exponent : (1<<14)) / 5)); return s; } // Move latitudes near the pole off the axis by this amount. static real eps() { using std::sqrt; return std::numeric_limits::epsilon() * sqrt(std::numeric_limits::epsilon()); } 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, }; /** * \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 GEOGRAPHICLIB_EXPORT coeff { private: int _Nx, _nmx, _mmx; std::vector::const_iterator _Cnm; std::vector::const_iterator _Snm; public: /** * A default constructor **********************************************************************/ coeff() : _Nx(-1) , _nmx(-1) , _mmx(-1) {} /** * 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. * @exception GeographicErr if \e N, \e nmx, and \e mmx do not satisfy * \e N ≥ \e nmx ≥ \e mmx ≥ −1. * @exception GeographicErr if \e C or \e S is not big enough to hold the * coefficients. * @exception std::bad_alloc if the memory for the square root table * can't be allocated. **********************************************************************/ coeff(const std::vector& C, const std::vector& S, int N, int nmx, int mmx) : _Nx(N) , _nmx(nmx) , _mmx(mmx) , _Cnm(C.begin()) , _Snm(S.begin()) { if (!((_Nx >= _nmx && _nmx >= _mmx && _mmx >= 0) || // If mmx = -1 then the sums are empty so require nmx = -1 also. (_nmx == -1 && _mmx == -1))) throw GeographicErr("Bad indices for coeff"); if (!(index(_nmx, _mmx) < int(C.size()) && index(_nmx, _mmx) < int(S.size()) + (_Nx + 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. * @exception GeographicErr if \e N does not satisfy \e N ≥ −1. * @exception GeographicErr if \e C or \e S is not big enough to hold the * coefficients. * @exception std::bad_alloc if the memory for the square root table * can't be allocated. **********************************************************************/ coeff(const std::vector& C, const std::vector& S, int N) : _Nx(N) , _nmx(N) , _mmx(N) , _Cnm(C.begin()) , _Snm(S.begin()) { if (!(_Nx >= -1)) throw GeographicErr("Bad indices for coeff"); if (!(index(_nmx, _mmx) < int(C.size()) && index(_nmx, _mmx) < int(S.size()) + (_Nx + 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. **********************************************************************/ int N() const { return _Nx; } /** * @return \e nmx the maximum degree to be used. **********************************************************************/ int nmx() const { return _nmx; } /** * @return \e mmx the maximum order to be used. **********************************************************************/ int mmx() const { 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. **********************************************************************/ int index(int n, int m) const { return m * _Nx - 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. **********************************************************************/ 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. **********************************************************************/ Math::real Sv(int k) const { return *(_Snm + (k - (_Nx + 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. **********************************************************************/ 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. **********************************************************************/ Math::real Sv(int k, int n, int m, real f) const { return m > _mmx || n > _nmx ? 0 : *(_Snm + (k - (_Nx + 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 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 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[in,out] N The maximum degree of the coefficients. * @param[in,out] M The maximum order of the coefficients. * @param[out] C The vector of cosine coefficients. * @param[out] S The vector of sine coefficients. * @param[in] truncate if false (the default) then \e N and \e M are * determined by the values in the binary stream; otherwise, the input * values of \e N and \e M are used to truncate the coefficients read * from the stream at the given degree and order. * @exception GeographicErr if \e N and \e M do not satisfy \e N ≥ * \e M ≥ −1. * @exception GeographicErr if there's an error reading the data. * @exception std::bad_alloc if the memory for \e C or \e S can't be * allocated. * * \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, bool truncate = false); }; /** * 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); /** * 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. * @exception std::bad_alloc if the memory for the CircularEngine can't be * allocated. * @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. * @exception std::bad_alloc if the memory for the square root table can't * be allocated. * * 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. * * \warning 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); sqrttable().swap(temp); } }; } // namespace GeographicLib #if defined(_MSC_VER) # pragma warning (pop) #endif #endif // GEOGRAPHICLIB_SPHERICALENGINE_HPP GeographicLib-1.52/include/GeographicLib/SphericalHarmonic.hpp0000644000771000077100000003532314064202371024251 0ustar ckarneyckarney/** * \file SphericalHarmonic.hpp * \brief Header for GeographicLib::SphericalHarmonic class * * Copyright (c) Charles Karney (2011-2019) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC_HPP) #define GEOGRAPHICLIB_SPHERICALHARMONIC_HPP 1 #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, * - θ = atan2(\e p, \e z) = the spherical \e colatitude, * - λ = atan2(\e y, \e x) = the longitude. * - Pnm(\e t) is the associated Legendre polynomial of * degree \e n and order \e m. * * Two normalizations are supported for Pnm * - 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. Geodesy 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 GEOGRAPHICLIB_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) https://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θ) * cos(mλ) and * Pnmfull(cosθ) * sin(mλ) 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) https://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θ) * cos(mλ) and * Pnmschmidt(cosθ) * sin(mλ) over the sphere is 1/(2\e n + 1). * * @hideinitializer **********************************************************************/ SCHMIDT = SphericalEngine::SCHMIDT, }; 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 Cnm. * @param[in] S the coefficients Snm. * @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. * @exception GeographicErr if \e N does not satisfy \e N ≥ −1. * @exception GeographicErr if \e C or \e S is not big enough to hold the * coefficients. * * The coefficients Cnm and * Snm are stored in the one-dimensional vectors * \e C and \e S which must contain (\e N + 1)(\e N + 2)/2 and \e 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 Cnm. * @param[in] S the coefficients Snm. * @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. * @exception GeographicErr if \e N, \e nmx, and \e mmx do not satisfy * \e N ≥ \e nmx ≥ \e mmx ≥ −1. * @exception GeographicErr if \e C or \e S is not big enough to hold the * coefficients. * * 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 { 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: default: // To avoid compiler warnings 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 { 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: default: // To avoid compiler warnings 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. * @exception std::bad_alloc if the memory for the CircularEngine can't be * allocated. * @return the CircularEngine object. * * SphericalHarmonic::operator()() exchanges the order of the sums in the * definition, i.e., ∑n = 0..N * ∑m = 0..n becomes ∑m = * 0..Nn = 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). * * 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 { return _c[0]; } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_SPHERICALHARMONIC_HPP GeographicLib-1.52/include/GeographicLib/SphericalHarmonic1.hpp0000644000771000077100000002714414064202371024334 0ustar ckarneyckarney/** * \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 * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP) #define GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP 1 #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 * Cnm are replaced by * Cnm + \e tau C'nm (and * similarly for Snm). * * Example of use: * \include example-SphericalHarmonic1.cpp **********************************************************************/ class GEOGRAPHICLIB_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, }; 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 Cnm. * @param[in] S the coefficients Snm. * @param[in] N the maximum degree and order of the sum * @param[in] C1 the coefficients C'nm. * @param[in] S1 the coefficients S'nm. * @param[in] N1 the maximum degree and order of the correction * coefficients C'nm and * S'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. * @exception GeographicErr if \e N and \e N1 do not satisfy \e N ≥ * \e N1 ≥ −1. * @exception GeographicErr if any of the vectors of coefficients is not * large enough. * * See SphericalHarmonic for the way the coefficients should be stored. * * 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 Cnm. * @param[in] S the coefficients Snm. * @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 C'nm. * @param[in] S1 the coefficients S'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. * @exception GeographicErr if the parameters do not satisfy \e N ≥ \e * nmx ≥ \e mmx ≥ −1; \e N1 ≥ \e nmx1 ≥ \e mmx1 ≥ * −1; \e N ≥ \e N1; \e nmx ≥ \e nmx1; \e mmx ≥ \e mmx1. * @exception GeographicErr if any of the vectors of coefficients is not * large enough. * * 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 { 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: default: // To avoid compiler warnings 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 { 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: default: // To avoid compiler warnings 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. * @exception std::bad_alloc if the memory for the CircularEngine can't be * allocated. * @return the CircularEngine object. * * SphericalHarmonic1::operator()() exchanges the order of the sums in the * definition, i.e., ∑n = 0..N * ∑m = 0..n becomes ∑m = * 0..Nn = 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). * * 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 { return _c[0]; } /** * @return the first SphericalEngine::coeff object. **********************************************************************/ const SphericalEngine::coeff& Coefficients1() const { return _c[1]; } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP GeographicLib-1.52/include/GeographicLib/SphericalHarmonic2.hpp0000644000771000077100000003325314064202371024333 0ustar ckarneyckarney/** * \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 * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP) #define GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP 1 #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 * Cnm are replaced by * Cnm + \e tau' C'nm + \e * tau'' C''nm (and similarly for * Snm). * * Example of use: * \include example-SphericalHarmonic2.cpp **********************************************************************/ // Don't include the GEOGRPAHIC_EXPORT because this header-only class isn't // used by any other classes in the library. class /*GEOGRAPHICLIB_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, }; 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 Cnm. * @param[in] S the coefficients Snm. * @param[in] N the maximum degree and order of the sum * @param[in] C1 the coefficients C'nm. * @param[in] S1 the coefficients S'nm. * @param[in] N1 the maximum degree and order of the first correction * coefficients C'nm and * S'nm. * @param[in] C2 the coefficients C''nm. * @param[in] S2 the coefficients S''nm. * @param[in] N2 the maximum degree and order of the second correction * coefficients C'nm and * S'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. * @exception GeographicErr if \e N and \e N1 do not satisfy \e N ≥ * \e N1 ≥ −1, and similarly for \e N2. * @exception GeographicErr if any of the vectors of coefficients is not * large enough. * * 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 Cnm. * @param[in] S the coefficients Snm. * @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 C'nm. * @param[in] S1 the coefficients S'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 C''nm. * @param[in] S2 the coefficients S''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. * @exception GeographicErr if the parameters do not satisfy \e N ≥ \e * nmx ≥ \e mmx ≥ −1; \e N1 ≥ \e nmx1 ≥ \e mmx1 ≥ * −1; \e N ≥ \e N1; \e nmx ≥ \e nmx1; \e mmx ≥ \e mmx1; * and similarly for \e N2, \e nmx2, and \e mmx2. * @exception GeographicErr if any of the vectors of coefficients is not * large enough. * * 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 mmx2 cannot 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 { 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: default: // To avoid compiler warnings 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 { 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: default: // To avoid compiler warnings 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. * @exception std::bad_alloc if the memory for the CircularEngine can't be * allocated. * @return the CircularEngine object. * * SphericalHarmonic2::operator()() exchanges the order of the sums in the * definition, i.e., ∑n = 0..N * ∑m = 0..n becomes ∑m = * 0..Nn = 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). * * 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 { return _c[0]; } /** * @return the first SphericalEngine::coeff object. **********************************************************************/ const SphericalEngine::coeff& Coefficients1() const { return _c[1]; } /** * @return the second SphericalEngine::coeff object. **********************************************************************/ const SphericalEngine::coeff& Coefficients2() const { return _c[2]; } }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP GeographicLib-1.52/include/GeographicLib/TransverseMercator.hpp0000644000771000077100000002202514064202371024502 0ustar ckarneyckarney/** * \file TransverseMercator.hpp * \brief Header for GeographicLib::TransverseMercator class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP) #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP 1 #include #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER) /** * The order of the series approximation used in TransverseMercator. * GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER can be set to any integer in [4, 8]. **********************************************************************/ # define GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER \ (GEOGRAPHICLIB_PRECISION == 2 ? 6 : \ (GEOGRAPHICLIB_PRECISION == 1 ? 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 2 * × 10−15" and the relative error in the scale * is 6 × 10−12%%. See Sec. 4 of * arXiv:1002.1417 for details. * The speed penalty in going to 6th order is only about 1%. * * There's a singularity in the projection at φ = 0°, λ * − λ0 = ±(1 − \e e)90° (≈ * ±82.6° for the WGS84 ellipsoid), where \e e is the * eccentricity. Beyond this point, the series ceases to converge and the * results from this method will be garbage. To be on the safe side, don't * use this method if the angular distance from the central meridian exceeds * (1 − 2e)90° (≈ 75° for the WGS84 ellipsoid) * * 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. * * This class also returns the meridian convergence \e gamma and scale \e k. * The meridian convergence is the bearing of grid north (the \e y axis) * measured clockwise from true north. * * 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 GEOGRAPHICLIB_EXPORT TransverseMercator { private: typedef Math::real real; static const int maxpow_ = GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER; static const int numit_ = 5; real _a, _f, _k0, _e2, _es, _e2m, _c, _n; // _alp[0] and _bet[0] unused real _a1, _b1, _alp[maxpow_ + 1], _bet[maxpow_ + 1]; friend class Ellipsoid; // For access to taupf, tauf. 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. * @param[in] k0 central scale factor. * @exception GeographicErr if \e a, (1 − \e f) \e a, 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°]. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const; /** * 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. 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; /** * TransverseMercator::Forward without returning the convergence and scale. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y) const { 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 { 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 EquatorialRadius() const { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ Math::real Flattening() const { return _f; } /** * @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 { return _k0; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * 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.52/include/GeographicLib/TransverseMercatorExact.hpp0000644000771000077100000002721514064202371025475 0ustar ckarneyckarney/** * \file TransverseMercatorExact.hpp * \brief Header for GeographicLib::TransverseMercatorExact class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP) #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP 1 #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 2 × 10−15", * the relative error in the scale is 7 × 10−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. * * This class also returns the meridian convergence \e gamma and scale \e k. * The meridian convergence is the bearing of grid north (the \e y axis) * measured clockwise from true north. * * 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 GEOGRAPHICLIB_EXPORT TransverseMercatorExact { private: typedef Math::real real; static const int numit_ = 10; real tol_, tol2_, taytol_; real _a, _f, _k0, _mu, _mv, _e; bool _extendp; EllipticFunction _Eu, _Ev; void zeta(real u, real snu, real cnu, real dnu, real v, real snv, real cnv, real dnv, real& taup, real& lam) const; void dwdzeta(real u, real snu, real cnu, real dnu, real v, real snv, real cnv, real dnv, real& du, real& dv) const; bool zetainv0(real psi, real lam, real& u, real& v) const; void zetainv(real taup, real lam, real& u, real& v) const; void sigma(real u, real snu, real cnu, real dnu, real v, real snv, real cnv, real dnv, real& xi, real& eta) const; void dwdsigma(real u, real snu, real cnu, real dnu, real v, real snv, real cnv, real dnv, real& du, real& dv) const; bool sigmainv0(real xi, real eta, real& u, real& v) const; void sigmainv(real xi, real eta, real& u, real& v) const; void Scale(real tau, real lam, real snu, real cnu, real dnu, real snv, real cnv, real dnv, real& gamma, real& k) const; public: /** * Constructor for a ellipsoid with * * @param[in] a equatorial radius (meters). * @param[in] f flattening of ellipsoid. * @param[in] k0 central scale factor. * @param[in] extendp use extended domain. * @exception GeographicErr if \e a, \e f, or \e k0 is not positive. * * 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 \e x > 18381 km, \e 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°, \e lon = 88°. * * 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, ∞) and * y/(\e k0 \e a) in [0, E(e2)] * - x/(\e k0 \e a) in [K(1 − e2) − * E(1 − e2), ∞) and y/(\e k0 \e * a) in (−∞, 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::epsilon(). However, TransverseMercator treats the * sphere exactly. **********************************************************************/ 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°]. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const; /** * 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. 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; /** * TransverseMercatorExact::Forward without returning the convergence and * scale. **********************************************************************/ void Forward(real lon0, real lat, real lon, real& x, real& y) const { 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 { 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 EquatorialRadius() const { return _a; } /** * @return \e f the flattening of the ellipsoid. This is the value used in * the constructor. **********************************************************************/ Math::real Flattening() const { return _f; } /** * @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 { return _k0; } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") Math::real MajorRadius() const { return EquatorialRadius(); } ///@} /** * 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.52/include/GeographicLib/UTMUPS.hpp0000644000771000077100000005046614064202371021720 0ustar ckarneyckarney/** * \file UTMUPS.hpp * \brief Header for GeographicLib::UTMUPS class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_UTMUPS_HPP) #define GEOGRAPHICLIB_UTMUPS_HPP 1 #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. * These are the algorithms recommended by the NGA document * - * The Universal Grids and the Transverse Mercator and Polar Stereographic * Map Projections, NGA.SIG.0012 (2014). * * 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. * * The GeographicLib::UTMUPS::EncodeZone encodes the UTM zone and hemisphere * to allow UTM/UPS coordinated to be displayed as, for example, "38N 444500 * 3688500". According to NGA.SIG.0012_2.0.0_UTMUPS the use of "N" to denote * "north" in the context is not allowed (since a upper case letter in this * context denotes the MGRS latitude band). Consequently, as of version * 1.36, EncodeZone uses the lower case letters "n" and "s" to denote the * hemisphere. In addition EncodeZone accepts an optional final argument \e * abbrev, which, if false, results in the hemisphere being spelled out as in * "38north". * * Example of use: * \include example-UTMUPS.cpp **********************************************************************/ class GEOGRAPHICLIB_EXPORT UTMUPS { private: typedef Math::real real; static const int falseeasting_[4]; static const int falsenorthing_[4]; static const int mineasting_[4]; static const int maxeasting_[4]; static const int minnorthing_[4]; static const int maxnorthing_[4]; static const int epsg01N = 32601; // EPSG code for UTM 01N static const int epsg60N = 32660; // EPSG code for UTM 60N static const int epsgN = 32661; // EPSG code for UPS N static const int epsg01S = 32701; // EPSG code for UTM 01S static const int epsg60S = 32760; // EPSG code for UTM 60S static const int epsgS = 32761; // EPSG code for UPS S static real CentralMeridian(int zone) { return real(6 * zone - 183); } // 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). If omitted, use the * standard rules for picking the zone. If \e setzone is given then use * that zone if it is non-negative, otherwise apply the rules given in * UTMUPS::zonespec. * @exception GeographicErr if \e setzone is outside the range * [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZONE] = [−4, 60]. * * This is exact. **********************************************************************/ 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 (optional). * @param[in] mgrslimits if true enforce the stricter MGRS limits on the * coordinates (default = false). * @exception GeographicErr if \e lat is not in [−90°, * 90°]. * @exception GeographicErr if the resulting \e x or \e y is out of allowed * range (see Reverse); in this case, these arguments are unchanged. * * If \e setzone is omitted, use the standard rules for picking the zone. * If \e setzone is given then use that zone if it is non-negative, * otherwise apply the rules given in UTMUPS::zonespec. The accuracy of * the conversion is about 5nm. * * The northing \e y jumps by UTMUPS::UTMShift() when crossing the equator * in the southerly direction. Sometimes it is useful to remove this * discontinuity in \e y by extending the "northern" hemisphere using * UTMUPS::Transfer: * \code double lat = -1, lon = 123; int zone; bool northp; double x, y, gamma, k; GeographicLib::UTMUPS::Forward(lat, lon, zone, northp, x, y, gamma, k); GeographicLib::UTMUPS::Transfer(zone, northp, x, y, zone, true, x, y, zone); northp = true; \endcode **********************************************************************/ 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). * @exception GeographicErr if \e zone, \e x, or \e y is out of allowed * range; this this 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, 3300km] 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); } /** * Transfer UTM/UPS coordinated from one zone to another. * * @param[in] zonein the UTM zone for \e xin and \e yin (or zero for UPS). * @param[in] northpin hemisphere for \e xin and \e yin (true means north, * false means south). * @param[in] xin easting of point (meters) in \e zonein. * @param[in] yin northing of point (meters) in \e zonein. * @param[in] zoneout the requested UTM zone for \e xout and \e yout (or * zero for UPS). * @param[in] northpout hemisphere for \e xout output and \e yout. * @param[out] xout easting of point (meters) in \e zoneout. * @param[out] yout northing of point (meters) in \e zoneout. * @param[out] zone the actual UTM zone for \e xout and \e yout (or zero * for UPS); this equals \e zoneout if \e zoneout ≥ 0. * @exception GeographicErr if \e zonein is out of range (see below). * @exception GeographicErr if \e zoneout is out of range (see below). * @exception GeographicErr if \e xin or \e yin fall outside their allowed * ranges (see UTMUPS::Reverse). * @exception GeographicErr if \e xout or \e yout fall outside their * allowed ranges (see UTMUPS::Reverse). * * \e zonein must be in the range [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0, * 60] with \e zonein = UTMUPS::UPS, 0, indicating UPS. \e zonein may * also be UTMUPS::INVALID. * * \e zoneout must be in the range [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZONE] * = [-4, 60]. If \e zoneout < UTMUPS::MINZONE then the rules give in * the documentation of UTMUPS::zonespec are applied, and \e zone is set to * the actual zone used for output. * * (\e xout, \e yout) can overlap with (\e xin, \e yin). **********************************************************************/ static void Transfer(int zonein, bool northpin, real xin, real yin, int zoneout, bool northpout, real& xout, real& yout, int& zone); /** * 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). * @exception GeographicErr if \e zonestr is malformed. * * 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 (or "north" or "south" spelled out). For UPS, * it consists just of the hemisphere letter (or the spelled out * hemisphere). 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° ≤ \e lat < 40°. n, 01s, 2n, 38s, * south, 3north are legal. 0n, 001s, +3n, 61n, 38P are illegal. INV is a * special value for which the returned value of \e is UTMUPS::INVALID. **********************************************************************/ static void DecodeZone(const std::string& zonestr, int& zone, bool& northp); /** * Encode a UTM/UPS zone string. * * @param[in] zone the UTM zone (zero means UPS). * @param[in] northp hemisphere (true means north, false means south). * @param[in] abbrev if true (the default) use abbreviated (n/s) notation * for hemisphere; otherwise spell out the hemisphere (north/south) * @exception GeographicErr if \e zone is out of range (see below). * @exception std::bad_alloc if memoy for the string can't be allocated. * @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, bool abbrev = true); /** * Decode EPSG. * * @param[in] epsg the EPSG code. * @param[out] zone the UTM zone (zero means UPS). * @param[out] northp hemisphere (true means north, false means south). * * EPSG (European Petroleum Survery Group) codes are a way to refer to many * different projections. DecodeEPSG decodes those referring to UTM or UPS * projections for the WGS84 ellipsoid. If the code does not refer to one * of these projections, \e zone is set to UTMUPS::INVALID. See * https://www.spatialreference.org/ref/epsg/ **********************************************************************/ static void DecodeEPSG(int epsg, int& zone, bool& northp); /** * Encode zone as EPSG. * * @param[in] zone the UTM zone (zero means UPS). * @param[in] northp hemisphere (true means north, false means south). * @return EPSG code (or -1 if \e zone is not in the range * [UTMUPS::MINZONE, UTMUPS::MAXZONE] = [0, 60]) * * Convert \e zone and \e northp to the corresponding EPSG (European * Petroleum Survery Group) codes **********************************************************************/ static int EncodeEPSG(int zone, bool northp); /** * @return shift (meters) necessary to align north and south halves of a * UTM zone (107). **********************************************************************/ static Math::real UTMShift(); /** \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 EquatorialRadius() { 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() { return Constants::WGS84_f(); } /** * \deprecated An old name for EquatorialRadius(). **********************************************************************/ GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()") static Math::real MajorRadius() { return EquatorialRadius(); } ///@} }; } // namespace GeographicLib #endif // GEOGRAPHICLIB_UTMUPS_HPP GeographicLib-1.52/include/GeographicLib/Utility.hpp0000644000771000077100000007314414064202371022324 0ustar ckarneyckarney/** * \file Utility.hpp * \brief Header for GeographicLib::Utility class * * Copyright (c) Charles Karney (2011-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #if !defined(GEOGRAPHICLIB_UTILITY_HPP) #define GEOGRAPHICLIB_UTILITY_HPP 1 #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and unsafe gmtime # pragma warning (push) # pragma warning (disable: 4127 4996) #endif namespace GeographicLib { /** * \brief Some utility routines for %GeographicLib * * Example of use: * \include example-Utility.cpp **********************************************************************/ class GEOGRAPHICLIB_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 15821015 } 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) { // 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. * @exception GeographicErr if the date is invalid and \e check is true. * @return the sequential day number. **********************************************************************/ 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) { 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. The string "now" is interpreted as the present * date (in UTC). * * @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. * @exception GeographicErr is \e s is malformed. **********************************************************************/ static void date(const std::string& s, int& y, int& m, int& d) { if (s == "now") { std::time_t t = std::time(0); struct tm* now = gmtime(&t); y = now->tm_year + 1900; m = now->tm_mon + 1; d = now->tm_mday; return; } 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 = val(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 = val(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 = val(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 = val(s.substr(p1, p2 - p1)); if (++p2 == s.size()) throw GeographicErr("Empty day field in date " + s); d1 = val(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) { 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) { 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. * @exception GeographicErr if \e s can't be interpreted as a date. * @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 val(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). * @exception std::bad_alloc if memory for the string can't be allocated. * @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) { std::ostringstream s; if (p >= 0) s << std::fixed << std::setprecision(p); s << x; return s.str(); } /** * Convert a Math::real object to a string. * * @param[in] x the value to be converted. * @param[in] p the precision used (default −1). * @exception std::bad_alloc if memory for the string can't be allocated. * @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. This is * an overload of str which deals with inf and nan. **********************************************************************/ static std::string str(Math::real x, int p = -1) { using std::isfinite; if (!isfinite(x)) return x < 0 ? std::string("-inf") : (x > 0 ? std::string("inf") : std::string("nan")); std::ostringstream s; #if GEOGRAPHICLIB_PRECISION == 4 // boost-quadmath treats precision == 0 as "use as many digits as // necessary" (see https://svn.boost.org/trac/boost/ticket/10103), so... using std::floor; using std::fmod; if (p == 0) { x += Math::real(0.5); Math::real ix = floor(x); // Implement the "round ties to even" rule x = (ix == x && fmod(ix, Math::real(2)) == 1) ? ix - 1 : ix; s << std::fixed << std::setprecision(1) << x; std::string r(s.str()); // strip off trailing ".0" return r.substr(0, (std::max)(int(r.size()) - 2, 0)); } #endif if (p >= 0) s << std::fixed << std::setprecision(p); s << x; return s.str(); } /** * Trim the white space from the beginning and end of a string. * * @param[in] s the string to be trimmed * @return the trimmed string **********************************************************************/ static std::string trim(const std::string& s) { unsigned beg = 0, end = unsigned(s.size()); while (beg < end && isspace(s[beg])) ++beg; while (beg < end && isspace(s[end - 1])) --end; return std::string(s, beg, end-beg); } /** * Convert a string to type T. * * @tparam T the type of the return value. * @param[in] s the string to be converted. * @exception GeographicErr is \e s is not readable as a T. * @return object of type T. * * White space at the beginning and end of \e s is ignored. * * Special handling is provided for some types. * * If T is a floating point type, then inf and nan are recognized. * * If T is bool, then \e s should either be string a representing 0 (false) * or 1 (true) or one of the strings * - "false", "f", "nil", "no", "n", "off", or "" meaning false, * - "true", "t", "yes", "y", or "on" meaning true; * . * case is ignored. * * If T is std::string, then \e s is returned (with the white space at the * beginning and end removed). **********************************************************************/ template static T val(const std::string& s) { // If T is bool, then the specialization val() defined below is // used. T x; std::string errmsg, t(trim(s)); do { // Executed once (provides the ability to break) std::istringstream is(t); if (!(is >> x)) { errmsg = "Cannot decode " + t; break; } int pos = int(is.tellg()); // Returns -1 at end of string? if (!(pos < 0 || pos == int(t.size()))) { errmsg = "Extra text " + t.substr(pos) + " at end of " + t; break; } return x; } while (false); x = std::numeric_limits::is_integer ? 0 : nummatch(t); if (x == 0) throw GeographicErr(errmsg); return x; } /** * \deprecated An old name for val(s). **********************************************************************/ template GEOGRAPHICLIB_DEPRECATED("Use Utility::val(s)") static T num(const std::string& s) { return val(s); } /** * Match "nan" and "inf" (and variants thereof) in a string. * * @tparam T the type of the return value (this should be a floating point * type). * @param[in] s the string to be matched. * @return appropriate special value (±∞, nan) or 0 if none is * found. * * White space is not allowed at the beginning or end of \e s. **********************************************************************/ template static T nummatch(const std::string& s) { if (s.length() < 3) return 0; std::string t(s); for (std::string::iterator p = t.begin(); p != t.end(); ++p) *p = char(std::toupper(*p)); for (size_t i = s.length(); i--;) t[i] = char(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. * @exception GeographicErr is \e s is not readable as a fraction of type * T. * @return object of type T * * \note The msys shell under Windows converts arguments which look like * pathnames into their Windows equivalents. As a result the argument * "-1/300" gets mangled into something unrecognizable. A workaround is to * use a floating point number in the numerator, i.e., "-1.0/300". (Recent * versions of the msys shell appear \e not to have this problem.) **********************************************************************/ 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()) ? val(s) : // delim in [1, size() - 2] val(s.substr(0, delim)) / val(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) { std::string::size_type r = s.find(char(std::toupper(c))); return r == std::string::npos ? -1 : int(r); } /** * Lookup up a character in a char*. * * @param[in] s the char* 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 char* s, char c) { const char* p = std::strchr(s, std::toupper(c)); return p != NULL ? int(p - s) : -1; } /** * 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. * @exception GeographicErr if the data cannot be read. **********************************************************************/ template static void readarray(std::istream& str, IntT array[], size_t num) { #if GEOGRAPHICLIB_PRECISION < 4 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 #endif { 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). * @exception GeographicErr if the data cannot be read. **********************************************************************/ template static void readarray(std::istream& str, std::vector& array) { if (array.size() > 0) 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. * @exception GeographicErr if the data cannot be written. **********************************************************************/ template static void writearray(std::ostream& str, const IntT array[], size_t num) { #if GEOGRAPHICLIB_PRECISION < 4 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 #endif { 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). * @exception GeographicErr if the data cannot be written. **********************************************************************/ template static void writearray(std::ostream& str, std::vector& array) { if (array.size() > 0) writearray(str, &array[0], array.size()); } /** * Parse a KEY [=] VALUE line. * * @param[in] line the input line. * @param[out] key the KEY. * @param[out] value the VALUE. * @param[in] delim delimiter to separate KEY and VALUE, if NULL use first * space character. * @exception std::bad_alloc if memory for the internal strings can't be * allocated. * @return whether a key was found. * * A "#" character and everything after it are discarded and the result * trimmed of leading and trailing white space. Use the delimiter * character (or, if it is NULL, the first white space) to separate \e key * and \e value. \e key and \e value are trimmed of leading and trailing * white space. If \e key is empty, then \e value is set to "" and false * is returned. **********************************************************************/ static bool ParseLine(const std::string& line, std::string& key, std::string& value, char delim); /** * Parse a KEY VALUE line. * * @param[in] line the input line. * @param[out] key the KEY. * @param[out] value the VALUE. * @exception std::bad_alloc if memory for the internal strings can't be * allocated. * @return whether a key was found. * * \note This is a transition routine. At some point \e delim will be made * an optional argument in the previous version of ParseLine and this * version will be removed. **********************************************************************/ static bool ParseLine(const std::string& line, std::string& key, std::string& value); /** * Set the binary precision of a real number. * * @param[in] ndigits the number of bits of precision. If ndigits is 0 * (the default), then determine the precision from the environment * variable GEOGRAPHICLIB_DIGITS. If this is undefined, use ndigits = * 256 (i.e., about 77 decimal digits). * @return the resulting number of bits of precision. * * This only has an effect when GEOGRAPHICLIB_PRECISION = 5. The * precision should only be set once and before calls to any other * GeographicLib functions. (Several functions, for example Math::pi(), * cache the return value in a static local variable. The precision needs * to be set before a call to any such functions.) In multi-threaded * applications, it is necessary also to set the precision in each thread * (see the example GeoidToGTX.cpp). **********************************************************************/ static int set_digits(int ndigits = 0); }; /** * The specialization of Utility::val() for strings. **********************************************************************/ template<> inline std::string Utility::val(const std::string& s) { return trim(s); } /** * The specialization of Utility::val() for bools. **********************************************************************/ template<> inline bool Utility::val(const std::string& s) { std::string t(trim(s)); if (t.empty()) return false; bool x; { std::istringstream is(t); if (is >> x) { int pos = int(is.tellg()); // Returns -1 at end of string? if (!(pos < 0 || pos == int(t.size()))) throw GeographicErr("Extra text " + t.substr(pos) + " at end of " + t); return x; } } for (std::string::iterator p = t.begin(); p != t.end(); ++p) *p = char(std::tolower(*p)); switch (t[0]) { // already checked that t isn't empty case 'f': if (t == "f" || t == "false") return false; break; case 'n': if (t == "n" || t == "nil" || t == "no") return false; break; case 'o': if (t == "off") return false; else if (t == "on") return true; break; case 't': if (t == "t" || t == "true") return true; break; case 'y': if (t == "y" || t == "yes") return true; break; default: break; } throw GeographicErr("Cannot decode " + t + " as a bool"); } } // namespace GeographicLib #if defined(_MSC_VER) # pragma warning (pop) #endif #endif // GEOGRAPHICLIB_UTILITY_HPP GeographicLib-1.52/include/GeographicLib/Config-ac.h.in0000644000771000077100000000452514064202374022514 0ustar ckarneyckarney/* include/GeographicLib/Config-ac.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* major version number */ #undef GEOGRAPHICLIB_VERSION_MAJOR /* minor version number */ #undef GEOGRAPHICLIB_VERSION_MINOR /* patch number */ #undef GEOGRAPHICLIB_VERSION_PATCH /* define if the compiler supports basic C++11 syntax */ #undef HAVE_CXX11 /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_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 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 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 the sub-directory where 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 GeographicLib-1.52/include/GeographicLib/Config.h0000644000771000077100000000063014064202407021514 0ustar ckarneyckarney// This will be overwritten by ./configure #define GEOGRAPHICLIB_VERSION_STRING "1.52" #define GEOGRAPHICLIB_VERSION_MAJOR 1 #define GEOGRAPHICLIB_VERSION_MINOR 52 #define GEOGRAPHICLIB_VERSION_PATCH 0 // Undefine HAVE_LONG_DOUBLE if this type is unknown to the compiler #define GEOGRAPHICLIB_HAVE_LONG_DOUBLE 1 // Define WORDS_BIGENDIAN to be 1 if your machine is big endian /* #undef WORDS_BIGENDIAN */ GeographicLib-1.52/include/Makefile.am0000644000771000077100000000343414064202371017500 0ustar ckarneyckarney# # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine 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/Ellipsoid.hpp \ GeographicLib/EllipticFunction.hpp \ GeographicLib/GARS.hpp \ GeographicLib/GeoCoords.hpp \ GeographicLib/Geocentric.hpp \ GeographicLib/Geodesic.hpp \ GeographicLib/GeodesicExact.hpp \ GeographicLib/GeodesicLine.hpp \ GeographicLib/GeodesicLineExact.hpp \ GeographicLib/Geohash.hpp \ GeographicLib/Geoid.hpp \ GeographicLib/Georef.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/NearestNeighbor.hpp \ GeographicLib/NormalGravity.hpp \ GeographicLib/OSGB.hpp \ GeographicLib/PolarStereographic.hpp \ GeographicLib/PolygonArea.hpp \ GeographicLib/Rhumb.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 geographiclib_data=$(datadir)/GeographicLib DEFS=-DGEOGRAPHICLIB_DATA=\"$(geographiclib_data)\" @DEFS@ EXTRA_DIST = Makefile.mk GeographicLib/CMakeLists.txt GeographicLib/Config.h.in GeographicLib-1.52/include/Makefile.mk0000644000771000077100000000173414064202371017513 0ustar ckarneyckarneyMODULES = Accumulator \ AlbersEqualArea \ AzimuthalEquidistant \ CassiniSoldner \ CircularEngine \ DMS \ Ellipsoid \ EllipticFunction \ GARS \ GeoCoords \ Geocentric \ Geodesic \ GeodesicExact \ GeodesicLine \ GeodesicLineExact \ Geohash \ Geoid \ Georef \ Gnomonic \ GravityCircle \ GravityModel \ LambertConformalConic \ LocalCartesian \ MGRS \ MagneticCircle \ MagneticModel \ Math \ NormalGravity \ OSGB \ PolarStereographic \ PolygonArea \ Rhumb \ SphericalEngine \ TransverseMercator \ TransverseMercatorExact \ UTMUPS \ Utility EXTRAHEADERS = Constants \ NearestNeighbor \ SphericalHarmonic \ SphericalHarmonic1 \ SphericalHarmonic2 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 GeographicLib-1.52/include/Makefile.in0000644000771000077100000004553614064202402017515 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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 VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(nobase_include_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(nobase_include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ 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@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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@ pkgconfigdir = @pkgconfigdir@ 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/Ellipsoid.hpp \ GeographicLib/EllipticFunction.hpp \ GeographicLib/GARS.hpp \ GeographicLib/GeoCoords.hpp \ GeographicLib/Geocentric.hpp \ GeographicLib/Geodesic.hpp \ GeographicLib/GeodesicExact.hpp \ GeographicLib/GeodesicLine.hpp \ GeographicLib/GeodesicLineExact.hpp \ GeographicLib/Geohash.hpp \ GeographicLib/Geoid.hpp \ GeographicLib/Georef.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/NearestNeighbor.hpp \ GeographicLib/NormalGravity.hpp \ GeographicLib/OSGB.hpp \ GeographicLib/PolarStereographic.hpp \ GeographicLib/PolygonArea.hpp \ GeographicLib/Rhumb.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 geographiclib_data = $(datadir)/GeographicLib 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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) @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ $(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)`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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 TAGS all all-am check check-am clean clean-generic \ clean-libtool cscopelist-am ctags ctags-am 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 tags-am uninstall \ uninstall-am uninstall-nobase_includeHEADERS .PRECIOUS: Makefile # 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.52/java/README.txt0000644000771000077100000000160014064202371016431 0ustar ckarneyckarneyThis is a Java implementation of the geodesic algorithms described in C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); https://doi.org/10.1007/s00190-012-0578-z Addenda: https://geographiclib.sourceforge.io/geod-addenda.html For documentation, see https://geographiclib.sourceforge.io/html/java/ The code in this directory is entirely self-contained. In particular, it does not depend on the C++ classes. You can build the example programs using, for example, cd inverse/src/main/java javac -cp .:../../../../src/main/java Inverse.java echo -30 0 29.5 179.5 | java -cp .:../../../../src/main/java Inverse On Windows, change this to cd inverse\src\main\java javac -cp .;../../../../src/main/java Inverse.java echo -30 0 29.5 179.5 | java -cp .;../../../../src/main/java Inverse Building with maven is also supported (see the documentation). GeographicLib-1.52/java/direct/pom.xml0000644000771000077100000000505114064202371017526 0ustar ckarneyckarney 4.0.0 net.sf.geographiclib.example Direct Direct 1.52-SNAPSHOT jar . 1.6 2.9 UTF-8 2.3.2 2.4 2.8 3.0 net.sf.geographiclib GeographicLib-Java 1.52 org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} ${java.version} ${java.version} org.apache.maven.plugins maven-surefire-plugin ${surefire-plugin.version} false org.apache.maven.plugins maven-javadoc-plugin ${maven-javadoc.version} public true attach-javadocs jar org.codehaus.mojo exec-maven-plugin 1.2.1 Direct GeographicLib-1.52/java/direct/src/main/java/Direct.java0000644000771000077100000000161714064202371022726 0ustar ckarneyckarney/** * A test program for the GeographicLib.Geodesic.Direct method **********************************************************************/ import java.util.*; import net.sf.geographiclib.*; public class Direct { /** * Solve the direct geodesic problem. * * This program reads in lines with lat1, lon1, azi1, s12 and prints out lines * with lat2, lon2, azi2 (for the WGS84 ellipsoid). **********************************************************************/ public static void main(String[] args) { try { Scanner in = new Scanner(System.in); double lat1, lon1, azi1, s12; while (true) { lat1 = in.nextDouble(); lon1 = in.nextDouble(); azi1 = in.nextDouble(); s12 = in.nextDouble(); GeodesicData g = Geodesic.WGS84.Direct(lat1, lon1, azi1, s12); System.out.println(g.lat2 + " " + g.lon2 + " " + g.azi2); } } catch (Exception e) {} } } GeographicLib-1.52/java/inverse/pom.xml0000644000771000077100000000505414064202371017732 0ustar ckarneyckarney 4.0.0 net.sf.geographiclib.example Inverse Inverse 1.52-SNAPSHOT jar . 1.6 2.9 UTF-8 2.3.2 2.4 2.8 3.0 net.sf.geographiclib GeographicLib-Java 1.52 org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} ${java.version} ${java.version} org.apache.maven.plugins maven-surefire-plugin ${surefire-plugin.version} false org.apache.maven.plugins maven-javadoc-plugin ${maven-javadoc.version} public true attach-javadocs jar org.codehaus.mojo exec-maven-plugin 1.2.1 Inverse GeographicLib-1.52/java/inverse/src/main/java/Inverse.java0000644000771000077100000000162514064202371023327 0ustar ckarneyckarney/** * A test program for the GeographicLib.Geodesic.Inverse method **********************************************************************/ import java.util.*; import net.sf.geographiclib.*; /** * Solve the inverse geodesic problem. * * This program reads in lines with lat1, lon1, lat2, lon2 and prints out lines * with azi1, azi2, s12 (for the WGS84 ellipsoid). **********************************************************************/ public class Inverse { public static void main(String[] args) { try { Scanner in = new Scanner(System.in); double lat1, lon1, lat2, lon2; while (true) { lat1 = in.nextDouble(); lon1 = in.nextDouble(); lat2 = in.nextDouble(); lon2 = in.nextDouble(); GeodesicData g = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2); System.out.println(g.azi1 + " " + g.azi2 + " " + g.s12); } } catch (Exception e) {} } } GeographicLib-1.52/java/planimeter/pom.xml0000644000771000077100000000506514064202371020421 0ustar ckarneyckarney 4.0.0 net.sf.geographiclib.example Planimeter Planimeter 1.52-SNAPSHOT jar . 1.6 2.9 UTF-8 2.3.2 2.4 2.8 3.0 net.sf.geographiclib GeographicLib-Java 1.52 org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} ${java.version} ${java.version} org.apache.maven.plugins maven-surefire-plugin ${surefire-plugin.version} false org.apache.maven.plugins maven-javadoc-plugin ${maven-javadoc.version} public true attach-javadocs jar org.codehaus.mojo exec-maven-plugin 1.2.1 Planimeter GeographicLib-1.52/java/planimeter/src/main/java/Planimeter.java0000644000771000077100000000170414064202371024477 0ustar ckarneyckarney/** * A test program for the GeographicLib.PolygonArea class **********************************************************************/ import java.util.*; import net.sf.geographiclib.*; /** * Compute the area of a geodesic polygon. * * This program reads lines with lat, lon for each vertex of a polygon. At the * end of input, the program prints the number of vertices, the perimeter of * the polygon and its area (for the WGS84 ellipsoid). **********************************************************************/ public class Planimeter { public static void main(String[] args) { PolygonArea p = new PolygonArea(Geodesic.WGS84, false); try { Scanner in = new Scanner(System.in); while (true) { double lat = in.nextDouble(), lon = in.nextDouble(); p.AddPoint(lat, lon); } } catch (Exception e) {} PolygonResult r = p.Compute(); System.out.println(r.num + " " + r.perimeter + " " + r.area); } } GeographicLib-1.52/java/pom.xml0000644000771000077100000001234014064202371016253 0ustar ckarneyckarney 4.0.0 net.sf.geographiclib GeographicLib-Java 1.52 jar The MIT License(MIT) http://opensource.org/licenses/MIT Java implementation of GeographicLib This is a Java implementation of the geodesic algorithms from GeographicLib. This is a self-contained library which makes it easy to do geodesic computations for an ellipsoid of revolution in a Java program. It requires Java version 1.1 or later. https://geographiclib.sourceforge.io Charles Karney charles@karney.com https://sourceforge.net/u/karney/profile/ . 1.7 2.9 UTF-8 2.3.2 2.4 2.8 3.0 org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} ${java.version} ${java.version} org.apache.maven.plugins maven-surefire-plugin ${surefire-plugin.version} false release org.apache.maven.plugins maven-javadoc-plugin ${maven-javadoc.version} 8 public true attach-javadocs jar org.apache.maven.plugins maven-source-plugin 2.2.1 attach-sources jar-no-fork org.sonatype.plugins nexus-staging-maven-plugin 1.6.3 true ossrh https://oss.sonatype.org/ true org.apache.maven.plugins maven-gpg-plugin 1.5 sign-artifacts verify sign ossrh https://oss.sonatype.org/content/repositories/snapshots ossrh https://oss.sonatype.org/service/local/staging/deploy/maven2 scm:git://git.code.sourceforge.net/p/geographiclib/code scm:git:https://git.code.sourceforge.net/p/geographiclib/code https://sourceforge.net/p/geographiclib/code/ci/master/tree/ junit junit 4.12 test GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/Accumulator.java0000644000771000077100000001262314064202371026515 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Accumulator class * * Copyright (c) Charles Karney (2013-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * An accumulator for sums. *

* This allow many double precision numbers to be added together with twice the * normal precision. Thus the effective precision of the sum is 106 bits or * about 32 decimal places. *

* The implementation follows J. R. Shewchuk, * Adaptive Precision * Floating-Point Arithmetic and Fast Robust Geometric Predicates, * Discrete & Computational Geometry 18(3) 305–363 (1997). *

* In the documentation of the member functions, sum stands for the * value currently held in the accumulator. ***********************************************************************/ public class Accumulator { // _s + _t accumulators for the sum. private double _s, _t; /** * Construct from a double. *

* @param y set sum = y. **********************************************************************/ public Accumulator(double y) { _s = y; _t = 0; } /** * Construct from another Accumulator. *

* @param a set sum = a. **********************************************************************/ public Accumulator(Accumulator a) { _s = a._s; _t = a._t; } /** * Set the value to a double. *

* @param y set sum = y. **********************************************************************/ public void Set(double y) { _s = y; _t = 0; } /** * Return the value held in the accumulator. *

* @return sum. **********************************************************************/ public double Sum() { return _s; } /** * Return the result of adding a number to sum (but don't change * sum). *

* @param y the number to be added to the sum. * @return sum + y. **********************************************************************/ public double Sum(double y) { Pair p = new Pair(); AddInternal(p, _s, _t, y); return p.first; } /** * Internal version of Add, p = [s, t] + y *

* @param s the larger part of the accumulator. * @param t the smaller part of the accumulator. * @param y the addend. * @param p output Pair(s, t) with the result. **********************************************************************/ public static void AddInternal(Pair p, double s, double t, double y) { // Here's Shewchuk's solution... double u; // hold exact sum as [s, t, u] // Accumulate starting at least significant end GeoMath.sum(p, y, t); y = p.first; u = p.second; GeoMath.sum(p, y, s); s = p.first; t = p.second; // 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. p.first = s; p.second = t; } /** * Add a number to the accumulator. *

* @param y set sum += y. **********************************************************************/ public void Add(double y) { Pair p = new Pair(); AddInternal(p, _s, _t, y); _s = p.first; _t = p.second; } /** * Negate an accumulator. *

* Set sum = −sum. **********************************************************************/ public void Negate() { _s = -_s; _t = -_t; } /** * Take the remainder. *

* @param y the modulus *

* Put sum in the rangle [−y, y]. **********************************************************************/ public void Remainder(double y) { _s = GeoMath.remainder(_s, y); Add(0.0); // renormalize } } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/Constants.java0000644000771000077100000000167314064202371026215 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Constants class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * Constants needed by GeographicLib. *

* Define constants specifying the WGS84 ellipsoid. ***********************************************************************/ public class Constants { /** * The equatorial radius of WGS84 ellipsoid (6378137 m). **********************************************************************/ public static final double WGS84_a = 6378137; /** * The flattening of WGS84 ellipsoid (1/298.257223563). **********************************************************************/ public static final double WGS84_f = 1/298.257223563; private Constants() {} } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/GeoMath.java0000644000771000077100000003023214064202371025556 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeoMath class * * Copyright (c) Charles Karney (2013-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * Mathematical functions needed by GeographicLib. *

* Define mathematical functions and constants so that any version of Java * can be used. **********************************************************************/ public class GeoMath { /** * The number of binary digits in the fraction of a double precision * number (equivalent to C++'s {@code numeric_limits::digits}). **********************************************************************/ public static final int digits = 53; /** * Square a number. *

* @param x the argument. * @return x2. **********************************************************************/ public static double sq(double x) { return x * x; } /** * 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. *

* @param x the argument. * @return atanh(x). **********************************************************************/ public static double atanh(double x) { double y = Math.abs(x); // Enforce odd parity y = Math.log1p(2 * y/(1 - y))/2; return x > 0 ? y : (x < 0 ? -y : x); } /** * Normalize a sine cosine pair. *

* @param p return parameter for normalized quantities with sinx2 * + cosx2 = 1. * @param sinx the sine. * @param cosx the cosine. **********************************************************************/ public static void norm(Pair p, double sinx, double cosx) { double r = Math.hypot(sinx, cosx); p.first = sinx/r; p.second = cosx/r; } /** * The error-free sum of two numbers. *

* @param u the first number in the sum. * @param v the second number in the sum. * @param p output Pair(s, t) with s = round(u + * v) and t = u + v - s. *

* See D. E. Knuth, TAOCP, Vol 2, 4.2.2, Theorem B. **********************************************************************/ public static void sum(Pair p, double u, double v) { double s = u + v; double up = s - v; double vpp = s - up; up -= u; vpp -= v; double t = -(up + vpp); // u + v = s + t // = round(u + v) + t p.first = s; p.second = t; } /** * Evaluate a polynomial. *

* @param N the order of the polynomial. * @param p the coefficient array (of size N + s + 1 or more). * @param s starting index for the array. * @param x the variable. * @return the value of the polynomial. *

* Evaluate y = ∑n=0..N * ps+n * xNn. Return 0 if N < 0. * Return ps, if N = 0 (even if x is * infinite or a nan). The evaluation uses Horner's method. **********************************************************************/ public static double polyval(int N, double p[], int s, double x) { double y = N < 0 ? 0 : p[s++]; while (--N >= 0) y = y * x + p[s++]; return y; } /** * Coarsen a value close to zero. *

* @param x the argument * @return the coarsened value. *

* This makes the smallest gap in x = 1/16 − nextafter(1/16, 0) * = 1/257 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., * 10−200). This converts −0 to +0; however tiny * negative numbers get converted to −0. **********************************************************************/ public static double AngRound(double x) { final double z = 1/16.0; if (x == 0) return 0; double 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; } /** * The remainder function. *

* @param x the numerator of the division * @param y the denominator of the division * @return the remainder in the range [−y/2, y/2]. *

* The range of x is unrestricted; y must be positive. **********************************************************************/ public static double remainder(double x, double y) { x = x % y; return x < -y/2 ? x + y : (x < y/2 ? x : x - y); } /** * Normalize an angle. *

* @param x the angle in degrees. * @return the angle reduced to the range [−180°, 180°). *

* The range of x is unrestricted. **********************************************************************/ public static double AngNormalize(double x) { x = remainder(x, 360.0); return x == -180 ? 180 : x; } /** * Normalize a latitude. *

* @param x the angle in degrees. * @return x if it is in the range [−90°, 90°], otherwise * return NaN. **********************************************************************/ public static double LatFix(double x) { return Math.abs(x) > 90 ? Double.NaN : x; } /** * The exact difference of two angles reduced to (−180°, 180°]. *

* @param x the first angle in degrees. * @param y the second angle in degrees. * @param p output Pair(d, e) with d being the rounded * difference and e being the error. *

* The computes z = yx exactly, reduced to * (−180°, 180°]; and then sets z = d + e * where d is the nearest representable number to z and * e is the truncation error. If d = −180, then e * > 0; If d = 180, then e ≤ 0. **********************************************************************/ public static void AngDiff(Pair p, double x, double y) { sum(p, AngNormalize(-x), AngNormalize(y)); double d = AngNormalize(p.first), t = p.second; sum(p, d == 180 && t > 0 ? -180 : d, t); } /** * Evaluate the sine and cosine function with the argument in degrees * * @param p return Pair(s, t) with s = sin(x) and * c = cos(x). * @param x in degrees. *

* The results obey exactly the elementary properties of the trigonometric * functions, e.g., sin 9° = cos 81° = − sin 123456789°. **********************************************************************/ public static void sincosd(Pair p, double x) { // In order to minimize round-off errors, this function exactly reduces // the argument to the range [-45, 45] before converting it to radians. double r; int q; r = x % 360.0; q = (int)Math.round(r / 90); // If r is NaN this returns 0 r -= 90 * q; // now abs(r) <= 45 r = Math.toRadians(r); // Possibly could call the gnu extension sincos double s = Math.sin(r), c = Math.cos(r); double sinx, cosx; switch (q & 3) { case 0: sinx = s; cosx = c; break; case 1: sinx = c; cosx = -s; break; case 2: sinx = -s; cosx = -c; break; default: sinx = -c; cosx = s; break; // case 3 } if (x != 0) { sinx += 0.0; cosx += 0.0; } p.first = sinx; p.second = cosx; } /** * Evaluate the atan2 function with the result in degrees * * @param y the sine of the angle * @param x the cosine of the angle * @return atan2(y, x) in degrees. *

* The result is in the range (−180° 180°]. N.B., * atan2d(±0, −1) = +180°; atan2d(−ε, * −1) = −180°, for ε positive and tiny; * atan2d(±0, 1) = ±0°. **********************************************************************/ public static double atan2d(double y, double x) { // In order to minimize round-off errors, this function rearranges the // arguments so that result of atan2 is in the range [-pi/4, pi/4] before // converting it to degrees and mapping the result to the correct // quadrant. int q = 0; if (Math.abs(y) > Math.abs(x)) { double t; t = x; x = y; y = t; q = 2; } if (x < 0) { x = -x; ++q; } // here x >= 0 and x >= abs(y), so angle is in [-pi/4, pi/4] double ang = Math.toDegrees(Math.atan2(y, x)); switch (q) { // Note that atan2d(-0.0, 1.0) will return -0. However, we expect that // atan2d will not be called with y = -0. If need be, include // // case 0: ang = 0 + ang; break; // // and handle mpfr as in AngRound. case 1: ang = (y >= 0 ? 180 : -180) - ang; break; case 2: ang = 90 - ang; break; case 3: ang = -90 + ang; break; default: break; } return ang; } /** * Test for finiteness. *

* @param x the argument. * @return true if number is finite, false if NaN or infinite. **********************************************************************/ public static boolean isfinite(double x) { return Math.abs(x) <= Double.MAX_VALUE; } /** * Normalize a sine cosine pair. *

* @param sinx the sine. * @param cosx the cosine. * @return a Pair of normalized quantities with sinx2 + * cosx2 = 1. * * @deprecated Use {@link #sincosd(Pair, double)} instead. **********************************************************************/ // @Deprecated public static Pair norm(double sinx, double cosx) { Pair p = new Pair(); norm(p, sinx, cosx); return p; } /** * The error-free sum of two numbers. *

* @param u the first number in the sum. * @param v the second number in the sum. * @return Pair(s, t) with s = round(u + * v) and t = u + v - s. *

* See D. E. Knuth, TAOCP, Vol 2, 4.2.2, Theorem B. * * @deprecated Use {@link #sincosd(Pair, double)} instead. **********************************************************************/ // @Deprecated public static Pair sum(double u, double v) { Pair p = new Pair(); sum(p, u, v); return p; } /** * The exact difference of two angles reduced to (−180°, 180°]. *

* @param x the first angle in degrees. * @param y the second angle in degrees. * @return Pair(d, e) with d being the rounded * difference and e being the error. *

* The computes z = yx exactly, reduced to * (−180°, 180°]; and then sets z = d + e * where d is the nearest representable number to z and * e is the truncation error. If d = −180, then e * > 0; If d = 180, then e ≤ 0. * * @deprecated Use {@link #sincosd(Pair, double)} instead. **********************************************************************/ // @Deprecated public static Pair AngDiff(double x, double y) { Pair p = new Pair(); AngDiff(p, x, y); return p; } /** * Evaluate the sine and cosine function with the argument in degrees * * @param x in degrees. * @return Pair(s, t) with s = sin(x) and * c = cos(x). *

* The results obey exactly the elementary properties of the trigonometric * functions, e.g., sin 9° = cos 81° = − sin 123456789°. * * @deprecated Use {@link #sincosd(Pair, double)} instead. **********************************************************************/ // @Deprecated public static Pair sincosd(double x) { Pair p = new Pair(); sincosd(p, x); return p; } private GeoMath() {} } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/Geodesic.java0000644000771000077100000023460214064202371025763 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Geodesic class * * Copyright (c) Charles Karney (2013-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * 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 * {@link #Direct 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 {@link #Inverse * 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 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 provided by * {@link #ArcDirect ArcDirect}. An arc length in excess of 180° 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 90°. *

* 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 second point is displaced * m12 dazi1 in the direction azi2 + 90°. 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. The area between the geodesic from point 1 to point 2 and * the equation is represented by S12; it is the area, measured * counter-clockwise, of the geodesic quadrilateral with corners * (lat1,lon1), (0,lon1), (0,lon2), and * (lat2,lon2). It can be used to compute the area of any * geodesic polygon. *
*

* The quantities m12, M12, M21 which all specify the * behavior of nearby geodesics obey addition rules. If points 1, 2, and 3 all * lie on a single geodesic, then the following rules hold: *

    *
  • * s13 = s12 + s23 *
  • * a13 = a12 + a23 *
  • * S13 = S12 + S23 *
  • * m13 = m12 M23 + m23 M21 *
  • * M13 = M12 M23 − (1 − M12 * M21) m23 / m12 *
  • * M31 = M32 M21 − (1 − M23 * M32) m12 / m23 *
*

* The results of the geodesic calculations are bundled up into a {@link * GeodesicData} object which includes the input parameters and all the * computed results, i.e., lat1, lon1, azi1, lat2, * lon2, azi2, s12, a12, m12, M12, * M21, S12. *

* The functions {@link #Direct(double, double, double, double, int) Direct}, * {@link #ArcDirect(double, double, double, double, int) ArcDirect}, and * {@link #Inverse(double, double, double, double, int) Inverse} include an * optional final argument outmask which allows you specify which * results should be computed and returned. If you omit outmask, then * the "standard" geodesic results are computed (latitudes, longitudes, * azimuths, and distance). outmask is bitor'ed combination of {@link * GeodesicMask} values. For example, if you wish just to compute the distance * between two points you would call, e.g., *

 * {@code
 *  GeodesicData g = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2,
 *                      GeodesicMask.DISTANCE); }
*

* Additional functionality is provided by the {@link GeodesicLine} class, * which allows a sequence of points along a geodesic to be computed. *

* The shortest distance returned by the solution of the inverse problem is * (obviously) uniquely defined. However, in a few special cases there are * multiple azimuths which yield the same shortest distance. Here is a * catalog of those cases: *

    *
  • * lat1 = −lat2 (with neither point at a pole). If * azi1 = azi2, the geodesic is unique. Otherwise there are * two geodesics and the second one is obtained by setting [azi1, * azi2] → [azi2, azi1], [M12, M21] * → [M21, M12], S12 → −S12. * (This occurs when the longitude difference is near ±180° for * oblate ellipsoids.) *
  • * lon2 = lon1 ± 180° (with neither point at a * pole). If azi1 = 0° or ±180°, the geodesic is * unique. Otherwise there are two geodesics and the second one is obtained * by setting [ azi1, azi2] → [−azi1, * −azi2], S12 → − S12. (This occurs * when lat2 is near −lat1 for prolate ellipsoids.) *
  • * Points 1 and 2 at opposite poles. There are infinitely many geodesics * which can be generated by setting [azi1, azi2] → * [azi1, azi2] + [d, −d], for arbitrary * d. (For spheres, this prescription applies when points 1 and 2 are * antipodal.) *
  • * s12 = 0 (coincident points). There are infinitely many geodesics * which can be generated by setting [azi1, azi2] → * [azi1, azi2] + [d, d], for arbitrary d. *
*

* The calculations are accurate to better than 15 nm (15 nanometers) for the * WGS84 ellipsoid. See Sec. 9 of * arXiv:1102.1215v1 for * details. The algorithms used by this class are based on series expansions * using the flattening f as a small parameter. These are only accurate * for |f| < 0.02; however reasonably accurate results will be * obtained for |f| < 0.2. Here is a table of the approximate * maximum error (expressed as a distance) for an ellipsoid with the same * equatorial radius as the WGS84 ellipsoid and different values of the * flattening.

 *     |f|      error
 *     0.01     25 nm
 *     0.02     30 nm
 *     0.05     10 um
 *     0.1     1.5 mm
 *     0.2     300 mm 
*

* The algorithms are described in *

*

* Example of use: *

 * {@code
 * // Solve the direct geodesic problem.
 *
 * // This program reads in lines with lat1, lon1, azi1, s12 and prints
 * // out lines with lat2, lon2, azi2 (for the WGS84 ellipsoid).
 *
 * import java.util.*;
 * import net.sf.geographiclib.*;
 * public class Direct {
 *   public static void main(String[] args) {
 *     try {
 *       Scanner in = new Scanner(System.in);
 *       double lat1, lon1, azi1, s12;
 *       while (true) {
 *         lat1 = in.nextDouble(); lon1 = in.nextDouble();
 *         azi1 = in.nextDouble(); s12 = in.nextDouble();
 *         GeodesicData g = Geodesic.WGS84.Direct(lat1, lon1, azi1, s12);
 *         System.out.println(g.lat2 + " " + g.lon2 + " " + g.azi2);
 *       }
 *     }
 *     catch (Exception e) {}
 *   }
 * }}
**********************************************************************/ public class Geodesic { /** * The order of the expansions used by Geodesic. **********************************************************************/ protected static final int GEOGRAPHICLIB_GEODESIC_ORDER = 6; protected static final int nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nA3x_ = nA3_; protected static final int nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC3x_ = (nC3_ * (nC3_ - 1)) / 2; protected static final int nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER; protected static final int nC4x_ = (nC4_ * (nC4_ + 1)) / 2; private static final int maxit1_ = 20; private static final int maxit2_ = maxit1_ + GeoMath.digits + 10; // Underflow guard. We require // tiny_ * epsilon() > 0 // tiny_ + epsilon() == epsilon() protected static final double tiny_ = Math.sqrt(Double.MIN_NORMAL); private static final double tol0_ = Math.ulp(1.0); // 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) private static final double tol1_ = 200 * tol0_; private static final double tol2_ = Math.sqrt(tol0_); // Check on bisection interval private static final double tolb_ = tol0_ * tol2_; private static final double xthresh_ = 1000 * tol2_; protected double _a, _f, _f1, _e2, _ep2, _b, _c2; private double _n, _etol2; private double _A3x[], _C3x[], _C4x[]; /** * Constructor for a ellipsoid with *

* @param a equatorial radius (meters). * @param f flattening of ellipsoid. Setting f = 0 gives a sphere. * Negative f gives a prolate ellipsoid. * @exception GeographicErr if a or (1 − f ) a is * not positive. **********************************************************************/ public Geodesic(double a, double f) { _a = a; _f = f; _f1 = 1 - _f; _e2 = _f * (2 - _f); _ep2 = _e2 / GeoMath.sq(_f1); // e2 / (1 - e2) _n = _f / ( 2 - _f); _b = _a * _f1; _c2 = (GeoMath.sq(_a) + GeoMath.sq(_b) * (_e2 == 0 ? 1 : (_e2 > 0 ? GeoMath.atanh(Math.sqrt(_e2)) : Math.atan(Math.sqrt(-_e2))) / Math.sqrt(Math.abs(_e2))))/2; // authalic radius squared // The sig12 threshold for "really short". Using the auxiliary sphere // solution with dnm computed at (bet1 + bet2) / 2, the relative error in // the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. // (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a // given f and sig12, the max error occurs for lines near the pole. If // the old rule for computing dnm = (dn1 + dn2)/2 is used, then the error // increases by a factor of 2.) Setting this equal to epsilon gives // sig12 = etol2. Here 0.1 is a safety factor (error decreased by 100) // and max(0.001, abs(f)) stops etol2 getting too large in the nearly // spherical case. _etol2 = 0.1 * tol2_ / Math.sqrt( Math.max(0.001, Math.abs(_f)) * Math.min(1.0, 1 - _f/2) / 2 ); if (!(GeoMath.isfinite(_a) && _a > 0)) throw new GeographicErr("Equatorial radius is not positive"); if (!(GeoMath.isfinite(_b) && _b > 0)) throw new GeographicErr("Polar semi-axis is not positive"); _A3x = new double[nA3x_]; _C3x = new double[nC3x_]; _C4x = new double[nC4x_]; A3coeff(); C3coeff(); C4coeff(); } /** * Solve the direct geodesic problem where the length of the geodesic * is specified in terms of distance. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param s12 distance between point 1 and point 2 (meters); it can be * negative. * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. *

* lat1 should be in the range [−90°, 90°]. 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, writing lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) **********************************************************************/ public GeodesicData Direct(double lat1, double lon1, double azi1, double s12) { return Direct(lat1, lon1, azi1, false, s12, GeodesicMask.STANDARD); } /** * Solve the direct geodesic problem where the length of the geodesic is * specified in terms of distance and with a subset of the geodesic results * returned. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param s12 distance between point 1 and point 2 (meters); it can be * negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the fields specified by * outmask computed. *

* lat1, lon1, azi1, s12, and a12 are * always included in the returned result. The value of lon2 returned * is in the range [−180°, 180°], unless the outmask * includes the {@link GeodesicMask#LONG_UNROLL} flag. **********************************************************************/ public GeodesicData Direct(double lat1, double lon1, double azi1, double s12, int outmask) { return Direct(lat1, lon1, azi1, false, s12, outmask); } /** * Solve the direct geodesic problem where the length of the geodesic * is specified in terms of arc length. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param a12 arc length between point 1 and point 2 (degrees); it can * be negative. * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. *

* lat1 should be in the range [−90°, 90°]. 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, writing lat = ±(90° − ε), * and taking the limit ε → 0+. An arc length greater that * 180° 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°.) **********************************************************************/ public GeodesicData ArcDirect(double lat1, double lon1, double azi1, double a12) { return Direct(lat1, lon1, azi1, true, a12, GeodesicMask.STANDARD); } /** * Solve the direct geodesic problem where the length of the geodesic is * specified in terms of arc length and with a subset of the geodesic results * returned. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param a12 arc length between point 1 and point 2 (degrees); it can * be negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the fields specified by * outmask computed. *

* lat1, lon1, azi1, and a12 are always included * in the returned result. The value of lon2 returned is in the range * [−180°, 180°], unless the outmask includes the {@link * GeodesicMask#LONG_UNROLL} flag. **********************************************************************/ public GeodesicData ArcDirect(double lat1, double lon1, double azi1, double a12, int outmask) { return Direct(lat1, lon1, azi1, true, a12, outmask); } /** * The general direct geodesic problem. {@link #Direct Direct} and * {@link #ArcDirect ArcDirect} are defined in terms of this function. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param arcmode boolean flag determining the meaning of the * s12_a12. * @param s12_a12 if 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 negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the fields specified by * outmask computed. *

* The {@link GeodesicMask} values possible for outmask are *

    *
  • * outmask |= {@link GeodesicMask#LATITUDE} for the latitude * lat2; *
  • * outmask |= {@link GeodesicMask#LONGITUDE} for the latitude * lon2; *
  • * outmask |= {@link GeodesicMask#AZIMUTH} for the latitude * azi2; *
  • * outmask |= {@link GeodesicMask#DISTANCE} for the distance * s12; *
  • * outmask |= {@link GeodesicMask#REDUCEDLENGTH} for the reduced * length m12; *
  • * outmask |= {@link GeodesicMask#GEODESICSCALE} for the geodesic * scales M12 and M21; *
  • * outmask |= {@link GeodesicMask#AREA} for the area S12; *
  • * outmask |= {@link GeodesicMask#ALL} for all of the above; *
  • * outmask |= {@link GeodesicMask#LONG_UNROLL}, if set then * lon1 is unchanged and lon2lon1 indicates * how many times and in what sense the geodesic encircles the ellipsoid. * Otherwise lon1 and lon2 are both reduced to the range * [−180°, 180°]. *
*

* The function value a12 is always computed and returned and this * equals s12_a12 is arcmode is true. If outmask * includes {@link GeodesicMask#DISTANCE} and arcmode is false, then * s12 = s12_a12. It is not necessary to include {@link * GeodesicMask#DISTANCE_IN} in outmask; this is automatically * included is arcmode is false. **********************************************************************/ public GeodesicData Direct(double lat1, double lon1, double azi1, boolean arcmode, double s12_a12, int outmask) { // Automatically supply DISTANCE_IN if necessary if (!arcmode) outmask |= GeodesicMask.DISTANCE_IN; return new GeodesicLine(this, lat1, lon1, azi1, outmask) . // Note the dot! Position(arcmode, s12_a12, outmask); } /** * Define a {@link GeodesicLine} in terms of the direct geodesic problem * specified in terms of distance with all capabilities included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param s12 distance between point 1 and point 2 (meters); it can be * negative. * @return a {@link GeodesicLine} object. *

* This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. *

* lat1 should be in the range [−90°, 90°]. **********************************************************************/ public GeodesicLine DirectLine(double lat1, double lon1, double azi1, double s12) { return DirectLine(lat1, lon1, azi1, s12, GeodesicMask.ALL); } /** * Define a {@link GeodesicLine} in terms of the direct geodesic problem * specified in terms of distance with a subset of the capabilities included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param s12 distance between point 1 and point 2 (meters); it can be * negative. * @param caps bitor'ed combination of {@link GeodesicMask} values * specifying the capabilities the GeodesicLine object should possess, * i.e., which quantities can be returned in calls to * {@link GeodesicLine#Position GeodesicLine.Position}. * @return a {@link GeodesicLine} object. *

* This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. *

* lat1 should be in the range [−90°, 90°]. **********************************************************************/ public GeodesicLine DirectLine(double lat1, double lon1, double azi1, double s12, int caps) { return GenDirectLine(lat1, lon1, azi1, false, s12, caps); } /** * Define a {@link GeodesicLine} in terms of the direct geodesic problem * specified in terms of arc length with all capabilities included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param a12 arc length between point 1 and point 2 (degrees); it can * be negative. * @return a {@link GeodesicLine} object. *

* This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. *

* lat1 should be in the range [−90°, 90°]. **********************************************************************/ public GeodesicLine ArcDirectLine(double lat1, double lon1, double azi1, double a12) { return ArcDirectLine(lat1, lon1, azi1, a12, GeodesicMask.ALL); } /** * Define a {@link GeodesicLine} in terms of the direct geodesic problem * specified in terms of arc length with a subset of the capabilities * included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param a12 arc length between point 1 and point 2 (degrees); it can * be negative. * @param caps bitor'ed combination of {@link GeodesicMask} values * specifying the capabilities the GeodesicLine object should possess, * i.e., which quantities can be returned in calls to * {@link GeodesicLine#Position GeodesicLine.Position}. * @return a {@link GeodesicLine} object. *

* This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. *

* lat1 should be in the range [−90°, 90°]. **********************************************************************/ public GeodesicLine ArcDirectLine(double lat1, double lon1, double azi1, double a12, int caps) { return GenDirectLine(lat1, lon1, azi1, true, a12, caps); } /** * Define a {@link GeodesicLine} in terms of the direct geodesic problem * specified in terms of either distance or arc length with a subset of the * capabilities included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param arcmode boolean flag determining the meaning of the s12_a12. * @param s12_a12 if 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 negative. * @param caps bitor'ed combination of {@link GeodesicMask} values * specifying the capabilities the GeodesicLine object should possess, * i.e., which quantities can be returned in calls to * {@link GeodesicLine#Position GeodesicLine.Position}. * @return a {@link GeodesicLine} object. *

* This function sets point 3 of the GeodesicLine to correspond to point 2 * of the direct geodesic problem. *

* lat1 should be in the range [−90°, 90°]. **********************************************************************/ public GeodesicLine GenDirectLine(double lat1, double lon1, double azi1, boolean arcmode, double s12_a12, int caps) { azi1 = GeoMath.AngNormalize(azi1); double salp1, calp1; // Guard against underflow in salp0. Also -0 is converted to +0. Pair p = new Pair(); GeoMath.sincosd(p, GeoMath.AngRound(azi1)); salp1 = p.first; calp1 = p.second; // Automatically supply DISTANCE_IN if necessary if (!arcmode) caps |= GeodesicMask.DISTANCE_IN; return new GeodesicLine(this, lat1, lon1, azi1, salp1, calp1, caps, arcmode, s12_a12); } /** * Solve the inverse geodesic problem. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param lat2 latitude of point 2 (degrees). * @param lon2 longitude of point 2 (degrees). * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. *

* lat1 and lat2 should be in the range [−90°, * 90°]. 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, writing lat = ±(90° − ε), * taking the limit ε → 0+. *

* The solution to the inverse problem is found using Newton's method. If * this fails to converge (this is very unlikely in geodetic applications * but does occur for very eccentric ellipsoids), then the bisection method * is used to refine the solution. **********************************************************************/ public GeodesicData Inverse(double lat1, double lon1, double lat2, double lon2) { return Inverse(lat1, lon1, lat2, lon2, GeodesicMask.STANDARD); } private class InverseData { private GeodesicData g; private double salp1, calp1, salp2, calp2; private InverseData() { g = new GeodesicData(); salp1 = calp1 = salp2 = calp2 = Double.NaN; } } private InverseData InverseInt(double lat1, double lon1, double lat2, double lon2, int outmask) { InverseData result = new InverseData(); Pair p = new Pair(); GeodesicData r = result.g; // Compute longitude difference (AngDiff does this carefully). Result is // in [-180, 180] but -180 is only for west-going geodesics. 180 is for // east-going and meridional geodesics. r.lat1 = lat1 = GeoMath.LatFix(lat1); r.lat2 = lat2 = GeoMath.LatFix(lat2); // If really close to the equator, treat as on equator. lat1 = GeoMath.AngRound(lat1); lat2 = GeoMath.AngRound(lat2); double lon12, lon12s; GeoMath.AngDiff(p, lon1, lon2); lon12 = p.first; lon12s = p.second; if ((outmask & GeodesicMask.LONG_UNROLL) != 0) { r.lon1 = lon1; r.lon2 = (lon1 + lon12) + lon12s; } else { r.lon1 = GeoMath.AngNormalize(lon1); r.lon2 = GeoMath.AngNormalize(lon2); } // Make longitude difference positive. int lonsign = lon12 >= 0 ? 1 : -1; // If very close to being on the same half-meridian, then make it so. lon12 = lonsign * GeoMath.AngRound(lon12); lon12s = GeoMath.AngRound((180 - lon12) - lonsign * lon12s); double lam12 = Math.toRadians(lon12), slam12, clam12; GeoMath.sincosd(p, lon12 > 90 ? lon12s : lon12); slam12 = p.first; clam12 = (lon12 > 90 ? -1 : 1) * p.second; // Swap points so that point with higher (abs) latitude is point 1 // If one latitude is a nan, then it becomes lat1. int swapp = Math.abs(lat1) < Math.abs(lat2) ? -1 : 1; if (swapp < 0) { lonsign *= -1; { double t = lat1; lat1 = lat2; lat2 = t; } } // 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. double sbet1, cbet1, sbet2, cbet2, s12x, m12x; s12x = m12x = Double.NaN; GeoMath.sincosd(p, lat1); sbet1 = _f1 * p.first; cbet1 = p.second; // Ensure cbet1 = +epsilon at poles; doing the fix on beta means that sig12 // will be <= 2*tiny for two points at the same pole. GeoMath.norm(p, sbet1, cbet1); sbet1 = p.first; cbet1 = p.second; cbet1 = Math.max(tiny_, cbet1); GeoMath.sincosd(p, lat2); sbet2 = _f1 * p.first; cbet2 = p.second; // Ensure cbet2 = +epsilon at poles GeoMath.norm(p, sbet2, cbet2); sbet2 = p.first; cbet2 = p.second; cbet2 = Math.max(tiny_, 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 (Math.abs(sbet2) == -sbet1) cbet2 = cbet1; } double dn1 = Math.sqrt(1 + _ep2 * GeoMath.sq(sbet1)), dn2 = Math.sqrt(1 + _ep2 * GeoMath.sq(sbet2)); double a12, sig12, calp1, salp1, calp2, salp2; a12 = sig12 = calp1 = salp1 = calp2 = salp2 = Double.NaN; // index zero elements of these arrays are unused double C1a[] = new double[nC1_ + 1]; double C2a[] = new double[nC2_ + 1]; double C3a[] = new double[nC3_]; boolean meridian = lat1 == -90 || slam12 == 0; LengthsV v = new LengthsV(); 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 double // tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1, csig1 = calp1 * cbet1, ssig2 = sbet2, csig2 = calp2 * cbet2; // sig12 = sig2 - sig1 sig12 = Math.atan2(Math.max(0.0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); Lengths(v, _n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | GeodesicMask.DISTANCE | GeodesicMask.REDUCEDLENGTH, C1a, C2a); s12x = v.s12b; m12x = v.m12b; if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { r.M12 = v.M12; r.M21 = v.M21; } // Add the check for sig12 since zero length geodesics might yield m12 < // 0. Test case was // // echo 20.001 0 20.001 0 | GeodSolve -i // // In fact, we will have sig12 > pi/2 for meridional geodesic which is // not a shortest path. if (sig12 < 1 || m12x >= 0) { // Need at least 2, to handle 90 0 90 180 if (sig12 < 3 * tiny_ || // Prevent negative s12 or m12 for short lines (sig12 < tol0_ && (s12x < 0 || m12x < 0))) sig12 = m12x = s12x = 0; m12x *= _b; s12x *= _b; a12 = Math.toDegrees(sig12); } else // m12 < 0, i.e., prolate and too close to anti-podal meridian = false; } double omg12 = Double.NaN, somg12 = 2, comg12 = Double.NaN; if (!meridian && sbet1 == 0 && // and sbet2 == 0 // Mimic the way Lambda12 works with calp1 = 0 (_f <= 0 || lon12s >= _f * 180)) { // Geodesic runs along equator calp1 = calp2 = 0; salp1 = salp2 = 1; s12x = _a * lam12; sig12 = omg12 = lam12 / _f1; m12x = _b * Math.sin(sig12); if ((outmask & GeodesicMask.GEODESICSCALE) != 0) r.M12 = r.M21 = Math.cos(sig12); a12 = lon12 / _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 double dnm; { InverseStartV s = InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a, p, v); sig12 = s.sig12; salp1 = s.salp1; calp1 = s.calp1; salp2 = s.salp2; calp2 = s.calp2; dnm = s.dnm; } if (sig12 >= 0) { // Short lines (InverseStart sets salp2, calp2, dnm) s12x = sig12 * _b * dnm; m12x = GeoMath.sq(dnm) * _b * Math.sin(sig12 / dnm); if ((outmask & GeodesicMask.GEODESICSCALE) != 0) r.M12 = r.M21 = Math.cos(sig12 / dnm); a12 = Math.toDegrees(sig12); omg12 = lam12 / (_f1 * dnm); } else { // Newton's method. This is a straightforward solution of f(alp1) = // lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one // root in the interval (0, pi) and its derivative is positive at the // root. Thus f(alp) is positive for alp > alp1 and negative for alp < // alp1. During the course of the iteration, a range (alp1a, alp1b) is // maintained which brackets the root and with each evaluation of // f(alp) the range is shrunk, if possible. Newton's method is // restarted whenever the derivative of f is negative (because the new // value of alp1 is then further from the solution) or if the new // estimate of alp1 lies outside (0,pi); in this case, the new starting // guess is taken to be (alp1a + alp1b) / 2. double ssig1, csig1, ssig2, csig2, eps, domg12; ssig1 = csig1 = ssig2 = csig2 = eps = domg12 = Double.NaN; int numit = 0; // Bracketing range double salp1a = tiny_, calp1a = 1, salp1b = tiny_, calp1b = -1; Lambda12V w = new Lambda12V(); for (boolean tripn = false, tripb = false; numit < maxit2_; ++numit) { // the WGS84 test set: mean = 1.47, sd = 1.25, max = 16 // WGS84 and random input: mean = 2.85, sd = 0.60 double V, dV; Lambda12(w, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, numit < maxit1_, C1a, C2a, C3a, p, v); V = w.lam12; salp2 = w.salp2; calp2 = w.calp2; sig12 = w.sig12; ssig1 = w.ssig1; csig1 = w.csig1; ssig2 = w.ssig2; csig2 = w.csig2; eps = w.eps; domg12 = w.domg12; dV = w.dlam12; // Reversed test to allow escape with NaNs if (tripb || !(Math.abs(V) >= (tripn ? 8 : 1) * tol0_)) break; // Update bracketing values if (V > 0 && (numit > maxit1_ || calp1/salp1 > calp1b/salp1b)) { salp1b = salp1; calp1b = calp1; } else if (V < 0 && (numit > maxit1_ || calp1/salp1 < calp1a/salp1a)) { salp1a = salp1; calp1a = calp1; } if (numit < maxit1_ && dV > 0) { double dalp1 = -V/dV; double sdalp1 = Math.sin(dalp1), cdalp1 = Math.cos(dalp1), nsalp1 = salp1 * cdalp1 + calp1 * sdalp1; if (nsalp1 > 0 && Math.abs(dalp1) < Math.PI) { calp1 = calp1 * cdalp1 - salp1 * sdalp1; salp1 = nsalp1; GeoMath.norm(p, salp1, calp1); salp1 = p.first; calp1 = p.second; // In some regimes we don't get quadratic convergence because // slope -> 0. So use convergence conditions based on epsilon // instead of sqrt(epsilon). tripn = Math.abs(V) <= 16 * tol0_; continue; } } // Either dV was not positive or updated value was outside legal // range. Use the midpoint of the bracket as the next estimate. // This mechanism is not needed for the WGS84 ellipsoid, but it does // catch problems with more eccentric ellipsoids. Its efficacy is // such for the WGS84 test set with the starting guess set to alp1 = // 90deg: // the WGS84 test set: mean = 5.21, sd = 3.93, max = 24 // WGS84 and random input: mean = 4.74, sd = 0.99 salp1 = (salp1a + salp1b)/2; calp1 = (calp1a + calp1b)/2; GeoMath.norm(p, salp1, calp1); salp1 = p.first; calp1 = p.second; tripn = false; tripb = (Math.abs(salp1a - salp1) + (calp1a - calp1) < tolb_ || Math.abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_); } { // Ensure that the reduced length and geodesic scale are computed in // a "canonical" way, with the I2 integral. int lengthmask = outmask | ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0 ? GeodesicMask.DISTANCE : GeodesicMask.NONE); Lengths(v, eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, lengthmask, C1a, C2a); s12x = v.s12b; m12x = v.m12b; if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { r.M12 = v.M12; r.M21 = v.M21; } } m12x *= _b; s12x *= _b; a12 = Math.toDegrees(sig12); if ((outmask & GeodesicMask.AREA) != 0) { // omg12 = lam12 - domg12 double sdomg12 = Math.sin(domg12), cdomg12 = Math.cos(domg12); somg12 = slam12 * cdomg12 - clam12 * sdomg12; comg12 = clam12 * cdomg12 + slam12 * sdomg12; } } } if ((outmask & GeodesicMask.DISTANCE) != 0) r.s12 = 0 + s12x; // Convert -0 to 0 if ((outmask & GeodesicMask.REDUCEDLENGTH) != 0) r.m12 = 0 + m12x; // Convert -0 to 0 if ((outmask & GeodesicMask.AREA) != 0) { double // From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1, calp0 = Math.hypot(calp1, salp1 * sbet1); // calp0 > 0 double alp12; if (calp0 != 0 && salp0 != 0) { double // From Lambda12: tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1, csig1 = calp1 * cbet1, ssig2 = sbet2, csig2 = calp2 * cbet2, k2 = GeoMath.sq(calp0) * _ep2, eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2), // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = GeoMath.sq(_a) * calp0 * salp0 * _e2; GeoMath.norm(p, ssig1, csig1); ssig1 = p.first; csig1 = p.second; GeoMath.norm(p, ssig2, csig2); ssig2 = p.first; csig2 = p.second; double C4a[] = new double[nC4_]; C4f(eps, C4a); double B41 = SinCosSeries(false, ssig1, csig1, C4a), B42 = SinCosSeries(false, ssig2, csig2, C4a); r.S12 = A4 * (B42 - B41); } else // Avoid problems with indeterminate sig1, sig2 on equator r.S12 = 0; if (!meridian && somg12 > 1) { somg12 = Math.sin(omg12); comg12 = Math.cos(omg12); } if (!meridian && comg12 > -0.7071 && // Long difference not too big sbet2 - sbet1 < 1.75) { // Lat difference not 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)) double domg12 = 1 + comg12, 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 double 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 = Math.atan2(salp12, calp12); } r.S12 += _c2 * alp12; r.S12 *= swapp * lonsign * latsign; // Convert -0 to 0 r.S12 += 0; } // Convert calp, salp to azimuth accounting for lonsign, swapp, latsign. if (swapp < 0) { { double t = salp1; salp1 = salp2; salp2 = t; } { double t = calp1; calp1 = calp2; calp2 = t; } if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { double t = r.M12; r.M12 = r.M21; r.M21 = t; } } salp1 *= swapp * lonsign; calp1 *= swapp * latsign; salp2 *= swapp * lonsign; calp2 *= swapp * latsign; // Returned value in [0, 180] r.a12 = a12; result.salp1 = salp1; result.calp1 = calp1; result.salp2 = salp2; result.calp2 = calp2; return result; } /** * Solve the inverse geodesic problem with a subset of the geodesic results * returned. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param lat2 latitude of point 2 (degrees). * @param lon2 longitude of point 2 (degrees). * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the fields specified by * outmask computed. *

* The {@link GeodesicMask} values possible for outmask are *

    *
  • * outmask |= {@link GeodesicMask#DISTANCE} for the distance * s12; *
  • * outmask |= {@link GeodesicMask#AZIMUTH} for the latitude * azi2; *
  • * outmask |= {@link GeodesicMask#REDUCEDLENGTH} for the reduced * length m12; *
  • * outmask |= {@link GeodesicMask#GEODESICSCALE} for the geodesic * scales M12 and M21; *
  • * outmask |= {@link GeodesicMask#AREA} for the area S12; *
  • * outmask |= {@link GeodesicMask#ALL} for all of the above. *
  • * outmask |= {@link GeodesicMask#LONG_UNROLL}, if set then * lon1 is unchanged and lon2lon1 indicates * whether the geodesic is east going or west going. Otherwise lon1 * and lon2 are both reduced to the range [−180°, * 180°]. *
*

* lat1, lon1, lat2, lon2, and a12 are * always included in the returned result. **********************************************************************/ public GeodesicData Inverse(double lat1, double lon1, double lat2, double lon2, int outmask) { outmask &= GeodesicMask.OUT_MASK; InverseData result = InverseInt(lat1, lon1, lat2, lon2, outmask); GeodesicData r = result.g; if ((outmask & GeodesicMask.AZIMUTH) != 0) { r.azi1 = GeoMath.atan2d(result.salp1, result.calp1); r.azi2 = GeoMath.atan2d(result.salp2, result.calp2); } return r; } /** * Define a {@link GeodesicLine} in terms of the inverse geodesic problem * with all capabilities included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param lat2 latitude of point 2 (degrees). * @param lon2 longitude of point 2 (degrees). * @return a {@link GeodesicLine} object. *

* This function sets point 3 of the GeodesicLine to correspond to point 2 * of the inverse geodesic problem. *

* lat1 and lat2 should be in the range [−90°, * 90°]. **********************************************************************/ public GeodesicLine InverseLine(double lat1, double lon1, double lat2, double lon2) { return InverseLine(lat1, lon1, lat2, lon2, GeodesicMask.ALL); } /** * Define a {@link GeodesicLine} in terms of the inverse geodesic problem * with a subset of the capabilities included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param lat2 latitude of point 2 (degrees). * @param lon2 longitude of point 2 (degrees). * @param caps bitor'ed combination of {@link GeodesicMask} values specifying * the capabilities the GeodesicLine object should possess, i.e., which * quantities can be returned in calls to * {@link GeodesicLine#Position GeodesicLine.Position}. * @return a {@link GeodesicLine} object. *

* This function sets point 3 of the GeodesicLine to correspond to point 2 * of the inverse geodesic problem. *

* lat1 and lat2 should be in the range [−90°, * 90°]. **********************************************************************/ public GeodesicLine InverseLine(double lat1, double lon1, double lat2, double lon2, int caps) { InverseData result = InverseInt(lat1, lon1, lat2, lon2, 0); double salp1 = result.salp1, calp1 = result.calp1, azi1 = GeoMath.atan2d(salp1, calp1), a12 = result.g.a12; // Ensure that a12 can be converted to a distance if ((caps & (GeodesicMask.OUT_MASK & GeodesicMask.DISTANCE_IN)) != 0) caps |= GeodesicMask.DISTANCE; return new GeodesicLine(this, lat1, lon1, azi1, salp1, calp1, caps, true, a12); } /** * Set up to compute several points on a single geodesic with all * capabilities included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @return a {@link GeodesicLine} object. *

* lat1 should be in the range [−90°, 90°]. The full * set of capabilities is included. *

* If the point is at a pole, the azimuth is defined by keeping the * lon1 fixed, writing lat1 = ±(90 − ε), * taking the limit ε → 0+. **********************************************************************/ public GeodesicLine Line(double lat1, double lon1, double azi1) { return Line(lat1, lon1, azi1, GeodesicMask.ALL); } /** * Set up to compute several points on a single geodesic with a subset of the * capabilities included. *

* @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param caps bitor'ed combination of {@link GeodesicMask} values specifying * the capabilities the {@link GeodesicLine} object should possess, i.e., * which quantities can be returned in calls to {@link * GeodesicLine#Position GeodesicLine.Position}. * @return a {@link GeodesicLine} object. *

* The {@link GeodesicMask} values are *

    *
  • * caps |= {@link GeodesicMask#LATITUDE} for the latitude * lat2; this is added automatically; *
  • * caps |= {@link GeodesicMask#LONGITUDE} for the latitude * lon2; *
  • * caps |= {@link GeodesicMask#AZIMUTH} for the azimuth azi2; * this is added automatically; *
  • * caps |= {@link GeodesicMask#DISTANCE} for the distance * s12; *
  • * caps |= {@link GeodesicMask#REDUCEDLENGTH} for the reduced length * m12; *
  • * caps |= {@link GeodesicMask#GEODESICSCALE} for the geodesic * scales M12 and M21; *
  • * caps |= {@link GeodesicMask#AREA} for the area S12; *
  • * caps |= {@link GeodesicMask#DISTANCE_IN} permits the length of * the geodesic to be given in terms of s12; without this capability * the length can only be specified in terms of arc length; *
  • * caps |= {@link GeodesicMask#ALL} for all of the above. *
*

* If the point is at a pole, the azimuth is defined by keeping lon1 * fixed, writing lat1 = ±(90 − ε), and taking * the limit ε → 0+. **********************************************************************/ public GeodesicLine Line(double lat1, double lon1, double azi1, int caps) { return new GeodesicLine(this, lat1, lon1, azi1, caps); } /** * @return a the equatorial radius of the ellipsoid (meters). This is * the value used in the constructor. **********************************************************************/ public double EquatorialRadius() { return _a; } /** * @return f the flattening of the ellipsoid. This is the * value used in the constructor. **********************************************************************/ public double Flattening() { return _f; } /** * @return total area of ellipsoid in meters2. The area of a * polygon encircling a pole can be found by adding EllipsoidArea()/2 to * the sum of S12 for each side of the polygon. **********************************************************************/ public double EllipsoidArea() { return 4 * Math.PI * _c2; } /** * @deprecated An old name for {@link #EquatorialRadius()}. * @return a the equatorial radius of the ellipsoid (meters). **********************************************************************/ @Deprecated public double MajorRadius() { return EquatorialRadius(); } /** * A global instantiation of Geodesic with the parameters for the WGS84 * ellipsoid. **********************************************************************/ public static final Geodesic WGS84 = new Geodesic(Constants.WGS84_a, Constants.WGS84_f); // 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 protected static double SinCosSeries(boolean sinp, double sinx, double cosx, double c[]) { // 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 int k = c.length, // Point to one beyond last element n = k - (sinp ? 1 : 0); double ar = 2 * (cosx - sinx) * (cosx + sinx), // 2 * cos(2 * x) y0 = (n & 1) != 0 ? c[--k] : 0, y1 = 0; // accumulators for sum // Now n is even n /= 2; while (n-- != 0) { // 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) } private class LengthsV { private double s12b, m12b, m0, M12, M21; private LengthsV() { s12b = m12b = m0 = M12 = M21 = Double.NaN; } } private void Lengths(LengthsV v, double eps, double sig12, double ssig1, double csig1, double dn1, double ssig2, double csig2, double dn2, double cbet1, double cbet2, int outmask, // Scratch areas of the right size double C1a[], double C2a[]) { // Return m12b = (reduced length)/_b; also calculate s12b = distance/_b, // and m0 = coefficient of secular term in expression for reduced length. outmask &= GeodesicMask.OUT_MASK; // v to hold compute s12b, m12b, m0, M12, M21; double m0x = 0, J12 = 0, A1 = 0, A2 = 0; if ((outmask & (GeodesicMask.DISTANCE | GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { A1 = A1m1f(eps); C1f(eps, C1a); if ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { A2 = A2m1f(eps); C2f(eps, C2a); m0x = A1 - A2; A2 = 1 + A2; } A1 = 1 + A1; } if ((outmask & GeodesicMask.DISTANCE) != 0) { double B1 = SinCosSeries(true, ssig2, csig2, C1a) - SinCosSeries(true, ssig1, csig1, C1a); // Missing a factor of _b v.s12b = A1 * (sig12 + B1); if ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { double B2 = SinCosSeries(true, ssig2, csig2, C2a) - SinCosSeries(true, ssig1, csig1, C2a); J12 = m0x * sig12 + (A1 * B1 - A2 * B2); } } else if ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { // Assume here that nC1_ >= nC2_ for (int l = 1; l <= nC2_; ++l) C2a[l] = A1 * C1a[l] - A2 * C2a[l]; J12 = m0x * sig12 + (SinCosSeries(true, ssig2, csig2, C2a) - SinCosSeries(true, ssig1, csig1, C2a)); } if ((outmask & GeodesicMask.REDUCEDLENGTH) != 0) { v.m0 = m0x; // Missing a factor of _b. // Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure // accurate cancellation in the case of coincident points. v.m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12; } if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { double csig12 = csig1 * csig2 + ssig1 * ssig2; double t = _ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2); v.M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1; v.M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2; } } private static double Astroid(double x, double 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. double k; double p = GeoMath.sq(x), q = GeoMath.sq(y), r = (p + q - 1) / 6; if ( !(q == 0 && r <= 0) ) { double // 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 = GeoMath.sq(r), r3 = r * r2, // The discriminant 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); double u = r; if (disc >= 0) { double 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 double root. cbrt(-8) = -2. double 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 double. double 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); } double v = Math.sqrt(GeoMath.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 + GeoMath.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; } private class InverseStartV { private double sig12, salp1, calp1, // Only updated if return val >= 0 salp2, calp2, // Only updated for short lines dnm; private InverseStartV() { sig12 = salp1 = calp1 = salp2 = calp2 = dnm = Double.NaN; } } private InverseStartV InverseStart(double sbet1, double cbet1, double dn1, double sbet2, double cbet2, double dn2, double lam12, double slam12, double clam12, // Scratch areas of the right size double C1a[], double C2a[], Pair p, LengthsV v) { // 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. // To hold sig12, salp1, calp1, salp2, calp2, dnm. InverseStartV w = new InverseStartV(); w.sig12 = -1; // Return value double // bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0] sbet12 = sbet2 * cbet1 - cbet2 * sbet1, cbet12 = cbet2 * cbet1 + sbet2 * sbet1; double sbet12a = sbet2 * cbet1 + cbet2 * sbet1; boolean shortline = cbet12 >= 0 && sbet12 < 0.5 && cbet2 * lam12 < 0.5; double somg12, comg12; if (shortline) { double sbetm2 = GeoMath.sq(sbet1 + sbet2); // sin((bet1+bet2)/2)^2 // = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) sbetm2 /= sbetm2 + GeoMath.sq(cbet1 + cbet2); w.dnm = Math.sqrt(1 + _ep2 * sbetm2); double omg12 = lam12 / (_f1 * w.dnm); somg12 = Math.sin(omg12); comg12 = Math.cos(omg12); } else { somg12 = slam12; comg12 = clam12; } w.salp1 = cbet2 * somg12; w.calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * GeoMath.sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * GeoMath.sq(somg12) / (1 - comg12); double ssig12 = Math.hypot(w.salp1, w.calp1), csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12; if (shortline && ssig12 < _etol2) { // really short lines w.salp2 = cbet1 * somg12; w.calp2 = sbet12 - cbet1 * sbet2 * (comg12 >= 0 ? GeoMath.sq(somg12) / (1 + comg12) : 1 - comg12); GeoMath.norm(p, w.salp2, w.calp2); w.salp2 = p.first; w.calp2 = p.second; // Set return value w.sig12 = Math.atan2(ssig12, csig12); } else if (Math.abs(_n) > 0.1 || // Skip astroid calc if too eccentric csig12 >= 0 || ssig12 >= 6 * Math.abs(_n) * Math.PI * GeoMath.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. double y, lamscale, betscale; // In C++ volatile declaration needed to fix inverse case // 56.320923501171 0 -56.320923501171 179.664747671772880215 // which otherwise fails with g++ 4.4.4 x86 -O3 double x; double lam12x = Math.atan2(-slam12, -clam12); // lam12 - pi if (_f >= 0) { // In fact f == 0 does not get here // x = dlong, y = dlat { double k2 = GeoMath.sq(sbet1) * _ep2, eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2); lamscale = _f * cbet1 * A3f(eps) * Math.PI; } betscale = lamscale * cbet1; x = lam12x / lamscale; y = sbet12a / betscale; } else { // _f < 0 // x = dlat, y = dlong double cbet12a = cbet2 * cbet1 - sbet2 * sbet1, bet12a = Math.atan2(sbet12a, cbet12a); double m12b, m0; // In the case of lon12 = 180, this repeats a calculation made in // Inverse. Lengths(v, _n, Math.PI + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, GeodesicMask.REDUCEDLENGTH, C1a, C2a); m12b = v.m12b; m0 = v.m0; x = -1 + m12b / (cbet1 * cbet2 * m0 * Math.PI); betscale = x < -0.01 ? sbet12a / x : -_f * GeoMath.sq(cbet1) * Math.PI; lamscale = betscale / cbet1; y = lam12x / lamscale; } if (y > -tol1_ && x > -1 - xthresh_) { // strip near cut if (_f >= 0) { w.salp1 = Math.min(1.0, -x); w.calp1 = - Math.sqrt(1 - GeoMath.sq(w.salp1)); } else { w.calp1 = Math.max(x > -tol1_ ? 0.0 : -1.0, x); w.salp1 = Math.sqrt(1 - GeoMath.sq(w.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 double k = Astroid(x, y); double omg12a = lamscale * ( _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 w.salp1 = cbet2 * somg12; w.calp1 = sbet12a - cbet2 * sbet1 * GeoMath.sq(somg12) / (1 - comg12); } } // Sanity check on starting guess. Backwards check allows NaN through. if (!(w.salp1 <= 0)) { GeoMath.norm(p, w.salp1, w.calp1); w.salp1 = p.first; w.calp1 = p.second; } else { w.salp1 = 1; w.calp1 = 0; } return w; } private class Lambda12V { private double lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, domg12, dlam12; private Lambda12V() { lam12 = salp2 = calp2 = sig12 = ssig1 = csig1 = ssig2 = csig2 = eps = domg12 = dlam12 = Double.NaN; } } private void Lambda12(Lambda12V w, double sbet1, double cbet1, double dn1, double sbet2, double cbet2, double dn2, double salp1, double calp1, double slam120, double clam120, boolean diffp, // Scratch areas of the right size double C1a[], double C2a[], double C3a[], Pair p, LengthsV v) { // Object to hold lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, // eps, domg12, dlam12; if (sbet1 == 0 && calp1 == 0) // Break degeneracy of equatorial line. This case has already been // handled. calp1 = -tiny_; double // sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1, calp0 = Math.hypot(calp1, salp1 * sbet1); // calp0 > 0 double somg1, comg1, somg2, comg2, somg12, comg12; // tan(bet1) = tan(sig1) * cos(alp1) // tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1) w.ssig1 = sbet1; somg1 = salp0 * sbet1; w.csig1 = comg1 = calp1 * cbet1; GeoMath.norm(p, w.ssig1, w.csig1); w.ssig1 = p.first; w.csig1 = p.second; // GeoMath.norm(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) w.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]). w.calp2 = cbet2 != cbet1 || Math.abs(sbet2) != -sbet1 ? Math.sqrt(GeoMath.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). w.ssig2 = sbet2; somg2 = salp0 * sbet2; w.csig2 = comg2 = w.calp2 * cbet2; GeoMath.norm(p, w.ssig2, w.csig2); w.ssig2 = p.first; w.csig2 = p.second; // GeoMath.norm(somg2, comg2); -- don't need to normalize! // sig12 = sig2 - sig1, limit to [0, pi] w.sig12 = Math.atan2(Math.max(0.0, w.csig1 * w.ssig2 - w.ssig1 * w.csig2), w.csig1 * w.csig2 + w.ssig1 * w.ssig2); // omg12 = omg2 - omg1, limit to [0, pi] somg12 = Math.max(0.0, comg1 * somg2 - somg1 * comg2); comg12 = comg1 * comg2 + somg1 * somg2; // eta = omg12 - lam120 double eta = Math.atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120); double B312; double k2 = GeoMath.sq(calp0) * _ep2; w.eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2); C3f(w.eps, C3a); B312 = (SinCosSeries(true, w.ssig2, w.csig2, C3a) - SinCosSeries(true, w.ssig1, w.csig1, C3a)); w.domg12 = -_f * A3f(w.eps) * salp0 * (w.sig12 + B312); w.lam12 = eta + w.domg12; if (diffp) { if (w.calp2 == 0) w.dlam12 = - 2 * _f1 * dn1 / sbet1; else { Lengths(v, w.eps, w.sig12, w.ssig1, w.csig1, dn1, w.ssig2, w.csig2, dn2, cbet1, cbet2, GeodesicMask.REDUCEDLENGTH, C1a, C2a); w.dlam12 = v.m12b; w.dlam12 *= _f1 / (w.calp2 * cbet2); } } } protected double A3f(double eps) { // Evaluate A3 return GeoMath.polyval(nA3_ - 1, _A3x, 0, eps); } protected void C3f(double eps, double c[]) { // Evaluate C3 coeffs // Elements c[1] thru c[nC3_ - 1] are set double mult = 1; int o = 0; for (int l = 1; l < nC3_; ++l) { // l is index of C3[l] int m = nC3_ - l - 1; // order of polynomial in eps mult *= eps; c[l] = mult * GeoMath.polyval(m, _C3x, o, eps); o += m + 1; } } protected void C4f(double eps, double c[]) { // Evaluate C4 coeffs // Elements c[0] thru c[nC4_ - 1] are set double mult = 1; int o = 0; for (int l = 0; l < nC4_; ++l) { // l is index of C4[l] int m = nC4_ - l - 1; // order of polynomial in eps c[l] = mult * GeoMath.polyval(m, _C4x, o, eps); o += m + 1; mult *= eps; } } // The scale factor A1-1 = mean value of (d/dsigma)I1 - 1 protected static double A1m1f(double eps) { final double coeff[] = { // (1-eps)*A1-1, polynomial in eps2 of order 3 1, 4, 64, 0, 256, }; int m = nA1_/2; double t = GeoMath.polyval(m, coeff, 0, GeoMath.sq(eps)) / coeff[m + 1]; return (t + eps) / (1 - eps); } // The coefficients C1[l] in the Fourier expansion of B1 protected static void C1f(double eps, double c[]) { final double coeff[] = { // C1[1]/eps^1, polynomial in eps2 of order 2 -1, 6, -16, 32, // C1[2]/eps^2, polynomial in eps2 of order 2 -9, 64, -128, 2048, // C1[3]/eps^3, polynomial in eps2 of order 1 9, -16, 768, // C1[4]/eps^4, polynomial in eps2 of order 1 3, -5, 512, // C1[5]/eps^5, polynomial in eps2 of order 0 -7, 1280, // C1[6]/eps^6, polynomial in eps2 of order 0 -7, 2048, }; double eps2 = GeoMath.sq(eps), d = eps; int o = 0; for (int l = 1; l <= nC1_; ++l) { // l is index of C1p[l] int m = (nC1_ - l) / 2; // order of polynomial in eps^2 c[l] = d * GeoMath.polyval(m, coeff, o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } // The coefficients C1p[l] in the Fourier expansion of B1p protected static void C1pf(double eps, double c[]) { final double coeff[] = { // C1p[1]/eps^1, polynomial in eps2 of order 2 205, -432, 768, 1536, // C1p[2]/eps^2, polynomial in eps2 of order 2 4005, -4736, 3840, 12288, // C1p[3]/eps^3, polynomial in eps2 of order 1 -225, 116, 384, // C1p[4]/eps^4, polynomial in eps2 of order 1 -7173, 2695, 7680, // C1p[5]/eps^5, polynomial in eps2 of order 0 3467, 7680, // C1p[6]/eps^6, polynomial in eps2 of order 0 38081, 61440, }; double eps2 = GeoMath.sq(eps), d = eps; int o = 0; for (int l = 1; l <= nC1p_; ++l) { // l is index of C1p[l] int m = (nC1p_ - l) / 2; // order of polynomial in eps^2 c[l] = d * GeoMath.polyval(m, coeff, o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } // The scale factor A2-1 = mean value of (d/dsigma)I2 - 1 protected static double A2m1f(double eps) { final double coeff[] = { // (eps+1)*A2-1, polynomial in eps2 of order 3 -11, -28, -192, 0, 256, }; int m = nA2_/2; double t = GeoMath.polyval(m, coeff, 0, GeoMath.sq(eps)) / coeff[m + 1]; return (t - eps) / (1 + eps); } // The coefficients C2[l] in the Fourier expansion of B2 protected static void C2f(double eps, double c[]) { final double coeff[] = { // C2[1]/eps^1, polynomial in eps2 of order 2 1, 2, 16, 32, // C2[2]/eps^2, polynomial in eps2 of order 2 35, 64, 384, 2048, // C2[3]/eps^3, polynomial in eps2 of order 1 15, 80, 768, // C2[4]/eps^4, polynomial in eps2 of order 1 7, 35, 512, // C2[5]/eps^5, polynomial in eps2 of order 0 63, 1280, // C2[6]/eps^6, polynomial in eps2 of order 0 77, 2048, }; double eps2 = GeoMath.sq(eps), d = eps; int o = 0; for (int l = 1; l <= nC2_; ++l) { // l is index of C2[l] int m = (nC2_ - l) / 2; // order of polynomial in eps^2 c[l] = d * GeoMath.polyval(m, coeff, o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } // The scale factor A3 = mean value of (d/dsigma)I3 protected void A3coeff() { final double coeff[] = { // A3, coeff of eps^5, polynomial in n of order 0 -3, 128, // A3, coeff of eps^4, polynomial in n of order 1 -2, -3, 64, // A3, coeff of eps^3, polynomial in n of order 2 -1, -3, -1, 16, // A3, coeff of eps^2, polynomial in n of order 2 3, -1, -2, 8, // A3, coeff of eps^1, polynomial in n of order 1 1, -1, 2, // A3, coeff of eps^0, polynomial in n of order 0 1, 1, }; int o = 0, k = 0; for (int j = nA3_ - 1; j >= 0; --j) { // coeff of eps^j int m = Math.min(nA3_ - j - 1, j); // order of polynomial in n _A3x[k++] = GeoMath.polyval(m, coeff, o, _n) / coeff[o + m + 1]; o += m + 2; } } // The coefficients C3[l] in the Fourier expansion of B3 protected void C3coeff() { final double coeff[] = { // C3[1], coeff of eps^5, polynomial in n of order 0 3, 128, // C3[1], coeff of eps^4, polynomial in n of order 1 2, 5, 128, // C3[1], coeff of eps^3, polynomial in n of order 2 -1, 3, 3, 64, // C3[1], coeff of eps^2, polynomial in n of order 2 -1, 0, 1, 8, // C3[1], coeff of eps^1, polynomial in n of order 1 -1, 1, 4, // C3[2], coeff of eps^5, polynomial in n of order 0 5, 256, // C3[2], coeff of eps^4, polynomial in n of order 1 1, 3, 128, // C3[2], coeff of eps^3, polynomial in n of order 2 -3, -2, 3, 64, // C3[2], coeff of eps^2, polynomial in n of order 2 1, -3, 2, 32, // C3[3], coeff of eps^5, polynomial in n of order 0 7, 512, // C3[3], coeff of eps^4, polynomial in n of order 1 -10, 9, 384, // C3[3], coeff of eps^3, polynomial in n of order 2 5, -9, 5, 192, // C3[4], coeff of eps^5, polynomial in n of order 0 7, 512, // C3[4], coeff of eps^4, polynomial in n of order 1 -14, 7, 512, // C3[5], coeff of eps^5, polynomial in n of order 0 21, 2560, }; int o = 0, k = 0; for (int l = 1; l < nC3_; ++l) { // l is index of C3[l] for (int j = nC3_ - 1; j >= l; --j) { // coeff of eps^j int m = Math.min(nC3_ - j - 1, j); // order of polynomial in n _C3x[k++] = GeoMath.polyval(m, coeff, o, _n) / coeff[o + m + 1]; o += m + 2; } } } protected void C4coeff() { final double coeff[] = { // C4[0], coeff of eps^5, polynomial in n of order 0 97, 15015, // C4[0], coeff of eps^4, polynomial in n of order 1 1088, 156, 45045, // C4[0], coeff of eps^3, polynomial in n of order 2 -224, -4784, 1573, 45045, // C4[0], coeff of eps^2, polynomial in n of order 3 -10656, 14144, -4576, -858, 45045, // C4[0], coeff of eps^1, polynomial in n of order 4 64, 624, -4576, 6864, -3003, 15015, // C4[0], coeff of eps^0, polynomial in n of order 5 100, 208, 572, 3432, -12012, 30030, 45045, // C4[1], coeff of eps^5, polynomial in n of order 0 1, 9009, // C4[1], coeff of eps^4, polynomial in n of order 1 -2944, 468, 135135, // C4[1], coeff of eps^3, polynomial in n of order 2 5792, 1040, -1287, 135135, // C4[1], coeff of eps^2, polynomial in n of order 3 5952, -11648, 9152, -2574, 135135, // C4[1], coeff of eps^1, polynomial in n of order 4 -64, -624, 4576, -6864, 3003, 135135, // C4[2], coeff of eps^5, polynomial in n of order 0 8, 10725, // C4[2], coeff of eps^4, polynomial in n of order 1 1856, -936, 225225, // C4[2], coeff of eps^3, polynomial in n of order 2 -8448, 4992, -1144, 225225, // C4[2], coeff of eps^2, polynomial in n of order 3 -1440, 4160, -4576, 1716, 225225, // C4[3], coeff of eps^5, polynomial in n of order 0 -136, 63063, // C4[3], coeff of eps^4, polynomial in n of order 1 1024, -208, 105105, // C4[3], coeff of eps^3, polynomial in n of order 2 3584, -3328, 1144, 315315, // C4[4], coeff of eps^5, polynomial in n of order 0 -128, 135135, // C4[4], coeff of eps^4, polynomial in n of order 1 -2560, 832, 405405, // C4[5], coeff of eps^5, polynomial in n of order 0 128, 99099, }; int o = 0, k = 0; for (int l = 0; l < nC4_; ++l) { // l is index of C4[l] for (int j = nC4_ - 1; j >= l; --j) { // coeff of eps^j int m = nC4_ - j - 1; // order of polynomial in n _C4x[k++] = GeoMath.polyval(m, coeff, o, _n) / coeff[o + m + 1]; o += m + 2; } } } } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/GeodesicData.java0000644000771000077100000000576114064202371026557 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeodesicData class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * The results of geodesic calculations. * * This is used to return the results for a geodesic between point 1 * (lat1, lon1) and point 2 (lat2, lon2). Fields * that have not been set will be filled with Double.NaN. The returned * GeodesicData objects always include the parameters provided to {@link * Geodesic#Direct(double, double, double, double) Geodesic.Direct} and {@link * Geodesic#Inverse(double, double, double, double) Geodesic.Inverse} and it * always includes the field a12. **********************************************************************/ public class GeodesicData { /** * latitude of point 1 (degrees). **********************************************************************/ public double lat1; /** * longitude of point 1 (degrees). **********************************************************************/ public double lon1; /** * azimuth at point 1 (degrees). **********************************************************************/ public double azi1; /** * latitude of point 2 (degrees). **********************************************************************/ public double lat2; /** * longitude of point 2 (degrees). **********************************************************************/ public double lon2; /** * azimuth at point 2 (degrees). **********************************************************************/ public double azi2; /** * distance between point 1 and point 2 (meters). **********************************************************************/ public double s12; /** * arc length on the auxiliary sphere between point 1 and point 2 * (degrees). **********************************************************************/ public double a12; /** * reduced length of geodesic (meters). **********************************************************************/ public double m12; /** * geodesic scale of point 2 relative to point 1 (dimensionless). **********************************************************************/ public double M12; /** * geodesic scale of point 1 relative to point 2 (dimensionless). **********************************************************************/ public double M21; /** * area under the geodesic (meters2). **********************************************************************/ public double S12; /** * Initialize all the fields to Double.NaN. **********************************************************************/ public GeodesicData() { lat1 = lon1 = azi1 = lat2 = lon2 = azi2 = s12 = a12 = m12 = M12 = M21 = S12 = Double.NaN; } } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/GeodesicLine.java0000644000771000077100000007654214064202371026602 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeodesicLine class * * Copyright (c) Charles Karney (2013-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * 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; alternatively, the {@link * Geodesic#Line Geodesic.Line} method can be used to create a GeodesicLine. * {@link #Position Position} returns the location of point 2 a distance * s12 along the geodesic. Alternatively {@link #ArcPosition * ArcPosition} gives the position of point 2 an arc length a12 along * the geodesic. *

* You can register the position of a reference point 3 a distance (arc * length), s13 (a13) along the geodesic with the * {@link #SetDistance SetDistance} ({@link #SetArc SetArc}) functions. Points * a fractional distance along the line can be found by providing, for example, * 0.5 * {@link #Distance} as an argument to {@link #Position Position}. The * {@link Geodesic#InverseLine Geodesic.InverseLine} or * {@link Geodesic#DirectLine Geodesic.DirectLine} methods return GeodesicLine * objects with point 3 set to the point 2 of the corresponding geodesic * problem. GeodesicLine objects created with the public constructor or with * {@link Geodesic#Line Geodesic.Line} have s13 and a13 set to * NaNs. *

* The calculations are accurate to better than 15 nm (15 nanometers). See * Sec. 9 of * arXiv:1102.1215v1 for * details. The algorithms used by this class are based on series expansions * using the flattening f as a small parameter. These are only accurate * for |f| < 0.02; however reasonably accurate results will be * obtained for |f| < 0.2. *

* The algorithms are described in *

*

* Here's an example of using this class *

 * {@code
 * import net.sf.geographiclib.*;
 * public class GeodesicLineTest {
 *   public static void main(String[] args) {
 *     // Print waypoints between JFK and SIN
 *     Geodesic geod = Geodesic.WGS84;
 *     double
 *       lat1 = 40.640, lon1 = -73.779, // JFK
 *       lat2 =  1.359, lon2 = 103.989; // SIN
 *     GeodesicLine line = geod.InverseLine(lat1, lon1, lat2, lon2,
 *                                          GeodesicMask.DISTANCE_IN |
 *                                          GeodesicMask.LATITUDE |
 *                                          GeodesicMask.LONGITUDE);
 *     double ds0 = 500e3;     // Nominal distance between points = 500 km
 *     // The number of intervals
 *     int num = (int)(Math.ceil(line.Distance() / ds0));
 *     {
 *       // Use intervals of equal length
 *       double ds = line.Distance() / num;
 *       for (int i = 0; i <= num; ++i) {
 *         GeodesicData g = line.Position(i * ds,
 *                                        GeodesicMask.LATITUDE |
 *                                        GeodesicMask.LONGITUDE);
 *         System.out.println(i + " " + g.lat2 + " " + g.lon2);
 *       }
 *     }
 *     {
 *       // Slightly faster, use intervals of equal arc length
 *       double da = line.Arc() / num;
 *       for (int i = 0; i <= num; ++i) {
 *         GeodesicData g = line.ArcPosition(i * da,
 *                                           GeodesicMask.LATITUDE |
 *                                           GeodesicMask.LONGITUDE);
 *         System.out.println(i + " " + g.lat2 + " " + g.lon2);
 *       }
 *     }
 *   }
 * }}
**********************************************************************/ public class GeodesicLine { private static final int nC1_ = Geodesic.nC1_; private static final int nC1p_ = Geodesic.nC1p_; private static final int nC2_ = Geodesic.nC2_; private static final int nC3_ = Geodesic.nC3_; private static final int nC4_ = Geodesic.nC4_; private double _lat1, _lon1, _azi1; private double _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2, _salp1, _calp1, _ssig1, _csig1, _dn1, _stau1, _ctau1, _somg1, _comg1, _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41; private double _a13, _s13; // index zero elements of _C1a, _C1pa, _C2a, _C3a are unused private double _C1a[], _C1pa[], _C2a[], _C3a[], _C4a[]; // all the elements of _C4a are used private int _caps; /** * Constructor for a geodesic line staring at latitude lat1, longitude * lon1, and azimuth azi1 (all in degrees). *

* @param g A {@link Geodesic} object used to compute the necessary * information about the GeodesicLine. * @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). *

* lat1 should be in the range [−90°, 90°]. *

* If the point is at a pole, the azimuth is defined by keeping lon1 * fixed, writing lat1 = ±(90° − ε), and * taking the limit ε → 0+. **********************************************************************/ public GeodesicLine(Geodesic g, double lat1, double lon1, double azi1) { this(g, lat1, lon1, azi1, GeodesicMask.ALL); } /** * Constructor for a geodesic line staring at latitude lat1, longitude * lon1, and azimuth azi1 (all in degrees) with a subset of the * capabilities included. *

* @param g A {@link Geodesic} object used to compute the necessary * information about the GeodesicLine. * @param lat1 latitude of point 1 (degrees). * @param lon1 longitude of point 1 (degrees). * @param azi1 azimuth at point 1 (degrees). * @param caps bitor'ed combination of {@link GeodesicMask} values * specifying the capabilities the GeodesicLine object should possess, * i.e., which quantities can be returned in calls to {@link #Position * Position}. *

* The {@link GeodesicMask} values are *

    *
  • * caps |= {@link GeodesicMask#LATITUDE} for the latitude * lat2; this is added automatically; *
  • * caps |= {@link GeodesicMask#LONGITUDE} for the latitude * lon2; *
  • * caps |= {@link GeodesicMask#AZIMUTH} for the latitude * azi2; this is added automatically; *
  • * caps |= {@link GeodesicMask#DISTANCE} for the distance * s12; *
  • * caps |= {@link GeodesicMask#REDUCEDLENGTH} for the reduced length * m12; *
  • * caps |= {@link GeodesicMask#GEODESICSCALE} for the geodesic * scales M12 and M21; *
  • * caps |= {@link GeodesicMask#AREA} for the area S12; *
  • * caps |= {@link GeodesicMask#DISTANCE_IN} permits the length of * the geodesic to be given in terms of s12; without this capability * the length can only be specified in terms of arc length; *
  • * caps |= {@link GeodesicMask#ALL} for all of the above. *
**********************************************************************/ public GeodesicLine(Geodesic g, double lat1, double lon1, double azi1, int caps) { azi1 = GeoMath.AngNormalize(azi1); double salp1, calp1; Pair p = new Pair(); // Guard against underflow in salp0 GeoMath.sincosd(p, GeoMath.AngRound(azi1)); salp1 = p.first; calp1 = p.second; LineInit(g, lat1, lon1, azi1, salp1, calp1, caps, p); } private void LineInit(Geodesic g, double lat1, double lon1, double azi1, double salp1, double calp1, int caps, Pair p) { _a = g._a; _f = g._f; _b = g._b; _c2 = g._c2; _f1 = g._f1; // Always allow latitude and azimuth and unrolling the longitude _caps = caps | GeodesicMask.LATITUDE | GeodesicMask.AZIMUTH | GeodesicMask.LONG_UNROLL; _lat1 = GeoMath.LatFix(lat1); _lon1 = lon1; _azi1 = azi1; _salp1 = salp1; _calp1 = calp1; double cbet1, sbet1; GeoMath.sincosd(p, GeoMath.AngRound(_lat1)); sbet1 = _f1 * p.first; cbet1 = p.second; // Ensure cbet1 = +epsilon at poles GeoMath.norm(p, sbet1, cbet1); sbet1 = p.first; cbet1 = Math.max(Geodesic.tiny_, p.second); _dn1 = Math.sqrt(1 + g._ep2 * GeoMath.sq(sbet1)); // Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), _salp0 = _salp1 * cbet1; // alp0 in [0, pi/2 - |bet1|] // Alt: calp0 = Math.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; GeoMath.norm(p, _ssig1, _csig1); _ssig1 = p.first; _csig1 = p.second; // sig1 in (-pi, pi] // GeoMath.norm(_somg1, _comg1); -- don't need to normalize! _k2 = GeoMath.sq(_calp0) * g._ep2; double eps = _k2 / (2 * (1 + Math.sqrt(1 + _k2)) + _k2); if ((_caps & GeodesicMask.CAP_C1) != 0) { _A1m1 = Geodesic.A1m1f(eps); _C1a = new double[nC1_ + 1]; Geodesic.C1f(eps, _C1a); _B11 = Geodesic.SinCosSeries(true, _ssig1, _csig1, _C1a); double s = Math.sin(_B11), c = Math.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 & GeodesicMask.CAP_C1p) != 0) { _C1pa = new double[nC1p_ + 1]; Geodesic.C1pf(eps, _C1pa); } if ((_caps & GeodesicMask.CAP_C2) != 0) { _C2a = new double[nC2_ + 1]; _A2m1 = Geodesic.A2m1f(eps); Geodesic.C2f(eps, _C2a); _B21 = Geodesic.SinCosSeries(true, _ssig1, _csig1, _C2a); } if ((_caps & GeodesicMask.CAP_C3) != 0) { _C3a = new double[nC3_]; g.C3f(eps, _C3a); _A3c = -_f * _salp0 * g.A3f(eps); _B31 = Geodesic.SinCosSeries(true, _ssig1, _csig1, _C3a); } if ((_caps & GeodesicMask.CAP_C4) != 0) { _C4a = new double[nC4_]; g.C4f(eps, _C4a); // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) _A4 = GeoMath.sq(_a) * _calp0 * _salp0 * g._e2; _B41 = Geodesic.SinCosSeries(false, _ssig1, _csig1, _C4a); } } protected GeodesicLine(Geodesic g, double lat1, double lon1, double azi1, double salp1, double calp1, int caps, boolean arcmode, double s13_a13) { Pair p = new Pair(); LineInit(g, lat1, lon1, azi1, salp1, calp1, caps, p); GenSetDistance(arcmode, s13_a13); } /** * 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 {@link Geodesic.Line}. Use {@link * Init()} to test whether object is still in this uninitialized state. * (This constructor was useful in C++, e.g., to allow vectors of * GeodesicLine objects. It may not be needed in Java, so make it private.) **********************************************************************/ private GeodesicLine() { _caps = 0; } /** * Compute the position of point 2 which is a distance s12 (meters) * from point 1. *

* @param s12 distance from point 1 to point 2 (meters); it can be * negative. * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. Some of these results may be * missing if the GeodesicLine did not include the relevant capability. *

* The values of lon2 and azi2 returned are in the range * [−180°, 180°]. *

* The GeodesicLine object must have been constructed with caps * |= {@link GeodesicMask#DISTANCE_IN}; otherwise no parameters are set. **********************************************************************/ public GeodesicData Position(double s12) { return Position(false, s12, GeodesicMask.STANDARD); } /** * Compute the position of point 2 which is a distance s12 (meters) * from point 1 and with a subset of the geodesic results returned. *

* @param s12 distance from point 1 to point 2 (meters); it can be * negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object including the requested results. *

* The GeodesicLine object must have been constructed with caps * |= {@link GeodesicMask#DISTANCE_IN}; otherwise no parameters are set. * Requesting a value which the GeodesicLine object is not capable of * computing is not an error (no parameters will be set). The value of * lon2 returned is normally in the range [−180°, 180°]; * however if the outmask includes the * {@link GeodesicMask#LONG_UNROLL} flag, the longitude is "unrolled" so that * the quantity lon2lon1 indicates how many times and * in what sense the geodesic encircles the ellipsoid. **********************************************************************/ public GeodesicData Position(double s12, int outmask) { return Position(false, s12, outmask); } /** * Compute the position of point 2 which is an arc length a12 * (degrees) from point 1. *

* @param a12 arc length from point 1 to point 2 (degrees); it can * be negative. * @return a {@link GeodesicData} object with the following fields: * lat1, lon1, azi1, lat2, lon2, * azi2, s12, a12. Some of these results may be * missing if the GeodesicLine did not include the relevant capability. *

* The values of lon2 and azi2 returned are in the range * [−180°, 180°]. *

* The GeodesicLine object must have been constructed with caps * |= {@link GeodesicMask#DISTANCE_IN}; otherwise no parameters are set. **********************************************************************/ public GeodesicData ArcPosition(double a12) { return Position(true, a12, GeodesicMask.STANDARD); } /** * Compute the position of point 2 which is an arc length a12 * (degrees) from point 1 and with a subset of the geodesic results returned. *

* @param a12 arc length from point 1 to point 2 (degrees); it can * be negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object giving lat1, lon2, * azi2, and a12. *

* Requesting a value which the GeodesicLine object is not capable of * computing is not an error (no parameters will be set). The value of * lon2 returned is in the range [−180°, 180°], unless * the outmask includes the {@link GeodesicMask#LONG_UNROLL} flag. **********************************************************************/ public GeodesicData ArcPosition(double a12, int outmask) { return Position(true, a12, outmask); } /** * The general position function. {@link #Position(double, int) Position} * and {@link #ArcPosition(double, int) ArcPosition} are defined in terms of * this function. *

* @param arcmode boolean flag determining the meaning of the second * parameter; if arcmode is false, then the GeodesicLine object must have * been constructed with caps |= {@link GeodesicMask#DISTANCE_IN}. * @param s12_a12 if 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 negative. * @param outmask a bitor'ed combination of {@link GeodesicMask} values * specifying which results should be returned. * @return a {@link GeodesicData} object with the requested results. *

* The {@link GeodesicMask} values possible for outmask are *

    *
  • * outmask |= {@link GeodesicMask#LATITUDE} for the latitude * lat2; *
  • * outmask |= {@link GeodesicMask#LONGITUDE} for the latitude * lon2; *
  • * outmask |= {@link GeodesicMask#AZIMUTH} for the latitude * azi2; *
  • * outmask |= {@link GeodesicMask#DISTANCE} for the distance * s12; *
  • * outmask |= {@link GeodesicMask#REDUCEDLENGTH} for the reduced * length m12; *
  • * outmask |= {@link GeodesicMask#GEODESICSCALE} for the geodesic * scales M12 and M21; *
  • * outmask |= {@link GeodesicMask#ALL} for all of the above; *
  • * outmask |= {@link GeodesicMask#LONG_UNROLL} to unroll lon2 * (instead of reducing it to the range [−180°, 180°]). *
*

* Requesting a value which the GeodesicLine object is not capable of * computing is not an error; Double.NaN is returned instead. **********************************************************************/ public GeodesicData Position(boolean arcmode, double s12_a12, int outmask) { outmask &= _caps & GeodesicMask.OUT_MASK; GeodesicData r = new GeodesicData(); if (!( Init() && (arcmode || (_caps & (GeodesicMask.OUT_MASK & GeodesicMask.DISTANCE_IN)) != 0) )) // Uninitialized or impossible distance calculation requested return r; r.lat1 = _lat1; r.azi1 = _azi1; r.lon1 = ((outmask & GeodesicMask.LONG_UNROLL) != 0) ? _lon1 : GeoMath.AngNormalize(_lon1); // Avoid warning about uninitialized B12. double sig12, ssig12, csig12, B12 = 0, AB1 = 0; if (arcmode) { // Interpret s12_a12 as spherical arc length r.a12 = s12_a12; sig12 = Math.toRadians(s12_a12); Pair p = new Pair(); GeoMath.sincosd(p, s12_a12); ssig12 = p.first; csig12 = p.second; } else { // Interpret s12_a12 as distance r.s12 = s12_a12; double tau12 = s12_a12 / (_b * (1 + _A1m1)), s = Math.sin(tau12), c = Math.cos(tau12); // tau2 = tau1 + tau12 B12 = - Geodesic.SinCosSeries(true, _stau1 * c + _ctau1 * s, _ctau1 * c - _stau1 * s, _C1pa); sig12 = tau12 - (B12 - _B11); ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12); if (Math.abs(_f) > 0.01) { // Reverted distance series is inaccurate for |f| > 1/100, so correct // sig12 with 1 Newton iteration. The following table shows the // approximate maximum error for a = WGS_a() and various f relative to // GeodesicExact. // erri = the error in the inverse solution (nm) // errd = the error in the direct solution (series only) (nm) // errda = the error in the direct solution // (series + 1 Newton) (nm) // // f erri errd errda // -1/5 12e6 1.2e9 69e6 // -1/10 123e3 12e6 765e3 // -1/20 1110 108e3 7155 // -1/50 18.63 200.9 27.12 // -1/100 18.63 23.78 23.37 // -1/150 18.63 21.05 20.26 // 1/150 22.35 24.73 25.83 // 1/100 22.35 25.03 25.31 // 1/50 29.80 231.9 30.44 // 1/20 5376 146e3 10e3 // 1/10 829e3 22e6 1.5e6 // 1/5 157e6 3.8e9 280e6 double ssig2 = _ssig1 * csig12 + _csig1 * ssig12, csig2 = _csig1 * csig12 - _ssig1 * ssig12; B12 = Geodesic.SinCosSeries(true, ssig2, csig2, _C1a); double serr = (1 + _A1m1) * (sig12 + (B12 - _B11)) - s12_a12 / _b; sig12 = sig12 - serr / Math.sqrt(1 + _k2 * GeoMath.sq(ssig2)); ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12); // Update B12 below } r.a12 = Math.toDegrees(sig12); } double ssig2, csig2, sbet2, cbet2, salp2, calp2; // sig2 = sig1 + sig12 ssig2 = _ssig1 * csig12 + _csig1 * ssig12; csig2 = _csig1 * csig12 - _ssig1 * ssig12; double dn2 = Math.sqrt(1 + _k2 * GeoMath.sq(ssig2)); if ((outmask & (GeodesicMask.DISTANCE | GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { if (arcmode || Math.abs(_f) > 0.01) B12 = Geodesic.SinCosSeries(true, ssig2, csig2, _C1a); AB1 = (1 + _A1m1) * (B12 - _B11); } // sin(bet2) = cos(alp0) * sin(sig2) sbet2 = _calp0 * ssig2; // Alt: cbet2 = Math.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(alp0) = cos(sig2)*tan(alp2) salp2 = _salp0; calp2 = _calp0 * csig2; // No need to normalize if ((outmask & GeodesicMask.DISTANCE) != 0 && arcmode) r.s12 = _b * ((1 + _A1m1) * sig12 + AB1); if ((outmask & GeodesicMask.LONGITUDE) != 0) { // tan(omg2) = sin(alp0) * tan(sig2) double somg2 = _salp0 * ssig2, comg2 = csig2, // No need to normalize E = Math.copySign(1, _salp0); // east or west going? // omg12 = omg2 - omg1 double omg12 = ((outmask & GeodesicMask.LONG_UNROLL) != 0) ? E * (sig12 - (Math.atan2( ssig2, csig2) - Math.atan2( _ssig1, _csig1)) + (Math.atan2(E*somg2, comg2) - Math.atan2(E*_somg1, _comg1))) : Math.atan2(somg2 * _comg1 - comg2 * _somg1, comg2 * _comg1 + somg2 * _somg1); double lam12 = omg12 + _A3c * ( sig12 + (Geodesic.SinCosSeries(true, ssig2, csig2, _C3a) - _B31)); double lon12 = Math.toDegrees(lam12); r.lon2 = ((outmask & GeodesicMask.LONG_UNROLL) != 0) ? _lon1 + lon12 : GeoMath.AngNormalize(r.lon1 + GeoMath.AngNormalize(lon12)); } if ((outmask & GeodesicMask.LATITUDE) != 0) r.lat2 = GeoMath.atan2d(sbet2, _f1 * cbet2); if ((outmask & GeodesicMask.AZIMUTH) != 0) r.azi2 = GeoMath.atan2d(salp2, calp2); if ((outmask & (GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE)) != 0) { double B22 = Geodesic.SinCosSeries(true, ssig2, csig2, _C2a), AB2 = (1 + _A2m1) * (B22 - _B21), J12 = (_A1m1 - _A2m1) * sig12 + (AB1 - AB2); if ((outmask & GeodesicMask.REDUCEDLENGTH) != 0) // Add parens around (_csig1 * ssig2) and (_ssig1 * csig2) to ensure // accurate cancellation in the case of coincident points. r.m12 = _b * ((dn2 * (_csig1 * ssig2) - _dn1 * (_ssig1 * csig2)) - _csig1 * csig2 * J12); if ((outmask & GeodesicMask.GEODESICSCALE) != 0) { double t = _k2 * (ssig2 - _ssig1) * (ssig2 + _ssig1) / (_dn1 + dn2); r.M12 = csig12 + (t * ssig2 - csig2 * J12) * _ssig1 / _dn1; r.M21 = csig12 - (t * _ssig1 - _csig1 * J12) * ssig2 / dn2; } } if ((outmask & GeodesicMask.AREA) != 0) { double B42 = Geodesic.SinCosSeries(false, ssig2, csig2, _C4a); double salp12, calp12; if (_calp0 == 0 || _salp0 == 0) { // alp12 = alp2 - alp1, used in atan2 so no need to normalize salp12 = salp2 * _calp1 - calp2 * _salp1; calp12 = calp2 * _calp1 + salp2 * _salp1; } 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 = GeoMath.sq(_salp0) + GeoMath.sq(_calp0) * _csig1 * csig2; } r.S12 = _c2 * Math.atan2(salp12, calp12) + _A4 * (B42 - _B41); } return r; } /** * Specify position of point 3 in terms of distance. * * @param s13 the distance from point 1 to point 3 (meters); it * can be negative. * * This is only useful if the GeodesicLine object has been constructed * with caps |= {@link GeodesicMask#DISTANCE_IN}. **********************************************************************/ public void SetDistance(double s13) { _s13 = s13; GeodesicData g = Position(false, _s13, 0); _a13 = g.a12; } /** * Specify position of point 3 in terms of arc length. * * @param a13 the arc length from point 1 to point 3 (degrees); it * can be negative. * * The distance s13 is only set if the GeodesicLine object has been * constructed with caps |= {@link GeodesicMask#DISTANCE}. **********************************************************************/ void SetArc(double a13) { _a13 = a13; GeodesicData g = Position(true, _a13, GeodesicMask.DISTANCE); _s13 = g.s12; } /** * Specify position of point 3 in terms of either distance or arc length. * * @param arcmode boolean flag determining the meaning of the second * parameter; if arcmode is false, then the GeodesicLine object must * have been constructed with caps |= * {@link GeodesicMask#DISTANCE_IN}. * @param s13_a13 if arcmode is false, this is the distance from * point 1 to point 3 (meters); otherwise it is the arc length from * point 1 to point 3 (degrees); it can be negative. **********************************************************************/ public void GenSetDistance(boolean arcmode, double s13_a13) { if (arcmode) SetArc(s13_a13); else SetDistance(s13_a13); } /** * @return true if the object has been initialized. **********************************************************************/ private boolean Init() { return _caps != 0; } /** * @return lat1 the latitude of point 1 (degrees). **********************************************************************/ public double Latitude() { return Init() ? _lat1 : Double.NaN; } /** * @return lon1 the longitude of point 1 (degrees). **********************************************************************/ public double Longitude() { return Init() ? _lon1 : Double.NaN; } /** * @return azi1 the azimuth (degrees) of the geodesic line at point 1. **********************************************************************/ public double Azimuth() { return Init() ? _azi1 : Double.NaN; } /** * @return pair of sine and cosine of azi1 the azimuth (degrees) of * the geodesic line at point 1. **********************************************************************/ public Pair AzimuthCosines() { return new Pair(Init() ? _salp1 : Double.NaN, Init() ? _calp1 : Double.NaN); } /** * @return azi0 the azimuth (degrees) of the geodesic line as it * crosses the equator in a northward direction. **********************************************************************/ public double EquatorialAzimuth() { return Init() ? GeoMath.atan2d(_salp0, _calp0) : Double.NaN; } /** * @return pair of sine and cosine of azi0 the azimuth of the geodesic * line as it crosses the equator in a northward direction. **********************************************************************/ public Pair EquatorialAzimuthCosines() { return new Pair(Init() ? _salp0 : Double.NaN, Init() ? _calp0 : Double.NaN); } /** * @return a1 the arc length (degrees) between the northward * equatorial crossing and point 1. **********************************************************************/ public double EquatorialArc() { return Init() ? GeoMath.atan2d(_ssig1, _csig1) : Double.NaN; } /** * @return a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ public double EquatorialRadius() { return Init() ? _a : Double.NaN; } /** * @return f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ public double Flattening() { return Init() ? _f : Double.NaN; } /** * @return caps the computational capabilities that this object was * constructed with. LATITUDE and AZIMUTH are always included. **********************************************************************/ public int Capabilities() { return _caps; } /** * @param testcaps a set of bitor'ed {@link GeodesicMask} values. * @return true if the GeodesicLine object has all these capabilities. **********************************************************************/ public boolean Capabilities(int testcaps) { testcaps &= GeodesicMask.OUT_ALL; return (_caps & testcaps) == testcaps; } /** * The distance or arc length to point 3. * * @param arcmode boolean flag determining the meaning of returned * value. * @return s13 if arcmode is false; a13 if * arcmode is true. **********************************************************************/ public double GenDistance(boolean arcmode) { return Init() ? (arcmode ? _a13 : _s13) : Double.NaN; } /** * @return s13, the distance to point 3 (meters). **********************************************************************/ public double Distance() { return GenDistance(false); } /** * @return a13, the arc length to point 3 (degrees). **********************************************************************/ public double Arc() { return GenDistance(true); } /** * @deprecated An old name for {@link #EquatorialRadius()}. * @return a the equatorial radius of the ellipsoid (meters). **********************************************************************/ @Deprecated public double MajorRadius() { return EquatorialRadius(); } } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/GeodesicMask.java0000644000771000077100000001023214064202371026566 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeodesicMask class * * Copyright (c) Charles Karney (2013-2014) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * Bit masks for what geodesic calculations to do. *

* These masks do double duty. They specify (via the outmask parameter) * which results to return in the {@link GeodesicData} object returned by the * general routines {@link Geodesic#Direct(double, double, double, double, int) * Geodesic.Direct} and {@link Geodesic#Inverse(double, double, double, double, * int) Geodesic.Inverse} routines. They also signify (via the caps * parameter) to the {@link GeodesicLine#GeodesicLine(Geodesic, double, double, * double, int) GeodesicLine.GeodesicLine} constructor and to {@link * Geodesic#Line(double, double, double, int) Geodesic.Line} what capabilities * should be included in the {@link GeodesicLine} object. **********************************************************************/ public class GeodesicMask { protected static final int CAP_NONE = 0; protected static final int CAP_C1 = 1<<0; protected static final int CAP_C1p = 1<<1; protected static final int CAP_C2 = 1<<2; protected static final int CAP_C3 = 1<<3; protected static final int CAP_C4 = 1<<4; protected static final int CAP_ALL = 0x1F; protected static final int CAP_MASK = CAP_ALL; protected static final int OUT_ALL = 0x7F80; protected static final int OUT_MASK = 0xFF80; // Include LONG_UNROLL /** * No capabilities, no output. **********************************************************************/ public static final int NONE = 0; /** * Calculate latitude lat2. (It's not necessary to include this as a * capability to {@link GeodesicLine} because this is included by default.) **********************************************************************/ public static final int LATITUDE = 1<<7 | CAP_NONE; /** * Calculate longitude lon2. **********************************************************************/ public static final int LONGITUDE = 1<<8 | CAP_C3; /** * Calculate azimuths azi1 and azi2. (It's not necessary to * include this as a capability to {@link GeodesicLine} because this is * included by default.) **********************************************************************/ public static final int AZIMUTH = 1<<9 | CAP_NONE; /** * Calculate distance s12. **********************************************************************/ public static final int DISTANCE = 1<<10 | CAP_C1; /** * All of the above, the "standard" output and capabilities. **********************************************************************/ public static final int STANDARD = LATITUDE | LONGITUDE | AZIMUTH | DISTANCE; /** * Allow distance s12 to be used as input in the direct * geodesic problem. **********************************************************************/ public static final int DISTANCE_IN = 1<<11 | CAP_C1 | CAP_C1p; /** * Calculate reduced length m12. **********************************************************************/ public static final int REDUCEDLENGTH = 1<<12 | CAP_C1 | CAP_C2; /** * Calculate geodesic scales M12 and M21. **********************************************************************/ public static final int GEODESICSCALE = 1<<13 | CAP_C1 | CAP_C2; /** * Calculate area S12. **********************************************************************/ public static final int AREA = 1<<14 | CAP_C4; /** * All capabilities, calculate everything. (LONG_UNROLL is not included in * this mask.) **********************************************************************/ public static final int ALL = OUT_ALL| CAP_ALL; /** * Unroll lon2. **********************************************************************/ public static final int LONG_UNROLL = 1<<15; } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/GeographicErr.java0000644000771000077100000000161214064202371026753 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GeographicErr class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * Exception handling for GeographicLib. *

* A class to handle exceptions. It's derived from RuntimeException so it * can be caught by the usual catch clauses. **********************************************************************/ public class GeographicErr extends RuntimeException { /** * Constructor *

* @param msg a string message, which is accessible in the catch * clause via getMessage(). **********************************************************************/ public GeographicErr(String msg) { super(msg); } } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/Gnomonic.java0000644000771000077100000002723714064202371026016 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Gnomonic class * * Copyright (c) BMW Car IT GmbH (2014-2019) * and Charles Karney (2020) ∑ and licensed and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * Gnomonic projection. *

* Note: Gnomonic.java has been ported to Java from its C++ equivalent * Gnomonic.cpp, authored by C. F. F. Karney and licensed under MIT/X11 * license. The following documentation is mostly the same as for its C++ * equivalent, but has been adopted to apply to this Java implementation. *

* Gnomonic projection centered at an arbitrary position C on the * ellipsoid. This projection is derived in Section 8 of *

*

* The gnomonic projection of a point P on the ellipsoid is defined as * follows: compute the geodesic line from C to P; compute the * reduced length m12, geodesic scale M12, and ρ = * m12/M12; finally, this gives the coordinates x and * y of P in gnomonic projection with x = ρ sin * azi1; y = ρ cos azi1, where azi1 is the * azimuth of the geodesic at C. The method * {@link Gnomonic#Forward(double, double, double, double)} performs the * forward projection and * {@link Gnomonic#Reverse(double, double, double, double)} is the * inverse of the projection. The 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 is 1/rk2. *

* For a sphere, ρ 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 45°, when endpoints are a distance r away, and * when their azimuths from the center are ± 45° or ± * 135°. To lowest order in r and the flattening f, the * deviation is f (r/2a)3 r. *

* 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 Gnomonic.java class
 * import net.sf.geographiclib.Geodesic;
 * import net.sf.geographiclib.Gnomonic;
 * import net.sf.geographiclib.GnomonicData;
 * public class ExampleGnomonic {
 *   public static void main(String[] args) {
 *     Geodesic geod = Geodesic.WGS84;
 *     double lat0 = 48 + 50 / 60.0, lon0 = 2 + 20 / 60.0; // Paris
 *     Gnomonic gnom = new Gnomonic(geod);
 *     {
 *       // Sample forward calculation
 *       double lat = 50.9, lon = 1.8; // Calais
 *       GnomonicData proj = gnom.Forward(lat0, lon0, lat, lon);
 *       System.out.println(proj.x + " " + proj.y);
 *     }
 *     {
 *       // Sample reverse calculation
 *       double x = -38e3, y = 230e3;
 *       GnomonicData proj = gnom.Reverse(lat0, lon0, x, y);
 *       System.out.println(proj.lat + " " + proj.lon);
 *     }
 *   }
 * }
 * 
*/ public class Gnomonic { private static final double eps_ = 0.01 * Math.sqrt(Math.ulp(1.0)); private static final int numit_ = 10; private Geodesic _earth; private double _a, _f; /** * Constructor for Gnomonic. *

* @param earth the {@link Geodesic} object to use for geodesic * calculations. */ public Gnomonic(Geodesic earth) { _earth = earth; _a = _earth.EquatorialRadius(); _f = _earth.Flattening(); } /** * Forward projection, from geographic to gnomonic. *

* @param lat0 latitude of center point of projection (degrees). * @param lon0 longitude of center point of projection (degrees). * @param lat latitude of point (degrees). * @param lon longitude of point (degrees). * @return {@link GnomonicData} object with the following fields: * lat0, lon0, lat, lon, x, y, * azi, rk. *

* lat0 and lat should be in the range [−90°, * 90°] and lon0 and lon should be in the range * [−540°, 540°). 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. */ public GnomonicData Forward(double lat0, double lon0, double lat, double lon) { GeodesicData inv = _earth.Inverse(lat0, lon0, lat, lon, GeodesicMask.AZIMUTH | GeodesicMask.GEODESICSCALE | GeodesicMask.REDUCEDLENGTH); GnomonicData fwd = new GnomonicData(lat0, lon0, lat, lon, Double.NaN, Double.NaN, inv.azi2, inv.M12); if (inv.M12 > 0) { double rho = inv.m12 / inv.M12; Pair p = new Pair(); GeoMath.sincosd(p, inv.azi1); fwd.x = rho * p.first; fwd.y = rho * p.second; } return fwd; } /** * Reverse projection, from gnomonic to geographic. *

* @param lat0 latitude of center point of projection (degrees). * @param lon0 longitude of center point of projection (degrees). * @param x easting of point (meters). * @param y northing of point (meters). * @return {@link GnomonicData} object with the following fields: * lat0, lon0, lat, lon, x, y, * azi, rk. *

* lat0 should be in the range [−90°, 90°] and * lon0 should be in the range [−540°, 540°). * 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). */ public GnomonicData Reverse(double lat0, double lon0, double x, double y) { GnomonicData rev = new GnomonicData(lat0, lon0, Double.NaN, Double.NaN, x, y, Double.NaN, Double.NaN); double azi0 = GeoMath.atan2d(x, y); double rho = Math.hypot(x, y); double s = _a * Math.atan(rho / _a); boolean little = rho <= _a; if (!little) rho = 1 / rho; GeodesicLine line = _earth.Line(lat0, lon0, azi0, GeodesicMask.LATITUDE | GeodesicMask.LONGITUDE | GeodesicMask.AZIMUTH | GeodesicMask.DISTANCE_IN | GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE); int count = numit_, trip = 0; GeodesicData pos = null; while (count-- > 0) { pos = line.Position(s, GeodesicMask.LONGITUDE | GeodesicMask.LATITUDE | GeodesicMask.AZIMUTH | GeodesicMask.DISTANCE_IN | GeodesicMask.REDUCEDLENGTH | GeodesicMask.GEODESICSCALE); if (trip > 0) break; double ds = little ? ((pos.m12 / pos.M12) - rho) * pos.M12 * pos.M12 : (rho - (pos.M12 / pos.m12)) * pos.m12 * pos.m12; s -= ds; if (Math.abs(ds) <= eps_ * _a) trip++; } if (trip == 0) return rev; rev.lat = pos.lat2; rev.lon = pos.lon2; rev.azi = pos.azi2; rev.rk = pos.M12; return rev; } /** * @return a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ public double EquatorialRadius() { return _a; } /** * @return f the flattening of the ellipsoid. This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ public double Flattening() { return _f; } /** * @deprecated An old name for {@link #EquatorialRadius()}. * @return a the equatorial radius of the ellipsoid (meters). **********************************************************************/ @Deprecated public double MajorRadius() { return EquatorialRadius(); } } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/GnomonicData.java0000644000771000077100000000640314064202371026600 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.GnomonicData class * * Copyright (c) BMW Car IT GmbH (2014-2016) * and licensed under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * The results of gnomonic projection. *

* This is used to return the results for a gnomonic projection of a point * (lat, lon) given a center point of projection (lat0, * lon0). The returned GnomonicData objects always include the * parameters provided to * {@link Gnomonic#Forward Gnomonic.Forward} * and * {@link Gnomonic#Reverse Gnomonic.Reverse} * and it always includes the fields x, y, azi. and * rk. **********************************************************************/ public class GnomonicData { /** * latitude of center point of projection (degrees). **********************************************************************/ public double lat0; /** * longitude of center point of projection (degrees). **********************************************************************/ public double lon0; /** * latitude of point (degrees). **********************************************************************/ public double lat; /** * longitude of point (degrees). **********************************************************************/ public double lon; /** * easting of point (meters). **********************************************************************/ public double x; /** * northing of point (meters). **********************************************************************/ public double y; /** * azimuth of geodesic at point (degrees). **********************************************************************/ public double azi; /** * reciprocal of azimuthal scale at point. **********************************************************************/ public double rk; /** * Initialize all the fields to Double.NaN. **********************************************************************/ public GnomonicData() { lat0 = lon0 = lat = lon = x = y = azi = rk = Double.NaN; } /** * Constructor initializing all the fields for gnomonic projection of a point * (lat, lon) given a center point of projection (lat0, * lon0). *

* @param lat0 * latitude of center point of projection (degrees). * @param lon0 * longitude of center point of projection (degrees). * @param lat * latitude of point (degrees). * @param lon * longitude of point (degrees). * @param x * easting of point (meters). * @param y * northing of point (meters). * @param azi * azimuth of geodesic at point (degrees). * @param rk * reciprocal of azimuthal scale at point. */ public GnomonicData(double lat0, double lon0, double lat, double lon, double x, double y, double azi, double rk) { this.lat0 = lat0; this.lon0 = lon0; this.lat = lat; this.lon = lon; this.x = x; this.y = y; this.azi = azi; this.rk = rk; } } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/Pair.java0000644000771000077100000000236114064202371025127 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.Pair class * * Copyright (c) Charles Karney (2013-2020) ∑ and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * A pair of double precision numbers. *

* This duplicates the C++ class {@code std::pair}. **********************************************************************/ public class Pair { /** * The first member of the pair. **********************************************************************/ public double first; /** * The second member of the pair. **********************************************************************/ public double second; /** * Constructor *

* @param first the first member of the pair. * @param second the second member of the pair. **********************************************************************/ public Pair(double first, double second) { this.first = first; this.second = second; } /** * No-argument Constructor **********************************************************************/ public Pair() {} } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/PolygonArea.java0000644000771000077100000003763514064202371026470 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.PolygonArea class * * Copyright (c) Charles Karney (2013-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * Polygon areas. *

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

*

* Arbitrarily complex polygons are allowed. In the case self-intersecting of * polygons the area is accumulated "algebraically", e.g., the areas of the 2 * loops in a figure-8 polygon will partially cancel. *

* This class lets you add vertices one at a time to the polygon. The area * and perimeter are accumulated at 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: *

 * {@code
 * // Compute the area of a geodesic polygon.
 *
 * // This program reads lines with lat, lon for each vertex of a polygon.
 * // At the end of input, the program prints the number of vertices,
 * // the perimeter of the polygon and its area (for the WGS84 ellipsoid).
 *
 * import java.util.*;
 * import net.sf.geographiclib.*;
 *
 * public class Planimeter {
 *   public static void main(String[] args) {
 *     PolygonArea p = new PolygonArea(Geodesic.WGS84, false);
 *     try {
 *       Scanner in = new Scanner(System.in);
 *       while (true) {
 *         double lat = in.nextDouble(), lon = in.nextDouble();
 *         p.AddPoint(lat, lon);
 *       }
 *     }
 *     catch (Exception e) {}
 *     PolygonResult r = p.Compute();
 *     System.out.println(r.num + " " + r.perimeter + " " + r.area);
 *   }
 * }}
**********************************************************************/ public class PolygonArea { private Geodesic _earth; private double _area0; // Full ellipsoid area private boolean _polyline; // Assume polyline (don't close and skip area) private int _mask; private int _num; private int _crossings; private Accumulator _areasum, _perimetersum; private double _lat0, _lon0, _lat1, _lon1; private static int transit(double lon1, double lon2) { // Return 1 or -1 if crossing prime meridian in east or west direction. // Otherwise return zero. // Compute lon12 the same way as Geodesic.Inverse. lon1 = GeoMath.AngNormalize(lon1); lon2 = GeoMath.AngNormalize(lon2); Pair p = new Pair(); GeoMath.AngDiff(p, lon1, lon2); double lon12 = p.first; int cross = lon1 <= 0 && lon2 > 0 && lon12 > 0 ? 1 : (lon2 <= 0 && lon1 > 0 && lon12 < 0 ? -1 : 0); return cross; } // an alternate version of transit to deal with longitudes in the direct // problem. private static int transitdirect(double lon1, double lon2) { // We want to compute exactly // int(ceil(lon2 / 360)) - int(ceil(lon1 / 360)) // Since we only need the parity of the result we can use std::remquo but // this is buggy with g++ 4.8.3 and requires C++11. So instead we do lon1 = lon1 % 720.0; lon2 = lon2 % 720.0; return ( ((lon2 <= 0 && lon2 > -360) || lon2 > 360 ? 1 : 0) - ((lon1 <= 0 && lon1 > -360) || lon1 > 360 ? 1 : 0) ); } // reduce Accumulator area to allowed range private static double AreaReduceA(Accumulator area, double area0, int crossings, boolean reverse, boolean sign) { area.Remainder(area0); if ((crossings & 1) != 0) area.Add((area.Sum() < 0 ? 1 : -1) * area0/2); // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) area.Negate(); // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (area.Sum() > area0/2) area.Add(-area0); else if (area.Sum() <= -area0/2) area.Add(+area0); } else { if (area.Sum() >= area0) area.Add(-area0); else if (area.Sum() < 0) area.Add(+area0); } return 0 + area.Sum(); } // reduce double area to allowed range private static double AreaReduceB(double area, double area0, int crossings, boolean reverse, boolean sign) { area = GeoMath.remainder(area, area0); if ((crossings & 1) != 0) area += (area < 0 ? 1 : -1) * area0/2; // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) area *= -1; // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (area > area0/2) area -= area0; else if (area <= -area0/2) area += area0; } else { if (area >= area0) area -= area0; else if (area < 0) area += area0; } return 0 + area; } /** * Constructor for PolygonArea. *

* @param earth the Geodesic object to use for geodesic calculations. * @param polyline if true that treat the points as defining a polyline * instead of a polygon. **********************************************************************/ public PolygonArea(Geodesic earth, boolean polyline) { _earth = earth; _area0 = _earth.EllipsoidArea(); _polyline = polyline; _mask = GeodesicMask.LATITUDE | GeodesicMask.LONGITUDE | GeodesicMask.DISTANCE | (_polyline ? GeodesicMask.NONE : GeodesicMask.AREA | GeodesicMask.LONG_UNROLL); _perimetersum = new Accumulator(0); if (!_polyline) _areasum = new Accumulator(0); Clear(); } /** * Clear PolygonArea, allowing a new polygon to be started. **********************************************************************/ public void Clear() { _num = 0; _crossings = 0; _perimetersum.Set(0); if (!_polyline) _areasum.Set(0); _lat0 = _lon0 = _lat1 = _lon1 = Double.NaN; } /** * Add a point to the polygon or polyline. *

* @param lat the latitude of the point (degrees). * @param lon the latitude of the point (degrees). *

* lat should be in the range [−90°, 90°]. **********************************************************************/ public void AddPoint(double lat, double lon) { lon = GeoMath.AngNormalize(lon); if (_num == 0) { _lat0 = _lat1 = lat; _lon0 = _lon1 = lon; } else { GeodesicData g = _earth.Inverse(_lat1, _lon1, lat, lon, _mask); _perimetersum.Add(g.s12); if (!_polyline) { _areasum.Add(g.S12); _crossings += transit(_lon1, lon); } _lat1 = lat; _lon1 = lon; } ++_num; } /** * Add an edge to the polygon or polyline. *

* @param azi azimuth at current point (degrees). * @param s distance from current point to next point (meters). *

* This does nothing if no points have been added yet. Use * PolygonArea.CurrentPoint to determine the position of the new vertex. **********************************************************************/ public void AddEdge(double azi, double s) { if (_num > 0) { // Do nothing if _num is zero GeodesicData g = _earth.Direct(_lat1, _lon1, azi, s, _mask); _perimetersum.Add(g.s12); if (!_polyline) { _areasum.Add(g.S12); _crossings += transitdirect(_lon1, g.lon2); } _lat1 = g.lat2; _lon1 = g.lon2; ++_num; } } /** * Return the results so far. *

* @return PolygonResult(num, perimeter, area) where * num is the number of vertices, perimeter is the perimeter * of the polygon or the length of the polyline (meters), and area * is the area of the polygon (meters2) or Double.NaN of * polyline is true in the constructor. *

* Counter-clockwise traversal counts as a positive area. **********************************************************************/ public PolygonResult Compute() { return Compute(false, true); } /** * Return the results so far. *

* @param reverse if true then clockwise (instead of counter-clockwise) * traversal counts as a positive area. * @param 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. * @return PolygonResult(num, perimeter, area) where * num is the number of vertices, perimeter is the perimeter * of the polygon or the length of the polyline (meters), and area * is the area of the polygon (meters2) or Double.NaN of * polyline is true in the constructor. *

* More points can be added to the polygon after this call. **********************************************************************/ public PolygonResult Compute(boolean reverse, boolean sign) { if (_num < 2) return new PolygonResult(_num, 0, _polyline ? Double.NaN : 0); if (_polyline) return new PolygonResult(_num, _perimetersum.Sum(), Double.NaN); GeodesicData g = _earth.Inverse(_lat1, _lon1, _lat0, _lon0, _mask); Accumulator tempsum = new Accumulator(_areasum); tempsum.Add(g.S12); return new PolygonResult(_num, _perimetersum.Sum(g.s12), AreaReduceA(tempsum, _area0, _crossings + transit(_lon1, _lon0), reverse, sign)); } /** * 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 lat the latitude of the test point (degrees). * @param lon the longitude of the test point (degrees). * @param reverse if true then clockwise (instead of counter-clockwise) * traversal counts as a positive area. * @param 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. * @return PolygonResult(num, perimeter, area) where * num is the number of vertices, perimeter is the perimeter * of the polygon or the length of the polyline (meters), and area * is the area of the polygon (meters2) or Double.NaN of * polyline is true in the constructor. *

* lat should be in the range [−90°, 90°]. **********************************************************************/ public PolygonResult TestPoint(double lat, double lon, boolean reverse, boolean sign) { if (_num == 0) return new PolygonResult(1, 0, _polyline ? Double.NaN : 0); double perimeter = _perimetersum.Sum(); double tempsum = _polyline ? 0 : _areasum.Sum(); int crossings = _crossings; int num = _num + 1; for (int i = 0; i < (_polyline ? 1 : 2); ++i) { GeodesicData g = _earth.Inverse(i == 0 ? _lat1 : lat, i == 0 ? _lon1 : lon, i != 0 ? _lat0 : lat, i != 0 ? _lon0 : lon, _mask); perimeter += g.s12; if (!_polyline) { tempsum += g.S12; crossings += transit(i == 0 ? _lon1 : lon, i != 0 ? _lon0 : lon); } } if (_polyline) return new PolygonResult(num, perimeter, Double.NaN); return new PolygonResult(num, perimeter, AreaReduceB(tempsum, _area0, crossings, reverse, sign)); } /** * Return the results assuming a tentative final test point is added via an * azimuth and distance; 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 azi azimuth at current point (degrees). * @param s distance from current point to final test point (meters). * @param reverse if true then clockwise (instead of counter-clockwise) * traversal counts as a positive area. * @param 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. * @return PolygonResult(num, perimeter, area) where * num is the number of vertices, perimeter is the perimeter * of the polygon or the length of the polyline (meters), and area * is the area of the polygon (meters2) or Double.NaN of * polyline is true in the constructor. **********************************************************************/ public PolygonResult TestEdge(double azi, double s, boolean reverse, boolean sign) { if (_num == 0) // we don't have a starting point! return new PolygonResult(0, Double.NaN, Double.NaN); int num = _num + 1; double perimeter = _perimetersum.Sum() + s; if (_polyline) return new PolygonResult(num, perimeter, Double.NaN); double tempsum = _areasum.Sum(); int crossings = _crossings; { double lat, lon, s12, S12, t; GeodesicData g = _earth.Direct(_lat1, _lon1, azi, false, s, _mask); tempsum += g.S12; crossings += transitdirect(_lon1, g.lon2); crossings += transit(g.lon2, _lon0); g = _earth.Inverse(g.lat2, g.lon2, _lat0, _lon0, _mask); perimeter += g.s12; tempsum += g.S12; } return new PolygonResult(num, perimeter, AreaReduceB(tempsum, _area0, crossings, reverse, sign)); } /** * @return a the equatorial radius of the ellipsoid (meters). This is * the value inherited from the Geodesic object used in the constructor. **********************************************************************/ public double EquatorialRadius() { return _earth.EquatorialRadius(); } /** * @return f the flattening of the ellipsoid. This is the value * inherited from the Geodesic object used in the constructor. **********************************************************************/ public double Flattening() { return _earth.Flattening(); } /** * Report the previous vertex added to the polygon or polyline. *

* @return Pair(lat, lon), the current latitude and longitude. *

* If no points have been added, then Double.NaN is returned. Otherwise, * lon will be in the range [−180°, 180°]. **********************************************************************/ public Pair CurrentPoint() { return new Pair(_lat1, _lon1); } /** * @deprecated An old name for {@link #EquatorialRadius()}. * @return a the equatorial radius of the ellipsoid (meters). **********************************************************************/ @Deprecated public double MajorRadius() { return EquatorialRadius(); } } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/PolygonResult.java0000644000771000077100000000265114064202371027064 0ustar ckarneyckarney/** * Implementation of the net.sf.geographiclib.PolygonResult class * * Copyright (c) Charles Karney (2013) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ package net.sf.geographiclib; /** * A container for the results from PolygonArea. **********************************************************************/ public class PolygonResult { /** * The number of vertices in the polygon **********************************************************************/ public int num; /** * The perimeter of the polygon or the length of the polyline (meters). **********************************************************************/ public double perimeter; /** * The area of the polygon (meters2). **********************************************************************/ public double area; /** * Constructor *

* @param num the number of vertices in the polygon. * @param perimeter the perimeter of the polygon or the length of the * polyline (meters). * @param area the area of the polygon (meters2). **********************************************************************/ public PolygonResult(int num, double perimeter, double area) { this.num = num; this.perimeter = perimeter; this.area = area; } } GeographicLib-1.52/java/src/main/java/net/sf/geographiclib/package-info.java0000644000771000077100000003557114064202371026571 0ustar ckarneyckarney/** *

Geodesic routines from GeographicLib implemented in Java

* @author Charles F. F. Karney (charles@karney.com) * @version 1.52 * *

* The documentation for other versions is available at * https://geographiclib.sourceforge.io/m.nn/java for versions * numbers m.nn ≥ 1.31. *

* Licensed under the * MIT/X11 License; see * * LICENSE.txt. * *

Abstract

*

* GeographicLib-Java is a Java implementation of the geodesic algorithms from * GeographicLib. This is a * self-contained library which makes it easy to do geodesic computations for * an ellipsoid of revolution in a Java program. It requires Java version 1.2 * or later. * *

Downloading

*

* Download either the source or the pre-built package as follows: * *

Obtaining the source

* GeographicLib-Java is part of GeographicLib which available for download at * *

* as either a compressed tar file (tar.gz) or a zip file. After unpacking * the source, the Java library can be found in GeographicLib-1.52/java. (This * library is completely independent from the rest of GeodegraphicLib.) The * library consists of the files in the src/main/java/net/sf/geographiclib * subdirectory. * *

The pre-built package

* GeographicLib-Java is available as a pre-built package on Maven Central * (thanks to Chris Bennight for help on this deployment). So, if you use * maven to build your code, you just * need to include the dependency
{@code
 *   
 *     net.sf.geographiclib
 *     GeographicLib-Java
 *     1.52
 *    }
* in your {@code pom.xml}. * *

Sample programs

*

* Included with the source are 3 small test programs *

    *
  • * {@code direct/src/main/java/Direct.java} is a simple command line utility * for solving the direct geodesic problem; *
  • * {@code inverse/src/main/java/Inverse.java} is a simple command line * utility for solving the inverse geodesic problem; *
  • * {@code planimeter/src/main/java/Planimeter.java} is a simple command line * utility for computing the area of a geodesic polygon given its vertices. *
*

* Here, for example, is {@code Inverse.java}

{@code
 * // Solve the inverse geodesic problem.
 *
 * // This program reads in lines with lat1, lon1, lat2, lon2 and prints
 * // out lines with azi1, azi2, s12 (for the WGS84 ellipsoid).
 *
 * import java.util.*;
 * import net.sf.geographiclib.*;
 * public class Inverse {
 *   public static void main(String[] args) {
 *     try {
 *       Scanner in = new Scanner(System.in);
 *       double lat1, lon1, lat2, lon2;
 *       while (true) {
 *         lat1 = in.nextDouble(); lon1 = in.nextDouble();
 *         lat2 = in.nextDouble(); lon2 = in.nextDouble();
 *         GeodesicData g = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2);
 *         System.out.println(g.azi1 + " " + g.azi2 + " " + g.s12);
 *       }
 *     }
 *     catch (Exception e) {}
 *   }
 * }}
* *

Compiling and running a sample program

*

* Three difference ways of compiling and running {@code Inverse.java} are * given. These differ in the degree to which they utilize * maven to manage your Java code and * its dependencies. (Thanks to Skip Breidbach for supplying the maven * support.) * *

Without using maven

* Compile and run as follows
 * cd inverse/src/main/java
 * javac -cp .:../../../../src/main/java Inverse.java
 * echo -30 0 29.5 179.5 | java -cp .:../../../../src/main/java Inverse 
* On Windows, change this to
 * cd inverse\src\main\java
 * javac -cp .;../../../../src/main/java Inverse.java
 * echo -30 0 29.5 179.5 | java -cp .;../../../../src/main/java Inverse 
* *

Using maven to package GeographicLib

* Use maven to create a jar file by * running (in the main java directory)
 * mvn package 
* (Your first run of maven may take a long time, because it needs to download * some additional packages to your local repository.) Then compile and run * Inverse.java with
 * cd inverse/src/main/java
 * javac -cp .:../../../../target/GeographicLib-Java-1.52.jar Inverse.java
 * echo -30 0 29.5 179.5 |
 *   java -cp .:../../../../target/GeographicLib-Java-1.52.jar Inverse 
* *

Using maven to build and run {@code Inverse.java}

* The sample code includes a {@code pom.xml} which specifies * GeographicLib-Java as a dependency. You can build and install this * dependency by running (in the main java directory)
 * mvn install 
* Alternatively, you can let maven download it from Maven Central. You can * compile and run Inverse.java with
 * cd inverse
 * mvn compile
 * echo -30 0 29.5 179.5 | mvn -q exec:java 
* *

Using the library

*
    *
  • * Put
     *   import net.sf.geographiclib.*
    * in your source code. *
  • * Make calls to the geodesic routines from your code. *
  • * Compile and run in one of the ways described above. *
*

* The important classes are *

    *
  • * {@link net.sf.geographiclib.Geodesic}, for direct and inverse geodesic * calculations; *
  • * {@link net.sf.geographiclib.GeodesicLine}, an efficient way of * calculating multiple points on a single geodesic; *
  • * {@link net.sf.geographiclib.GeodesicData}, the object containing the * results of the geodesic calculations; *
  • * {@link net.sf.geographiclib.GeodesicMask}, the constants that let you * specify the variables to return in * {@link net.sf.geographiclib.GeodesicData} and the capabilities of a * {@link net.sf.geographiclib.GeodesicLine}; *
  • * {@link net.sf.geographiclib.Constants}, the parameters for the WGS84 * ellipsoid; *
  • * {@link net.sf.geographiclib.PolygonArea}, a class to compute the * perimeter and area of a geodesic polygon (returned as a * {@link net.sf.geographiclib.PolygonResult}). *
*

* The documentation is generated using javadoc when * {@code mvn package -P release} is run (the top of the documentation tree is * {@code target/apidocs/index.html}). This is also available on the web at * * https://geographiclib.sourceforge.io/html/java/index.html. * *

External links

* * *

Change log

*
    *
  • * Version 1.52 * (released 2021-mm-dd) *
      *
    • * Be more aggressive in preventing negative s12 and m12 for short * lines. *
    *
  • * Version 1.51 * (released 2020-11-22) *
      *
    • * In order to reduce the amount of memory allocation and garbage collection, * introduce versions of GeoMath.norm, GeoMath.sum, GeoMath.AngDiff, and * GeoMath.sincosd, which take a {@link net.sf.geographiclib.Pair} as a * parameter instead of returning a new {@link net.sf.geographiclib.Pair}. * The previous versions are deprecated. *
    • * Geodesic.MajorRadius() is now called * {@link net.sf.geographiclib.Geodesic#EquatorialRadius()} and similarly for * {@link net.sf.geographiclib.GeodesicLine}, * {@link net.sf.geographiclib.Gnomonic}, and * {@link net.sf.geographiclib.PolygonArea}. *
    • * Update to Java 1.7 or later to support testing on Mac OSX. *
    *
  • * Version 1.50 * (released 2019-09-24) *
      *
    • * {@link net.sf.geographiclib.PolygonArea} can now handle arbitrarily * complex polygons. In the case of self-intersecting polygons the area is * accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 * polygon will partially cancel. *
    • * Fix two bugs in the computation of areas when some vertices are specified * by an added edge. *
    • * Require Java 1.6 or later and so remove epsilon, min, hypot, log1p, * copysign, cbrt from GeoMath. *
    • * GeoMath.cbrt, GeoMath.atanh, and GeoMath.asinh preserve the sign of * −0. *
    *
  • * Version 1.49 * (released 2017-10-05) *
      *
    • * Fix code formatting and add two tests. *
    *
  • * Version 1.48 * (released 2017-04-09) *
      *
    • * Change default range for longitude and azimuth to * (−180°, 180°] (instead of [−180°, 180°)). *
    *
  • * Version 1.47 * (released 2017-02-15) *
      *
    • * Improve accuracy of area calculation (fixing a flaw introduced in * version 1.46). *
    *
  • * Version 1.46 * (released 2016-02-15) *
      *
    • * Fix bug where the wrong longitude was being returned with direct geodesic * calculation with a negative distance when starting point was at a pole * (this bug was introduced in version 1.44). *
    • * Add Geodesic.DirectLine, Geodesic.ArcDirectLine, Geodesic.GenDirectLine, * Geodesic.InverseLine, GeodesicLine.SetDistance, GeodesicLine.SetArc, * GeodesicLine.GenSetDistance, GeodesicLine.Distance, GeodesicLine.Arc, * GeodesicLine.GenDistance. *
    • * More accurate inverse solution when longitude difference is close to * 180°. *
    • * GeoMath.AngDiff now returns a Pair. *
    *
  • * Version 1.45 * (released 2015-09-30) *
      *
    • * The solution of the inverse problem now correctly returns NaNs if * one of the latitudes is a NaN. *
    • * Add implementation of the ellipsoidal * {@link net.sf.geographiclib.Gnomonic} (courtesy of Sebastian Mattheis). *
    • * Math.toRadians and Math.toDegrees are used instead of GeoMath.degree * (which is now removed). This requires Java 1.2 or later (released * 1998-12). *
    *
  • * Version 1.44 * (released 2015-08-14) *
      *
    • * Improve accuracy of calculations by evaluating trigonometric * functions more carefully and replacing the series for the reduced * length with one with a smaller truncation error. *
    • * The allowed ranges for longitudes and azimuths is now unlimited; * it used to be [−540°, 540°). *
    • * Enforce the restriction of latitude to [−90°, 90°] by * returning NaNs if the latitude is outside this range. *
    • * Geodesic.Inverse sets s12 to zero for coincident points at pole * (instead of returning a tiny quantity). *
    • * Geodesic.Inverse pays attentions to the GeodesicMask.LONG_UNROLL bit in * outmask. *
    *
**********************************************************************/ package net.sf.geographiclib; GeographicLib-1.52/java/src/test/java/net/sf/geographiclib/GeodesicTest.java0000644000771000077100000010526214064202371026655 0ustar ckarneyckarneypackage net.sf.geographiclib.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.junit.Test; import net.sf.geographiclib.*; public class GeodesicTest { private static boolean isNaN(double x) { return x != x; } private static final PolygonArea polygon = new PolygonArea(Geodesic.WGS84, false); private static final PolygonArea polyline = new PolygonArea(Geodesic.WGS84, true); private static PolygonResult Planimeter(double points[][]) { polygon.Clear(); for (int i = 0; i < points.length; ++i) { polygon.AddPoint(points[i][0], points[i][1]); } return polygon.Compute(false, true); } private static PolygonResult PolyLength(double points[][]) { polyline.Clear(); for (int i = 0; i < points.length; ++i) { polyline.AddPoint(points[i][0], points[i][1]); } return polyline.Compute(false, true); } private static final double testcases[][] = { {35.60777, -139.44815, 111.098748429560326, -11.17491, -69.95921, 129.289270889708762, 8935244.5604818305, 80.50729714281974, 6273170.2055303837, 0.16606318447386067, 0.16479116945612937, 12841384694976.432}, {55.52454, 106.05087, 22.020059880982801, 77.03196, 197.18234, 109.112041110671519, 4105086.1713924406, 36.892740690445894, 3828869.3344387607, 0.80076349608092607, 0.80101006984201008, 61674961290615.615}, {-21.97856, 142.59065, -32.44456876433189, 41.84138, 98.56635, -41.84359951440466, 8394328.894657671, 75.62930491011522, 6161154.5773110616, 0.24816339233950381, 0.24930251203627892, -6637997720646.717}, {-66.99028, 112.2363, 173.73491240878403, -12.70631, 285.90344, 2.512956620913668, 11150344.2312080241, 100.278634181155759, 6289939.5670446687, -0.17199490274700385, -0.17722569526345708, -121287239862139.744}, {-17.42761, 173.34268, -159.033557661192928, -15.84784, 5.93557, -20.787484651536988, 16076603.1631180673, 144.640108810286253, 3732902.1583877189, -0.81273638700070476, -0.81299800519154474, 97825992354058.708}, {32.84994, 48.28919, 150.492927788121982, -56.28556, 202.29132, 48.113449399816759, 16727068.9438164461, 150.565799985466607, 3147838.1910180939, -0.87334918086923126, -0.86505036767110637, -72445258525585.010}, {6.96833, 52.74123, 92.581585386317712, -7.39675, 206.17291, 90.721692165923907, 17102477.2496958388, 154.147366239113561, 2772035.6169917581, -0.89991282520302447, -0.89986892177110739, -1311796973197.995}, {-50.56724, -16.30485, -105.439679907590164, -33.56571, -94.97412, -47.348547835650331, 6455670.5118668696, 58.083719495371259, 5409150.7979815838, 0.53053508035997263, 0.52988722644436602, 41071447902810.047}, {-58.93002, -8.90775, 140.965397902500679, -8.91104, 133.13503, 19.255429433416599, 11756066.0219864627, 105.755691241406877, 6151101.2270708536, -0.26548622269867183, -0.27068483874510741, -86143460552774.735}, {-68.82867, -74.28391, 93.774347763114881, -50.63005, -8.36685, 34.65564085411343, 3956936.926063544, 35.572254987389284, 3708890.9544062657, 0.81443963736383502, 0.81420859815358342, -41845309450093.787}, {-10.62672, -32.0898, -86.426713286747751, 5.883, -134.31681, -80.473780971034875, 11470869.3864563009, 103.387395634504061, 6184411.6622659713, -0.23138683500430237, -0.23155097622286792, 4198803992123.548}, {-21.76221, 166.90563, 29.319421206936428, 48.72884, 213.97627, 43.508671946410168, 9098627.3986554915, 81.963476716121964, 6299240.9166992283, 0.13965943368590333, 0.14152969707656796, 10024709850277.476}, {-19.79938, -174.47484, 71.167275780171533, -11.99349, -154.35109, 65.589099775199228, 2319004.8601169389, 20.896611684802389, 2267960.8703918325, 0.93427001867125849, 0.93424887135032789, -3935477535005.785}, {-11.95887, -116.94513, 92.712619830452549, 4.57352, 7.16501, 78.64960934409585, 13834722.5801401374, 124.688684161089762, 5228093.177931598, -0.56879356755666463, -0.56918731952397221, -9919582785894.853}, {-87.85331, 85.66836, -65.120313040242748, 66.48646, 16.09921, -4.888658719272296, 17286615.3147144645, 155.58592449699137, 2635887.4729110181, -0.90697975771398578, -0.91095608883042767, 42667211366919.534}, {1.74708, 128.32011, -101.584843631173858, -11.16617, 11.87109, -86.325793296437476, 12942901.1241347408, 116.650512484301857, 5682744.8413270572, -0.44857868222697644, -0.44824490340007729, 10763055294345.653}, {-25.72959, -144.90758, -153.647468693117198, -57.70581, -269.17879, -48.343983158876487, 9413446.7452453107, 84.664533838404295, 6356176.6898881281, 0.09492245755254703, 0.09737058264766572, 74515122850712.444}, {-41.22777, 122.32875, 14.285113402275739, -7.57291, 130.37946, 10.805303085187369, 3812686.035106021, 34.34330804743883, 3588703.8812128856, 0.82605222593217889, 0.82572158200920196, -2456961531057.857}, {11.01307, 138.25278, 79.43682622782374, 6.62726, 247.05981, 103.708090215522657, 11911190.819018408, 107.341669954114577, 6070904.722786735, -0.29767608923657404, -0.29785143390252321, 17121631423099.696}, {-29.47124, 95.14681, -163.779130441688382, -27.46601, -69.15955, -15.909335945554969, 13487015.8381145492, 121.294026715742277, 5481428.9945736388, -0.51527225545373252, -0.51556587964721788, 104679964020340.318}}; @Test public void InverseCheck() { for (int i = 0; i < testcases.length; ++i) { double lat1 = testcases[i][0], lon1 = testcases[i][1], azi1 = testcases[i][2], lat2 = testcases[i][3], lon2 = testcases[i][4], azi2 = testcases[i][5], s12 = testcases[i][6], a12 = testcases[i][7], m12 = testcases[i][8], M12 = testcases[i][9], M21 = testcases[i][10], S12 = testcases[i][11]; GeodesicData inv = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2, GeodesicMask.ALL | GeodesicMask.LONG_UNROLL); assertEquals(lon2, inv.lon2, 1e-13); assertEquals(azi1, inv.azi1, 1e-13); assertEquals(azi2, inv.azi2, 1e-13); assertEquals(s12, inv.s12, 1e-8); assertEquals(a12, inv.a12, 1e-13); assertEquals(m12, inv.m12, 1e-8); assertEquals(M12, inv.M12, 1e-15); assertEquals(M21, inv.M21, 1e-15); assertEquals(S12, inv.S12, 0.1); } } @Test public void DirectCheck() { for (int i = 0; i < testcases.length; ++i) { double lat1 = testcases[i][0], lon1 = testcases[i][1], azi1 = testcases[i][2], lat2 = testcases[i][3], lon2 = testcases[i][4], azi2 = testcases[i][5], s12 = testcases[i][6], a12 = testcases[i][7], m12 = testcases[i][8], M12 = testcases[i][9], M21 = testcases[i][10], S12 = testcases[i][11]; GeodesicData dir = Geodesic.WGS84.Direct(lat1, lon1, azi1, s12, GeodesicMask.ALL | GeodesicMask.LONG_UNROLL); assertEquals(lat2, dir.lat2, 1e-13); assertEquals(lon2, dir.lon2, 1e-13); assertEquals(azi2, dir.azi2, 1e-13); assertEquals(a12, dir.a12, 1e-13); assertEquals(m12, dir.m12, 1e-8); assertEquals(M12, dir.M12, 1e-15); assertEquals(M21, dir.M21, 1e-15); assertEquals(S12, dir.S12, 0.1); } } @Test public void ArcDirectCheck() { for (int i = 0; i < testcases.length; ++i) { double lat1 = testcases[i][0], lon1 = testcases[i][1], azi1 = testcases[i][2], lat2 = testcases[i][3], lon2 = testcases[i][4], azi2 = testcases[i][5], s12 = testcases[i][6], a12 = testcases[i][7], m12 = testcases[i][8], M12 = testcases[i][9], M21 = testcases[i][10], S12 = testcases[i][11]; GeodesicData dir = Geodesic.WGS84.ArcDirect(lat1, lon1, azi1, a12, GeodesicMask.ALL | GeodesicMask.LONG_UNROLL); assertEquals(lat2, dir.lat2, 1e-13); assertEquals(lon2, dir.lon2, 1e-13); assertEquals(azi2, dir.azi2, 1e-13); assertEquals(s12, dir.s12, 1e-8); assertEquals(m12, dir.m12, 1e-8); assertEquals(M12, dir.M12, 1e-15); assertEquals(M21, dir.M21, 1e-15); assertEquals(S12, dir.S12, 0.1); } } @Test public void GeodSolve0() { GeodesicData inv = Geodesic.WGS84.Inverse(40.6, -73.8, 49.01666667, 2.55); assertEquals(inv.azi1, 53.47022, 0.5e-5); assertEquals(inv.azi2, 111.59367, 0.5e-5); assertEquals(inv.s12, 5853226, 0.5); } @Test public void GeodSolve1() { GeodesicData dir = Geodesic.WGS84.Direct(40.63972222, -73.77888889, 53.5, 5850e3); assertEquals(dir.lat2, 49.01467, 0.5e-5); assertEquals(dir.lon2, 2.56106, 0.5e-5); assertEquals(dir.azi2, 111.62947, 0.5e-5); } @Test public void GeodSolve2() { // Check fix for antipodal prolate bug found 2010-09-04 Geodesic geod = new Geodesic(6.4e6, -1/150.0); GeodesicData inv = geod.Inverse(0.07476, 0, -0.07476, 180); assertEquals(inv.azi1, 90.00078, 0.5e-5); assertEquals(inv.azi2, 90.00078, 0.5e-5); assertEquals(inv.s12, 20106193, 0.5); inv = geod.Inverse(0.1, 0, -0.1, 180); assertEquals(inv.azi1, 90.00105, 0.5e-5); assertEquals(inv.azi2, 90.00105, 0.5e-5); assertEquals(inv.s12, 20106193, 0.5); } @Test public void GeodSolve4() { // Check fix for short line bug found 2010-05-21 GeodesicData inv = Geodesic.WGS84.Inverse(36.493349428792, 0, 36.49334942879201, .0000008); assertEquals(inv.s12, 0.072, 0.5e-3); } @Test public void GeodSolve5() { // Check fix for point2=pole bug found 2010-05-03 GeodesicData dir = Geodesic.WGS84.Direct(0.01777745589997, 30, 0, 10e6); assertEquals(dir.lat2, 90, 0.5e-5); if (dir.lon2 < 0) { assertEquals(dir.lon2, -150, 0.5e-5); assertEquals(Math.abs(dir.azi2), 180, 0.5e-5); } else { assertEquals(dir.lon2, 30, 0.5e-5); assertEquals(dir.azi2, 0, 0.5e-5); } } @Test public void GeodSolve6() { // 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). GeodesicData inv = Geodesic.WGS84.Inverse(88.202499451857, 0, -88.202499451857, 179.981022032992859592); assertEquals(inv.s12, 20003898.214, 0.5e-3); inv = Geodesic.WGS84.Inverse(89.262080389218, 0, -89.262080389218, 179.992207982775375662); assertEquals(inv.s12, 20003925.854, 0.5e-3); inv = Geodesic.WGS84.Inverse(89.333123580033, 0, -89.333123580032997687, 179.99295812360148422); assertEquals(inv.s12, 20003926.881, 0.5e-3); } @Test public void GeodSolve9() { // Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) GeodesicData inv = Geodesic.WGS84.Inverse(56.320923501171, 0, -56.320923501171, 179.664747671772880215); assertEquals(inv.s12, 19993558.287, 0.5e-3); } @Test public void GeodSolve10() { // Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio // 10 rel + debug) GeodesicData inv = Geodesic.WGS84.Inverse(52.784459512564, 0, -52.784459512563990912, 179.634407464943777557); assertEquals(inv.s12, 19991596.095, 0.5e-3); } @Test public void GeodSolve11() { // Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio // 10 rel + debug) GeodesicData inv = Geodesic.WGS84.Inverse(48.522876735459, 0, -48.52287673545898293, 179.599720456223079643); assertEquals(inv.s12, 19989144.774, 0.5e-3); } @Test public void GeodSolve12() { // Check fix for inverse geodesics on extreme prolate/oblate // ellipsoids Reported 2012-08-29 Stefan Guenther // ; fixed 2012-10-07 Geodesic geod = new Geodesic(89.8, -1.83); GeodesicData inv = geod.Inverse(0, 0, -10, 160); assertEquals(inv.azi1, 120.27, 1e-2); assertEquals(inv.azi2, 105.15, 1e-2); assertEquals(inv.s12, 266.7, 1e-1); } @Test public void GeodSolve14() { // Check fix for inverse ignoring lon12 = nan GeodesicData inv = Geodesic.WGS84.Inverse(0, 0, 1, Double.NaN); assertTrue(isNaN(inv.azi1)); assertTrue(isNaN(inv.azi2)); assertTrue(isNaN(inv.s12)); } @Test public void GeodSolve15() { // Initial implementation of Math::eatanhe was wrong for e^2 < 0. This // checks that this is fixed. Geodesic geod = new Geodesic(6.4e6, -1/150.0); GeodesicData dir = geod.Direct(1, 2, 3, 4, GeodesicMask.AREA); assertEquals(dir.S12, 23700, 0.5); } @Test public void GeodSolve17() { // Check fix for LONG_UNROLL bug found on 2015-05-07 GeodesicData dir = Geodesic.WGS84.Direct(40, -75, -10, 2e7, GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat2, -39, 1); assertEquals(dir.lon2, -254, 1); assertEquals(dir.azi2, -170, 1); GeodesicLine line = Geodesic.WGS84.Line(40, -75, -10); dir = line.Position(2e7, GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat2, -39, 1); assertEquals(dir.lon2, -254, 1); assertEquals(dir.azi2, -170, 1); dir = Geodesic.WGS84.Direct(40, -75, -10, 2e7); assertEquals(dir.lat2, -39, 1); assertEquals(dir.lon2, 105, 1); assertEquals(dir.azi2, -170, 1); dir = line.Position(2e7); assertEquals(dir.lat2, -39, 1); assertEquals(dir.lon2, 105, 1); assertEquals(dir.azi2, -170, 1); } @Test public void GeodSolve26() { // Check 0/0 problem with area calculation on sphere 2015-09-08 Geodesic geod = new Geodesic(6.4e6, 0); GeodesicData inv = geod.Inverse(1, 2, 3, 4, GeodesicMask.AREA); assertEquals(inv.S12, 49911046115.0, 0.5); } @Test public void GeodSolve28() { // Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in // Java implementation fixed on 2015-05-19). Geodesic geod = new Geodesic(6.4e6, 0.1); GeodesicData dir = geod.Direct(1, 2, 10, 5e6); assertEquals(dir.a12, 48.55570690, 0.5e-8); } @Test public void GeodSolve29() { // Check longitude unrolling with inverse calculation 2015-09-16 GeodesicData dir = Geodesic.WGS84.Inverse(0, 539, 0, 181); assertEquals(dir.lon1, 179, 1e-10); assertEquals(dir.lon2, -179, 1e-10); assertEquals(dir.s12, 222639, 0.5); dir = Geodesic.WGS84.Inverse(0, 539, 0, 181, GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lon1, 539, 1e-10); assertEquals(dir.lon2, 541, 1e-10); assertEquals(dir.s12, 222639, 0.5); } @Test public void GeodSolve33() { // Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- // sind(-0.0) = +0.0 -- and in some version of Visual Studio -- // fmod(-0.0, 360.0) = +0.0. GeodesicData inv = Geodesic.WGS84.Inverse(0, 0, 0, 179); assertEquals(inv.azi1, 90.00000, 0.5e-5); assertEquals(inv.azi2, 90.00000, 0.5e-5); assertEquals(inv.s12, 19926189, 0.5); inv = Geodesic.WGS84.Inverse(0, 0, 0, 179.5); assertEquals(inv.azi1, 55.96650, 0.5e-5); assertEquals(inv.azi2, 124.03350, 0.5e-5); assertEquals(inv.s12, 19980862, 0.5); inv = Geodesic.WGS84.Inverse(0, 0, 0, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(Math.abs(inv.azi2), 180.00000, 0.5e-5); assertEquals(inv.s12, 20003931, 0.5); inv = Geodesic.WGS84.Inverse(0, 0, 1, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(Math.abs(inv.azi2), 180.00000, 0.5e-5); assertEquals(inv.s12, 19893357, 0.5); Geodesic geod = new Geodesic(6.4e6, 0); inv = geod.Inverse(0, 0, 0, 179); assertEquals(inv.azi1, 90.00000, 0.5e-5); assertEquals(inv.azi2, 90.00000, 0.5e-5); assertEquals(inv.s12, 19994492, 0.5); inv = geod.Inverse(0, 0, 0, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(Math.abs(inv.azi2), 180.00000, 0.5e-5); assertEquals(inv.s12, 20106193, 0.5); inv = geod.Inverse(0, 0, 1, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(Math.abs(inv.azi2), 180.00000, 0.5e-5); assertEquals(inv.s12, 19994492, 0.5); geod = new Geodesic(6.4e6, -1/300.0); inv = geod.Inverse(0, 0, 0, 179); assertEquals(inv.azi1, 90.00000, 0.5e-5); assertEquals(inv.azi2, 90.00000, 0.5e-5); assertEquals(inv.s12, 19994492, 0.5); inv = geod.Inverse(0, 0, 0, 180); assertEquals(inv.azi1, 90.00000, 0.5e-5); assertEquals(inv.azi2, 90.00000, 0.5e-5); assertEquals(inv.s12, 20106193, 0.5); inv = geod.Inverse(0, 0, 0.5, 180); assertEquals(inv.azi1, 33.02493, 0.5e-5); assertEquals(inv.azi2, 146.97364, 0.5e-5); assertEquals(inv.s12, 20082617, 0.5); inv = geod.Inverse(0, 0, 1, 180); assertEquals(inv.azi1, 0.00000, 0.5e-5); assertEquals(Math.abs(inv.azi2), 180.00000, 0.5e-5); assertEquals(inv.s12, 20027270, 0.5); } @Test public void GeodSolve55() { // Check fix for nan + point on equator or pole not returning all nans in // Geodesic::Inverse, found 2015-09-23. GeodesicData inv = Geodesic.WGS84.Inverse(Double.NaN, 0, 0, 90); assertTrue(isNaN(inv.azi1)); assertTrue(isNaN(inv.azi2)); assertTrue(isNaN(inv.s12)); inv = Geodesic.WGS84.Inverse(Double.NaN, 0, 90, 3); assertTrue(isNaN(inv.azi1)); assertTrue(isNaN(inv.azi2)); assertTrue(isNaN(inv.s12)); } @Test public void GeodSolve59() { // Check for points close with longitudes close to 180 deg apart. GeodesicData inv = Geodesic.WGS84.Inverse(5, 0.00000000000001, 10, 180); assertEquals(inv.azi1, 0.000000000000035, 1.5e-14); assertEquals(inv.azi2, 179.99999999999996, 1.5e-14); assertEquals(inv.s12, 18345191.174332713, 5e-9); } @Test public void GeodSolve61() { // Make sure small negative azimuths are west-going GeodesicData dir = Geodesic.WGS84.Direct(45, 0, -0.000000000000000003, 1e7, GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat2, 45.30632, 0.5e-5); assertEquals(dir.lon2, -180, 0.5e-5); assertEquals(Math.abs(dir.azi2), 180, 0.5e-5); GeodesicLine line = Geodesic.WGS84.InverseLine(45, 0, 80, -0.000000000000000003); dir = line.Position(1e7, GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat2, 45.30632, 0.5e-5); assertEquals(dir.lon2, -180, 0.5e-5); assertEquals(Math.abs(dir.azi2), 180, 0.5e-5); } @Test public void GeodSolve65() { // Check for bug in east-going check in GeodesicLine (needed to check for // sign of 0) and sign error in area calculation due to a bogus override // of the code for alp12. Found/fixed on 2015-12-19. GeodesicLine line = Geodesic.WGS84.InverseLine(30, -0.000000000000000001, -31, 180); GeodesicData dir = line.Position(1e7, GeodesicMask.ALL | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat1, 30.00000 , 0.5e-5); assertEquals(dir.lon1, -0.00000 , 0.5e-5); assertEquals(Math.abs(dir.azi1), 180.00000, 0.5e-5); assertEquals(dir.lat2, -60.23169 , 0.5e-5); assertEquals(dir.lon2, -0.00000 , 0.5e-5); assertEquals(Math.abs(dir.azi2), 180.00000, 0.5e-5); assertEquals(dir.s12 , 10000000 , 0.5); assertEquals(dir.a12 , 90.06544 , 0.5e-5); assertEquals(dir.m12 , 6363636 , 0.5); assertEquals(dir.M12 , -0.0012834, 0.5e7); assertEquals(dir.M21 , 0.0013749 , 0.5e-7); assertEquals(dir.S12 , 0 , 0.5); dir = line.Position(2e7, GeodesicMask.ALL | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat1, 30.00000 , 0.5e-5); assertEquals(dir.lon1, -0.00000 , 0.5e-5); assertEquals(Math.abs(dir.azi1), 180.00000, 0.5e-5); assertEquals(dir.lat2, -30.03547 , 0.5e-5); assertEquals(dir.lon2, -180.00000, 0.5e-5); assertEquals(dir.azi2, -0.00000 , 0.5e-5); assertEquals(dir.s12 , 20000000 , 0.5); assertEquals(dir.a12 , 179.96459 , 0.5e-5); assertEquals(dir.m12 , 54342 , 0.5); assertEquals(dir.M12 , -1.0045592, 0.5e7); assertEquals(dir.M21 , -0.9954339, 0.5e-7); assertEquals(dir.S12 , 127516405431022.0, 0.5); } @Test public void GeodSolve69() { // Check for InverseLine if line is slightly west of S and that s13 is // correctly set. GeodesicLine line = Geodesic.WGS84.InverseLine(-5, -0.000000000000002, -10, 180); GeodesicData dir = line.Position(2e7, GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat2, 4.96445 , 0.5e-5); assertEquals(dir.lon2, -180.00000, 0.5e-5); assertEquals(dir.azi2, -0.00000 , 0.5e-5); dir = line.Position(0.5 * line.Distance(), GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat2, -87.52461 , 0.5e-5); assertEquals(dir.lon2, -0.00000 , 0.5e-5); assertEquals(dir.azi2, -180.00000, 0.5e-5); } @Test public void GeodSolve71() { // Check that DirectLine sets s13. GeodesicLine line = Geodesic.WGS84.DirectLine(1, 2, 45, 1e7); GeodesicData dir = line.Position(0.5 * line.Distance(), GeodesicMask.STANDARD | GeodesicMask.LONG_UNROLL); assertEquals(dir.lat2, 30.92625, 0.5e-5); assertEquals(dir.lon2, 37.54640, 0.5e-5); assertEquals(dir.azi2, 55.43104, 0.5e-5); } @Test public void GeodSolve73() { // Check for backwards from the pole bug reported by Anon on 2016-02-13. // This only affected the Java implementation. It was introduced in Java // version 1.44 and fixed in 1.46-SNAPSHOT on 2016-01-17. // Also the + sign on azi2 is a check on the normalizing of azimuths // (converting -0.0 to +0.0). GeodesicData dir = Geodesic.WGS84.Direct(90, 10, 180, -1e6); assertEquals(dir.lat2, 81.04623, 0.5e-5); assertEquals(dir.lon2, -170, 0.5e-5); assertEquals(dir.azi2, 0, 0.5e-5); assertTrue(Math.copySign(1, dir.azi2) > 0); } @Test public void GeodSolve74() { // Check fix for inaccurate areas, bug introduced in v1.46, fixed // 2015-10-16. GeodesicData inv = Geodesic.WGS84.Inverse(54.1589, 15.3872, 54.1591, 15.3877, GeodesicMask.ALL); assertEquals(inv.azi1, 55.723110355, 5e-9); assertEquals(inv.azi2, 55.723515675, 5e-9); assertEquals(inv.s12, 39.527686385, 5e-9); assertEquals(inv.a12, 0.000355495, 5e-9); assertEquals(inv.m12, 39.527686385, 5e-9); assertEquals(inv.M12, 0.999999995, 5e-9); assertEquals(inv.M21, 0.999999995, 5e-9); assertEquals(inv.S12, 286698586.30197, 5e-4); } @Test public void GeodSolve76() { // The distance from Wellington and Salamanca (a classic failure of // Vincenty) GeodesicData inv = Geodesic.WGS84.Inverse(-(41+19/60.0), 174+49/60.0, 40+58/60.0, -(5+30/60.0)); assertEquals(inv.azi1, 160.39137649664, 0.5e-11); assertEquals(inv.azi2, 19.50042925176, 0.5e-11); assertEquals(inv.s12, 19960543.857179, 0.5e-6); } @Test public void GeodSolve78() { // An example where the NGS calculator fails to converge GeodesicData inv = Geodesic.WGS84.Inverse(27.2, 0.0, -27.1, 179.5); assertEquals(inv.azi1, 45.82468716758, 0.5e-11); assertEquals(inv.azi2, 134.22776532670, 0.5e-11); assertEquals(inv.s12, 19974354.765767, 0.5e-6); } @Test public void GeodSolve80() { // Some tests to add code coverage: computing scale in special cases + zero // length geodesic (includes GeodSolve80 - GeodSolve83). GeodesicData inv = Geodesic.WGS84.Inverse(0, 0, 0, 90, GeodesicMask.GEODESICSCALE); assertEquals(inv.M12, -0.00528427534, 0.5e-10); assertEquals(inv.M21, -0.00528427534, 0.5e-10); inv = Geodesic.WGS84.Inverse(0, 0, 1e-6, 1e-6, GeodesicMask.GEODESICSCALE); assertEquals(inv.M12, 1, 0.5e-10); assertEquals(inv.M21, 1, 0.5e-10); inv = Geodesic.WGS84.Inverse(20.001, 0, 20.001, 0, GeodesicMask.ALL); assertEquals(inv.a12, 0, 1e-13); assertEquals(inv.s12, 0, 1e-8); assertEquals(inv.azi1, 180, 1e-13); assertEquals(inv.azi2, 180, 1e-13); assertEquals(inv.m12, 0, 1e-8); assertEquals(inv.M12, 1, 1e-15); assertEquals(inv.M21, 1, 1e-15); assertEquals(inv.S12, 0, 1e-10); assertTrue(Math.copySign(1, inv.a12) > 0); assertTrue(Math.copySign(1, inv.s12) > 0); assertTrue(Math.copySign(1, inv.m12) > 0); inv = Geodesic.WGS84.Inverse(90, 0, 90, 180, GeodesicMask.ALL); assertEquals(inv.a12, 0, 1e-13); assertEquals(inv.s12, 0, 1e-8); assertEquals(inv.azi1, 0, 1e-13); assertEquals(inv.azi2, 180, 1e-13); assertEquals(inv.m12, 0, 1e-8); assertEquals(inv.M12, 1, 1e-15); assertEquals(inv.M21, 1, 1e-15); assertEquals(inv.S12, 127516405431022.0, 0.5); // An incapable line which can't take distance as input GeodesicLine line = Geodesic.WGS84.Line(1, 2, 90, GeodesicMask.LATITUDE); GeodesicData dir = line.Position(1000, GeodesicMask.NONE); assertTrue(isNaN(dir.a12)); } @Test public void GeodSolve84() { // Tests for python implementation to check fix for range errors with // {fmod,sin,cos}(inf) (includes GeodSolve84 - GeodSolve91). GeodesicData dir; dir = Geodesic.WGS84.Direct(0, 0, 90, Double.POSITIVE_INFINITY); assertTrue(isNaN(dir.lat2)); assertTrue(isNaN(dir.lon2)); assertTrue(isNaN(dir.azi2)); dir = Geodesic.WGS84.Direct(0, 0, 90, Double.NaN); assertTrue(isNaN(dir.lat2)); assertTrue(isNaN(dir.lon2)); assertTrue(isNaN(dir.azi2)); dir = Geodesic.WGS84.Direct(0, 0, Double.POSITIVE_INFINITY, 1000); assertTrue(isNaN(dir.lat2)); assertTrue(isNaN(dir.lon2)); assertTrue(isNaN(dir.azi2)); dir = Geodesic.WGS84.Direct(0, 0, Double.NaN, 1000); assertTrue(isNaN(dir.lat2)); assertTrue(isNaN(dir.lon2)); assertTrue(isNaN(dir.azi2)); dir = Geodesic.WGS84.Direct(0, Double.POSITIVE_INFINITY, 90, 1000); assertTrue(dir.lat2 == 0); assertTrue(isNaN(dir.lon2)); assertTrue(dir.azi2 == 90); dir = Geodesic.WGS84.Direct(0, Double.NaN, 90, 1000); assertTrue(dir.lat2 == 0); assertTrue(isNaN(dir.lon2)); assertTrue(dir.azi2 == 90); dir = Geodesic.WGS84.Direct(Double.POSITIVE_INFINITY, 0, 90, 1000); assertTrue(isNaN(dir.lat2)); assertTrue(isNaN(dir.lon2)); assertTrue(isNaN(dir.azi2)); dir = Geodesic.WGS84.Direct(Double.NaN, 0, 90, 1000); assertTrue(isNaN(dir.lat2)); assertTrue(isNaN(dir.lon2)); assertTrue(isNaN(dir.azi2)); } @Test public void GeodSolve92() { // Check fix for inaccurate hypot with python 3.[89]. Problem reported // by agdhruv https://github.com/geopy/geopy/issues/466 ; see // https://bugs.python.org/issue43088 GeodesicData inv = Geodesic.WGS84.Inverse(37.757540000000006, -122.47018, 37.75754, -122.470177); assertEquals(inv.azi1, 89.99999923, 1e-7 ); assertEquals(inv.azi2, 90.00000106, 1e-7 ); assertEquals(inv.s12, 0.264, 0.5e-3); } @Test public void Planimeter0() { // Check fix for pole-encircling bug found 2011-03-16 double pa[][] = {{89, 0}, {89, 90}, {89, 180}, {89, 270}}; PolygonResult a = Planimeter(pa); assertEquals(a.perimeter, 631819.8745, 1e-4); assertEquals(a.area, 24952305678.0, 1); double pb[][] = {{-89, 0}, {-89, 90}, {-89, 180}, {-89, 270}}; a = Planimeter(pb); assertEquals(a.perimeter, 631819.8745, 1e-4); assertEquals(a.area, -24952305678.0, 1); double pc[][] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}}; a = Planimeter(pc); assertEquals(a.perimeter, 627598.2731, 1e-4); assertEquals(a.area, 24619419146.0, 1); double pd[][] = {{90, 0}, {0, 0}, {0, 90}}; a = Planimeter(pd); assertEquals(a.perimeter, 30022685, 1); assertEquals(a.area, 63758202715511.0, 1); a = PolyLength(pd); assertEquals(a.perimeter, 20020719, 1); assertTrue(isNaN(a.area)); } @Test public void Planimeter5() { // Check fix for Planimeter pole crossing bug found 2011-06-24 double points[][] = {{89, 0.1}, {89, 90.1}, {89, -179.9}}; PolygonResult a = Planimeter(points); assertEquals(a.perimeter, 539297, 1); assertEquals(a.area, 12476152838.5, 1); } @Test public void Planimeter6() { // Check fix for Planimeter lon12 rounding bug found 2012-12-03 double pa[][] = {{9, -0.00000000000001}, {9, 180}, {9, 0}}; PolygonResult a = Planimeter(pa); assertEquals(a.perimeter, 36026861, 1); assertEquals(a.area, 0, 1); double pb[][] = {{9, 0.00000000000001}, {9, 0}, {9, 180}}; a = Planimeter(pb); assertEquals(a.perimeter, 36026861, 1); assertEquals(a.area, 0, 1); double pc[][] = {{9, 0.00000000000001}, {9, 180}, {9, 0}}; a = Planimeter(pc); assertEquals(a.perimeter, 36026861, 1); assertEquals(a.area, 0, 1); double pd[][] = {{9, -0.00000000000001}, {9, 0}, {9, 180}}; a = Planimeter(pd); assertEquals(a.perimeter, 36026861, 1); assertEquals(a.area, 0, 1); } @Test public void Planimeter12() { // Area of arctic circle (not really -- adjunct to rhumb-area test) double points[][] = {{66.562222222, 0}, {66.562222222, 180}}; PolygonResult a = Planimeter(points); assertEquals(a.perimeter, 10465729, 1); assertEquals(a.area, 0, 1); } @Test public void Planimeter13() { // Check encircling pole twice double points[][] = {{89,-360}, {89,-240}, {89,-120}, {89,0}, {89,120}, {89,240}}; PolygonResult a = Planimeter(points); assertEquals(a.perimeter, 1160741, 1); assertEquals(a.area, 32415230256.0, 1); } @Test public void Planimeter15() { // Coverage tests, includes Planimeter15 - Planimeter18 (combinations of // reverse and sign) + calls to testpoint, testedge. PolygonResult a; double lat[] = {2, 1, 3}, lon[] = {1, 2, 3}; double r = 18454562325.45119, a0 = 510065621724088.5093; // ellipsoid area polygon.Clear(); polygon.AddPoint(lat[0], lon[0]); polygon.AddPoint(lat[1], lon[1]); a = polygon.TestPoint(lat[2], lon[2], false, true); assertEquals(a.area, r, 0.5); a = polygon.TestPoint(lat[2], lon[2], false, false); assertEquals(a.area, r, 0.5); a = polygon.TestPoint(lat[2], lon[2], true, true); assertEquals(a.area, -r, 0.5); a = polygon.TestPoint(lat[2], lon[2], true, false); assertEquals(a.area, a0-r, 0.5); GeodesicData inv = Geodesic.WGS84.Inverse(lat[1], lon[1], lat[2], lon[2]); a = polygon.TestEdge(inv.azi1, inv.s12, false, true); assertEquals(a.area, r, 0.5); a = polygon.TestEdge(inv.azi1, inv.s12, false, false); assertEquals(a.area, r, 0.5); a = polygon.TestEdge(inv.azi1, inv.s12, true, true); assertEquals(a.area, -r, 0.5); a = polygon.TestEdge(inv.azi1, inv.s12, true, false); assertEquals(a.area, a0-r, 0.5); polygon.AddPoint(lat[2], lon[2]); a = polygon.Compute(false, true); assertEquals(a.area, r, 0.5); a = polygon.Compute(false, false); assertEquals(a.area, r, 0.5); a = polygon.Compute(true, true); assertEquals(a.area, -r, 0.5); a = polygon.Compute(true, false); assertEquals(a.area, a0-r, 0.5); } @Test public void Planimeter19() { // Coverage tests, includes Planimeter19 - Planimeter20 (degenerate // polygons) + extra cases. PolygonResult a; polygon.Clear(); a = polygon.Compute(false, true); assertTrue(a.area == 0); assertTrue(a.perimeter == 0); a = polygon.TestPoint(1, 1, false, true); assertTrue(a.area == 0); assertTrue(a.perimeter == 0); a = polygon.TestEdge(90, 1000, false, true); assertTrue(isNaN(a.area)); assertTrue(isNaN(a.perimeter)); polygon.AddPoint(1, 1); a = polygon.Compute(false, true); assertTrue(a.area == 0); assertTrue(a.perimeter == 0); polyline.Clear(); a = polyline.Compute(false, true); assertTrue(a.perimeter == 0); a = polyline.TestPoint(1, 1, false, true); assertTrue(a.perimeter == 0); a = polyline.TestEdge(90, 1000, false, true); assertTrue(isNaN(a.perimeter)); polyline.AddPoint(1, 1); a = polyline.Compute(false, true); assertTrue(a.perimeter == 0); polygon.AddPoint(1, 1); a = polyline.TestEdge(90, 1000, false, true); assertEquals(a.perimeter, 1000, 1e-10); a = polyline.TestPoint(2, 2, false, true); assertEquals(a.perimeter, 156876.149, 0.5e-3); } @Test public void Planimeter21() { // Some test to add code coverage: multiple circlings of pole (includes // Planimeter21 - Planimeter28) + invocations via testpoint and testedge. PolygonResult a; double lat = 45, azi = 39.2144607176828184218, s = 8420705.40957178156285, r = 39433884866571.4277, // Area for one circuit a0 = 510065621724088.5093; // Ellipsoid area int i; polygon.Clear(); polygon.AddPoint(lat, 60); polygon.AddPoint(lat, 180); polygon.AddPoint(lat, -60); polygon.AddPoint(lat, 60); polygon.AddPoint(lat, 180); polygon.AddPoint(lat, -60); for (i = 3; i <= 4; ++i) { polygon.AddPoint(lat, 60); polygon.AddPoint(lat, 180); a = polygon.TestPoint(lat, -60, false, true); assertEquals(a.area, i*r, 0.5); a = polygon.TestPoint(lat, -60, false, false); assertEquals(a.area, i*r, 0.5); a = polygon.TestPoint(lat, -60, true, true); assertEquals(a.area, -i*r, 0.5); a = polygon.TestPoint(lat, -60, true, false); assertEquals(a.area, -i*r + a0, 0.5); a = polygon.TestEdge(azi, s, false, true); assertEquals(a.area, i*r, 0.5); a = polygon.TestEdge(azi, s, false, false); assertEquals(a.area, i*r, 0.5); a = polygon.TestEdge(azi, s, true, true); assertEquals(a.area, -i*r, 0.5); a = polygon.TestEdge(azi, s, true, false); assertEquals(a.area, -i*r + a0, 0.5); polygon.AddPoint(lat, -60); a = polygon.Compute(false, true); assertEquals(a.area, i*r, 0.5); a = polygon.Compute(false, false); assertEquals(a.area, i*r, 0.5); a = polygon.Compute(true, true); assertEquals(a.area, -i*r, 0.5); a = polygon.Compute(true, false); assertEquals(a.area, -i*r + a0, 0.5); } } @Test public void Planimeter29() { // Check fix to transitdirect vs transit zero handling inconsistency PolygonResult a; polygon.Clear(); polygon.AddPoint(0, 0); polygon.AddEdge( 90, 1000); polygon.AddEdge( 0, 1000); polygon.AddEdge(-90, 1000); a = polygon.Compute(false, true); // The area should be 1e6. Prior to the fix it was 1e6 - A/2, where // A = ellipsoid area. assertEquals(a.area, 1000000.0, 0.01); } } GeographicLib-1.52/js/CMakeLists.txt0000644000771000077100000001161414064202371017174 0ustar ckarneyckarney# This list governs the order in which the JavaScript sources are # concatenated. This shouldn't be changed. set (JS_MODULES Math Geodesic GeodesicLine PolygonArea DMS) # Combine JavaScript into a single file if necessary set (JSSCRIPTS) set (JS_BUILD 0) set (JS_BUILD_MIN 0) set (JS_TARGET "${CMAKE_CURRENT_BINARY_DIR}/geographiclib.js") set (JS_TARGET_MIN "${CMAKE_CURRENT_BINARY_DIR}/geographiclib.min.js") set (JS_TARGETS ${JS_TARGET} ${JS_TARGET_MIN}) set (FILE_INVENTORY "") foreach (_F ${JS_MODULES}) set (_S "src/${_F}.js") set (FILE_INVENTORY "${FILE_INVENTORY} ${_F}.js") list (APPEND JSSCRIPTS ${_S}) if ("${CMAKE_CURRENT_SOURCE_DIR}/_S" IS_NEWER_THAN ${JS_TARGET}) set (JS_BUILD 1) endif () if ("${CMAKE_CURRENT_SOURCE_DIR}/_S" IS_NEWER_THAN ${JS_TARGET_MIN}) set (JS_BUILD_MIN 1) endif () endforeach () if (JS_BUILD) file (STRINGS "src/Math.js" _S REGEX version_string) string (REGEX REPLACE ".*\"(.*)\".*" "\\1" JS_VERSION "${_S}") file (REMOVE ${JS_TARGET}) file (READ "HEADER.js" _S) string (CONFIGURE ${_S} _S @ONLY) file (APPEND ${JS_TARGET} "${_S}") file (APPEND ${JS_TARGET} "\n(function(cb) {\n") foreach (_F ${JSSCRIPTS}) get_filename_component (_N ${_F} NAME) file (READ "${_F}" _S) # Normalize the line endings. string (REGEX REPLACE "\r" "" _S "${_S}") file (APPEND ${JS_TARGET} "\n/**************** ${_N} ****************/\n") file (APPEND ${JS_TARGET} "${_S}") endforeach () # export GeographlicLib file (APPEND ${JS_TARGET} " cb(GeographicLib); })(function(geo) { if (typeof module === 'object' && module.exports) { /******** support loading with node's require ********/ module.exports = geo; } else if (typeof define === 'function' && define.amd) { /******** support loading with AMD ********/ define('geographiclib', [], function() { return geo; }); } else { /******** otherwise just pollute our global namespace ********/ window.GeographicLib = geo; } }); ") endif () if (JS_BUILD_MIN) file (STRINGS "src/Math.js" _S REGEX version_string) string (REGEX REPLACE ".*\"(.*)\".*" "\\1" JS_VERSION "${_S}") file (REMOVE ${JS_TARGET_MIN}) file (READ "HEADER.js" _S) string (CONFIGURE ${_S} _S @ONLY) file (APPEND ${JS_TARGET_MIN} "${_S}") file (APPEND ${JS_TARGET_MIN} "(function(cb){\n") foreach (_F ${JSSCRIPTS}) get_filename_component (_N ${_F} NAME) file (READ "${_F}" _S) # Normalize the line endings. string (REGEX REPLACE "\r" "\n" _S "${_S}") # This matches /*...*/ style comments, where ... is any number of # \*[^/] and [^*]. This has the defect that the it won't detect, # e.g., **/ as the end of the comment. string (REGEX REPLACE "/\\*(\\*[^/]|[^*])*\\*/" "" _S "${_S}") string (REGEX REPLACE "//[^\n]*\n" "\n" _S "${_S}") string (REGEX REPLACE "[ \t]+" " " _S "${_S}") string (REGEX REPLACE "([^\"A-Za-z0-9_]) " "\\1" _S "${_S}") string (REGEX REPLACE " ([^\\[\"A-Za-z0-9_])" "\\1" _S "${_S}") string (REGEX REPLACE "\n " "\n" _S "${_S}") string (REGEX REPLACE " \n" "\n" _S "${_S}") string (REGEX REPLACE "^\n" "" _S "${_S}") string (REGEX REPLACE "\n+" "\n" _S "${_S}") file (APPEND ${JS_TARGET_MIN} "// ${_N}\n${_S}") endforeach () # export GeographlicLib file (APPEND ${JS_TARGET_MIN} "cb(GeographicLib); })(function(geo){ if(typeof module==='object'&&module.exports){ module.exports=geo; }else if(typeof define==='function'&&define.amd){ define('geographiclib',[],function(){return geo;}); }else{ window.GeographicLib=geo; } }); ") endif () # "make javascript" will reconfigure cmake if necessary, since # geographiclib.js and geographiclib.min.js are created during # configuration. add_custom_command (OUTPUT ${JS_TARGETS} DEPENDS ${JSSCRIPTS} HEADER.js COMMAND ${CMAKE_COMMAND} ARGS "." WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) file (GLOB SAMPLES samples/*.html) file (COPY ${SAMPLES} DESTINATION .) add_custom_target (javascript ALL DEPENDS ${JS_TARGETS}) # Copy files so that publishing nodejs package can be done with: # npm publish ${CMAKE_CURRENT_BINARY_DIR}/geographiclib # To test, do: # cd ${CMAKE_CURRENT_BINARY_DIR}/geographiclib && npm test file (COPY ../LICENSE.txt package.json README.md ${JS_TARGETS} DESTINATION geographiclib) file (COPY ${JSSCRIPTS} DESTINATION geographiclib/src) file (COPY types/geographiclib.d.ts DESTINATION geographiclib/types) file (COPY test/geodesictest.js DESTINATION geographiclib/test) if (COMMON_INSTALL_PATH) set (INSTALL_JS_DIR "lib${LIB_SUFFIX}/node_modules/geographiclib") else () set (INSTALL_JS_DIR "node_modules/geographiclib") endif () # Install the JavaScript files install (FILES ../LICENSE.txt package.json README.md ${JS_TARGETS} DESTINATION ${INSTALL_JS_DIR}) install (FILES ${JSSCRIPTS} DESTINATION ${INSTALL_JS_DIR}/src) install (FILES types/geographiclib.d.ts DESTINATION ${INSTALL_JS_DIR}/types) install (FILES test/geodesictest.js DESTINATION ${INSTALL_JS_DIR}/test) GeographicLib-1.52/js/GeographicLib.md0000644000771000077100000001335614064202371017462 0ustar ckarneyckarney## Geodesic routines from GeographicLib This documentation applies to version 1.52. The documentation for other versions is available at https://geographiclib.sourceforge.io/m.nn/js for versions numbers m.nn ≥ 1.45. Licensed under the MIT/X11 License; see [LICENSE.txt](https://geographiclib.sourceforge.io/html/LICENSE.txt). ### Installation This library is a JavaScript implementation of the geodesic routines from [GeographicLib](https://geographiclib.sourceforge.io). This solves the direct and inverse geodesic problems for an ellipsoid of revolution. The library can be used in [node](https://nodejs.org) by first installing the [geographiclib node package](https://www.npmjs.com/package/geographiclib) with [npm](https://www.npmjs.com) ```bash $ npm install geographiclib $ node > var GeographicLib = require("geographiclib"); ``` The npm package includes a test suite. Run this by ```bash $ cd node_modules/geographiclib $ npm test ``` Alternatively, you can use it in client-side JavaScript, by including in your HTML page ```html ``` Both of these prescriptions define a {@link GeographicLib} namespace. ### Examples Now geodesic calculations can be carried out, for example, ```javascript var geod = GeographicLib.Geodesic.WGS84, r; // Find the distance from Wellington, NZ (41.32S, 174.81E) to // Salamanca, Spain (40.96N, 5.50W)... r = geod.Inverse(-41.32, 174.81, 40.96, -5.50); console.log("The distance is " + r.s12.toFixed(3) + " m."); // This prints "The distance is 19959679.267 m." // Find the point 20000 km SW of Perth, Australia (32.06S, 115.74E)... r = geod.Direct(-32.06, 115.74, 225, 20000e3); console.log("The position is (" + r.lat2.toFixed(8) + ", " + r.lon2.toFixed(8) + ")."); // This prints "The position is (32.11195529, -63.95925278)." ``` Two examples of this library in use are * [A geodesic calculator](https://geographiclib.sourceforge.io/scripts/geod-calc.html) * [Displaying geodesics on Google Maps](https://geographiclib.sourceforge.io/scripts/geod-google.html) ### More information * {@tutorial 1-geodesics} * {@tutorial 2-interface} * {@tutorial 3-examples} ### Implementations in various languages * {@link https://sourceforge.net/p/geographiclib/code/ci/release/tree/ git repository} * C++ (complete library): {@link https://geographiclib.sourceforge.io/html/index.html documentation}, {@link https://sourceforge.net/projects/geographiclib/files/distrib download}; * C (geodesic routines): {@link https://geographiclib.sourceforge.io/html/C/index.html documentation}, also included with recent versions of {@link https://github.com/OSGeo/proj.4/wiki proj.4}; * Fortran (geodesic routines): {@link https://geographiclib.sourceforge.io/html/Fortran/index.html documentation}; * Java (geodesic routines): {@link http://repo1.maven.org/maven2/net/sf/geographiclib/GeographicLib-Java/ Maven Central package}, {@link https://geographiclib.sourceforge.io/html/java/index.html documentation}; * JavaScript (geodesic routines): {@link https://www.npmjs.com/package/geographiclib npm package}, {@link https://geographiclib.sourceforge.io/html/js/index.html documentation}; * Python (geodesic routines): {@link http://pypi.python.org/pypi/geographiclib PyPI package}, {@link https://geographiclib.sourceforge.io/html/python/index.html documentation}; * Matlab/Octave (geodesic and some other routines): {@link https://www.mathworks.com/matlabcentral/fileexchange/50605 Matlab Central package}, {@link https://viewer.mathworks.com/?viewer=plain_code&url=https%3A%2F%2Fwww.mathworks.com%2Fmatlabcentral%2Fmlc-downloads%2Fdownloads%2Fsubmissions%2F50605%2Fversions%2F15%2Fcontents%2FContents.m documentation}; * C# (.NET wrapper for complete C++ library): {@link https://geographiclib.sourceforge.io/html/NET/index.html documentation}. ### Change log * Version 1.52 (released 2020-06-22) * Work around inaccuracy in Math.hypot (see the GeodSolve92 test). * Be more aggressive in preventing negative s12 and m12 for short lines. * Version 1.51 (released 2020-11-22) * More symbols allowed with DMS decodings. * Version 1.50 (released 2019-09-24) * PolygonArea can now handle arbitrarily complex polygons. In the case of self-intersecting polygons the area is accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. * Fix two bugs in the computation of areas when some vertices are specified by an added edge. * Fix bug in computing unsigned area. * When parsing DMS strings ignore various non-breaking spaces. * Fall back to system versions of hypot, cbrt, log1p, atanh if they are available. * Math.cbrt, Math.atanh, and Math.asinh preserve the sign of −0. * Version 1.49 (released 2017-10-05) * Use explicit test for nonzero real numbers. * Version 1.48 (released 2017-04-09) * Change default range for longitude and azimuth to (−180°, 180°] (instead of [−180°, 180°)). * Version 1.47 (released 2017-02-15) * Improve accuracy of area calculation (fixing a flaw introduced in version 1.46). * Version 1.46 (released 2016-02-15) * Fix bugs in PolygonArea.TestEdge (problem found by threepointone). * Add Geodesic.DirectLine, Geodesic.ArcDirectLine, Geodesic.GenDirectLine, Geodesic.InverseLine, GeodesicLine.SetDistance, GeodesicLine.SetArc, GeodesicLine.GenSetDistance, GeodesicLine.s13, GeodesicLine.a13. * More accurate inverse solution when longitude difference is close to 180°. ### Authors * algorithms + js code: Charles Karney (charles@karney.com) * node.js port: Yurij Mikhalevich (yurij@mikhalevi.ch) GeographicLib-1.52/js/HEADER.js0000644000771000077100000000137714064202371015727 0ustar ckarneyckarney/* * Geodesic routines from GeographicLib translated to JavaScript. See * https://geographiclib.sourceforge.io/html/js/ * * The algorithms are derived in * * Charles F. F. Karney, * Algorithms for geodesics, J. Geodesy 87, 43-55 (2013), * https://doi.org/10.1007/s00190-012-0578-z * Addenda: https://geographiclib.sourceforge.io/geod-addenda.html * * This file is the concatenation and compression of the JavaScript files in * doc/scripts/GeographicLib in the source tree for GeographicLib. * * Copyright (c) Charles Karney (2011-2015) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * Version: @JS_VERSION@ * File inventory: * @FILE_INVENTORY@ */ GeographicLib-1.52/js/Makefile.am0000644000771000077100000000237514064202371016474 0ustar ckarneyckarneyEXTRAFILES = $(srcdir)/HEADER.js SAMPLES = \ geod-calc.html \ geod-google.html \ geod-google-instructions.html # The order here is significant JSSCRIPTS = \ $(srcdir)/src/Math.js \ $(srcdir)/src/Geodesic.js \ $(srcdir)/src/GeodesicLine.js \ $(srcdir)/src/PolygonArea.js \ $(srcdir)/src/DMS.js TYPESSCRIPTS = $(srcdir)/types/geographiclib.d.ts TESTSCRIPTS = $(srcdir)/test/geodesictest.js all: geographiclib.js geographiclib.min.js $(SAMPLES) geod-calc.html: samples/geod-calc.html cp $^ $@ geod-google.html: samples/geod-google.html cp $^ $@ geod-google-instructions.html: samples/geod-google-instructions.html cp $^ $@ geographiclib.js: HEADER.js $(JSSCRIPTS) $(srcdir)/js-cat.sh $^ > $@ geographiclib.min.js: HEADER.js $(JSSCRIPTS) $(srcdir)/js-compress.sh $^ > $@ jsdir=$(DESTDIR)$(libdir)/node_modules/geographiclib install: all $(INSTALL) -d $(jsdir) $(INSTALL) -m 644 geographiclib.js geographiclib.min.js $(jsdir) $(INSTALL) -m 644 $(top_srcdir)/LICENSE.txt $(srcdir)/README.md \ $(srcdir)/package.json $(jsdir) $(INSTALL) -d $(jsdir)/src $(INSTALL) -m 644 $(JSSCRIPTS) $(jsdir)/src $(INSTALL) -d $(jsdir)/types $(INSTALL) -m 644 $(TYPESSCRIPTS) $(jsdir)/types $(INSTALL) -d $(jsdir)/test $(INSTALL) -m 644 $(TESTSCRIPTS) $(jsdir)/test GeographicLib-1.52/js/Makefile.mk0000644000771000077100000000217314064202371016502 0ustar ckarneyckarney# The order here is significant JS_MODULES=Math Geodesic GeodesicLine PolygonArea DMS JSSCRIPTS = $(patsubst %,src/%.js,$(JS_MODULES)) TYPESSCRIPTS = $(wildcard types/*.d.ts) TESTSCRIPTS = $(wildcard test/*.js) SAMPLESIN = $(wildcard samples/geod-*.html) SAMPLES = $(patsubst samples/%,%,$(SAMPLESIN)) all: geographiclib.js geographiclib.min.js $(SAMPLES) %.html: samples/%.html cp $^ $@ geographiclib.js: HEADER.js $(JSSCRIPTS) ./js-cat.sh $^ > $@ geographiclib.min.js: HEADER.js $(JSSCRIPTS) ./js-compress.sh $^ > $@ clean: rm -f geographiclib.js geographiclib.min.js *.html DEST = $(PREFIX)/lib/node_modules/geographiclib INSTALL = install -b install: all test -d $(DEST) || mkdir -p $(DEST) $(INSTALL) -m 644 geographiclib.js geographiclib.min.js $(DEST)/ $(INSTALL) -m 644 ../LICENSE.txt README.md package.json $(DEST)/ test -d $(DEST)/src || mkdir -p $(DEST)/src $(INSTALL) -m 644 $(JSSCRIPTS) $(DEST)/src/ test -d $(DEST)/types || mkdir -p $(DEST)/types $(INSTALL) -m 644 $(TYPESSCRIPTS) $(DEST)/types/ test -d $(DEST)/test || mkdir -p $(DEST)/test $(INSTALL) -m 644 $(TESTSCRIPTS) $(DEST)/test/ .PHONY: install clean GeographicLib-1.52/js/README.md0000644000771000077100000000270014064202371015707 0ustar ckarneyckarney# Geodesic routines from GeographicLib This library is a JavaScript implementation of the geodesic routines from [GeographicLib](https://geographiclib.sourceforge.io). This solves the direct and inverse geodesic problems for an ellipsoid of revolution. Licensed under the MIT/X11 License; see [LICENSE.txt](https://geographiclib.sourceforge.io/html/LICENSE.txt). ## Installation ```bash $ npm install geographiclib ``` ## Usage In [node](https://nodejs.org), do ```javascript var GeographicLib = require("geographiclib"); ``` ## Documentation Full documentation is provided at [https://geographiclib.sourceforge.io/1.52/js/](https://geographiclib.sourceforge.io/1.52/js/). ## Examples ```javascript var GeographicLib = require("geographiclib"), geod = GeographicLib.Geodesic.WGS84, r; // Find the distance from Wellington, NZ (41.32S, 174.81E) to // Salamanca, Spain (40.96N, 5.50W)... r = geod.Inverse(-41.32, 174.81, 40.96, -5.50); console.log("The distance is " + r.s12.toFixed(3) + " m."); // This prints "The distance is 19959679.267 m." // Find the point 20000 km SW of Perth, Australia (32.06S, 115.74E)... r = geod.Direct(-32.06, 115.74, 225, 20000e3); console.log("The position is (" + r.lat2.toFixed(8) + ", " + r.lon2.toFixed(8) + ")."); // This prints "The position is (32.11195529, -63.95925278)." ``` ## Authors * algorithms + js code: Charles Karney (charles@karney.com) * node.js port: Yurij Mikhalevich (yurij@mikhalevi.ch) GeographicLib-1.52/js/conf.json0000644000771000077100000000051314064202371016250 0ustar ckarneyckarney{ "tags": { "allowUnknownTags": true }, "source": { "includePattern": ".+\\.((js(doc)?)|(\\.d\\.ts))$", "excludePattern": "(^|\\/|\\\\)_" }, "plugins": [ "plugins/markdown" ], "templates": { "cleverLinks": false, "monospaceLinks": false, "default": { "outputSourceFiles": true } } } GeographicLib-1.52/js/doc/1-geodesics.md0000644000771000077100000002034214064202371017624 0ustar ckarneyckarneyJump to * [Introduction](#intro) * [Additional properties](#additional) * [Multiple shortest geodesics](#multiple) * [Background](#background) * [References](#references) ### Introduction Consider a ellipsoid of revolution with equatorial radius *a*, polar semi-axis *b*, and flattening *f* = (*a* − *b*)/*a* . Points on the surface of the ellipsoid are characterized by their latitude φ and longitude λ. (Note that latitude here means the *geographical latitude*, the angle between the normal to the ellipsoid and the equatorial plane). The shortest path between two points on the ellipsoid at (φ1, λ1) and (φ2, λ2) is called the geodesic. Its length is *s*12 and the geodesic from point 1 to point 2 has forward azimuths α1 and α2 at the two end points. In this figure, we have λ12 = λ2 − λ1.
A geodesic can be extended indefinitely by requiring that any sufficiently small segment is a shortest path; geodesics are also the straightest curves on the surface. Traditionally two geodesic problems are considered: * the direct problem — given φ1, λ1, α1, *s*12, determine φ2, λ2, and α2; this is solved by {@link module:GeographicLib/Geodesic.Geodesic#Direct Geodesic.Direct}. * the inverse problem — given φ1, λ1, φ2, λ2, determine *s*12, α1, and α2; this is solved by {@link module:GeographicLib/Geodesic.Geodesic#Inverse Geodesic.Inverse}. ### Additional properties The routines also calculate several other quantities of interest * *S*12 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 (φ11), (0,λ1), (0,λ2), and (φ22). It is given in meters2. * *m*12, the reduced length of the geodesic is defined such that if the initial azimuth is perturbed by *d*α1 (radians) then the second point is displaced by *m*12 *d*α1 in the direction perpendicular to the geodesic. *m*12 is given in meters. On a curved surface the reduced length obeys a symmetry relation, *m*12 + *m*21 = 0. On a flat surface, we have *m*12 = *s*12. * *M*12 and *M*21 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 *M*12 *dt* at point 2. *M*21 is defined similarly (with the geodesics being parallel to one another at point 2). *M*12 and *M*21 are dimensionless quantities. On a flat surface, we have *M*12 = *M*21 = 1. * σ12 is the arc length on the auxiliary sphere. This is a construct for converting the problem to one in spherical trigonometry. The spherical arc length from one equator crossing to the next is always 180°. If points 1, 2, and 3 lie on a single geodesic, then the following addition rules hold: * *s*13 = *s*12 + *s*23 * σ13 = σ12 + σ23 * *S*13 = *S*12 + *S*23 * *m*13 = *m*12*M*23 + *m*23*M*21 * *M*13 = *M*12*M*23 − (1 − *M*12*M*21) *m*23/*m*12 * *M*31 = *M*32*M*21 − (1 − *M*23*M*32) *m*12/*m*23 ### Multiple shortest geodesics The shortest distance found by solving the inverse problem is (obviously) uniquely defined. However, in a few special cases there are multiple azimuths which yield the same shortest distance. Here is a catalog of those cases: * φ1 = −φ2 (with neither point at a pole). If α1 = α2, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [α12] ← [α21], [*M*12,*M*21] ← [*M*21,*M*12], *S*12 ← −*S*12. (This occurs when the longitude difference is near ±180° for oblate ellipsoids.) * λ2 = λ1 ± 180° (with neither point at a pole). If α1 = 0° or ±180°, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [α12] ← [−α1,−α2], *S*12 ← −*S*12. (This occurs when φ2 is near −φ1 for prolate ellipsoids.) * Points 1 and 2 at opposite poles. There are infinitely many geodesics which can be generated by setting [α12] ← [α12] + [δ,−δ], for arbitrary δ. (For spheres, this prescription applies when points 1 and 2 are antipodal.) * *s*12 = 0 (coincident points). There are infinitely many geodesics which can be generated by setting [α12] ← [α12] + [δ,δ], for arbitrary δ. ### Background The algorithms implemented by this package are given in Karney (2013) and are based on Bessel (1825) and Helmert (1880); the algorithm for areas is based on Danielsen (1989). These improve on the work of Vincenty (1975) in the following respects: * The results are accurate to round-off for terrestrial ellipsoids (the error in the distance is less than 15 nanometers, compared to 0.1 mm for Vincenty). * The solution of the inverse problem is always found. (Vincenty's method fails to converge for nearly antipodal points.) * The routines calculate differential and integral properties of a geodesic. This allows, for example, the area of a geodesic polygon to be computed. ### References * F. W. Bessel, {@link https://arxiv.org/abs/0908.1824 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. * F. R. Helmert, {@link https://doi.org/10.5281/zenodo.32050 Mathematical and Physical Theories of Higher Geodesy, Vol 1}, (Teubner, Leipzig, 1880), Chaps. 5–7. * T. Vincenty, {@link http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations}, Survey Review **23**(176), 88–93 (1975). * J. Danielsen, {@link https://doi.org/10.1179/003962689791474267 The area under the geodesic}, Survey Review **30**(232), 61–66 (1989). * C. F. F. Karney, {@link https://doi.org/10.1007/s00190-012-0578-z Algorithms for geodesics}, J. Geodesy **87**(1) 43–55 (2013); {@link https://geographiclib.sourceforge.io/geod-addenda.html addenda}. * C. F. F. Karney, {@https://arxiv.org/abs/1102.1215v1 Geodesics on an ellipsoid of revolution}, Feb. 2011; {@link https://geographiclib.sourceforge.io/geod-addenda.html#geod-errata errata}. * {@link https://geographiclib.sourceforge.io/geodesic-papers/biblio.html A geodesic bibliography}. * The wikipedia page, {@link https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid Geodesics on an ellipsoid}. GeographicLib-1.52/js/doc/2-interface.md0000644000771000077100000001260014064202371017616 0ustar ckarneyckarneyJump to * [The units](#units) * [The results](#results) * [The *outmask* and *caps* parameters](#outmask) * [Restrictions on the parameters](#restrict) ### The units All angles (latitude, longitude, azimuth, arc length) are measured in degrees with latitudes increasing northwards, longitudes increasing eastwards, and azimuths measured clockwise from north. For a point at a pole, the azimuth is defined by keeping the longitude fixed, writing φ = ±(90° − ε), and taking the limit ε → 0+. ### The results The results returned by {@link module:GeographicLib/Geodesic.Geodesic#Inverse Geodesic.Direct}, {@link module:GeographicLib/Geodesic.Geodesic#Inverse Geodesic.Inverse}, {@link module:GeographicLib/GeodesicLine.GeodesicLine#Position GeodesicLine.Position}, etc., return an object with (some) of the following 12 fields set: * *lat1* = φ1, latitude of point 1 (degrees) * *lon1* = λ1, longitude of point 1 (degrees) * *azi1* = α1, azimuth of line at point 1 (degrees) * *lat2* = φ2, latitude of point 2 (degrees) * *lon2* = λ2, longitude of point 2 (degrees) * *azi2* = α2, (forward) azimuth of line at point 2 (degrees) * *s12* = *s*12, distance from 1 to 2 (meters) * *a12* = σ12, arc length on auxiliary sphere from 1 to 2 (degrees) * *m12* = *m*12, reduced length of geodesic (meters) * *M12* = *M*12, geodesic scale at 2 relative to 1 (dimensionless) * *M21* = *M*21, geodesic scale at 1 relative to 2 (dimensionless) * *S12* = *S*12, area between geodesic and equator (meters2) The input parameters together with *a12* are always included in the object. Azimuths are reduced to the range [−180°, 180°]. See {@tutorial 1-geodesics} for the definitions of these quantities. ### The *outmask* and *caps* parameters By default, the geodesic routines return the 7 basic quantities: *lat1*, *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, together with the arc length *a12*. The optional output mask parameter, *outmask*, can be used to tailor which quantities to calculate. In addition, when a {@link module:GeographicLib/GeodesicLine.GeodesicLine GeodesicLine} is constructed it can be provided with the optional capabilities parameter, *caps*, which specifies what quantities can be returned from the resulting object. Both *outmask* and *caps* are obtained by or'ing together the following values * Geodesic.NONE, no capabilities, no output; * Geodesic.ARC, compute arc length, *a12*; this is always implicitly set; * Geodesic.LATITUDE, compute latitude, *lat2*; * Geodesic.LONGITUDE, compute longitude, *lon2*; * Geodesic.AZIMUTH, compute azimuths, *azi1* and *azi2*; * Geodesic.DISTANCE, compute distance, *s12*; * Geodesic.STANDARD, all of the above; * Geodesic.DISTANCE_IN, allow *s12* to be used as input in the direct problem; * Geodesic.REDUCEDLENGTH, compute reduced length, *m12*; * Geodesic.GEODESICSCALE, compute geodesic scales, *M12* and *M21*; * Geodesic.AREA, compute area, *S12*; * Geodesic.ALL, all of the above; * Geodesic.LONG_UNROLL, unroll longitudes. Geodesic.DISTANCE_IN is a capability provided to the {@link module:GeographicLib/GeodesicLine.GeodesicLine GeodesicLine} constructor. It allows the position on the line to specified in terms of distance. (Without this, the position can only be specified in terms of the arc length.) This only makes sense in the *caps* parameter. Geodesic.LONG_UNROLL controls the treatment of longitude. If it is not set then the *lon1* and *lon2* fields are both reduced to the range [−180°, 180°]. If it is set, then *lon1* is as given in the function call and (*lon2* − *lon1*) determines how many times and in what sense the geodesic has encircled the ellipsoid. This only makes sense in the *outmask* parameter. Note that *a12* is always included in the result. ### Restrictions on the parameters * Latitudes must lie in [−90°, 90°]. Latitudes outside this range are replaced by NaNs. * The distance *s12* is unrestricted. This allows geodesics to wrap around the ellipsoid. Such geodesics are no longer shortest paths. However they retain the property that they are the straightest curves on the surface. * Similarly, the spherical arc length *a12* is unrestricted. * Longitudes and azimuths are unrestricted; internally these are exactly reduced to the range [−180°, 180°]; but see also the LONG_UNROLL bit. * The equatorial radius *a* and the polar semi-axis *b* must both be positive and finite (this implies that −∞ < *f* < 1). * The flattening *f* should satisfy *f* ∈ [−1/50,1/50] in order to retain full accuracy. This condition holds for most applications in geodesy. Reasonably accurate results can be obtained for −0.2 ≤ *f* ≤ 0.2. Here is a table of the approximate maximum error (expressed as a distance) for an ellipsoid with the same equatorial radius as the WGS84 ellipsoid and different values of the flattening. | abs(f) | error |:-------|------: | 0.003 | 15 nm | 0.01 | 25 nm | 0.02 | 30 nm | 0.05 | 10 μm | 0.1 | 1.5 mm | 0.2 | 300 mm Here 1 nm = 1 nanometer = 10−9 m (*not* 1 nautical mile!) GeographicLib-1.52/js/doc/3-examples.md0000644000771000077100000002253614064202371017506 0ustar ckarneyckarneyJump to * [GeographicLib namespace](#namespace) * [Specifying the ellipsoid](#ellipsoid) * [Basic geodesic calculations](#basic) * [Computing waypoints](#waypoints) * [Measuring areas](#area) * [Degrees, minutes, seconds conversion](#dms) ### GeographicLib namespace This capabilities of this package are all exposed through the {@link GeographicLib} namespace. This is can brought into scope in various ways. #### Using node after installing the package with npm If [npm](https://www.npmjs.com) has been used to install geographiclib via one of ```bash $ npm install geographiclib $ npm install --global geographiclib ``` then in [node](https://nodejs.org), you can do ```javascript var GeographicLib = require("geographiclib"); ``` #### Using node with a free-standing geographiclib.js If you have geographiclib.js (version 1.45 or later) in your current directory, then [node](https://nodejs.org) can access it with ```javascript var GeographicLib = require("./geographiclib"); ``` A similar prescription works if geographiclib.js is installed elsewhere in your filesystem, replacing "./" above with the correct directory. Note that the directory must begin with "./", "../", or "/". #### HTML with your own version of geographiclib.min.js Load geographiclib.min.js with ```html ``` This ".min.js" version has been "minified" by removing comments and redundant white space; this is appropriate for web applications. #### HTML downloading geographiclib.min.js from SourceForge Load geographiclib.min.js with ```html ``` This uses the latest version. If you want use a specific version, load with, for example, ```html ``` Browse [https://geographiclib.sourceforge.io/scripts](https://geographiclib.sourceforge.io/scripts) to see what versions are available. #### Loading geographiclib.min.js with AMD This uses [require.js](http://requirejs.org/) (which you can download [here](http://requirejs.org/docs/download.html)) to load geographiclib (version 1.45 or later) asynchronously. Your web page includes ```html ``` where main.js contains, for example, ```javascript require.config({ paths: { geographiclib: "./geographiclib.min" } }); define(["geographiclib"], function(GeographicLib) { // do something with GeographicLib here. }); ``` ### Specifying the ellipsoid Once {@link GeographicLib} has been brought into scope, the ellipsoid is defined via the {@link module:GeographicLib/Geodesic.Geodesic Geodesic} constructor using the equatorial radius *a* in meters and the flattening *f*, for example ```javascipt var geod = new GeographicLib.Geodesic.Geodesic(6378137, 1/298.257223563); ``` These are the parameters for the WGS84 ellipsoid and this comes predefined by the package as ```javascipt var geod = GeographicLib.Geodesic.WGS84; ``` Note that you can set *f* = 0 to give a sphere (on which geodesics are great circles) and *f* < 0 to give a prolate ellipsoid. The rest of the examples on this page assume the following assignments ```javascript var GeographicLib = require("geographiclib"); var Geodesic = GeographicLib.Geodesic, DMS = GeographicLib.DMS, geod = Geodesic.WGS84; ``` with the understanding that the first line should be replaced with the appropriate construction needed to bring the [GeographicLib namespace](#namespace) into scope. ### Basic geodesic calculations The distance from Wellington, NZ (41.32S, 174.81E) to Salamanca, Spain (40.96N, 5.50W) using {@link module:GeographicLib/Geodesic.Geodesic#Inverse Geodesic.Inverse}: ```javascript var r = geod.Inverse(-41.32, 174.81, 40.96, -5.50); console.log("The distance is " + r.s12.toFixed(3) + " m."); ``` →`The distance is 19959679.267 m.` The point the point 20000 km SW of Perth, Australia (32.06S, 115.74E) using {@link module:GeographicLib/Geodesic.Geodesic#Direct Geodesic.Direct}: ```javascript var r = geod.Direct(-32.06, 115.74, 225, 20000e3); console.log("The position is (" + r.lat2.toFixed(8) + ", " + r.lon2.toFixed(8) + ")."); ``` →`The position is (32.11195529, -63.95925278).` The area between the geodesic from JFK Airport (40.6N, 73.8W) to LHR Airport (51.6N, 0.5W) and the equator. This is an example of setting the *outmask* parameter, see {@tutorial 2-interface}, "The *outmask* and *caps* parameters". ```javascript var r = geod.Inverse(40.6, -73.8, 51.6, -0.5, Geodesic.AREA); console.log("The area is " + r.S12.toFixed(1) + " m^2"); ``` →`The area is 40041368848742.5 m^2` ### Computing waypoints Consider the geodesic between Beijing Airport (40.1N, 116.6E) and San Fransisco Airport (37.6N, 122.4W). Compute waypoints and azimuths at intervals of 1000 km using {@link module:GeographicLib/Geodesic.Geodesic#InverseLine Geodesic.InverseLine} and {@link module:GeographicLib/GeodesicLine.GeodesicLine#Position GeodesicLine.Position}: ```javascript var l = geod.InverseLine(40.1, 116.6, 37.6, -122.4), n = Math.ceil(l.s13 / ds), i, s; console.log("distance latitude longitude azimuth"); for (i = 0; i <= n; ++i) { s = Math.min(ds * i, l.s13); r = l.Position(s, Geodesic.STANDARD | Geodesic.LONG_UNROLL); console.log(r.s12.toFixed(0) + " " + r.lat2.toFixed(5) + " " + r.lon2.toFixed(5) + " " + r.azi2.toFixed(5)); } ``` gives ```text distance latitude longitude azimuth 0 40.10000 116.60000 42.91642 1000000 46.37321 125.44903 48.99365 2000000 51.78786 136.40751 57.29433 3000000 55.92437 149.93825 68.24573 4000000 58.27452 165.90776 81.68242 5000000 58.43499 183.03167 96.29014 6000000 56.37430 199.26948 109.99924 7000000 52.45769 213.17327 121.33210 8000000 47.19436 224.47209 129.98619 9000000 41.02145 233.58294 136.34359 9513998 37.60000 237.60000 138.89027 ``` The inclusion of Geodesic.LONG_UNROLL in the call to {@link module:GeographicLib/GeodesicLine.GeodesicLine#Position GeodesicLine.Position} ensures that the longitude does not jump on crossing the international dateline. If the purpose of computing the waypoints is to plot a smooth geodesic, then it's not important that they be exactly equally spaced. In this case, it's faster to parameterize the line in terms of the spherical arc length with {@link module:GeographicLib/GeodesicLine.GeodesicLine#ArcPosition GeodesicLine.ArcPosition} instead of the distance. Here the spacing is about 1° of arc which means that the distance between the waypoints will be about 60 NM. ```javascript var l = geod.InverseLine(40.1, 116.6, 37.6, -122.4, Geodesic.LATITUDE | Geodesic.LONGITUDE), da = 1, n = Math.ceil(l.a13 / da), i, a; da = l.a13 / n; console.log("latitude longitude"); for (i = 0; i <= n; ++i) { a = da * i; r = l.ArcPosition(a, Geodesic.LATITUDE | Geodesic.LONGITUDE | Geodesic.LONG_UNROLL); console.log(r.lat2.toFixed(5) + " " + r.lon2.toFixed(5)); } ``` gives ```text latitude longitude 40.10000 116.60000 40.82573 117.49243 41.54435 118.40447 42.25551 119.33686 42.95886 120.29036 43.65403 121.26575 44.34062 122.26380 ... 39.82385 235.05331 39.08884 235.91990 38.34746 236.76857 37.60000 237.60000 ``` The variation in the distance between these waypoints is on the order of 1/*f*. ### Measuring areas Measure the area of Antarctica using {@link module:GeographicLib/Geodesic.Geodesic#Polygon Geodesic.Polygon} and the {@link module:GeographicLib/PolygonArea.PolygonArea PolygonArea} class: ```javascript var p = geod.Polygon(false), i, antarctica = [ [-63.1, -58], [-72.9, -74], [-71.9,-102], [-74.9,-102], [-74.3,-131], [-77.5,-163], [-77.4, 163], [-71.7, 172], [-65.9, 140], [-65.7, 113], [-66.6, 88], [-66.9, 59], [-69.8, 25], [-70.0, -4], [-71.0, -14], [-77.3, -33], [-77.9, -46], [-74.7, -61] ]; for (i = 0; i < antarctica.length; ++i) p.AddPoint(antarctica[i][0], antarctica[i][1]); p = p.Compute(false, true); console.log("Perimeter/area of Antarctica are " + p.perimeter.toFixed(3) + " m / " + p.area.toFixed(1) + " m^2."); ``` →`Perimeter/area of Antarctica are 16831067.893 m / 13662703680020.1 m^2.` If the points of the polygon are being selected interactively, then {@link module:GeographicLib/PolygonArea.PolygonArea#TestPoint PolygonArea.TestPoint} can be used to report the area and perimeter for a polygon with a tentative final vertex which tracks the mouse pointer. ### Degrees, minutes, seconds conversion Compute the azimuth for geodesic from JFK (73.8W, 40.6N) to Paris CDG (49°01'N, 2°33'E) using the {@link module:GeographicLib/DMS DMS} module: ```javascript var c = "73.8W 40.6N 49°01'N 2°33'E".split(" "), p1 = DMS.DecodeLatLon(c[0], c[1]), p2 = DMS.DecodeLatLon(c[2], c[3]), r = geod.Inverse(p1.lat, p1.lon, p2.lat, p2.lon); console.log("Start = (" + DMS.Encode(r.lat1, DMS.MINUTE, 0, DMS.LATITUDE) + ", " + DMS.Encode(r.lon1, DMS.MINUTE, 0, DMS.LONGITUDE) + "), azimuth = " + DMS.Encode(r.azi1, DMS.MINUTE, 1, DMS.AZIMUTH)); ``` →`Start = (40°36'N, 073°48'W), azimuth = 053°28.2'` GeographicLib-1.52/js/doc/tutorials.json0000644000771000077100000000034114064202371020115 0ustar ckarneyckarney { "1-geodesics": { "title": "General information on geodesics" }, "2-interface": { "title": "The library interface" }, "3-examples": { "title": "Examples of use" } } GeographicLib-1.52/js/js-cat.sh0000755000771000077100000000161214064202371016151 0ustar ckarneyckarney#! /bin/sh -e # Concatenate JavaScript files HEADER=$1 shift JS_VERSION=`grep -h "version_string = " "$@" | cut -f2 -d'"'` FILE_INVENTORY= for f; do FILE_INVENTORY="$FILE_INVENTORY `basename $f`" done sed -e "s/@JS_VERSION@/$JS_VERSION/" -e "s/@FILE_INVENTORY@/$FILE_INVENTORY/" \ $HEADER cat <", "contributors": [ "Yurij Mikhalevich " ], "license": "MIT", "bugs": { "url": "https://sourceforge.net/p/geographiclib/discussion/", "email": "charles@karney.com" } } GeographicLib-1.52/js/samples/geod-calc.html0000644000771000077100000005316714064202371020615 0ustar ckarneyckarney Geodesic calculations for an ellipsoid done right

Geodesic calculations for an ellipsoid done right

This page illustrates the geodesic routines available in JavaScript package geographiclib, the geodesic routines in GeographicLib ( documentation). 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,
Algorithms for geodesics,
J. Geodesy 87(1), 43–55 (Jan. 2013);
DOI: 10.1007/s00190-012-0578-z (pdf); addenda: geod-addenda.html.
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. Basic online tools which provide similar capabilities are GeodSolve and Planimeter; these call a C++ backend. This page uses version of the geodesic code.

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. See GeodSolve(1) for the definition of the quantities a12, m12, M12, M21, and S12. The sample calculation finds the shortest path between Wellington, New Zealand, and Salamanca, Spain. 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:

a12:

m12:

M12 M21:

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. See GeodSolve(1) for the definition of the quantities a12, m12, M12, M21, and S12. 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:

a12:

m12:

M12 M21:

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 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> (2015-08-12)

Geographiclib Sourceforge GeographicLib-1.52/js/samples/geod-google-instructions.html0000644000771000077100000001262114064202371023717 0ustar ckarneyckarney 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 degrees, minutes, and seconds. Basic online tools which provide similar capabilities are GeodSolve and Planimeter; these call a C++ backend.

The JavaScript code for computing the geodesic lines, circles, and envelopes available in the JavaScript package geographiclib, the geodesic routines in GeographicLib ( documentation). The algorithms are derived in

Charles F. F. Karney,
Algorithms for geodesics,
J. Geodesy 87(1), 43–55 (Jan. 2013);
DOI: 10.1007/s00190-012-0578-z (pdf);
addenda: geod-addenda.html.
In putting together this Google Maps demonstration, I started with the sample code geometry-headings.


Charles Karney <charles@karney.com> (2011-08-02)

Geographiclib Sourceforge GeographicLib-1.52/js/samples/geod-google.html0000644000771000077100000002701714064202371021162 0ustar ckarneyckarney Geodesic lines, circles, envelopes in Google Maps

 Direct:  

 Inverse:

 lat1 lon1 azi1:

 lat2 lon2 azi2:

 s12:    status:    INSTRUCTIONS (v)

GeographicLib-1.52/js/src/DMS.js0000644000771000077100000004417114064202371016210 0ustar ckarneyckarney/* * 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-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ */ GeographicLib.DMS = {}; (function( /** * @exports GeographicLib/DMS * @description Decode/Encode angles expressed as degrees, minutes, and * seconds. This module defines several constants: * - hemisphere indicator (returned by * {@link module:GeographicLib/DMS.Decode Decode}) and a formatting * indicator (used by * {@link module:GeographicLib/DMS.Encode Encode}) * - NONE = 0, no designator and format as plain angle; * - LATITUDE = 1, a N/S designator and format as latitude; * - LONGITUDE = 2, an E/W designator and format as longitude; * - AZIMUTH = 3, format as azimuth; * - the specification of the trailing component in * {@link module:GeographicLib/DMS.Encode Encode} * - DEGREE; * - MINUTE; * - SECOND. */ d) { "use strict"; var lookup, zerofill, internalDecode, numMatch, hemispheres_ = "SNWE", signs_ = "-+", digits_ = "0123456789", dmsindicators_ = "D'\":", // dmsindicatorsu_ = "\u00b0\u2032\u2033"; // Unicode variants dmsindicatorsu_ = "\u00b0'\"", // Use degree symbol components_ = ["degrees", "minutes", "seconds"]; lookup = function(s, c) { return s.indexOf(c.toUpperCase()); }; zerofill = function(s, n) { return String("0000").substr(0, Math.max(0, Math.min(4, n-s.length))) + s; }; d.NONE = 0; d.LATITUDE = 1; d.LONGITUDE = 2; d.AZIMUTH = 3; d.DEGREE = 0; d.MINUTE = 1; d.SECOND = 2; /** * @summary Decode a DMS string. * @description The interpretation of the string is given in the * documentation of the corresponding function, Decode(string&, flag&) * in the {@link * https://geographiclib.sourceforge.io/html/classGeographicLib_1_1DMS.html * C++ DMS class} * @param {string} dms the string. * @returns {object} r where r.val is the decoded value (degrees) and r.ind * is a hemisphere designator, one of NONE, LATITUDE, LONGITUDE. * @throws an error if the string is illegal. */ d.Decode = function(dms) { var dmsa = dms, end, v = 0, i = 0, mi, pi, vals, ind1 = d.NONE, ind2, p, pa, pb; dmsa = dmsa .replace(/\u00b0/g, 'd' ) // U+00b0 degree symbol .replace(/\u00ba/g, 'd' ) // U+00ba alt symbol .replace(/\u2070/g, 'd' ) // U+2070 sup zero .replace(/\u02da/g, 'd' ) // U+02da ring above .replace(/\u2218/g, 'd' ) // U+2218 compose function .replace(/\*/g , 'd' ) // GRiD symbol for degree .replace(/`/g , 'd' ) // grave accent .replace(/\u2032/g, '\'') // U+2032 prime .replace(/\u2035/g, '\'') // U+2035 back prime .replace(/\u00b4/g, '\'') // U+00b4 acute accent .replace(/\u2018/g, '\'') // U+2018 left single quote .replace(/\u2019/g, '\'') // U+2019 right single quote .replace(/\u201b/g, '\'') // U+201b reversed-9 single quote .replace(/\u02b9/g, '\'') // U+02b9 modifier letter prime .replace(/\u02ca/g, '\'') // U+02ca modifier letter acute accent .replace(/\u02cb/g, '\'') // U+02cb modifier letter grave accent .replace(/\u2033/g, '"' ) // U+2033 double prime .replace(/\u2036/g, '"' ) // U+2036 reversed double prime .replace(/\u02dd/g, '"' ) // U+02dd double acute accent .replace(/\u201c/g, '"' ) // U+201d left double quote .replace(/\u201d/g, '"' ) // U+201d right double quote .replace(/\u201f/g, '"' ) // U+201f reversed-9 double quote .replace(/\u02ba/g, '"' ) // U+02ba modifier letter double prime .replace(/\u2795/g, '+' ) // U+2795 heavy plus .replace(/\u2064/g, '+' ) // U+2064 invisible plus .replace(/\u2010/g, '-' ) // U+2010 dash .replace(/\u2011/g, '-' ) // U+2011 non-breaking hyphen .replace(/\u2013/g, '-' ) // U+2013 en dash .replace(/\u2014/g, '-' ) // U+2014 em dash .replace(/\u2212/g, '-' ) // U+2212 minus sign .replace(/\u2796/g, '-' ) // U+2796 heavy minus .replace(/\u00a0/g, '' ) // U+00a0 non-breaking space .replace(/\u2007/g, '' ) // U+2007 figure space .replace(/\u2009/g, '' ) // U+2009 thin space .replace(/\u200a/g, '' ) // U+200a hair space .replace(/\u200b/g, '' ) // U+200b invisible space .replace(/\u202f/g, '' ) // U+202f narrow space .replace(/\u2063/g, '' ) // U+2063 invisible separator .replace(/''/g, '"' ) // '' -> " .trim(); end = dmsa.length; // p is pointer to the next piece that needs decoding for (p = 0; p < end; p = pb, ++i) { pa = p; // Skip over initial hemisphere letter (for i == 0) if (i === 0 && lookup(hemispheres_, dmsa.charAt(pa)) >= 0) ++pa; // Skip over initial sign (checking for it if i == 0) if (i > 0 || (pa < end && lookup(signs_, dmsa.charAt(pa)) >= 0)) ++pa; // Find next sign mi = dmsa.substr(pa, end - pa).indexOf('-'); pi = dmsa.substr(pa, end - pa).indexOf('+'); if (mi < 0) mi = end; else mi += pa; if (pi < 0) pi = end; else pi += pa; pb = Math.min(mi, pi); vals = internalDecode(dmsa.substr(p, pb - p)); v += vals.val; ind2 = vals.ind; if (ind1 === d.NONE) ind1 = ind2; else if (!(ind2 === d.NONE || ind1 === ind2)) throw new Error("Incompatible hemisphere specifies in " + dmsa.substr(0, pb)); } if (i === 0) throw new Error("Empty or incomplete DMS string " + dmsa); return {val: v, ind: ind1}; }; internalDecode = function(dmsa) { var vals = {}, errormsg = "", sign, beg, end, ind1, k, ipieces, fpieces, npiece, icurrent, fcurrent, ncurrent, p, pointseen, digcount, intcount, x; do { // Executed once (provides the ability to break) sign = 1; beg = 0; end = dmsa.length; ind1 = d.NONE; k = -1; if (end > beg && (k = lookup(hemispheres_, dmsa.charAt(beg))) >= 0) { ind1 = (k & 2) ? d.LONGITUDE : d.LATITUDE; sign = (k & 1) ? 1 : -1; ++beg; } if (end > beg && (k = lookup(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 = lookup(signs_, dmsa.charAt(beg))) >= 0) { if (k >= 0) { sign *= k ? 1 : -1; ++beg; } } if (end === beg) { errormsg = "Empty or incomplete DMS string " + dmsa; break; } ipieces = [0, 0, 0]; fpieces = [0, 0, 0]; npiece = 0; icurrent = 0; fcurrent = 0; ncurrent = 0; p = beg; pointseen = false; digcount = 0; intcount = 0; while (p < end) { x = dmsa.charAt(p++); if ((k = lookup(digits_, x)) >= 0) { ++ncurrent; if (digcount > 0) { ++digcount; // Count of decimal digits } else { icurrent = 10 * icurrent + k; ++intcount; } } else if (x === '.') { if (pointseen) { errormsg = "Multiple decimal points in " + dmsa.substr(beg, end - beg); break; } pointseen = true; digcount = 1; } else if ((k = lookup(dmsindicators_, x)) >= 0) { if (k >= 3) { if (p === end) { errormsg = "Illegal for colon to appear at the end of " + dmsa.substr(beg, end - beg); break; } k = npiece; } if (k === npiece - 1) { errormsg = "Repeated " + components_[k] + " component in " + dmsa.substr(beg, end - beg); break; } else if (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 > 0) { fcurrent = parseFloat(dmsa.substr(p - intcount - digcount - 1, intcount + digcount)); icurrent = 0; } ipieces[k] = icurrent; fpieces[k] = icurrent + fcurrent; if (p < end) { npiece = k + 1; icurrent = fcurrent = 0; ncurrent = digcount = intcount = 0; } } else if (lookup(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 (lookup(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 > 0) { fcurrent = parseFloat(dmsa.substr(p - intcount - digcount, intcount + digcount)); icurrent = 0; } 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 || fpieces[1] > 60) { errormsg = "Minutes " + fpieces[1] + " not in range [0,60)"; break; } if (ipieces[2] >= 60 || fpieces[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[2] ? (60*(60*fpieces[0] + fpieces[1]) + fpieces[2]) / 3600 : ( fpieces[1] ? (60*fpieces[0] + fpieces[1]) / 60 : fpieces[0] ) ); return vals; } while (false); vals.val = numMatch(dmsa); if (vals.val === 0) throw new Error(errormsg); else vals.ind = d.NONE; return vals; }; numMatch = function(s) { var t, sign, p0, p1; if (s.length < 3) return 0; t = s.toUpperCase().replace(/0+$/, ""); sign = t.charAt(0) === '-' ? -1 : 1; p0 = t.charAt(0) === '-' || t.charAt(0) === '+' ? 1 : 0; 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 Number.NaN; else if (t === "INF" || t === "1.#INF") return sign * Number.POSITIVE_INFINITY; return 0; }; /** * @summary Decode two DMS strings interpreting them as a latitude/longitude * pair. * @param {string} stra the first string. * @param {string} strb the first string. * @param {bool} [longfirst = false] if true assume then longitude is given * first (in the absence of any hemisphere indicators). * @returns {object} r where r.lat is the decoded latitude and r.lon is the * decoded longitude (both in degrees). * @throws an error if the strings are illegal. */ d.DecodeLatLon = function(stra, strb, longfirst) { var vals = {}, valsa = d.Decode(stra), valsb = d.Decode(strb), a = valsa.val, ia = valsa.ind, b = valsb.val, ib = valsb.ind, lat, lon; if (!longfirst) longfirst = false; if (ia === d.NONE && ib === d.NONE) { // Default to lat, long unless longfirst ia = longfirst ? d.LONGITUDE : d.LATITUDE; ib = longfirst ? 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")); lat = ia === d.LATITUDE ? a : b; lon = ia === d.LATITUDE ? b : a; if (Math.abs(lat) > 90) throw new Error("Latitude " + lat + " not in [-90,90]"); vals.lat = lat; vals.lon = lon; return vals; }; /** * @summary Decode a DMS string interpreting it as an arc length. * @param {string} angstr the string (this must not include a hemisphere * indicator). * @returns {number} the arc length (degrees). * @throws an error if the string is illegal. */ d.DecodeAngle = function(angstr) { var vals = d.Decode(angstr), 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; }; /** * @summary Decode a DMS string interpreting it as an azimuth. * @param {string} azistr the string (this may include an E/W hemisphere * indicator). * @returns {number} the azimuth (degrees). * @throws an error if the string is illegal. */ d.DecodeAzimuth = function(azistr) { var vals = d.Decode(azistr), azi = vals.val, ind = vals.ind; if (ind === d.LATITUDE) throw new Error("Azimuth " + azistr + " has a latitude hemisphere N/S"); return azi; }; /** * @summary Convert angle (in degrees) into a DMS string (using °, ', * and "). * @param {number} angle input angle (degrees). * @param {number} trailing one of DEGREE, MINUTE, or SECOND to indicate * the trailing component of the string (this component is given as a * decimal number if necessary). * @param {number} prec the number of digits after the decimal point for * the trailing component. * @param {number} [ind = NONE] a formatting indicator, one of NONE, * LATITUDE, LONGITUDE, AZIMUTH. * @returns {string} the resulting string formatted as follows: * * NONE, signed result no leading zeros on degrees except in the units * place, e.g., -8°03'. * * LATITUDE, trailing N or S hemisphere designator, no sign, pad * degrees to 2 digits, e.g., 08°03'S. * * LONGITUDE, trailing E or W hemisphere designator, no sign, pad * degrees to 3 digits, e.g., 008°03'W. * * AZIMUTH, convert to the range [0, 360°), no sign, pad degrees to * 3 digits, e.g., 351°57'. */ 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). var scale = 1, i, sign, idegree, fdegree, f, pieces, ip, fp, s; 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); 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; sign = angle < 0 ? -1 : 1; angle *= sign; // Break off integer part to preserve precision in manipulation of // fractional part. idegree = Math.floor(angle); fdegree = (angle - idegree) * scale + 0.5; f = Math.floor(fdegree); // Implement the "round ties to even" rule fdegree = (f === fdegree && (f & 1) === 1) ? f - 1 : f; fdegree /= scale; fdegree = Math.floor((angle - idegree) * scale + 0.5) / scale; if (fdegree >= 1) { idegree += 1; fdegree -= 1; } pieces = [fdegree, 0, 0]; for (i = 1; i <= trailing; ++i) { ip = Math.floor(pieces[i - 1]); fp = pieces[i - 1] - ip; pieces[i] = fp * 60; pieces[i - 1] = ip; } pieces[0] += idegree; s = ""; if (ind === d.NONE && sign < 0) s += '-'; switch (trailing) { case d.DEGREE: s += zerofill(pieces[0].toFixed(prec), ind === d.NONE ? 0 : 1 + Math.min(ind, 2) + prec + (prec ? 1 : 0)) + dmsindicatorsu_.charAt(0); break; default: s += zerofill(pieces[0].toFixed(0), ind === d.NONE ? 0 : 1 + Math.min(ind, 2)) + dmsindicatorsu_.charAt(0); switch (trailing) { case d.MINUTE: s += zerofill(pieces[1].toFixed(prec), 2 + prec + (prec ? 1 : 0)) + dmsindicatorsu_.charAt(1); break; case d.SECOND: s += zerofill(pieces[1].toFixed(0), 2) + dmsindicatorsu_.charAt(1); s += zerofill(pieces[2].toFixed(prec), 2 + prec + (prec ? 1 : 0)) + dmsindicatorsu_.charAt(2); break; default: break; } } if (ind !== d.NONE && ind !== d.AZIMUTH) s += hemispheres_.charAt((ind === d.LATITUDE ? 0 : 2) + (sign < 0 ? 0 : 1)); return s; }; })(GeographicLib.DMS); GeographicLib-1.52/js/src/Geodesic.js0000644000771000077100000015501014064202371017302 0ustar ckarneyckarney/* * Geodesic.js * Transcription of Geodesic.[ch]pp into JavaScript. * * See the documentation for the C++ class. The conversion is a literal * conversion from C++. * * The algorithms are derived in * * Charles F. F. Karney, * Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); * https://doi.org/10.1007/s00190-012-0578-z * Addenda: https://geographiclib.sourceforge.io/geod-addenda.html * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ */ // Load AFTER Math.js GeographicLib.Geodesic = {}; GeographicLib.GeodesicLine = {}; GeographicLib.PolygonArea = {}; (function( /** * @exports GeographicLib/Geodesic * @description Solve geodesic problems via the * {@link module:GeographicLib/Geodesic.Geodesic Geodesic} class. */ g, l, p, m, c) { "use strict"; var GEOGRAPHICLIB_GEODESIC_ORDER = 6, nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER, nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER, nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER, nA3x_ = nA3_, nC3x_, nC4x_, maxit1_ = 20, maxit2_ = maxit1_ + m.digits + 10, tol0_ = m.epsilon, tol1_ = 200 * tol0_, tol2_ = Math.sqrt(tol0_), tolb_ = tol0_ * tol1_, xthresh_ = 1000 * tol2_, CAP_NONE = 0, CAP_ALL = 0x1F, CAP_MASK = CAP_ALL, OUT_ALL = 0x7F80, astroid, A1m1f_coeff, C1f_coeff, C1pf_coeff, A2m1f_coeff, C2f_coeff, A3_coeff, C3_coeff, C4_coeff; g.tiny_ = Math.sqrt(Number.MIN_VALUE); g.nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER; g.nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER; g.nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER; g.nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER; g.nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER; nC3x_ = (g.nC3_ * (g.nC3_ - 1)) / 2; nC4x_ = (g.nC4_ * (g.nC4_ + 1)) / 2; 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.NONE = 0; g.ARC = 1<<6; g.LATITUDE = 1<<7 | CAP_NONE; g.LONGITUDE = 1<<8 | g.CAP_C3; g.AZIMUTH = 1<<9 | CAP_NONE; g.DISTANCE = 1<<10 | g.CAP_C1; g.STANDARD = g.LATITUDE | g.LONGITUDE | g.AZIMUTH | g.DISTANCE; 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 = OUT_ALL| CAP_ALL; g.LONG_UNROLL = 1<<15; g.OUT_MASK = OUT_ALL| g.LONG_UNROLL; g.SinCosSeries = function(sinp, sinx, cosx, c) { // 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 = c.length, // Point to one beyond last element n = k - (sinp ? 1 : 0), 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) }; 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, p = m.sq(x), q = m.sq(y), r = (p + q - 1) / 6, S, r2, r3, disc, u, T3, T, ang, v, uv, w; if ( !(q === 0 && 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 = m.sq(r); r3 = r * r2; // The discriminant 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 += T3 < 0 ? -Math.sqrt(disc) : Math.sqrt(disc); // T3 = (r * t)^3 // N.B. cbrt always returns the real root. cbrt(-8) = -2. 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. 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(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; }; A1m1f_coeff = [ // (1-eps)*A1-1, polynomial in eps2 of order 3 +1, 4, 64, 0, 256 ]; // The scale factor A1-1 = mean value of (d/dsigma)I1 - 1 g.A1m1f = function(eps) { var p = Math.floor(nA1_/2), t = m.polyval(p, A1m1f_coeff, 0, m.sq(eps)) / A1m1f_coeff[p + 1]; return (t + eps) / (1 - eps); }; C1f_coeff = [ // C1[1]/eps^1, polynomial in eps2 of order 2 -1, 6, -16, 32, // C1[2]/eps^2, polynomial in eps2 of order 2 -9, 64, -128, 2048, // C1[3]/eps^3, polynomial in eps2 of order 1 +9, -16, 768, // C1[4]/eps^4, polynomial in eps2 of order 1 +3, -5, 512, // C1[5]/eps^5, polynomial in eps2 of order 0 -7, 1280, // C1[6]/eps^6, polynomial in eps2 of order 0 -7, 2048 ]; // The coefficients C1[l] in the Fourier expansion of B1 g.C1f = function(eps, c) { var eps2 = m.sq(eps), d = eps, o = 0, l, p; for (l = 1; l <= g.nC1_; ++l) { // l is index of C1p[l] p = Math.floor((g.nC1_ - l) / 2); // order of polynomial in eps^2 c[l] = d * m.polyval(p, C1f_coeff, o, eps2) / C1f_coeff[o + p + 1]; o += p + 2; d *= eps; } }; C1pf_coeff = [ // C1p[1]/eps^1, polynomial in eps2 of order 2 +205, -432, 768, 1536, // C1p[2]/eps^2, polynomial in eps2 of order 2 +4005, -4736, 3840, 12288, // C1p[3]/eps^3, polynomial in eps2 of order 1 -225, 116, 384, // C1p[4]/eps^4, polynomial in eps2 of order 1 -7173, 2695, 7680, // C1p[5]/eps^5, polynomial in eps2 of order 0 +3467, 7680, // C1p[6]/eps^6, polynomial in eps2 of order 0 +38081, 61440 ]; // The coefficients C1p[l] in the Fourier expansion of B1p g.C1pf = function(eps, c) { var eps2 = m.sq(eps), d = eps, o = 0, l, p; for (l = 1; l <= g.nC1p_; ++l) { // l is index of C1p[l] p = Math.floor((g.nC1p_ - l) / 2); // order of polynomial in eps^2 c[l] = d * m.polyval(p, C1pf_coeff, o, eps2) / C1pf_coeff[o + p + 1]; o += p + 2; d *= eps; } }; A2m1f_coeff = [ // (eps+1)*A2-1, polynomial in eps2 of order 3 -11, -28, -192, 0, 256 ]; // The scale factor A2-1 = mean value of (d/dsigma)I2 - 1 g.A2m1f = function(eps) { var p = Math.floor(nA2_/2), t = m.polyval(p, A2m1f_coeff, 0, m.sq(eps)) / A2m1f_coeff[p + 1]; return (t - eps) / (1 + eps); }; C2f_coeff = [ // C2[1]/eps^1, polynomial in eps2 of order 2 +1, 2, 16, 32, // C2[2]/eps^2, polynomial in eps2 of order 2 +35, 64, 384, 2048, // C2[3]/eps^3, polynomial in eps2 of order 1 +15, 80, 768, // C2[4]/eps^4, polynomial in eps2 of order 1 +7, 35, 512, // C2[5]/eps^5, polynomial in eps2 of order 0 +63, 1280, // C2[6]/eps^6, polynomial in eps2 of order 0 +77, 2048 ]; // The coefficients C2[l] in the Fourier expansion of B2 g.C2f = function(eps, c) { var eps2 = m.sq(eps), d = eps, o = 0, l, p; for (l = 1; l <= g.nC2_; ++l) { // l is index of C2[l] p = Math.floor((g.nC2_ - l) / 2); // order of polynomial in eps^2 c[l] = d * m.polyval(p, C2f_coeff, o, eps2) / C2f_coeff[o + p + 1]; o += p + 2; d *= eps; } }; /** * @class * @property {number} a the equatorial radius (meters). * @property {number} f the flattening. * @summary Initialize a Geodesic object for a specific ellipsoid. * @classdesc Performs geodesic calculations on an ellipsoid of revolution. * The routines for solving the direct and inverse problems return an * object with some of the following fields set: lat1, lon1, azi1, lat2, * lon2, azi2, s12, a12, m12, M12, M21, S12. See {@tutorial 2-interface}, * "The results". * @example * var GeographicLib = require("geographiclib"), * geod = GeographicLib.Geodesic.WGS84; * var inv = geod.Inverse(1,2,3,4); * console.log("lat1 = " + inv.lat1 + ", lon1 = " + inv.lon1 + * ", lat2 = " + inv.lat2 + ", lon2 = " + inv.lon2 + * ",\nazi1 = " + inv.azi1 + ", azi2 = " + inv.azi2 + * ", s12 = " + inv.s12); * @param {number} a the equatorial radius of the ellipsoid (meters). * @param {number} f the flattening of the ellipsoid. Setting f = 0 gives * a sphere (on which geodesics are great circles). Negative f gives a * prolate ellipsoid. * @throws an error if the parameters are illegal. */ g.Geodesic = function(a, f) { this.a = a; this.f = 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". Using the auxiliary sphere // solution with dnm computed at (bet1 + bet2) / 2, the relative error in // the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. // (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a given // f and sig12, the max error occurs for lines near the pole. If the old // rule for computing dnm = (dn1 + dn2)/2 is used, then the error increases // by a factor of 2.) Setting this equal to epsilon gives sig12 = etol2. // Here 0.1 is a safety factor (error decreased by 100) and max(0.001, // abs(f)) stops etol2 getting too large in the nearly spherical case. this._etol2 = 0.1 * tol2_ / Math.sqrt( Math.max(0.001, Math.abs(this.f)) * Math.min(1.0, 1 - this.f/2) / 2 ); if (!(isFinite(this.a) && this.a > 0)) throw new Error("Equatorial radius is not positive"); if (!(isFinite(this._b) && this._b > 0)) throw new Error("Polar semi-axis is not positive"); this._A3x = new Array(nA3x_); this._C3x = new Array(nC3x_); this._C4x = new Array(nC4x_); this.A3coeff(); this.C3coeff(); this.C4coeff(); }; A3_coeff = [ // A3, coeff of eps^5, polynomial in n of order 0 -3, 128, // A3, coeff of eps^4, polynomial in n of order 1 -2, -3, 64, // A3, coeff of eps^3, polynomial in n of order 2 -1, -3, -1, 16, // A3, coeff of eps^2, polynomial in n of order 2 +3, -1, -2, 8, // A3, coeff of eps^1, polynomial in n of order 1 +1, -1, 2, // A3, coeff of eps^0, polynomial in n of order 0 +1, 1 ]; // The scale factor A3 = mean value of (d/dsigma)I3 g.Geodesic.prototype.A3coeff = function() { var o = 0, k = 0, j, p; for (j = nA3_ - 1; j >= 0; --j) { // coeff of eps^j p = Math.min(nA3_ - j - 1, j); // order of polynomial in n this._A3x[k++] = m.polyval(p, A3_coeff, o, this._n) / A3_coeff[o + p + 1]; o += p + 2; } }; C3_coeff = [ // C3[1], coeff of eps^5, polynomial in n of order 0 +3, 128, // C3[1], coeff of eps^4, polynomial in n of order 1 +2, 5, 128, // C3[1], coeff of eps^3, polynomial in n of order 2 -1, 3, 3, 64, // C3[1], coeff of eps^2, polynomial in n of order 2 -1, 0, 1, 8, // C3[1], coeff of eps^1, polynomial in n of order 1 -1, 1, 4, // C3[2], coeff of eps^5, polynomial in n of order 0 +5, 256, // C3[2], coeff of eps^4, polynomial in n of order 1 +1, 3, 128, // C3[2], coeff of eps^3, polynomial in n of order 2 -3, -2, 3, 64, // C3[2], coeff of eps^2, polynomial in n of order 2 +1, -3, 2, 32, // C3[3], coeff of eps^5, polynomial in n of order 0 +7, 512, // C3[3], coeff of eps^4, polynomial in n of order 1 -10, 9, 384, // C3[3], coeff of eps^3, polynomial in n of order 2 +5, -9, 5, 192, // C3[4], coeff of eps^5, polynomial in n of order 0 +7, 512, // C3[4], coeff of eps^4, polynomial in n of order 1 -14, 7, 512, // C3[5], coeff of eps^5, polynomial in n of order 0 +21, 2560 ]; // The coefficients C3[l] in the Fourier expansion of B3 g.Geodesic.prototype.C3coeff = function() { var o = 0, k = 0, l, j, p; for (l = 1; l < g.nC3_; ++l) { // l is index of C3[l] for (j = g.nC3_ - 1; j >= l; --j) { // coeff of eps^j p = Math.min(g.nC3_ - j - 1, j); // order of polynomial in n this._C3x[k++] = m.polyval(p, C3_coeff, o, this._n) / C3_coeff[o + p + 1]; o += p + 2; } } }; C4_coeff = [ // C4[0], coeff of eps^5, polynomial in n of order 0 +97, 15015, // C4[0], coeff of eps^4, polynomial in n of order 1 +1088, 156, 45045, // C4[0], coeff of eps^3, polynomial in n of order 2 -224, -4784, 1573, 45045, // C4[0], coeff of eps^2, polynomial in n of order 3 -10656, 14144, -4576, -858, 45045, // C4[0], coeff of eps^1, polynomial in n of order 4 +64, 624, -4576, 6864, -3003, 15015, // C4[0], coeff of eps^0, polynomial in n of order 5 +100, 208, 572, 3432, -12012, 30030, 45045, // C4[1], coeff of eps^5, polynomial in n of order 0 +1, 9009, // C4[1], coeff of eps^4, polynomial in n of order 1 -2944, 468, 135135, // C4[1], coeff of eps^3, polynomial in n of order 2 +5792, 1040, -1287, 135135, // C4[1], coeff of eps^2, polynomial in n of order 3 +5952, -11648, 9152, -2574, 135135, // C4[1], coeff of eps^1, polynomial in n of order 4 -64, -624, 4576, -6864, 3003, 135135, // C4[2], coeff of eps^5, polynomial in n of order 0 +8, 10725, // C4[2], coeff of eps^4, polynomial in n of order 1 +1856, -936, 225225, // C4[2], coeff of eps^3, polynomial in n of order 2 -8448, 4992, -1144, 225225, // C4[2], coeff of eps^2, polynomial in n of order 3 -1440, 4160, -4576, 1716, 225225, // C4[3], coeff of eps^5, polynomial in n of order 0 -136, 63063, // C4[3], coeff of eps^4, polynomial in n of order 1 +1024, -208, 105105, // C4[3], coeff of eps^3, polynomial in n of order 2 +3584, -3328, 1144, 315315, // C4[4], coeff of eps^5, polynomial in n of order 0 -128, 135135, // C4[4], coeff of eps^4, polynomial in n of order 1 -2560, 832, 405405, // C4[5], coeff of eps^5, polynomial in n of order 0 +128, 99099 ]; g.Geodesic.prototype.C4coeff = function() { var o = 0, k = 0, l, j, p; for (l = 0; l < g.nC4_; ++l) { // l is index of C4[l] for (j = g.nC4_ - 1; j >= l; --j) { // coeff of eps^j p = g.nC4_ - j - 1; // order of polynomial in n this._C4x[k++] = m.polyval(p, C4_coeff, o, this._n) / C4_coeff[o + p + 1]; o += p + 2; } } }; g.Geodesic.prototype.A3f = function(eps) { // Evaluate A3 return m.polyval(nA3x_ - 1, this._A3x, 0, eps); }; g.Geodesic.prototype.C3f = function(eps, c) { // Evaluate C3 coeffs // Elements c[1] thru c[nC3_ - 1] are set var mult = 1, o = 0, l, p; for (l = 1; l < g.nC3_; ++l) { // l is index of C3[l] p = g.nC3_ - l - 1; // order of polynomial in eps mult *= eps; c[l] = mult * m.polyval(p, this._C3x, o, eps); o += p + 1; } }; g.Geodesic.prototype.C4f = function(eps, c) { // Evaluate C4 coeffs // Elements c[0] thru c[g.nC4_ - 1] are set var mult = 1, o = 0, l, p; for (l = 0; l < g.nC4_; ++l) { // l is index of C4[l] p = g.nC4_ - l - 1; // order of polynomial in eps c[l] = mult * m.polyval(p, this._C4x, o, eps); o += p + 1; mult *= eps; } }; // return s12b, m12b, m0, M12, M21 g.Geodesic.prototype.Lengths = function(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask, C1a, C2a) { // Return m12b = (reduced length)/_b; also calculate s12b = // distance/_b, and m0 = coefficient of secular term in // expression for reduced length. outmask &= g.OUT_MASK; var vals = {}, m0x = 0, J12 = 0, A1 = 0, A2 = 0, B1, B2, l, csig12, t; if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) { A1 = g.A1m1f(eps); g.C1f(eps, C1a); if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) { A2 = g.A2m1f(eps); g.C2f(eps, C2a); m0x = A1 - A2; A2 = 1 + A2; } A1 = 1 + A1; } if (outmask & g.DISTANCE) { B1 = g.SinCosSeries(true, ssig2, csig2, C1a) - g.SinCosSeries(true, ssig1, csig1, C1a); // Missing a factor of _b vals.s12b = A1 * (sig12 + B1); if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) { B2 = g.SinCosSeries(true, ssig2, csig2, C2a) - g.SinCosSeries(true, ssig1, csig1, C2a); J12 = m0x * sig12 + (A1 * B1 - A2 * B2); } } else if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) { // Assume here that nC1_ >= nC2_ for (l = 1; l <= g.nC2_; ++l) C2a[l] = A1 * C1a[l] - A2 * C2a[l]; J12 = m0x * sig12 + (g.SinCosSeries(true, ssig2, csig2, C2a) - g.SinCosSeries(true, ssig1, csig1, C2a)); } if (outmask & g.REDUCEDLENGTH) { vals.m0 = m0x; // Missing a factor of _b. // Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure // accurate cancellation in the case of coincident points. vals.m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12; } if (outmask & g.GEODESICSCALE) { csig12 = csig1 * csig2 + ssig1 * ssig2; t = this._ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2); vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1; vals.M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2; } return vals; }; // return sig12, salp1, calp1, salp2, calp2, dnm g.Geodesic.prototype.InverseStart = function(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, 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, sbet12a, shortline, omg12, sbetm2, somg12, comg12, t, ssig12, csig12, x, y, lamscale, betscale, k2, eps, cbet12a, bet12a, m12b, m0, nvals, k, omg12a, lam12x; 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 sbet12a = sbet2 * cbet1; sbet12a += cbet2 * sbet1; shortline = cbet12 >= 0 && sbet12 < 0.5 && cbet2 * lam12 < 0.5; if (shortline) { sbetm2 = m.sq(sbet1 + sbet2); // sin((bet1+bet2)/2)^2 // = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) sbetm2 /= sbetm2 + m.sq(cbet1 + cbet2); vals.dnm = Math.sqrt(1 + this._ep2 * sbetm2); omg12 = lam12 / (this._f1 * vals.dnm); somg12 = Math.sin(omg12); comg12 = Math.cos(omg12); } else { somg12 = slam12; comg12 = clam12; } vals.salp1 = cbet2 * somg12; vals.calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * m.sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12); 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 * (comg12 >= 0 ? m.sq(somg12) / (1 + comg12) : 1 - comg12); // norm(vals.salp2, vals.calp2); t = m.hypot(vals.salp2, vals.calp2); vals.salp2 /= t; vals.calp2 /= t; // Set return value vals.sig12 = Math.atan2(ssig12, csig12); } else if (Math.abs(this._n) > 0.1 || // Skip astroid calc if too eccentric csig12 >= 0 || ssig12 >= 6 * Math.abs(this._n) * 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. lam12x = Math.atan2(-slam12, -clam12); // lam12 - pi if (this.f >= 0) { // In fact f == 0 does not get here // x = dlong, y = dlat 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 = lam12x / lamscale; y = sbet12a / betscale; } else { // f < 0 // x = dlat, y = dlong cbet12a = cbet2 * cbet1 - sbet2 * sbet1; bet12a = Math.atan2(sbet12a, cbet12a); // In the case of lon12 = 180, this repeats a calculation made // in Inverse. nvals = this.Lengths(this._n, Math.PI + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a); m12b = nvals.m12b; m0 = nvals.m0; x = -1 + m12b / (cbet1 * cbet2 * m0 * Math.PI); betscale = x < -0.01 ? sbet12a / x : -this.f * m.sq(cbet1) * Math.PI; lamscale = betscale / cbet1; y = lam12 / lamscale; } if (y > -tol1_ && x > -1 - 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 > -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 k = astroid(x, y); 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); } } // Sanity check on starting guess. Backwards check allows NaN through. if (!(vals.salp1 <= 0.0)) { // norm(vals.salp1, vals.calp1); t = m.hypot(vals.salp1, vals.calp1); vals.salp1 /= t; vals.calp1 /= t; } else { vals.salp1 = 1; vals.calp1 = 0; } return vals; }; // return lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, // domg12, dlam12, g.Geodesic.prototype.Lambda12 = function(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam120, clam120, diffp, C1a, C2a, C3a) { var vals = {}, t, salp0, calp0, somg1, comg1, somg2, comg2, somg12, comg12, B312, eta, k2, nvals; if (sbet1 === 0 && calp1 === 0) // Break degeneracy of equatorial line. This case has already been // handled. calp1 = -g.tiny_; // sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1; calp0 = m.hypot(calp1, salp1 * sbet1); // calp0 > 0 // 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; // norm(vals.ssig1, vals.csig1); t = m.hypot(vals.ssig1, vals.csig1); vals.ssig1 /= t; vals.csig1 /= t; // norm(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; // norm(vals.ssig2, vals.csig2); t = m.hypot(vals.ssig2, vals.csig2); vals.ssig2 /= t; vals.csig2 /= t; // norm(somg2, comg2); -- don't need to normalize! // sig12 = sig2 - sig1, limit to [0, pi] vals.sig12 = Math.atan2(Math.max(0, vals.csig1 * vals.ssig2 - vals.ssig1 * vals.csig2), vals.csig1 * vals.csig2 + vals.ssig1 * vals.ssig2); // omg12 = omg2 - omg1, limit to [0, pi] somg12 = Math.max(0, comg1 * somg2 - somg1 * comg2); comg12 = comg1 * comg2 + somg1 * somg2; // eta = omg12 - lam120 eta = Math.atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120); 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.SinCosSeries(true, vals.ssig1, vals.csig1, C3a)); vals.domg12 = -this.f * this.A3f(vals.eps) * salp0 * (vals.sig12 + B312); vals.lam12 = eta + vals.domg12; if (diffp) { if (vals.calp2 === 0) vals.dlam12 = -2 * this._f1 * dn1 / sbet1; else { nvals = this.Lengths(vals.eps, vals.sig12, vals.ssig1, vals.csig1, dn1, vals.ssig2, vals.csig2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a); vals.dlam12 = nvals.m12b; vals.dlam12 *= this._f1 / (vals.calp2 * cbet2); } } return vals; }; /** * @summary Solve the inverse geodesic problem. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} lat2 the latitude of the second point in degrees. * @param {number} lon2 the longitude of the second point in degrees. * @param {bitmask} [outmask = STANDARD] which results to include. * @returns {object} the requested results * @description The lat1, lon1, lat2, lon2, and a12 fields of the result are * always set. For details on the outmask parameter, see {@tutorial * 2-interface}, "The outmask and caps parameters". */ g.Geodesic.prototype.Inverse = function(lat1, lon1, lat2, lon2, outmask) { var r, vals; if (!outmask) outmask = g.STANDARD; if (outmask === g.LONG_UNROLL) outmask |= g.STANDARD; outmask &= g.OUT_MASK; r = this.InverseInt(lat1, lon1, lat2, lon2, outmask); vals = r.vals; if (outmask & g.AZIMUTH) { vals.azi1 = m.atan2d(r.salp1, r.calp1); vals.azi2 = m.atan2d(r.salp2, r.calp2); } return vals; }; g.Geodesic.prototype.InverseInt = function(lat1, lon1, lat2, lon2, outmask) { var vals = {}, lon12, lon12s, lonsign, t, swapp, latsign, sbet1, cbet1, sbet2, cbet2, s12x, m12x, dn1, dn2, lam12, slam12, clam12, sig12, calp1, salp1, calp2, salp2, C1a, C2a, C3a, meridian, nvals, ssig1, csig1, ssig2, csig2, eps, omg12, dnm, numit, salp1a, calp1a, salp1b, calp1b, tripn, tripb, v, dv, dalp1, sdalp1, cdalp1, nsalp1, lengthmask, salp0, calp0, alp12, k2, A4, C4a, B41, B42, somg12, comg12, domg12, dbet1, dbet2, salp12, calp12, sdomg12, cdomg12; // Compute longitude difference (AngDiff does this carefully). Result is // in [-180, 180] but -180 is only for west-going geodesics. 180 is for // east-going and meridional geodesics. vals.lat1 = lat1 = m.LatFix(lat1); vals.lat2 = lat2 = m.LatFix(lat2); // If really close to the equator, treat as on equator. lat1 = m.AngRound(lat1); lat2 = m.AngRound(lat2); lon12 = m.AngDiff(lon1, lon2); lon12s = lon12.t; lon12 = lon12.s; if (outmask & g.LONG_UNROLL) { vals.lon1 = lon1; vals.lon2 = (lon1 + lon12) + lon12s; } else { vals.lon1 = m.AngNormalize(lon1); vals.lon2 = m.AngNormalize(lon2); } // Make longitude difference positive. lonsign = lon12 >= 0 ? 1 : -1; // If very close to being on the same half-meridian, then make it so. lon12 = lonsign * m.AngRound(lon12); lon12s = m.AngRound((180 - lon12) - lonsign * lon12s); lam12 = lon12 * m.degree; t = m.sincosd(lon12 > 90 ? lon12s : lon12); slam12 = t.s; clam12 = (lon12 > 90 ? -1 : 1) * t.c; // Swap points so that point with higher (abs) latitude is point 1 // If one latitude is a nan, then it becomes lat1. swapp = Math.abs(lat1) < Math.abs(lat2) ? -1 : 1; if (swapp < 0) { lonsign *= -1; t = lat1; lat1 = lat2; lat2 = t; // swap(lat1, lat2); } // Make lat1 <= 0 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. t = m.sincosd(lat1); sbet1 = this._f1 * t.s; cbet1 = t.c; // norm(sbet1, cbet1); t = m.hypot(sbet1, cbet1); sbet1 /= t; cbet1 /= t; // Ensure cbet1 = +epsilon at poles cbet1 = Math.max(g.tiny_, cbet1); t = m.sincosd(lat2); sbet2 = this._f1 * t.s; cbet2 = t.c; // norm(sbet2, cbet2); t = m.hypot(sbet2, cbet2); sbet2 /= t; cbet2 /= t; // Ensure cbet2 = +epsilon at poles cbet2 = Math.max(g.tiny_, 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 (Math.abs(sbet2) === -sbet1) cbet2 = cbet1; } dn1 = Math.sqrt(1 + this._ep2 * m.sq(sbet1)); dn2 = Math.sqrt(1 + this._ep2 * m.sq(sbet2)); // index zero elements of these arrays are unused C1a = new Array(g.nC1_ + 1); C2a = new Array(g.nC2_ + 1); C3a = new Array(g.nC3_); 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 // tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1; csig1 = calp1 * cbet1; ssig2 = sbet2; csig2 = calp2 * cbet2; // sig12 = sig2 - sig1 sig12 = Math.atan2(Math.max(0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); nvals = this.Lengths(this._n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | g.DISTANCE | g.REDUCEDLENGTH, C1a, C2a); s12x = nvals.s12b; m12x = nvals.m12b; // Ignore m0 if (outmask & g.GEODESICSCALE) { 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 | GeodSolve -i // // In fact, we will have sig12 > pi/2 for meridional geodesic // which is not a shortest path. if (sig12 < 1 || m12x >= 0) { // Need at least 2, to handle 90 0 90 180 if (sig12 < 3 * g.tiny_ || // Prevent negative s12 or m12 for short lines (sig12 < tol0_ && (s12x < 0 || m12x < 0))) sig12 = m12x = s12x = 0; m12x *= this._b; s12x *= this._b; vals.a12 = sig12 / m.degree; } else // m12 < 0, i.e., prolate and too close to anti-podal meridian = false; } somg12 = 2; if (!meridian && sbet1 === 0 && // and sbet2 == 0 (this.f <= 0 || lon12s >= this.f * 180)) { // Geodesic runs along equator calp1 = calp2 = 0; salp1 = salp2 = 1; s12x = this.a * lam12; sig12 = omg12 = lam12 / this._f1; m12x = this._b * Math.sin(sig12); if (outmask & g.GEODESICSCALE) vals.M12 = vals.M21 = Math.cos(sig12); vals.a12 = lon12 / 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 nvals = this.InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, 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, dnm) dnm = nvals.dnm; s12x = sig12 * this._b * dnm; m12x = m.sq(dnm) * this._b * Math.sin(sig12 / dnm); if (outmask & g.GEODESICSCALE) vals.M12 = vals.M21 = Math.cos(sig12 / dnm); vals.a12 = sig12 / m.degree; omg12 = lam12 / (this._f1 * dnm); } else { // Newton's method. This is a straightforward solution of f(alp1) = // lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one // root in the interval (0, pi) and its derivative is positive at the // root. Thus f(alp) is positive for alp > alp1 and negative for alp < // alp1. During the course of the iteration, a range (alp1a, alp1b) is // maintained which brackets the root and with each evaluation of // f(alp) the range is shrunk if possible. Newton's method is // restarted whenever the derivative of f is negative (because the new // value of alp1 is then further from the solution) or if the new // estimate of alp1 lies outside (0,pi); in this case, the new starting // guess is taken to be (alp1a + alp1b) / 2. numit = 0; // Bracketing range salp1a = g.tiny_; calp1a = 1; salp1b = g.tiny_; calp1b = -1; for (tripn = false, tripb = false; numit < maxit2_; ++numit) { // the WGS84 test set: mean = 1.47, sd = 1.25, max = 16 // WGS84 and random input: mean = 2.85, sd = 0.60 nvals = this.Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, numit < maxit1_, C1a, C2a, C3a); v = nvals.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; domg12 = nvals.domg12; dv = nvals.dlam12; // Reversed test to allow escape with NaNs if (tripb || !(Math.abs(v) >= (tripn ? 8 : 1) * tol0_)) break; // Update bracketing values if (v > 0 && (numit < maxit1_ || calp1/salp1 > calp1b/salp1b)) { salp1b = salp1; calp1b = calp1; } else if (v < 0 && (numit < maxit1_ || calp1/salp1 < calp1a/salp1a)) { salp1a = salp1; calp1a = calp1; } if (numit < maxit1_ && dv > 0) { dalp1 = -v/dv; sdalp1 = Math.sin(dalp1); cdalp1 = Math.cos(dalp1); nsalp1 = salp1 * cdalp1 + calp1 * sdalp1; if (nsalp1 > 0 && Math.abs(dalp1) < Math.PI) { calp1 = calp1 * cdalp1 - salp1 * sdalp1; salp1 = nsalp1; // norm(salp1, calp1); 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). tripn = Math.abs(v) <= 16 * tol0_; continue; } } // Either dv was not positive or updated value was outside legal // range. Use the midpoint of the bracket as the next estimate. // This mechanism is not needed for the WGS84 ellipsoid, but it does // catch problems with more eccentric ellipsoids. Its efficacy is // such for the WGS84 test set with the starting guess set to alp1 = // 90deg: // the WGS84 test set: mean = 5.21, sd = 3.93, max = 24 // WGS84 and random input: mean = 4.74, sd = 0.99 salp1 = (salp1a + salp1b)/2; calp1 = (calp1a + calp1b)/2; // norm(salp1, calp1); t = m.hypot(salp1, calp1); salp1 /= t; calp1 /= t; tripn = false; tripb = (Math.abs(salp1a - salp1) + (calp1a - calp1) < tolb_ || Math.abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_); } lengthmask = outmask | (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE) ? g.DISTANCE : g.NONE); nvals = this.Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, lengthmask, C1a, C2a); s12x = nvals.s12b; m12x = nvals.m12b; // Ignore m0 if (outmask & g.GEODESICSCALE) { vals.M12 = nvals.M12; vals.M21 = nvals.M21; } m12x *= this._b; s12x *= this._b; vals.a12 = sig12 / m.degree; if (outmask & g.AREA) { // omg12 = lam12 - domg12 sdomg12 = Math.sin(domg12); cdomg12 = Math.cos(domg12); somg12 = slam12 * cdomg12 - clam12 * sdomg12; comg12 = clam12 * cdomg12 + slam12 * sdomg12; } } } 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) { // From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1; calp0 = m.hypot(calp1, salp1 * sbet1); // calp0 > 0 if (calp0 !== 0 && salp0 !== 0) { // From Lambda12: tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1; csig1 = calp1 * cbet1; ssig2 = sbet2; csig2 = calp2 * cbet2; k2 = m.sq(calp0) * this._ep2; eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2); // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = m.sq(this.a) * calp0 * salp0 * this._e2; // norm(ssig1, csig1); t = m.hypot(ssig1, csig1); ssig1 /= t; csig1 /= t; // norm(ssig2, csig2); t = m.hypot(ssig2, csig2); ssig2 /= t; csig2 /= t; C4a = new Array(g.nC4_); this.C4f(eps, C4a); B41 = g.SinCosSeries(false, ssig1, csig1, C4a); B42 = g.SinCosSeries(false, ssig2, csig2, C4a); vals.S12 = A4 * (B42 - B41); } else // Avoid problems with indeterminate sig1, sig2 on equator vals.S12 = 0; if (!meridian && somg12 > 1) { somg12 = Math.sin(omg12); comg12 = Math.cos(omg12); } if (!meridian && comg12 > -0.7071 && // Long difference not too big sbet2 - sbet1 < 1.75) { // Lat difference not 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)) domg12 = 1 + comg12; 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 && 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) { t = salp1; salp1 = salp2; salp2 = t; // swap(salp1, salp2); t = calp1; calp1 = calp2; calp2 = t; // swap(calp1, calp2); if (outmask & g.GEODESICSCALE) { 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; return {vals: vals, salp1: salp1, calp1: calp1, salp2: salp2, calp2: calp2}; }; /** * @summary Solve the general direct geodesic problem. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} azi1 the azimuth at the first point in degrees. * @param {bool} arcmode is the next parameter an arc length? * @param {number} s12_a12 the (arcmode ? arc length : distance) from the * first point to the second in (arcmode ? degrees : meters). * @param {bitmask} [outmask = STANDARD] which results to include. * @returns {object} the requested results. * @description The lat1, lon1, azi1, and a12 fields of the result are always * set; s12 is included if arcmode is false. For details on the outmask * parameter, see {@tutorial 2-interface}, "The outmask and caps * parameters". */ g.Geodesic.prototype.GenDirect = function(lat1, lon1, azi1, arcmode, s12_a12, outmask) { var line; if (!outmask) outmask = g.STANDARD; else if (outmask === g.LONG_UNROLL) outmask |= g.STANDARD; // Automatically supply DISTANCE_IN if necessary if (!arcmode) outmask |= g.DISTANCE_IN; line = new l.GeodesicLine(this, lat1, lon1, azi1, outmask); return line.GenPosition(arcmode, s12_a12, outmask); }; /** * @summary Solve the direct geodesic problem. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} azi1 the azimuth at the first point in degrees. * @param {number} s12 the distance from the first point to the second in * meters. * @param {bitmask} [outmask = STANDARD] which results to include. * @returns {object} the requested results. * @description The lat1, lon1, azi1, s12, and a12 fields of the result are * always set. For details on the outmask parameter, see {@tutorial * 2-interface}, "The outmask and caps parameters". */ g.Geodesic.prototype.Direct = function(lat1, lon1, azi1, s12, outmask) { return this.GenDirect(lat1, lon1, azi1, false, s12, outmask); }; /** * @summary Solve the direct geodesic problem with arc length. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} azi1 the azimuth at the first point in degrees. * @param {number} a12 the arc length from the first point to the second in * degrees. * @param {bitmask} [outmask = STANDARD] which results to include. * @returns {object} the requested results. * @description The lat1, lon1, azi1, and a12 fields of the result are * always set. For details on the outmask parameter, see {@tutorial * 2-interface}, "The outmask and caps parameters". */ g.Geodesic.prototype.ArcDirect = function(lat1, lon1, azi1, a12, outmask) { return this.GenDirect(lat1, lon1, azi1, true, a12, outmask); }; /** * @summary Create a {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} object. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} azi1 the azimuth at the first point in degrees. * degrees. * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to * include. * @returns {object} the * {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} object * @description For details on the caps parameter, see {@tutorial * 2-interface}, "The outmask and caps parameters". */ g.Geodesic.prototype.Line = function(lat1, lon1, azi1, caps) { return new l.GeodesicLine(this, lat1, lon1, azi1, caps); }; /** * @summary Define a {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} in terms of the direct geodesic problem specified in terms * of distance. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} azi1 the azimuth at the first point in degrees. * degrees. * @param {number} s12 the distance between point 1 and point 2 (meters); it * can be negative. * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to * include. * @returns {object} the * {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} object * @description This function sets point 3 of the GeodesicLine to correspond * to point 2 of the direct geodesic problem. For details on the caps * parameter, see {@tutorial 2-interface}, "The outmask and caps * parameters". */ g.Geodesic.prototype.DirectLine = function(lat1, lon1, azi1, s12, caps) { return this.GenDirectLine(lat1, lon1, azi1, false, s12, caps); }; /** * @summary Define a {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} in terms of the direct geodesic problem specified in terms * of arc length. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} azi1 the azimuth at the first point in degrees. * degrees. * @param {number} a12 the arc length between point 1 and point 2 (degrees); * it can be negative. * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to * include. * @returns {object} the * {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} object * @description This function sets point 3 of the GeodesicLine to correspond * to point 2 of the direct geodesic problem. For details on the caps * parameter, see {@tutorial 2-interface}, "The outmask and caps * parameters". */ g.Geodesic.prototype.ArcDirectLine = function(lat1, lon1, azi1, a12, caps) { return this.GenDirectLine(lat1, lon1, azi1, true, a12, caps); }; /** * @summary Define a {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} in terms of the direct geodesic problem specified in terms * of either distance or arc length. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} azi1 the azimuth at the first point in degrees. * degrees. * @param {bool} arcmode boolean flag determining the meaning of the * s12_a12. * @param {number} s12_a12 if 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 negative. * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to * include. * @returns {object} the * {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} object * @description This function sets point 3 of the GeodesicLine to correspond * to point 2 of the direct geodesic problem. For details on the caps * parameter, see {@tutorial 2-interface}, "The outmask and caps * parameters". */ g.Geodesic.prototype.GenDirectLine = function(lat1, lon1, azi1, arcmode, s12_a12, caps) { var t; if (!caps) caps = g.STANDARD | g.DISTANCE_IN; // Automatically supply DISTANCE_IN if necessary if (!arcmode) caps |= g.DISTANCE_IN; t = new l.GeodesicLine(this, lat1, lon1, azi1, caps); t.GenSetDistance(arcmode, s12_a12); return t; }; /** * @summary Define a {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} in terms of the inverse geodesic problem. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} lat2 the latitude of the second point in degrees. * @param {number} lon2 the longitude of the second point in degrees. * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to * include. * @returns {object} the * {@link module:GeographicLib/GeodesicLine.GeodesicLine * GeodesicLine} object * @description This function sets point 3 of the GeodesicLine to correspond * to point 2 of the inverse geodesic problem. For details on the caps * parameter, see {@tutorial 2-interface}, "The outmask and caps * parameters". */ g.Geodesic.prototype.InverseLine = function(lat1, lon1, lat2, lon2, caps) { var r, t, azi1; if (!caps) caps = g.STANDARD | g.DISTANCE_IN; r = this.InverseInt(lat1, lon1, lat2, lon2, g.ARC); azi1 = m.atan2d(r.salp1, r.calp1); // Ensure that a12 can be converted to a distance if (caps & (g.OUT_MASK & g.DISTANCE_IN)) caps |= g.DISTANCE; t = new l.GeodesicLine(this, lat1, lon1, azi1, caps, r.salp1, r.calp1); t.SetArc(r.vals.a12); return t; }; /** * @summary Create a {@link module:GeographicLib/PolygonArea.PolygonArea * PolygonArea} object. * @param {bool} [polyline = false] if true the new PolygonArea object * describes a polyline instead of a polygon. * @returns {object} the * {@link module:GeographicLib/PolygonArea.PolygonArea * PolygonArea} object */ g.Geodesic.prototype.Polygon = function(polyline) { return new p.PolygonArea(this, polyline); }; /** * @summary a {@link module:GeographicLib/Geodesic.Geodesic Geodesic} object * initialized for the WGS84 ellipsoid. * @constant {object} */ g.WGS84 = new g.Geodesic(c.WGS84.a, c.WGS84.f); })(GeographicLib.Geodesic, GeographicLib.GeodesicLine, GeographicLib.PolygonArea, GeographicLib.Math, GeographicLib.Constants); GeographicLib-1.52/js/src/GeodesicLine.js0000644000771000077100000004170414064202371020116 0ustar ckarneyckarney/* * GeodesicLine.js * Transcription of GeodesicLine.[ch]pp into JavaScript. * * See the documentation for the C++ class. The conversion is a literal * conversion from C++. * * The algorithms are derived in * * Charles F. F. Karney, * Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); * https://doi.org/10.1007/s00190-012-0578-z * Addenda: https://geographiclib.sourceforge.io/geod-addenda.html * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ */ // Load AFTER GeographicLib/Math.js, GeographicLib/Geodesic.js (function( g, /** * @exports GeographicLib/GeodesicLine * @description Solve geodesic problems on a single geodesic line via the * {@link module:GeographicLib/GeodesicLine.GeodesicLine GeodesicLine} * class. */ l, m) { "use strict"; /** * @class * @property {number} a the equatorial radius (meters). * @property {number} f the flattening. * @property {number} lat1 the initial latitude (degrees). * @property {number} lon1 the initial longitude (degrees). * @property {number} azi1 the initial azimuth (degrees). * @property {number} salp1 the sine of the azimuth at the first point. * @property {number} calp1 the cosine the azimuth at the first point. * @property {number} s13 the distance to point 3 (meters). * @property {number} a13 the arc length to point 3 (degrees). * @property {bitmask} caps the capabilities of the object. * @summary Initialize a GeodesicLine object. For details on the caps * parameter, see {@tutorial 2-interface}, "The outmask and caps * parameters". * @classdesc Performs geodesic calculations along a given geodesic line. * This object is usually instantiated by * {@link module:GeographicLib/Geodesic.Geodesic#Line Geodesic.Line}. * The methods * {@link module:GeographicLib/Geodesic.Geodesic#DirectLine * Geodesic.DirectLine} and * {@link module:GeographicLib/Geodesic.Geodesic#InverseLine * Geodesic.InverseLine} set in addition the position of a reference point * 3. * @param {object} geod a {@link module:GeographicLib/Geodesic.Geodesic * Geodesic} object. * @param {number} lat1 the latitude of the first point in degrees. * @param {number} lon1 the longitude of the first point in degrees. * @param {number} azi1 the azimuth at the first point in degrees. * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to * include; LATITUDE | AZIMUTH are always included. */ l.GeodesicLine = function(geod, lat1, lon1, azi1, caps, salp1, calp1) { var t, cbet1, sbet1, eps, s, c; if (!caps) caps = g.STANDARD | g.DISTANCE_IN; this.a = geod.a; this.f = geod.f; this._b = geod._b; this._c2 = geod._c2; this._f1 = geod._f1; this.caps = caps | g.LATITUDE | g.AZIMUTH | g.LONG_UNROLL; this.lat1 = m.LatFix(lat1); this.lon1 = lon1; if (typeof salp1 === 'undefined' || typeof calp1 === 'undefined') { this.azi1 = m.AngNormalize(azi1); t = m.sincosd(m.AngRound(this.azi1)); this.salp1 = t.s; this.calp1 = t.c; } else { this.azi1 = azi1; this.salp1 = salp1; this.calp1 = calp1; } t = m.sincosd(m.AngRound(this.lat1)); sbet1 = this._f1 * t.s; cbet1 = t.c; // norm(sbet1, cbet1); t = m.hypot(sbet1, cbet1); sbet1 /= t; cbet1 /= t; // Ensure cbet1 = +epsilon at poles cbet1 = Math.max(g.tiny_, cbet1); this._dn1 = Math.sqrt(1 + geod._ep2 * m.sq(sbet1)); // 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; // norm(this._ssig1, this._csig1); // sig1 in (-pi, pi] t = m.hypot(this._ssig1, this._csig1); this._ssig1 /= t; this._csig1 /= t; // norm(this._somg1, this._comg1); -- don't need to normalize! this._k2 = m.sq(this._calp0) * geod._ep2; 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); 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); } 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); } 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); } if (this.caps & g.CAP_C4) { this._C4a = new Array(g.nC4_); // all the elements of _C4a are used geod.C4f(eps, 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); } this.a13 = this.s13 = Number.NaN; }; /** * @summary Find the position on the line (general case). * @param {bool} arcmode is the next parameter an arc length? * @param {number} s12_a12 the (arcmode ? arc length : distance) from the * first point to the second in (arcmode ? degrees : meters). * @param {bitmask} [outmask = STANDARD] which results to include; this is * subject to the capabilities of the object. * @returns {object} the requested results. * @description The lat1, lon1, azi1, and a12 fields of the result are * always set; s12 is included if arcmode is false. For details on the * outmask parameter, see {@tutorial 2-interface}, "The outmask and caps * parameters". */ l.GeodesicLine.prototype.GenPosition = function(arcmode, s12_a12, outmask) { var vals = {}, sig12, ssig12, csig12, B12, AB1, ssig2, csig2, tau12, s, c, serr, omg12, lam12, lon12, E, sbet2, cbet2, somg2, comg2, salp2, calp2, dn2, B22, AB2, J12, t, B42, salp12, calp12; if (!outmask) outmask = g.STANDARD; else if (outmask === g.LONG_UNROLL) outmask |= g.STANDARD; outmask &= this.caps & g.OUT_MASK; vals.lat1 = this.lat1; vals.azi1 = this.azi1; vals.lon1 = outmask & g.LONG_UNROLL ? this.lon1 : m.AngNormalize(this.lon1); if (arcmode) vals.a12 = s12_a12; else vals.s12 = s12_a12; if (!( arcmode || (this.caps & g.DISTANCE_IN & g.OUT_MASK) )) { // Uninitialized or impossible distance calculation requested vals.a12 = Number.NaN; return vals; } // Avoid warning about uninitialized B12. B12 = 0; AB1 = 0; if (arcmode) { // Interpret s12_a12 as spherical arc length sig12 = s12_a12 * m.degree; t = m.sincosd(s12_a12); ssig12 = t.s; csig12 = t.c; } else { // Interpret s12_a12 as distance 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); sig12 = tau12 - (B12 - this._B11); ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12); if (Math.abs(this.f) > 0.01) { // Reverted distance series is inaccurate for |f| > 1/100, so correct // sig12 with 1 Newton iteration. The following table shows the // approximate maximum error for a = WGS_a() and various f relative to // GeodesicExact. // erri = the error in the inverse solution (nm) // errd = the error in the direct solution (series only) (nm) // errda = the error in the direct solution // (series + 1 Newton) (nm) // // f erri errd errda // -1/5 12e6 1.2e9 69e6 // -1/10 123e3 12e6 765e3 // -1/20 1110 108e3 7155 // -1/50 18.63 200.9 27.12 // -1/100 18.63 23.78 23.37 // -1/150 18.63 21.05 20.26 // 1/150 22.35 24.73 25.83 // 1/100 22.35 25.03 25.31 // 1/50 29.80 231.9 30.44 // 1/20 5376 146e3 10e3 // 1/10 829e3 22e6 1.5e6 // 1/5 157e6 3.8e9 280e6 ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12; csig2 = this._csig1 * csig12 - this._ssig1 * ssig12; B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a); serr = (1 + this._A1m1) * (sig12 + (B12 - this._B11)) - s12_a12 / this._b; sig12 = sig12 - serr / Math.sqrt(1 + this._k2 * m.sq(ssig2)); ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12); // Update B12 below } } // sig2 = sig1 + sig12 ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12; csig2 = this._csig1 * csig12 - this._ssig1 * ssig12; dn2 = Math.sqrt(1 + this._k2 * m.sq(ssig2)); if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) { if (arcmode || Math.abs(this.f) > 0.01) B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a); 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(alp0) = cos(sig2)*tan(alp2) salp2 = this._salp0; calp2 = this._calp0 * csig2; // No need to normalize if (arcmode && (outmask & g.DISTANCE)) vals.s12 = this._b * ((1 + this._A1m1) * sig12 + AB1); if (outmask & g.LONGITUDE) { // tan(omg2) = sin(alp0) * tan(sig2) somg2 = this._salp0 * ssig2; comg2 = csig2; // No need to normalize E = m.copysign(1, this._salp0); // omg12 = omg2 - omg1 omg12 = outmask & g.LONG_UNROLL ? E * (sig12 - (Math.atan2(ssig2, csig2) - Math.atan2(this._ssig1, this._csig1)) + (Math.atan2(E * somg2, comg2) - Math.atan2(E * this._somg1, this._comg1))) : Math.atan2(somg2 * this._comg1 - comg2 * this._somg1, comg2 * this._comg1 + somg2 * this._somg1); lam12 = omg12 + this._A3c * ( sig12 + (g.SinCosSeries(true, ssig2, csig2, this._C3a) - this._B31)); lon12 = lam12 / m.degree; vals.lon2 = outmask & g.LONG_UNROLL ? this.lon1 + lon12 : m.AngNormalize(m.AngNormalize(this.lon1) + m.AngNormalize(lon12)); } if (outmask & g.LATITUDE) vals.lat2 = m.atan2d(sbet2, this._f1 * cbet2); if (outmask & g.AZIMUTH) vals.azi2 = m.atan2d(salp2, calp2); if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) { B22 = g.SinCosSeries(true, ssig2, csig2, this._C2a); 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 * (( dn2 * (this._csig1 * ssig2) - this._dn1 * (this._ssig1 * csig2)) - this._csig1 * csig2 * J12); if (outmask & g.GEODESICSCALE) { t = this._k2 * (ssig2 - this._ssig1) * (ssig2 + this._ssig1) / (this._dn1 + dn2); vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * this._ssig1 / this._dn1; vals.M21 = csig12 - (t * this._ssig1 - this._csig1 * J12) * ssig2 / dn2; } } if (outmask & g.AREA) { B42 = g.SinCosSeries(false, ssig2, csig2, this._C4a); if (this._calp0 === 0 || this._salp0 === 0) { // alp12 = alp2 - alp1, used in atan2 so no need to normalize salp12 = salp2 * this.calp1 - calp2 * this.salp1; calp12 = calp2 * this.calp1 + salp2 * this.salp1; } 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); } if (!arcmode) vals.a12 = sig12 / m.degree; return vals; }; /** * @summary Find the position on the line given s12. * @param {number} s12 the distance from the first point to the second in * meters. * @param {bitmask} [outmask = STANDARD] which results to include; this is * subject to the capabilities of the object. * @returns {object} the requested results. * @description The lat1, lon1, azi1, s12, and a12 fields of the result are * always set; s12 is included if arcmode is false. For details on the * outmask parameter, see {@tutorial 2-interface}, "The outmask and caps * parameters". */ l.GeodesicLine.prototype.Position = function(s12, outmask) { return this.GenPosition(false, s12, outmask); }; /** * @summary Find the position on the line given a12. * @param {number} a12 the arc length from the first point to the second in * degrees. * @param {bitmask} [outmask = STANDARD] which results to include; this is * subject to the capabilities of the object. * @returns {object} the requested results. * @description The lat1, lon1, azi1, and a12 fields of the result are * always set. For details on the outmask parameter, see {@tutorial * 2-interface}, "The outmask and caps parameters". */ l.GeodesicLine.prototype.ArcPosition = function(a12, outmask) { return this.GenPosition(true, a12, outmask); }; /** * @summary Specify position of point 3 in terms of either distance or arc * length. * @param {bool} arcmode boolean flag determining the meaning of the second * parameter; if arcmode is false, then the GeodesicLine object must have * been constructed with caps |= DISTANCE_IN. * @param {number} s13_a13 if arcmode is false, this is the distance from * point 1 to point 3 (meters); otherwise it is the arc length from * point 1 to point 3 (degrees); it can be negative. */ l.GeodesicLine.prototype.GenSetDistance = function(arcmode, s13_a13) { if (arcmode) this.SetArc(s13_a13); else this.SetDistance(s13_a13); }; /** * @summary Specify position of point 3 in terms distance. * @param {number} s13 the distance from point 1 to point 3 (meters); it * can be negative. */ l.GeodesicLine.prototype.SetDistance = function(s13) { var r; this.s13 = s13; r = this.GenPosition(false, this.s13, g.ARC); this.a13 = 0 + r.a12; // the 0+ converts undefined into NaN }; /** * @summary Specify position of point 3 in terms of arc length. * @param {number} a13 the arc length from point 1 to point 3 (degrees); * it can be negative. */ l.GeodesicLine.prototype.SetArc = function(a13) { var r; this.a13 = a13; r = this.GenPosition(true, this.a13, g.DISTANCE); this.s13 = 0 + r.s12; // the 0+ converts undefined into NaN }; })(GeographicLib.Geodesic, GeographicLib.GeodesicLine, GeographicLib.Math); GeographicLib-1.52/js/src/Math.js0000644000771000077100000003423714064202371016460 0ustar ckarneyckarney/* * Math.js * Transcription of Math.hpp, Constants.hpp, and Accumulator.hpp into * JavaScript. * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ */ /** * @namespace GeographicLib * @description The parent namespace for the following modules: * - {@link module:GeographicLib/Geodesic GeographicLib/Geodesic} The main * engine for solving geodesic problems via the * {@link module:GeographicLib/Geodesic.Geodesic Geodesic} class. * - {@link module:GeographicLib/GeodesicLine GeographicLib/GeodesicLine} * computes points along a single geodesic line via the * {@link module:GeographicLib/GeodesicLine.GeodesicLine GeodesicLine} * class. * - {@link module:GeographicLib/PolygonArea GeographicLib/PolygonArea} * computes the area of a geodesic polygon via the * {@link module:GeographicLib/PolygonArea.PolygonArea PolygonArea} * class. * - {@link module:GeographicLib/DMS GeographicLib/DMS} handles the decoding * and encoding of angles in degree, minutes, and seconds, via static * functions in this module. * - {@link module:GeographicLib/Constants GeographicLib/Constants} defines * constants specifying the version numbers and the parameters for the WGS84 * ellipsoid. * * The following modules are used internally by the package: * - {@link module:GeographicLib/Math GeographicLib/Math} defines various * mathematical functions. * - {@link module:GeographicLib/Accumulator GeographicLib/Accumulator} * interally used by * {@link module:GeographicLib/PolygonArea.PolygonArea PolygonArea} (via the * {@link module:GeographicLib/Accumulator.Accumulator Accumulator} class) * for summing the contributions to the area of a polygon. */ var GeographicLib = {}; GeographicLib.Constants = {}; GeographicLib.Math = {}; GeographicLib.Accumulator = {}; (function( /** * @exports GeographicLib/Constants * @description Define constants defining the version and WGS84 parameters. */ c) { "use strict"; /** * @constant * @summary WGS84 parameters. * @property {number} a the equatorial radius (meters). * @property {number} f the flattening. */ c.WGS84 = { a: 6378137, f: 1/298.257223563 }; /** * @constant * @summary an array of version numbers. * @property {number} major the major version number. * @property {number} minor the minor version number. * @property {number} patch the patch number. */ c.version = { major: 1, minor: 52, patch: 0 }; /** * @constant * @summary version string */ c.version_string = "1.52"; })(GeographicLib.Constants); (function( /** * @exports GeographicLib/Math * @description Some useful mathematical constants and functions (mainly for * internal use). */ m) { "use strict"; /** * @summary The number of digits of precision in floating-point numbers. * @constant {number} */ m.digits = 53; /** * @summary The machine epsilon. * @constant {number} */ m.epsilon = Math.pow(0.5, m.digits - 1); /** * @summary The factor to convert degrees to radians. * @constant {number} */ m.degree = Math.PI/180; /** * @summary Square a number. * @param {number} x the number. * @returns {number} the square. */ m.sq = function(x) { return x * x; }; /** * @summary The hypotenuse function. * @param {number} x the first side. * @param {number} y the second side. * @returns {number} the hypotenuse. */ m.hypot = function(x, y) { // Built in Math.hypot give incorrect results from GeodSolve92. return Math.sqrt(x*x + y*y); }; /** * @summary Cube root function. * @param {number} x the argument. * @returns {number} the real cube root. */ m.cbrt = Math.cbrt || function(x) { var y = Math.pow(Math.abs(x), 1/3); return x > 0 ? y : (x < 0 ? -y : x); }; /** * @summary The log1p function. * @param {number} x the argument. * @returns {number} log(1 + x). */ m.log1p = 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; }; /** * @summary Inverse hyperbolic tangent. * @param {number} x the argument. * @returns {number} tanh−1 x. */ m.atanh = Math.atanh || function(x) { var y = Math.abs(x); // Enforce odd parity y = m.log1p(2 * y/(1 - y))/2; return x > 0 ? y : (x < 0 ? -y : x); }; /** * @summary Copy the sign. * @param {number} x gives the magitude of the result. * @param {number} y gives the sign of the result. * @returns {number} value with the magnitude of x and with the sign of y. */ m.copysign = function(x, y) { return Math.abs(x) * (y < 0 || (y === 0 && 1/y < 0) ? -1 : 1); }; /** * @summary An error-free sum. * @param {number} u * @param {number} v * @returns {object} sum with sum.s = round(u + v) and sum.t is u + v − * round(u + v) */ m.sum = function(u, v) { var s = u + v, up = s - v, vpp = s - up, t; up -= u; vpp -= v; t = -(up + vpp); // u + v = s + t // = round(u + v) + t return {s: s, t: t}; }; /** * @summary Evaluate a polynomial. * @param {integer} N the order of the polynomial. * @param {array} p the coefficient array (of size N + 1) (leading * order coefficient first) * @param {number} x the variable. * @returns {number} the value of the polynomial. */ m.polyval = function(N, p, s, x) { var y = N < 0 ? 0 : p[s++]; while (--N >= 0) y = y * x + p[s++]; return y; }; /** * @summary Coarsen a value close to zero. * @param {number} x * @returns {number} the coarsened value. */ m.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). This converts -0 to +0; however // tiny negative numbers get converted to -0. if (x === 0) return x; var z = 1/16, 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; }; /** * @summary The remainder function. * @param {number} x the numerator of the division * @param {number} y the denominator of the division * @return {number} the remainder in the range [−y/2, y/2]. *

* The range of x is unrestricted; y must be positive. */ m.remainder = function(x, y) { x = x % y; return x < -y/2 ? x + y : (x < y/2 ? x : x - y); }; /** * @summary Normalize an angle. * @param {number} x the angle in degrees. * @returns {number} the angle reduced to the range (−180°, * 180°]. */ m.AngNormalize = function(x) { // Place angle in (-180, 180]. x = m.remainder(x, 360); return x == -180 ? 180 : x; }; /** * @summary Normalize a latitude. * @param {number} x the angle in degrees. * @returns {number} x if it is in the range [−90°, 90°], * otherwise return NaN. */ m.LatFix = function(x) { // Replace angle with NaN if outside [-90, 90]. return Math.abs(x) > 90 ? Number.NaN : x; }; /** * @summary The exact difference of two angles reduced to (−180°, * 180°] * @param {number} x the first angle in degrees. * @param {number} y the second angle in degrees. * @return {object} diff the exact difference, y − x. * * This computes z = y − x exactly, reduced to (−180°, * 180°]; and then sets diff.s = d = round(z) and diff.t = e = z − * round(z). If d = −180, then e > 0; If d = 180, then e ≤ 0. */ m.AngDiff = function(x, y) { // Compute y - x and reduce to [-180,180] accurately. var r = m.sum(m.AngNormalize(-x), m.AngNormalize(y)), d = m.AngNormalize(r.s), t = r.t; return m.sum(d === 180 && t > 0 ? -180 : d, t); }; /** * @summary Evaluate the sine and cosine function with the argument in * degrees * @param {number} x in degrees. * @returns {object} r with r.s = sin(x) and r.c = cos(x). */ m.sincosd = function(x) { // In order to minimize round-off errors, this function exactly reduces // the argument to the range [-45, 45] before converting it to radians. var r, q, s, c, sinx, cosx; r = x % 360; q = 0 + Math.round(r / 90); // If r is NaN this returns NaN r -= 90 * q; // now abs(r) <= 45 r *= this.degree; // Possibly could call the gnu extension sincos s = Math.sin(r); c = Math.cos(r); switch (q & 3) { case 0: sinx = s; cosx = c; break; case 1: sinx = c; cosx = -s; break; case 2: sinx = -s; cosx = -c; break; default: sinx = -c; cosx = s; break; // case 3 } if (x !== 0) { sinx += 0; cosx += 0; } return {s: sinx, c: cosx}; }; /** * @summary Evaluate the atan2 function with the result in degrees * @param {number} y * @param {number} x * @returns atan2(y, x) in degrees, in the range (−180° * 180°]. */ m.atan2d = function(y, x) { // In order to minimize round-off errors, this function rearranges the // arguments so that result of atan2 is in the range [-pi/4, pi/4] before // converting it to degrees and mapping the result to the correct // quadrant. var q = 0, t, ang; if (Math.abs(y) > Math.abs(x)) { t = x; x = y; y = t; q = 2; } if (x < 0) { x = -x; ++q; } // here x >= 0 and x >= abs(y), so angle is in [-pi/4, pi/4] ang = Math.atan2(y, x) / this.degree; switch (q) { // Note that atan2d(-0.0, 1.0) will return -0. However, we expect that // atan2d will not be called with y = -0. If need be, include // // case 0: ang = 0 + ang; break; // // and handle mpfr as in AngRound. case 1: ang = (y >= 0 ? 180 : -180) - ang; break; case 2: ang = 90 - ang; break; case 3: ang = -90 + ang; break; default: break; } return ang; }; })(GeographicLib.Math); (function( /** * @exports GeographicLib/Accumulator * @description Accurate summation via the * {@link module:GeographicLib/Accumulator.Accumulator Accumulator} class * (mainly for internal use). */ a, m) { "use strict"; /** * @class * @summary Accurate summation of many numbers. * @classdesc This allows many numbers to be added together with twice the * normal precision. In the documentation of the member functions, sum * stands for the value currently held in the accumulator. * @param {number | Accumulator} [y = 0] set sum = y. */ a.Accumulator = function(y) { this.Set(y); }; /** * @summary Set the accumulator to a number. * @param {number | Accumulator} [y = 0] set sum = 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; } }; /** * @summary Add a number to the accumulator. * @param {number} [y = 0] set sum += y. */ a.Accumulator.prototype.Add = function(y) { // Here's Shewchuk's solution... // Accumulate starting at least significant end var u = m.sum(y, this._t), v = m.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. }; /** * @summary Return the result of adding a number to sum (but * don't change sum). * @param {number} [y = 0] the number to be added to the sum. * @return sum + y. */ a.Accumulator.prototype.Sum = function(y) { var b; if (!y) return this._s; else { b = new a.Accumulator(this); b.Add(y); return b._s; } }; /** * @summary Set sum = −sum. */ a.Accumulator.prototype.Negate = function() { this._s *= -1; this._t *= -1; }; /** * @summary Take the remainder * @param {number} y the divisor of the remainder operation. * @return sum in range [−y/2, y/2]. */ a.Accumulator.prototype.Remainder = function(y) { this._s = m.remainder(this._s, y); this.Add(0); }; })(GeographicLib.Accumulator, GeographicLib.Math); GeographicLib-1.52/js/src/PolygonArea.js0000644000771000077100000002713314064202371020004 0ustar ckarneyckarney/* * PolygonArea.js * Transcription of PolygonArea.[ch]pp into JavaScript. * * See the documentation for the C++ class. The conversion is a literal * conversion from C++. * * The algorithms are derived in * * Charles F. F. Karney, * Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); * https://doi.org/10.1007/s00190-012-0578-z * Addenda: https://geographiclib.sourceforge.io/geod-addenda.html * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ */ // Load AFTER GeographicLib/Math.js and GeographicLib/Geodesic.js (function( /** * @exports GeographicLib/PolygonArea * @description Compute the area of geodesic polygons via the * {@link module:GeographicLib/PolygonArea.PolygonArea PolygonArea} * class. */ p, g, m, a) { "use strict"; var transit, transitdirect, AreaReduceA, AreaReduceB; transit = function(lon1, lon2) { // Return 1 or -1 if crossing prime meridian in east or west direction. // Otherwise return zero. var lon12, cross; // Compute lon12 the same way as Geodesic::Inverse. lon1 = m.AngNormalize(lon1); lon2 = m.AngNormalize(lon2); lon12 = m.AngDiff(lon1, lon2).s; cross = lon1 <= 0 && lon2 > 0 && lon12 > 0 ? 1 : (lon2 <= 0 && lon1 > 0 && lon12 < 0 ? -1 : 0); return cross; }; // an alternate version of transit to deal with longitudes in the direct // problem. transitdirect = function(lon1, lon2) { // We want to compute exactly // int(ceil(lon2 / 360)) - int(ceil(lon1 / 360)) // Since we only need the parity of the result we can use std::remquo but // this is buggy with g++ 4.8.3 and requires C++11. So instead we do lon1 = lon1 % 720.0; lon2 = lon2 % 720.0; return ( ((lon2 <= 0 && lon2 > -360) || lon2 > 360 ? 1 : 0) - ((lon1 <= 0 && lon1 > -360) || lon1 > 360 ? 1 : 0) ); }; // Reduce Accumulator area AreaReduceA = function(area, area0, crossings, reverse, sign) { area.Remainder(area0); if (crossings & 1) area.Add( (area.Sum() < 0 ? 1 : -1) * area0/2 ); // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) area.Negate(); // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (area.Sum() > area0/2) area.Add( -area0 ); else if (area.Sum() <= -area0/2) area.Add( +area0 ); } else { if (area.Sum() >= area0) area.Add( -area0 ); else if (area.Sum() < 0) area.Add( +area0 ); } return 0 + area.Sum(); }; // Reduce double area AreaReduceB = function(area, area0, crossings, reverse, sign) { area = m.remainder(area, area0); if (crossings & 1) area += (area < 0 ? 1 : -1) * area0/2; // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) area *= -1; // If sign put area in (-area0/2, area0/2], else put area in [0, area0) if (sign) { if (area > area0/2) area -= area0; else if (area <= -area0/2) area += area0; } else { if (area >= area0) area -= area0; else if (area < 0) area += area0; } return 0 + area; }; /** * @class * @property {number} a the equatorial radius (meters). * @property {number} f the flattening. * @property {bool} polyline whether the PolygonArea object describes a * polyline or a polygon. * @property {number} num the number of vertices so far. * @property {number} lat the current latitude (degrees). * @property {number} lon the current longitude (degrees). * @summary Initialize a PolygonArea object. * @classdesc Computes the area and perimeter of a geodesic polygon. * This object is usually instantiated by * {@link module:GeographicLib/Geodesic.Geodesic#Polygon Geodesic.Polygon}. * @param {object} geod a {@link module:GeographicLib/Geodesic.Geodesic * Geodesic} object. * @param {bool} [polyline = false] if true the new PolygonArea object * describes a polyline instead of a polygon. */ p.PolygonArea = function(geod, polyline) { this._geod = geod; this.a = this._geod.a; this.f = this._geod.f; this._area0 = 4 * Math.PI * geod._c2; this.polyline = !polyline ? false : polyline; this._mask = g.LATITUDE | g.LONGITUDE | g.DISTANCE | (this.polyline ? g.NONE : g.AREA | g.LONG_UNROLL); if (!this.polyline) this._areasum = new a.Accumulator(0); this._perimetersum = new a.Accumulator(0); this.Clear(); }; /** * @summary Clear the PolygonArea object, setting the number of vertices to * 0. */ 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.lat = this.lon = Number.NaN; }; /** * @summary Add the next vertex to the polygon. * @param {number} lat the latitude of the point (degrees). * @param {number} lon the longitude of the point (degrees). * @description This adds an edge from the current vertex to the new vertex. */ p.PolygonArea.prototype.AddPoint = function(lat, lon) { var t; if (this.num === 0) { this._lat0 = this.lat = lat; this._lon0 = this.lon = lon; } else { t = this._geod.Inverse(this.lat, this.lon, lat, lon, this._mask); this._perimetersum.Add(t.s12); if (!this.polyline) { this._areasum.Add(t.S12); this._crossings += transit(this.lon, lon); } this.lat = lat; this.lon = lon; } ++this.num; }; /** * @summary Add the next edge to the polygon. * @param {number} azi the azimuth at the current the point (degrees). * @param {number} s the length of the edge (meters). * @description This specifies the new vertex in terms of the edge from the * current vertex. */ p.PolygonArea.prototype.AddEdge = function(azi, s) { var t; if (this.num) { t = this._geod.Direct(this.lat, this.lon, azi, s, this._mask); this._perimetersum.Add(s); if (!this.polyline) { this._areasum.Add(t.S12); this._crossings += transitdirect(this.lon, t.lon2); } this.lat = t.lat2; this.lon = t.lon2; } ++this.num; }; /** * @summary Compute the perimeter and area of the polygon. * @param {bool} reverse if true then clockwise (instead of * counter-clockwise) traversal counts as a positive area. * @param {bool} 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. * @returns {object} r where r.number is the number of vertices, r.perimeter * is the perimeter (meters), and r.area (only returned if polyline is * false) is the area (meters2). * @description Arbitrarily complex polygons are allowed. In the case of * self-intersecting polygons the area is accumulated "algebraically", * e.g., the areas of the 2 loops in a figure-8 polygon will partially * cancel. If the object is a polygon (and not a polyline), the perimeter * includes the length of a final edge connecting the current point to the * initial point. If the object is a polyline, then area is nan. More * points can be added to the polygon after this call. */ p.PolygonArea.prototype.Compute = function(reverse, sign) { var vals = {number: this.num}, t, tempsum; 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; } t = this._geod.Inverse(this.lat, this.lon, this._lat0, this._lon0, this._mask); vals.perimeter = this._perimetersum.Sum(t.s12); tempsum = new a.Accumulator(this._areasum); tempsum.Add(t.S12); vals.area = AreaReduceA(tempsum, this._area0, this._crossings + transit(this.lon, this._lon0), reverse, sign); return vals; }; /** * @summary Compute the perimeter and area of the polygon with a tentative * new vertex. * @param {number} lat the latitude of the point (degrees). * @param {number} lon the longitude of the point (degrees). * @param {bool} reverse if true then clockwise (instead of * counter-clockwise) traversal counts as a positive area. * @param {bool} 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. * @returns {object} r where r.number is the number of vertices, r.perimeter * is the perimeter (meters), and r.area (only returned if polyline is * false) is the area (meters2). * @description A new vertex is *not* added to the polygon. */ p.PolygonArea.prototype.TestPoint = function(lat, lon, reverse, sign) { var vals = {number: this.num + 1}, t, tempsum, crossings, i; if (this.num === 0) { vals.perimeter = 0; if (!this.polyline) vals.area = 0; return vals; } vals.perimeter = this._perimetersum.Sum(); tempsum = this.polyline ? 0 : this._areasum.Sum(); crossings = this._crossings; for (i = 0; i < (this.polyline ? 1 : 2); ++i) { t = this._geod.Inverse( i === 0 ? this.lat : lat, i === 0 ? this.lon : lon, i !== 0 ? this._lat0 : lat, i !== 0 ? this._lon0 : lon, this._mask); vals.perimeter += t.s12; if (!this.polyline) { tempsum += t.S12; crossings += transit(i === 0 ? this.lon : lon, i !== 0 ? this._lon0 : lon); } } if (this.polyline) return vals; vals.area = AreaReduceB(tempsum, this._area0, crossings, reverse, sign); return vals; }; /** * @summary Compute the perimeter and area of the polygon with a tentative * new edge. * @param {number} azi the azimuth of the edge (degrees). * @param {number} s the length of the edge (meters). * @param {bool} reverse if true then clockwise (instead of * counter-clockwise) traversal counts as a positive area. * @param {bool} 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. * @returns {object} r where r.number is the number of vertices, r.perimeter * is the perimeter (meters), and r.area (only returned if polyline is * false) is the area (meters2). * @description A new vertex is *not* added to the polygon. */ p.PolygonArea.prototype.TestEdge = function(azi, s, reverse, sign) { var vals = {number: this.num ? this.num + 1 : 0}, t, tempsum, crossings; if (this.num === 0) return vals; vals.perimeter = this._perimetersum.Sum() + s; if (this.polyline) return vals; tempsum = this._areasum.Sum(); crossings = this._crossings; t = this._geod.Direct(this.lat, this.lon, azi, s, this._mask); tempsum += t.S12; crossings += transitdirect(this.lon, t.lon2); crossings += transit(t.lon2, this._lon0); t = this._geod.Inverse(t.lat2, t.lon2, this._lat0, this._lon0, this._mask); vals.perimeter += t.s12; tempsum += t.S12; vals.area = AreaReduceB(tempsum, this._area0, crossings, reverse, sign); return vals; }; })(GeographicLib.PolygonArea, GeographicLib.Geodesic, GeographicLib.Math, GeographicLib.Accumulator); GeographicLib-1.52/js/test/geodesictest.js0000644000771000077100000010520614064202371020434 0ustar ckarneyckarney"use strict"; var assert = require("assert"), G = require("../geographiclib"), g = G.Geodesic, d = G.DMS, m = G.Math, testcases = [ [35.60777, -139.44815, 111.098748429560326, -11.17491, -69.95921, 129.289270889708762, 8935244.5604818305, 80.50729714281974, 6273170.2055303837, 0.16606318447386067, 0.16479116945612937, 12841384694976.432], [55.52454, 106.05087, 22.020059880982801, 77.03196, 197.18234, 109.112041110671519, 4105086.1713924406, 36.892740690445894, 3828869.3344387607, 0.80076349608092607, 0.80101006984201008, 61674961290615.615], [-21.97856, 142.59065, -32.44456876433189, 41.84138, 98.56635, -41.84359951440466, 8394328.894657671, 75.62930491011522, 6161154.5773110616, 0.24816339233950381, 0.24930251203627892, -6637997720646.717], [-66.99028, 112.2363, 173.73491240878403, -12.70631, 285.90344, 2.512956620913668, 11150344.2312080241, 100.278634181155759, 6289939.5670446687, -0.17199490274700385, -0.17722569526345708, -121287239862139.744], [-17.42761, 173.34268, -159.033557661192928, -15.84784, 5.93557, -20.787484651536988, 16076603.1631180673, 144.640108810286253, 3732902.1583877189, -0.81273638700070476, -0.81299800519154474, 97825992354058.708], [32.84994, 48.28919, 150.492927788121982, -56.28556, 202.29132, 48.113449399816759, 16727068.9438164461, 150.565799985466607, 3147838.1910180939, -0.87334918086923126, -0.86505036767110637, -72445258525585.010], [6.96833, 52.74123, 92.581585386317712, -7.39675, 206.17291, 90.721692165923907, 17102477.2496958388, 154.147366239113561, 2772035.6169917581, -0.89991282520302447, -0.89986892177110739, -1311796973197.995], [-50.56724, -16.30485, -105.439679907590164, -33.56571, -94.97412, -47.348547835650331, 6455670.5118668696, 58.083719495371259, 5409150.7979815838, 0.53053508035997263, 0.52988722644436602, 41071447902810.047], [-58.93002, -8.90775, 140.965397902500679, -8.91104, 133.13503, 19.255429433416599, 11756066.0219864627, 105.755691241406877, 6151101.2270708536, -0.26548622269867183, -0.27068483874510741, -86143460552774.735], [-68.82867, -74.28391, 93.774347763114881, -50.63005, -8.36685, 34.65564085411343, 3956936.926063544, 35.572254987389284, 3708890.9544062657, 0.81443963736383502, 0.81420859815358342, -41845309450093.787], [-10.62672, -32.0898, -86.426713286747751, 5.883, -134.31681, -80.473780971034875, 11470869.3864563009, 103.387395634504061, 6184411.6622659713, -0.23138683500430237, -0.23155097622286792, 4198803992123.548], [-21.76221, 166.90563, 29.319421206936428, 48.72884, 213.97627, 43.508671946410168, 9098627.3986554915, 81.963476716121964, 6299240.9166992283, 0.13965943368590333, 0.14152969707656796, 10024709850277.476], [-19.79938, -174.47484, 71.167275780171533, -11.99349, -154.35109, 65.589099775199228, 2319004.8601169389, 20.896611684802389, 2267960.8703918325, 0.93427001867125849, 0.93424887135032789, -3935477535005.785], [-11.95887, -116.94513, 92.712619830452549, 4.57352, 7.16501, 78.64960934409585, 13834722.5801401374, 124.688684161089762, 5228093.177931598, -0.56879356755666463, -0.56918731952397221, -9919582785894.853], [-87.85331, 85.66836, -65.120313040242748, 66.48646, 16.09921, -4.888658719272296, 17286615.3147144645, 155.58592449699137, 2635887.4729110181, -0.90697975771398578, -0.91095608883042767, 42667211366919.534], [1.74708, 128.32011, -101.584843631173858, -11.16617, 11.87109, -86.325793296437476, 12942901.1241347408, 116.650512484301857, 5682744.8413270572, -0.44857868222697644, -0.44824490340007729, 10763055294345.653], [-25.72959, -144.90758, -153.647468693117198, -57.70581, -269.17879, -48.343983158876487, 9413446.7452453107, 84.664533838404295, 6356176.6898881281, 0.09492245755254703, 0.09737058264766572, 74515122850712.444], [-41.22777, 122.32875, 14.285113402275739, -7.57291, 130.37946, 10.805303085187369, 3812686.035106021, 34.34330804743883, 3588703.8812128856, 0.82605222593217889, 0.82572158200920196, -2456961531057.857], [11.01307, 138.25278, 79.43682622782374, 6.62726, 247.05981, 103.708090215522657, 11911190.819018408, 107.341669954114577, 6070904.722786735, -0.29767608923657404, -0.29785143390252321, 17121631423099.696], [-29.47124, 95.14681, -163.779130441688382, -27.46601, -69.15955, -15.909335945554969, 13487015.8381145492, 121.294026715742277, 5481428.9945736388, -0.51527225545373252, -0.51556587964721788, 104679964020340.318]]; assert.approx = function(x, y, d) { assert(Math.abs(x-y) <= d, x + " = " + y + " +/- " + d); }; describe("GeographicLib", function() { describe("GeodesicTest", function () { var geod = g.WGS84, i, check_geod_inverse, check_geod_direct, check_geod_arcdirect; check_geod_inverse = function(l) { var lat1 = l[0], lon1 = l[1], azi1 = l[2], lat2 = l[3], lon2 = l[4], azi2 = l[5], s12 = l[6], a12 = l[7], m12 = l[8], M12 = l[9], M21 = l[10], S12 = l[11], inv = geod.Inverse(lat1, lon1, lat2, G.Math.AngNormalize(lon2), g.ALL | g.LONG_UNROLL); assert.approx(lon2, inv.lon2, 1e-13); assert.approx(azi1, inv.azi1, 1e-13); assert.approx(azi2, inv.azi2, 1e-13); assert.approx(s12, inv.s12, 1e-8); assert.approx(a12, inv.a12, 1e-13); assert.approx(m12, inv.m12, 1e-8); assert.approx(M12, inv.M12, 1e-15); assert.approx(M21, inv.M21, 1e-15); assert.approx(S12, inv.S12, 0.1); }; check_geod_direct = function(l) { var lat1 = l[0], lon1 = l[1], azi1 = l[2], lat2 = l[3], lon2 = l[4], azi2 = l[5], s12 = l[6], a12 = l[7], m12 = l[8], M12 = l[9], M21 = l[10], S12 = l[11], dir = geod.Direct(lat1, lon1, azi1, s12, g.ALL | g.LONG_UNROLL); assert.approx(lat2, dir.lat2, 1e-13); assert.approx(lon2, dir.lon2, 1e-13); assert.approx(azi2, dir.azi2, 1e-13); assert.approx(a12, dir.a12, 1e-13); assert.approx(m12, dir.m12, 1e-8); assert.approx(M12, dir.M12, 1e-15); assert.approx(M21, dir.M21, 1e-15); assert.approx(S12, dir.S12, 0.1); }; check_geod_arcdirect = function(l) { var lat1 = l[0], lon1 = l[1], azi1 = l[2], lat2 = l[3], lon2 = l[4], azi2 = l[5], s12 = l[6], a12 = l[7], m12 = l[8], M12 = l[9], M21 = l[10], S12 = l[11], dir = geod.ArcDirect(lat1, lon1, azi1, a12, g.ALL | g.LONG_UNROLL); assert.approx(lat2, dir.lat2, 1e-13); assert.approx(lon2, dir.lon2, 1e-13); assert.approx(azi2, dir.azi2, 1e-13); assert.approx(s12, dir.s12, 1e-8); assert.approx(m12, dir.m12, 1e-8); assert.approx(M12, dir.M12, 1e-15); assert.approx(M21, dir.M21, 1e-15); assert.approx(S12, dir.S12, 0.1); }; it("check inverse", function () { for (i = 0; i < testcases.length; ++i) { check_geod_inverse(testcases[i]); } }); it("check direct", function () { for (i = 0; i < testcases.length; ++i) { check_geod_direct(testcases[i]); } }); it("check arcdirect", function () { for (i = 0; i < testcases.length; ++i) { check_geod_arcdirect(testcases[i]); } }); }); describe("DMSTest", function () { it("check decode", function () { assert.deepEqual(d.Decode("E7:33:36"), d.Decode("-7.56W")); }); }); describe("GeodesicSolve", function () { it("GeodSolve0", function () { var geod = g.WGS84, inv = geod.Inverse(40.6, -73.8, 49.01666667, 2.55); assert.approx(inv.azi1, 53.47022, 0.5e-5); assert.approx(inv.azi2, 111.59367, 0.5e-5); assert.approx(inv.s12, 5853226, 0.5); }); it("GeodSolve1", function() { var geod = g.WGS84, dir = geod.Direct(40.63972222, -73.77888889, 53.5, 5850e3); assert.approx(dir.lat2, 49.01467, 0.5e-5); assert.approx(dir.lon2, 2.56106, 0.5e-5); assert.approx(dir.azi2, 111.62947, 0.5e-5); }); it("GeodSolve2", function() { // Check fix for antipodal prolate bug found 2010-09-04 var geod = new g.Geodesic(6.4e6, -1/150.0), inv = geod.Inverse(0.07476, 0, -0.07476, 180); assert.approx(inv.azi1, 90.00078, 0.5e-5); assert.approx(inv.azi2, 90.00078, 0.5e-5); assert.approx(inv.s12, 20106193, 0.5); inv = geod.Inverse(0.1, 0, -0.1, 180); assert.approx(inv.azi1, 90.00105, 0.5e-5); assert.approx(inv.azi2, 90.00105, 0.5e-5); assert.approx(inv.s12, 20106193, 0.5); }); it("GeodSolve4", function() { // Check fix for short line bug found 2010-05-21 var geod = g.WGS84, inv = geod.Inverse(36.493349428792, 0, 36.49334942879201, 0.0000008); assert.approx(inv.s12, 0.072, 0.5e-3); }); it("GeodSolve5", function() { // Check fix for point2=pole bug found 2010-05-03 var geod = g.WGS84, dir = geod.Direct(0.01777745589997, 30, 0, 10e6); assert.approx(dir.lat2, 90, 0.5e-5); if (dir.lon2 < 0) { assert.approx(dir.lon2, -150, 0.5e-5); assert.approx(Math.abs(dir.azi2), 180, 0.5e-5); } else { assert.approx(dir.lon2, 30, 0.5e-5); assert.approx(dir.azi2, 0, 0.5e-5); } }); it("GeodSolve6", function() { // 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). var geod = g.WGS84, inv = geod.Inverse(88.202499451857, 0, -88.202499451857, 179.981022032992859592); assert.approx(inv.s12, 20003898.214, 0.5e-3); inv = geod.Inverse(89.262080389218, 0, -89.262080389218, 179.992207982775375662); assert.approx(inv.s12, 20003925.854, 0.5e-3); inv = geod.Inverse(89.333123580033, 0, -89.333123580032997687, 179.99295812360148422); assert.approx(inv.s12, 20003926.881, 0.5e-3); }); it("GeodSolve9", function() { // Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) var geod = g.WGS84, inv = geod.Inverse(56.320923501171, 0, -56.320923501171, 179.664747671772880215); assert.approx(inv.s12, 19993558.287, 0.5e-3); }); it("GeodSolve10", function() { // Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio // 10 rel + debug) var geod = g.WGS84, inv = geod.Inverse(52.784459512564, 0, -52.784459512563990912, 179.634407464943777557); assert.approx(inv.s12, 19991596.095, 0.5e-3); }); it("GeodSolve11", function() { // Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio // 10 rel + debug) var geod = g.WGS84, inv = geod.Inverse(48.522876735459, 0, -48.52287673545898293, 179.599720456223079643); assert.approx(inv.s12, 19989144.774, 0.5e-3); }); it("GeodSolve12", function() { // Check fix for inverse geodesics on extreme prolate/oblate // ellipsoids Reported 2012-08-29 Stefan Guenther // ; fixed 2012-10-07 var geod = new g.Geodesic(89.8, -1.83), inv = geod.Inverse(0, 0, -10, 160); assert.approx(inv.azi1, 120.27, 1e-2); assert.approx(inv.azi2, 105.15, 1e-2); assert.approx(inv.s12, 266.7, 1e-1); }); it("GeodSolve14", function() { // Check fix for inverse ignoring lon12 = nan var geod = g.WGS84, inv = geod.Inverse(0, 0, 1, NaN); assert(isNaN(inv.azi1)); assert(isNaN(inv.azi2)); assert(isNaN(inv.s12)); }); it("GeodSolve15", function() { // Initial implementation of Math::eatanhe was wrong for e^2 < 0. This // checks that this is fixed. var geod = new g.Geodesic(6.4e6, -1/150.0), dir = geod.Direct(1, 2, 3, 4, g.AREA); assert.approx(dir.S12, 23700, 0.5); }); it("GeodSolve17", function() { // Check fix for LONG_UNROLL bug found on 2015-05-07 var geod = g.WGS84, dir = geod.Direct(40, -75, -10, 2e7, g.LONG_UNROLL), line; assert.approx(dir.lat2, -39, 1); assert.approx(dir.lon2, -254, 1); assert.approx(dir.azi2, -170, 1); line = geod.Line(40, -75, -10); dir = line.Position(2e7, g.LONG_UNROLL); assert.approx(dir.lat2, -39, 1); assert.approx(dir.lon2, -254, 1); assert.approx(dir.azi2, -170, 1); dir = geod.Direct(40, -75, -10, 2e7); assert.approx(dir.lat2, -39, 1); assert.approx(dir.lon2, 105, 1); assert.approx(dir.azi2, -170, 1); dir = line.Position(2e7); assert.approx(dir.lat2, -39, 1); assert.approx(dir.lon2, 105, 1); assert.approx(dir.azi2, -170, 1); }); it("GeodSolve26", function() { // Check 0/0 problem with area calculation on sphere 2015-09-08 var geod = new g.Geodesic(6.4e6, 0), inv = geod.Inverse(1, 2, 3, 4, g.AREA); assert.approx(inv.S12, 49911046115.0, 0.5); }); it("GeodSolve28", function() { // Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in // Java implementation fixed on 2015-05-19). var geod = new g.Geodesic(6.4e6, 0.1), dir = geod.Direct(1, 2, 10, 5e6); assert.approx(dir.a12, 48.55570690, 0.5e-8); }); it("GeodSolve29", function() { // Check longitude unrolling with inverse calculation 2015-09-16 var geod = g.WGS84, dir = geod.Inverse(0, 539, 0, 181); assert.approx(dir.lon1, 179, 1e-10); assert.approx(dir.lon2, -179, 1e-10); assert.approx(dir.s12, 222639, 0.5); dir = geod.Inverse(0, 539, 0, 181, g.LONG_UNROLL); assert.approx(dir.lon1, 539, 1e-10); assert.approx(dir.lon2, 541, 1e-10); assert.approx(dir.s12, 222639, 0.5); }); it("GeodSolve33", function() { // Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- // sind(-0.0) = +0.0 -- and in some version of Visual Studio -- // fmod(-0.0, 360.0) = +0.0. var geod = g.WGS84, inv = geod.Inverse(0, 0, 0, 179); assert.approx(inv.azi1, 90.00000, 0.5e-5); assert.approx(inv.azi2, 90.00000, 0.5e-5); assert.approx(inv.s12, 19926189, 0.5); inv = geod.Inverse(0, 0, 0, 179.5); assert.approx(inv.azi1, 55.96650, 0.5e-5); assert.approx(inv.azi2, 124.03350, 0.5e-5); assert.approx(inv.s12, 19980862, 0.5); inv = geod.Inverse(0, 0, 0, 180); assert.approx(inv.azi1, 0.00000, 0.5e-5); assert.approx(Math.abs(inv.azi2), 180.00000, 0.5e-5); assert.approx(inv.s12, 20003931, 0.5); inv = geod.Inverse(0, 0, 1, 180); assert.approx(inv.azi1, 0.00000, 0.5e-5); assert.approx(Math.abs(inv.azi2), 180.00000, 0.5e-5); assert.approx(inv.s12, 19893357, 0.5); geod = new g.Geodesic(6.4e6, 0); inv = geod.Inverse(0, 0, 0, 179); assert.approx(inv.azi1, 90.00000, 0.5e-5); assert.approx(inv.azi2, 90.00000, 0.5e-5); assert.approx(inv.s12, 19994492, 0.5); inv = geod.Inverse(0, 0, 0, 180); assert.approx(inv.azi1, 0.00000, 0.5e-5); assert.approx(Math.abs(inv.azi2), 180.00000, 0.5e-5); assert.approx(inv.s12, 20106193, 0.5); inv = geod.Inverse(0, 0, 1, 180); assert.approx(inv.azi1, 0.00000, 0.5e-5); assert.approx(Math.abs(inv.azi2), 180.00000, 0.5e-5); assert.approx(inv.s12, 19994492, 0.5); geod = new g.Geodesic(6.4e6, -1/300.0); inv = geod.Inverse(0, 0, 0, 179); assert.approx(inv.azi1, 90.00000, 0.5e-5); assert.approx(inv.azi2, 90.00000, 0.5e-5); assert.approx(inv.s12, 19994492, 0.5); inv = geod.Inverse(0, 0, 0, 180); assert.approx(inv.azi1, 90.00000, 0.5e-5); assert.approx(inv.azi2, 90.00000, 0.5e-5); assert.approx(inv.s12, 20106193, 0.5); inv = geod.Inverse(0, 0, 0.5, 180); assert.approx(inv.azi1, 33.02493, 0.5e-5); assert.approx(inv.azi2, 146.97364, 0.5e-5); assert.approx(inv.s12, 20082617, 0.5); inv = geod.Inverse(0, 0, 1, 180); assert.approx(inv.azi1, 0.00000, 0.5e-5); assert.approx(Math.abs(inv.azi2), 180.00000, 0.5e-5); assert.approx(inv.s12, 20027270, 0.5); }); it("GeodSolve55", function() { // Check fix for nan + point on equator or pole not returning all nans in // Geodesic::Inverse, found 2015-09-23. var geod = g.WGS84, inv = geod.Inverse(NaN, 0, 0, 90); assert(isNaN(inv.azi1)); assert(isNaN(inv.azi2)); assert(isNaN(inv.s12)); inv = geod.Inverse(NaN, 0, 90, 9); assert(isNaN(inv.azi1)); assert(isNaN(inv.azi2)); assert(isNaN(inv.s12)); }); it("GeodSolve59", function() { // Check for points close with longitudes close to 180 deg apart. var geod = g.WGS84, inv = geod.Inverse(5, 0.00000000000001, 10, 180); assert.approx(inv.azi1, 0.000000000000035, 1.5e-14); assert.approx(inv.azi2, 179.99999999999996, 1.5e-14); assert.approx(inv.s12, 18345191.174332713, 5e-9); }); it("GeodSolve61", function() { // Make sure small negative azimuths are west-going var geod = g.WGS84, dir = geod.Direct(45, 0, -0.000000000000000003, 1e7, g.LONG_UNROLL), line; assert.approx(dir.lat2, 45.30632, 0.5e-5); assert.approx(dir.lon2, -180, 0.5e-5); assert.approx(Math.abs(dir.azi2), 180, 0.5e-5); line = geod.InverseLine(45, 0, 80, -0.000000000000000003); dir = line.Position(1e7, g.LONG_UNROLL); assert.approx(dir.lat2, 45.30632, 0.5e-5); assert.approx(dir.lon2, -180, 0.5e-5); assert.approx(Math.abs(dir.azi2), 180, 0.5e-5); }); it("GeodSolve65", function() { // Check for bug in east-going check in GeodesicLine (needed to check for // sign of 0) and sign error in area calculation due to a bogus override // of the code for alp12. Found/fixed on 2015-12-19. var geod = g.WGS84, line = geod.InverseLine(30, -0.000000000000000001, -31, 180, g.ALL), dir = line.Position(1e7, g.ALL | g.LONG_UNROLL); assert.approx(dir.lat1, 30.00000 , 0.5e-5); assert.approx(dir.lon1, -0.00000 , 0.5e-5); assert.approx(Math.abs(dir.azi1), 180.00000, 0.5e-5); assert.approx(dir.lat2, -60.23169 , 0.5e-5); assert.approx(dir.lon2, -0.00000 , 0.5e-5); assert.approx(Math.abs(dir.azi2), 180.00000, 0.5e-5); assert.approx(dir.s12 , 10000000 , 0.5); assert.approx(dir.a12 , 90.06544 , 0.5e-5); assert.approx(dir.m12 , 6363636 , 0.5); assert.approx(dir.M12 , -0.0012834, 0.5e7); assert.approx(dir.M21 , 0.0013749 , 0.5e-7); assert.approx(dir.S12 , 0 , 0.5); dir = line.Position(2e7, g.ALL | g.LONG_UNROLL); assert.approx(dir.lat1, 30.00000 , 0.5e-5); assert.approx(dir.lon1, -0.00000 , 0.5e-5); assert.approx(Math.abs(dir.azi1), 180.00000, 0.5e-5); assert.approx(dir.lat2, -30.03547 , 0.5e-5); assert.approx(dir.lon2, -180.00000, 0.5e-5); assert.approx(dir.azi2, -0.00000 , 0.5e-5); assert.approx(dir.s12 , 20000000 , 0.5); assert.approx(dir.a12 , 179.96459 , 0.5e-5); assert.approx(dir.m12 , 54342 , 0.5); assert.approx(dir.M12 , -1.0045592, 0.5e7); assert.approx(dir.M21 , -0.9954339, 0.5e-7); assert.approx(dir.S12 , 127516405431022.0, 0.5); }); it("GeodSolve69", function() { // Check for InverseLine if line is slightly west of S and that s13 is // correctly set. var geod = g.WGS84, line = geod.InverseLine(-5, -0.000000000000002, -10, 180), dir = line.Position(2e7, g.LONG_UNROLL); assert.approx(dir.lat2, 4.96445 , 0.5e-5); assert.approx(dir.lon2, -180.00000, 0.5e-5); assert.approx(dir.azi2, -0.00000 , 0.5e-5); dir = line.Position(0.5 * line.s13, g.LONG_UNROLL); assert.approx(dir.lat2, -87.52461 , 0.5e-5); assert.approx(dir.lon2, -0.00000 , 0.5e-5); assert.approx(dir.azi2, -180.00000, 0.5e-5); }); it("GeodSolve71", function() { // Check that DirectLine sets s13. var geod = g.WGS84, line = geod.DirectLine(1, 2, 45, 1e7), dir = line.Position(0.5 * line.s13, g.LONG_UNROLL); assert.approx(dir.lat2, 30.92625, 0.5e-5); assert.approx(dir.lon2, 37.54640, 0.5e-5); assert.approx(dir.azi2, 55.43104, 0.5e-5); }); it("GeodSolve73", function() { // Check for backwards from the pole bug reported by Anon on 2016-02-13. // This only affected the Java implementation. It was introduced in Java // version 1.44 and fixed in 1.46-SNAPSHOT on 2016-01-17. // Also the + sign on azi2 is a check on the normalizing of azimuths // (converting -0.0 to +0.0). var geod = g.WGS84, dir = geod.Direct(90, 10, 180, -1e6); assert.approx(dir.lat2, 81.04623, 0.5e-5); assert.approx(dir.lon2, -170, 0.5e-5); assert.approx(dir.azi2, 0, 0.5e-5); assert.ok(m.copysign(1, dir.azi2) > 0); }); it("GeodSolve74", function() { // Check fix for inaccurate areas, bug introduced in v1.46, fixed // 2015-10-16. var geod = g.WGS84, inv = geod.Inverse(54.1589, 15.3872, 54.1591, 15.3877, g.ALL); assert.approx(inv.azi1, 55.723110355, 5e-9); assert.approx(inv.azi2, 55.723515675, 5e-9); assert.approx(inv.s12, 39.527686385, 5e-9); assert.approx(inv.a12, 0.000355495, 5e-9); assert.approx(inv.m12, 39.527686385, 5e-9); assert.approx(inv.M12, 0.999999995, 5e-9); assert.approx(inv.M21, 0.999999995, 5e-9); assert.approx(inv.S12, 286698586.30197, 5e-4); }); it("GeodSolve76", function() { // The distance from Wellington and Salamanca (a classic failure of // Vincenty) var geod = g.WGS84, inv = geod.Inverse(-(41+19/60.0), 174+49/60.0, 40+58/60.0, -(5+30/60.0)); assert.approx(inv.azi1, 160.39137649664, 0.5e-11); assert.approx(inv.azi2, 19.50042925176, 0.5e-11); assert.approx(inv.s12, 19960543.857179, 0.5e-6); }); it("GeodSolve78", function() { // An example where the NGS calculator fails to converge var geod = g.WGS84, inv = geod.Inverse(27.2, 0.0, -27.1, 179.5); assert.approx(inv.azi1, 45.82468716758, 0.5e-11); assert.approx(inv.azi2, 134.22776532670, 0.5e-11); assert.approx(inv.s12, 19974354.765767, 0.5e-6); }); it("GeodSolve80", function() { // Some tests to add code coverage: computing scale in special cases + // zero length geodesic (includes GeodSolve80 - GeodSolve83). var geod = g.WGS84, inv, line, dir; inv = geod.Inverse(0, 0, 0, 90, g.GEODESICSCALE); assert.approx(inv.M12, -0.00528427534, 0.5e-10); assert.approx(inv.M21, -0.00528427534, 0.5e-10); inv = geod.Inverse(0, 0, 1e-6, 1e-6, g.GEODESICSCALE); assert.approx(inv.M12, 1, 0.5e-10); assert.approx(inv.M21, 1, 0.5e-10); inv = geod.Inverse(20.001, 0, 20.001, 0, g.ALL); assert.approx(inv.a12, 0, 1e-13); assert.approx(inv.s12, 0, 1e-8); assert.approx(inv.azi1, 180, 1e-13); assert.approx(inv.azi2, 180, 1e-13); assert.approx(inv.m12, 0, 1e-8); assert.approx(inv.M12, 1, 1e-15); assert.approx(inv.M21, 1, 1e-15); assert.approx(inv.S12, 0, 1e-10); assert.ok(m.copysign(1, inv.a12) > 0); assert.ok(m.copysign(1, inv.s12) > 0); assert.ok(m.copysign(1, inv.m12) > 0); inv = geod.Inverse(90, 0, 90, 180, g.ALL); assert.approx(inv.a12, 0, 1e-13); assert.approx(inv.s12, 0, 1e-8); assert.approx(inv.azi1, 0, 1e-13); assert.approx(inv.azi2, 180, 1e-13); assert.approx(inv.m12, 0, 1e-8); assert.approx(inv.M12, 1, 1e-15); assert.approx(inv.M21, 1, 1e-15); assert.approx(inv.S12, 127516405431022.0, 0.5); // An incapable line which can't take distance as input line = geod.Line(1, 2, 90, g.LATITUDE); dir = line.Position(1000, g.NONE); assert(isNaN(dir.a12)); }); it("GeodSolve84", function() { // Tests for python implementation to check fix for range errors with // {fmod,sin,cos}(inf) (includes GeodSolve84 - GeodSolve86). var geod = g.WGS84, dir; dir = geod.Direct(0, 0, 90, Infinity); assert(isNaN(dir.lat2)); assert(isNaN(dir.lon2)); assert(isNaN(dir.azi2)); dir = geod.Direct(0, 0, 90, NaN); assert(isNaN(dir.lat2)); assert(isNaN(dir.lon2)); assert(isNaN(dir.azi2)); dir = geod.Direct(0, 0, Infinity, 1000); assert(isNaN(dir.lat2)); assert(isNaN(dir.lon2)); assert(isNaN(dir.azi2)); dir = geod.Direct(0, 0, NaN, 1000); assert(isNaN(dir.lat2)); assert(isNaN(dir.lon2)); assert(isNaN(dir.azi2)); dir = geod.Direct(0, Infinity, 90, 1000); assert(dir.lat2 == 0); assert(isNaN(dir.lon2)); assert(dir.azi2 == 90); dir = geod.Direct(0, NaN, 90, 1000); assert(dir.lat2 == 0); assert(isNaN(dir.lon2)); assert(dir.azi2 == 90); dir = geod.Direct(Infinity, 0, 90, 1000); assert(isNaN(dir.lat2)); assert(isNaN(dir.lon2)); assert(isNaN(dir.azi2)); dir = geod.Direct(NaN, 0, 90, 1000); assert(isNaN(dir.lat2)); assert(isNaN(dir.lon2)); assert(isNaN(dir.azi2)); }); it("GeodSolve92", function() { // Check fix for inaccurate hypot with python 3.[89]. Problem reported // by agdhruv https://github.com/geopy/geopy/issues/466 ; see // https://bugs.python.org/issue43088 var geod = g.WGS84, inv = geod.Inverse(37.757540000000006, -122.47018, 37.75754, -122.470177); assert.approx(inv.azi1, 89.99999923, 1e-7 ); assert.approx(inv.azi2, 90.00000106, 1e-7 ); assert.approx(inv.s12, 0.264, 0.5e-3); }); }); describe("Planimeter", function () { var geod = g.WGS84, polygon = geod.Polygon(false), polyline = geod.Polygon(true), Planimeter, PolyLength; Planimeter = function(points) { var i; polygon.Clear(); for (i = 0; i < points.length; ++i) { polygon.AddPoint(points[i][0], points[i][1]); } return polygon.Compute(false, true); }; PolyLength = function(points) { var i; polyline.Clear(); for (i = 0; i < points.length; ++i) { polyline.AddPoint(points[i][0], points[i][1]); } return polyline.Compute(false, true); }; it("Planimeter0", function() { // Check fix for pole-encircling bug found 2011-03-16 var points, a; points = [[89, 0], [89, 90], [89, 180], [89, 270]]; a = Planimeter(points); assert.approx(a.perimeter, 631819.8745, 1e-4); assert.approx(a.area, 24952305678.0, 1); points = [[-89, 0], [-89, 90], [-89, 180], [-89, 270]]; a = Planimeter(points); assert.approx(a.perimeter, 631819.8745, 1e-4); assert.approx(a.area, -24952305678.0, 1); points = [[0, -1], [-1, 0], [0, 1], [1, 0]]; a = Planimeter(points); assert.approx(a.perimeter, 627598.2731, 1e-4); assert.approx(a.area, 24619419146.0, 1); points = [[90, 0], [0, 0], [0, 90]]; a = Planimeter(points); assert.approx(a.perimeter, 30022685, 1); assert.approx(a.area, 63758202715511.0, 1); a = PolyLength(points); assert.approx(a.perimeter, 20020719, 1); assert(isNaN(a.area)); }); it("Planimeter5", function() { // Check fix for Planimeter pole crossing bug found 2011-06-24 var points, a; points = [[89, 0.1], [89, 90.1], [89, -179.9]]; a = Planimeter(points); assert.approx(a.perimeter, 539297, 1); assert.approx(a.area, 12476152838.5, 1); }); it("Planimeter6", function() { // Check fix for Planimeter lon12 rounding bug found 2012-12-03 var points, a; points = [[9, -0.00000000000001], [9, 180], [9, 0]]; a = Planimeter(points); assert.approx(a.perimeter, 36026861, 1); assert.approx(a.area, 0, 1); points = [[9, 0.00000000000001], [9, 0], [9, 180]]; a = Planimeter(points); assert.approx(a.perimeter, 36026861, 1); assert.approx(a.area, 0, 1); points = [[9, 0.00000000000001], [9, 180], [9, 0]]; a = Planimeter(points); assert.approx(a.perimeter, 36026861, 1); assert.approx(a.area, 0, 1); points = [[9, -0.00000000000001], [9, 0], [9, 180]]; a = Planimeter(points); assert.approx(a.perimeter, 36026861, 1); assert.approx(a.area, 0, 1); }); it("Planimeter12", function() { // Area of arctic circle (not really -- adjunct to rhumb-area test) var points, a; points = [[66.562222222, 0], [66.562222222, 180]]; a = Planimeter(points); assert.approx(a.perimeter, 10465729, 1); assert.approx(a.area, 0, 1); }); it("Planimeter13", function() { // Check encircling pole twice var points, a; points = [[89,-360], [89,-240], [89,-120], [89,0], [89,120], [89,240]]; a = Planimeter(points); assert.approx(a.perimeter, 1160741, 1); assert.approx(a.area, 32415230256.0, 1); }); it("Planimeter15", function() { // Coverage tests, includes Planimeter15 - Planimeter18 (combinations of // reverse and sign) + calls to testpoint, testedge. var a, lat, lon, r, a0, area, inv; lat = [2, 1, 3]; lon = [1, 2, 3]; r = 18454562325.45119; a0 = 510065621724088.5093; // ellipsoid area polygon.Clear(); polygon.AddPoint(lat[0], lon[0]); polygon.AddPoint(lat[1], lon[1]); a = polygon.TestPoint(lat[2], lon[2], false, true); assert.approx(a.area, r, 0.5); a = polygon.TestPoint(lat[2], lon[2], false, false); assert.approx(a.area, r, 0.5); a = polygon.TestPoint(lat[2], lon[2], true, true); assert.approx(a.area, -r, 0.5); a = polygon.TestPoint(lat[2], lon[2], true, false); assert.approx(a.area, a0-r, 0.5); inv = geod.Inverse(lat[1], lon[1], lat[2], lon[2]); a = polygon.TestEdge(inv.azi1, inv.s12, false, true); assert.approx(a.area, r, 0.5); a = polygon.TestEdge(inv.azi1, inv.s12, false, false); assert.approx(a.area, r, 0.5); a = polygon.TestEdge(inv.azi1, inv.s12, true, true); assert.approx(a.area, -r, 0.5); a = polygon.TestEdge(inv.azi1, inv.s12, true, false); assert.approx(a.area, a0-r, 0.5); polygon.AddPoint(lat[2], lon[2]); a = polygon.Compute(false, true); assert.approx(a.area, r, 0.5); a = polygon.Compute(false, false); assert.approx(a.area, r, 0.5); a = polygon.Compute(true, true); assert.approx(a.area, -r, 0.5); a = polygon.Compute(true, false); assert.approx(a.area, a0-r, 0.5); }); it("Planimeter19", function() { // Coverage tests, includes Planimeter19 - Planimeter20 (degenerate // polygons) + extra cases. var a; polygon.Clear(); a = polygon.Compute(false, true); assert(a.area == 0); assert(a.perimeter == 0); a = polygon.TestPoint(1, 1, false, true); assert(a.area == 0); assert(a.perimeter == 0); a = polygon.TestEdge(90, 1000, false, true); assert(isNaN(a.area)); assert(isNaN(a.perimeter)); polygon.AddPoint(1, 1); a = polygon.Compute(false, true); assert(a.area == 0); assert(a.perimeter == 0); polyline.Clear(); a = polyline.Compute(false, true); assert(a.perimeter == 0); a = polyline.TestPoint(1, 1, false, true); assert(a.perimeter == 0); a = polyline.TestEdge(90, 1000, false, true); assert(isNaN(a.perimeter)); polyline.AddPoint(1, 1); a = polyline.Compute(false, true); assert(a.perimeter == 0); polygon.AddPoint(1, 1); a = polyline.TestEdge(90, 1000, false, true); assert.approx(a.perimeter, 1000, 1e-10); a = polyline.TestPoint(2, 2, false, true); assert.approx(a.perimeter, 156876.149, 0.5e-3); }); it("Planimeter21", function() { // Some test to add code coverage: multiple circlings of pole (includes // Planimeter21 - Planimeter28) + invocations via testpoint and testedge. var a, lat, azi, s, r, a0, i; lat = 45; azi = 39.2144607176828184218; s = 8420705.40957178156285; r = 39433884866571.4277; // Area for one circuit a0 = 510065621724088.5093; // Ellipsoid area polygon.Clear(); polygon.AddPoint(lat, 60); polygon.AddPoint(lat, 180); polygon.AddPoint(lat, -60); polygon.AddPoint(lat, 60); polygon.AddPoint(lat, 180); polygon.AddPoint(lat, -60); for (i = 3; i <= 4; ++i) { polygon.AddPoint(lat, 60); polygon.AddPoint(lat, 180); a = polygon.TestPoint(lat, -60, false, true); assert.approx(a.area, i*r, 0.5); a = polygon.TestPoint(lat, -60, false, false); assert.approx(a.area, i*r, 0.5); a = polygon.TestPoint(lat, -60, true, true); assert.approx(a.area, -i*r, 0.5); a = polygon.TestPoint(lat, -60, true, false); assert.approx(a.area, -i*r + a0, 0.5); a = polygon.TestEdge(azi, s, false, true); assert.approx(a.area, i*r, 0.5); a = polygon.TestEdge(azi, s, false, false); assert.approx(a.area, i*r, 0.5); a = polygon.TestEdge(azi, s, true, true); assert.approx(a.area, -i*r, 0.5); a = polygon.TestEdge(azi, s, true, false); assert.approx(a.area, -i*r + a0, 0.5); polygon.AddPoint(lat, -60); a = polygon.Compute(false, true); assert.approx(a.area, i*r, 0.5); a = polygon.Compute(false, false); assert.approx(a.area, i*r, 0.5); a = polygon.Compute(true, true); assert.approx(a.area, -i*r, 0.5); a = polygon.Compute(true, false); assert.approx(a.area, -i*r + a0, 0.5); } }); it("Planimeter29", function() { // Check fix to transitdirect vs transit zero handling inconsistency var a; polygon.Clear(); polygon.AddPoint(0, 0); polygon.AddEdge( 90, 1000); polygon.AddEdge( 0, 1000); polygon.AddEdge(-90, 1000); a = polygon.Compute(false, true); // The area should be 1e6. Prior to the fix it was 1e6 - A/2, where // A = ellipsoid area. assert.approx(a.area, 1000000.0, 0.01); }); it("check TestEdge", function() { // Check fix of bugs found by threepointone, 2015-10-14 polygon.Clear(); polygon.AddPoint(33, 44); polygon.TestEdge(90, 10e3, false, true); polygon.AddEdge(90, 10e3, false, true); }); }); }); GeographicLib-1.52/js/types/geographiclib.d.ts0000644000771000077100000000526714064202371021200 0ustar ckarneyckarneyexport enum DMSHemisphereIndicator { NONE = 0, LATITUDE = 1, LONGITUDE = 2, AZIMUTH = 3 } export enum DMSTrailingComponent { DEGREE = 0, MINUTE = 1, SECOND = 2 } export declare const DMS: { NONE: DMSHemisphereIndicator.NONE, LATITUDE: DMSHemisphereIndicator.LATITUDE, LONGITUDE: DMSHemisphereIndicator.LONGITUDE, AZIMUTH: DMSHemisphereIndicator.AZIMUTH, DEGREE: DMSTrailingComponent.DEGREE, MINUTE: DMSTrailingComponent.MINUTE, SECOND: DMSTrailingComponent.SECOND, Decode: (dms: string) => { val: number; ind: DMSHemisphereIndicator; }, DecodeLatLon: ( stra: string, strb: string, longfirst?: boolean // default = false ) => { lat: number; lon: number; }, DecodeAngle: (angstr: string) => number, DecodeAzimuth: (azistr: string) => number, Encode: ( angle: number, trailing: DMSTrailingComponent, prec: number, ind?: DMSHemisphereIndicator // default = NONE ) => string }; declare class GeodesicClass { constructor(a: number, f: number); ArcDirect( lat1: number, lon1: number, azi1: number, a12: number, outmask?: number ): { lat1: number; lon1: number; azi1: number; a12: number; }; ArcDirectLine( lat1: number, lon1: number, azi1: number, a12: number, caps?: number ): any; // TODO: define GeodesicLine object Direct( lat1: number, lon1: number, azi1: number, s12: number, outmask?: number ): { lat1: number; lon1: number; azi1: number; s12: number; a12: number; }; DirectLine( lat1: number, lon1: number, azi1: number, s12: number, caps?: number ): any; // TODO: define GeodesicLine object GenDirect( lat1: number, lon1: number, azi1: number, arcmode: boolean, s12_a12: number, outmask?: number ): { lat1: number; lon1: number; azi1: number; s12?: number; a12: number; }; GenDirectLine( lat1: number, lon1: number, azi1: number, arcmode: boolean, s12_a12: number, caps?: number ): any; // TODO: define GeodesicLine object Inverse( lat1: number, lon1: number, lat2: number, lon2: number, outmask?: number ): { lat1: number; lon1: number; lat2: number; lon2: number; a12: number; s12?: number; } InverseLine( lat1: number, lon1: number, lat2: number, lon2: number, caps?: number ): any; // TODO: define GeodesicLine object } export declare const Geodesic: { Geodesic: typeof GeodesicClass, WGS84: GeodesicClass }; // TODO: Type export declare const GeodesicLine: any; export declare const Math: any; export declare const PolygonArea: any; GeographicLib-1.52/js/Makefile.in0000644000771000077100000003334714064202402016503 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = js 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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@ pkgconfigdir = @pkgconfigdir@ 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)/HEADER.js SAMPLES = \ geod-calc.html \ geod-google.html \ geod-google-instructions.html # The order here is significant JSSCRIPTS = \ $(srcdir)/src/Math.js \ $(srcdir)/src/Geodesic.js \ $(srcdir)/src/GeodesicLine.js \ $(srcdir)/src/PolygonArea.js \ $(srcdir)/src/DMS.js TYPESSCRIPTS = $(srcdir)/types/geographiclib.d.ts TESTSCRIPTS = $(srcdir)/test/geodesictest.js jsdir = $(DESTDIR)$(libdir)/node_modules/geographiclib 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 js/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu js/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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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 \ cscopelist-am ctags-am 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 \ tags-am uninstall uninstall-am .PRECIOUS: Makefile all: geographiclib.js geographiclib.min.js $(SAMPLES) geod-calc.html: samples/geod-calc.html cp $^ $@ geod-google.html: samples/geod-google.html cp $^ $@ geod-google-instructions.html: samples/geod-google-instructions.html cp $^ $@ geographiclib.js: HEADER.js $(JSSCRIPTS) $(srcdir)/js-cat.sh $^ > $@ geographiclib.min.js: HEADER.js $(JSSCRIPTS) $(srcdir)/js-compress.sh $^ > $@ install: all $(INSTALL) -d $(jsdir) $(INSTALL) -m 644 geographiclib.js geographiclib.min.js $(jsdir) $(INSTALL) -m 644 $(top_srcdir)/LICENSE.txt $(srcdir)/README.md \ $(srcdir)/package.json $(jsdir) $(INSTALL) -d $(jsdir)/src $(INSTALL) -m 644 $(JSSCRIPTS) $(jsdir)/src $(INSTALL) -d $(jsdir)/types $(INSTALL) -m 644 $(TYPESSCRIPTS) $(jsdir)/types $(INSTALL) -d $(jsdir)/test $(INSTALL) -m 644 $(TESTSCRIPTS) $(jsdir)/test # 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.52/legacy/C/00README.txt0000644000771000077100000000140514064202371017301 0ustar ckarneyckarneyThis is a C implementation of the geodesic algorithms described in C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); https://doi.org/10.1007/s00190-012-0578-z Addenda: https://geographiclib.sourceforge.io/geod-addenda.html For documentation, see https://geographiclib.sourceforge.io/html/C/ The code in this directory is entirely self-contained. In particular, it does not depend on the C++ classes. You can compile and link the example programs directly with something like: cc -o inverse inverse.c geodesic.c -lm echo 30 0 29.5 179.5 | ./inverse Alternatively, you can build the examples using cmake. For example, on Linux systems you might do: mkdir BUILD cd BUILD cmake .. make echo 30 0 29.5 179.5 | ./inverse GeographicLib-1.52/legacy/C/CMakeLists.txt0000644000771000077100000000457314064202371020214 0ustar ckarneyckarneyproject (GeographicLib-C C) cmake_minimum_required (VERSION 3.1.0) # 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 () # We require C99 set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) # Make the compiler more picky. if (MSVC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-array-bounds -pedantic") if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion") endif () endif () # Tell Intel compiler to do arithmetic accurately. This is needed to # stop the compiler from ignoring parentheses in expressions like # (a + b) + c and from simplifying 0.0 + x to x (which is wrong if # x = -0.0). if (CMAKE_C_COMPILER_ID STREQUAL "Intel") if (MSVC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fp:precise /Qdiag-disable:11074,11076") else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -diag-disable=11074,11076") endif () endif () include (CheckCSourceCompiles) if (MSVC) set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} /WX") else () set (CMAKE_REQUIRED_LIBRARIES m) set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} -Werror") endif () # Check whether the C99 math function: hypot, atanh, etc. are available. check_c_source_compiles ( "#include int main() { int q = 0; return (int)(hypot(3.0, 4.0) + atanh(0.8) + copysign(1.0, -0.0) + cbrt(8.0) + remainder(100.0, 90.0) + remquo(100.0, 90.0, &q)); }\n" C99_MATH) if (NOT C99_MATH) message (FATAL_ERROR "Missing C99 math functions") endif () if (CONVERT_WARNINGS_TO_ERRORS) if (MSVC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") else () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") endif () endif () set (TOOLS direct inverse planimeter geodtest) foreach (TOOL ${TOOLS}) add_executable (${TOOL} ${TOOL}.c geodesic.c geodesic.h) if (NOT MSVC) target_link_libraries (${TOOL} m) endif () endforeach () if (MSVC OR CMAKE_CONFIGURATION_TYPES) # Add _d suffix for your debug versions of the tools set_target_properties (${TOOLS} PROPERTIES DEBUG_POSTFIX _d) endif () # Turn on testing enable_testing () # Run the test suite add_test (NAME geodtest COMMAND geodtest) GeographicLib-1.52/legacy/C/direct.c0000644000771000077100000000163314064202371017064 0ustar ckarneyckarney/** * @file direct.c * @brief A test program for geod_direct() **********************************************************************/ #include #include "geodesic.h" #if defined(_MSC_VER) /* Squelch warnings about scanf */ # pragma warning (disable: 4996) #endif /** * A simple program to solve the direct geodesic problem. * * This program reads in lines with lat1, lon1, azi1, s12 and prints out lines * with lat2, lon2, azi2 (for the WGS84 ellipsoid). **********************************************************************/ int main() { double a = 6378137, f = 1/298.257223563; /* WGS84 */ double lat1, lon1, azi1, lat2, lon2, azi2, s12; struct geod_geodesic g; geod_init(&g, a, f); while (scanf("%lf %lf %lf %lf", &lat1, &lon1, &azi1, &s12) == 4) { geod_direct(&g, lat1, lon1, azi1, s12, &lat2, &lon2, &azi2); printf("%.15f %.15f %.15f\n", lat2, lon2, azi2); } return 0; } GeographicLib-1.52/legacy/C/geodesic.c0000644000771000077100000021313314064202371017374 0ustar ckarneyckarney/** * \file geodesic.c * \brief Implementation of the geodesic routines in C * * For the full documentation see geodesic.h. **********************************************************************/ /** @cond SKIP */ /* * This is a C implementation of the geodesic algorithms described in * * C. F. F. Karney, * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * https://doi.org/10.1007/s00190-012-0578-z * Addenda: https://geographiclib.sourceforge.io/geod-addenda.html * * See the comments in geodesic.h for documentation. * * Copyright (c) Charles Karney (2012-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ */ #include "geodesic.h" #include #include #include #if !defined(__cplusplus) #define nullptr 0 #endif #define GEOGRAPHICLIB_GEODESIC_ORDER 6 #define nA1 GEOGRAPHICLIB_GEODESIC_ORDER #define nC1 GEOGRAPHICLIB_GEODESIC_ORDER #define nC1p GEOGRAPHICLIB_GEODESIC_ORDER #define nA2 GEOGRAPHICLIB_GEODESIC_ORDER #define nC2 GEOGRAPHICLIB_GEODESIC_ORDER #define nA3 GEOGRAPHICLIB_GEODESIC_ORDER #define nA3x nA3 #define nC3 GEOGRAPHICLIB_GEODESIC_ORDER #define nC3x ((nC3 * (nC3 - 1)) / 2) #define nC4 GEOGRAPHICLIB_GEODESIC_ORDER #define nC4x ((nC4 * (nC4 + 1)) / 2) #define nC (GEOGRAPHICLIB_GEODESIC_ORDER + 1) typedef double real; typedef int boolx; static unsigned init = 0; static const int FALSE = 0; static const int TRUE = 1; static unsigned digits, maxit1, maxit2; static real epsilon, realmin, pi, degree, NaN, tiny, tol0, tol1, tol2, tolb, xthresh; static void Init(void) { if (!init) { digits = DBL_MANT_DIG; epsilon = DBL_EPSILON; realmin = DBL_MIN; #if defined(M_PI) pi = M_PI; #else pi = atan2(0.0, -1.0); #endif maxit1 = 20; maxit2 = maxit1 + digits + 10; tiny = sqrt(realmin); tol0 = 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) */ tol1 = 200 * tol0; tol2 = sqrt(tol0); /* Check on bisection interval */ tolb = tol0 * tol2; xthresh = 1000 * tol2; degree = pi/180; NaN = nan("0"); init = 1; } } 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 sq(real x) { return x * x; } static real sumx(real u, real v, real* t) { volatile real s = u + v; volatile real up = s - v; volatile real vpp = s - up; up -= u; vpp -= v; if (t) *t = -(up + vpp); /* error-free sum: * u + v = s + t * = round(u + v) + t */ return s; } static real polyval(int N, const real p[], real x) { real y = N < 0 ? 0 : *p++; while (--N >= 0) y = y * x + *p++; return y; } /* mimic C++ std::min and std::max */ static real minx(real a, real b) { return (b < a) ? b : a; } static real maxx(real a, real b) { return (a < b) ? b : a; } static void swapx(real* x, real* y) { real t = *x; *x = *y; *y = t; } static void norm2(real* sinx, real* cosx) { #if defined(_MSC_VER) && defined(_M_IX86) /* hypot for Visual Studio (A=win32) fails monotonicity, e.g., with * x = 0.6102683302836215 * y1 = 0.7906090004346522 * y2 = y1 + 1e-16 * the test * hypot(x, y2) >= hypot(x, y1) * fails. See also * https://bugs.python.org/issue43088 */ real r = sqrt(*sinx * *sinx + *cosx * *cosx); #else real r = hypot(*sinx, *cosx); #endif *sinx /= r; *cosx /= r; } static real AngNormalize(real x) { x = remainder(x, (real)(360)); return x != -180 ? x : 180; } static real LatFix(real x) { return fabs(x) > 90 ? NaN : x; } static real AngDiff(real x, real y, real* e) { real t, d = AngNormalize(sumx(AngNormalize(-x), AngNormalize(y), &t)); /* Here y - x = d + t (mod 360), exactly, where d is in (-180,180] and * abs(t) <= eps (eps = 2^-45 for doubles). The only case where the * addition of t takes the result outside the range (-180,180] is d = 180 * and t > 0. The case, d = -180 + eps, t = -eps, can't happen, since * sum would have returned the exact result in such a case (i.e., given t * = 0). */ return sumx(d == 180 && t > 0 ? -180 : d, t, e); } static real AngRound(real x) { const real z = 1/(real)(16); volatile real y; if (x == 0) return 0; y = fabs(x); /* The compiler mustn't "simplify" z - (z - y) to y */ y = y < z ? z - (z - y) : y; return x < 0 ? -y : y; } static void sincosdx(real x, real* sinx, real* cosx) { /* In order to minimize round-off errors, this function exactly reduces * the argument to the range [-45, 45] before converting it to radians. */ real r, s, c; int q = 0; r = remquo(x, (real)(90), &q); /* now abs(r) <= 45 */ r *= degree; /* Possibly could call the gnu extension sincos */ s = sin(r); c = cos(r); switch ((unsigned)q & 3U) { case 0U: *sinx = s; *cosx = c; break; case 1U: *sinx = c; *cosx = -s; break; case 2U: *sinx = -s; *cosx = -c; break; default: *sinx = -c; *cosx = s; break; /* case 3U */ } if (x != 0) { *sinx += (real)(0); *cosx += (real)(0); } } static real atan2dx(real y, real x) { /* In order to minimize round-off errors, this function rearranges the * arguments so that result of atan2 is in the range [-pi/4, pi/4] before * converting it to degrees and mapping the result to the correct * quadrant. */ int q = 0; real ang; if (fabs(y) > fabs(x)) { swapx(&x, &y); q = 2; } if (x < 0) { x = -x; ++q; } /* here x >= 0 and x >= abs(y), so angle is in [-pi/4, pi/4] */ ang = atan2(y, x) / degree; switch (q) { /* Note that atan2d(-0.0, 1.0) will return -0. However, we expect that * atan2d will not be called with y = -0. If need be, include * * case 0: ang = 0 + ang; break; */ case 1: ang = (y >= 0 ? 180 : -180) - ang; break; case 2: ang = 90 - ang; break; case 3: ang = -90 + ang; break; default: break; } return ang; } static void A3coeff(struct geod_geodesic* g); static void C3coeff(struct geod_geodesic* g); static void C4coeff(struct geod_geodesic* g); static real SinCosSeries(boolx sinp, real sinx, real cosx, const real c[], int n); static void Lengths(const struct geod_geodesic* g, real eps, real sig12, real ssig1, real csig1, real dn1, real ssig2, real csig2, real dn2, real cbet1, real cbet2, real* ps12b, real* pm12b, real* pm0, real* pM12, real* pM21, /* Scratch area of the right size */ real Ca[]); static real Astroid(real x, real y); static real InverseStart(const struct geod_geodesic* g, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real lam12, real slam12, real clam12, real* psalp1, real* pcalp1, /* Only updated if return val >= 0 */ real* psalp2, real* pcalp2, /* Only updated for short lines */ real* pdnm, /* Scratch area of the right size */ real Ca[]); static real Lambda12(const struct geod_geodesic* g, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real salp1, real calp1, real slam120, real clam120, real* psalp2, real* pcalp2, real* psig12, real* pssig1, real* pcsig1, real* pssig2, real* pcsig2, real* peps, real* pdomg12, boolx diffp, real* pdlam12, /* Scratch area of the right size */ real Ca[]); static real A3f(const struct geod_geodesic* g, real eps); static void C3f(const struct geod_geodesic* g, real eps, real c[]); static void C4f(const struct geod_geodesic* g, real eps, real c[]); static real A1m1f(real eps); static void C1f(real eps, real c[]); static void C1pf(real eps, real c[]); static real A2m1f(real eps); static void C2f(real eps, real c[]); static int transit(real lon1, real lon2); static int transitdirect(real lon1, real lon2); static void accini(real s[]); static void acccopy(const real s[], real t[]); static void accadd(real s[], real y); static real accsum(const real s[], real y); static void accneg(real s[]); static void accrem(real s[], real y); static real areareduceA(real area[], real area0, int crossings, boolx reverse, boolx sign); static real areareduceB(real area, real area0, int crossings, boolx reverse, boolx sign); void geod_init(struct geod_geodesic* g, real a, real f) { if (!init) Init(); g->a = a; g->f = f; g->f1 = 1 - g->f; g->e2 = g->f * (2 - g->f); g->ep2 = g->e2 / sq(g->f1); /* e2 / (1 - e2) */ g->n = g->f / ( 2 - g->f); g->b = g->a * g->f1; g->c2 = (sq(g->a) + sq(g->b) * (g->e2 == 0 ? 1 : (g->e2 > 0 ? atanh(sqrt(g->e2)) : atan(sqrt(-g->e2))) / sqrt(fabs(g->e2))))/2; /* authalic radius squared */ /* The sig12 threshold for "really short". Using the auxiliary sphere * solution with dnm computed at (bet1 + bet2) / 2, the relative error in the * azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. (Error * measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a given f and * sig12, the max error occurs for lines near the pole. If the old rule for * computing dnm = (dn1 + dn2)/2 is used, then the error increases by a * factor of 2.) Setting this equal to epsilon gives sig12 = etol2. Here * 0.1 is a safety factor (error decreased by 100) and max(0.001, abs(f)) * stops etol2 getting too large in the nearly spherical case. */ g->etol2 = 0.1 * tol2 / sqrt( maxx((real)(0.001), fabs(g->f)) * minx((real)(1), 1 - g->f/2) / 2 ); A3coeff(g); C3coeff(g); C4coeff(g); } static void geod_lineinit_int(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps) { real cbet1, sbet1, eps; l->a = g->a; l->f = g->f; l->b = g->b; l->c2 = g->c2; l->f1 = g->f1; /* If caps is 0 assume the standard direct calculation */ l->caps = (caps ? caps : GEOD_DISTANCE_IN | GEOD_LONGITUDE) | /* always allow latitude and azimuth and unrolling of longitude */ GEOD_LATITUDE | GEOD_AZIMUTH | GEOD_LONG_UNROLL; l->lat1 = LatFix(lat1); l->lon1 = lon1; l->azi1 = azi1; l->salp1 = salp1; l->calp1 = calp1; sincosdx(AngRound(l->lat1), &sbet1, &cbet1); sbet1 *= l->f1; /* Ensure cbet1 = +epsilon at poles */ norm2(&sbet1, &cbet1); cbet1 = maxx(tiny, cbet1); l->dn1 = sqrt(1 + g->ep2 * sq(sbet1)); /* Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), */ l->salp0 = l->salp1 * cbet1; /* alp0 in [0, pi/2 - |bet1|] */ /* Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following * is slightly better (consider the case salp1 = 0). */ l->calp0 = hypot(l->calp1, l->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. */ l->ssig1 = sbet1; l->somg1 = l->salp0 * sbet1; l->csig1 = l->comg1 = sbet1 != 0 || l->calp1 != 0 ? cbet1 * l->calp1 : 1; norm2(&l->ssig1, &l->csig1); /* sig1 in (-pi, pi] */ /* norm2(somg1, comg1); -- don't need to normalize! */ l->k2 = sq(l->calp0) * g->ep2; eps = l->k2 / (2 * (1 + sqrt(1 + l->k2)) + l->k2); if (l->caps & CAP_C1) { real s, c; l->A1m1 = A1m1f(eps); C1f(eps, l->C1a); l->B11 = SinCosSeries(TRUE, l->ssig1, l->csig1, l->C1a, nC1); s = sin(l->B11); c = cos(l->B11); /* tau1 = sig1 + B11 */ l->stau1 = l->ssig1 * c + l->csig1 * s; l->ctau1 = l->csig1 * c - l->ssig1 * s; /* Not necessary because C1pa reverts C1a * B11 = -SinCosSeries(TRUE, stau1, ctau1, C1pa, nC1p); */ } if (l->caps & CAP_C1p) C1pf(eps, l->C1pa); if (l->caps & CAP_C2) { l->A2m1 = A2m1f(eps); C2f(eps, l->C2a); l->B21 = SinCosSeries(TRUE, l->ssig1, l->csig1, l->C2a, nC2); } if (l->caps & CAP_C3) { C3f(g, eps, l->C3a); l->A3c = -l->f * l->salp0 * A3f(g, eps); l->B31 = SinCosSeries(TRUE, l->ssig1, l->csig1, l->C3a, nC3-1); } if (l->caps & CAP_C4) { C4f(g, eps, l->C4a); /* Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) */ l->A4 = sq(l->a) * l->calp0 * l->salp0 * g->e2; l->B41 = SinCosSeries(FALSE, l->ssig1, l->csig1, l->C4a, nC4); } l->a13 = l->s13 = NaN; } void geod_lineinit(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, unsigned caps) { real salp1, calp1; azi1 = AngNormalize(azi1); /* Guard against underflow in salp0 */ sincosdx(AngRound(azi1), &salp1, &calp1); geod_lineinit_int(l, g, lat1, lon1, azi1, salp1, calp1, caps); } void geod_gendirectline(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, unsigned flags, real s12_a12, unsigned caps) { geod_lineinit(l, g, lat1, lon1, azi1, caps); geod_gensetdistance(l, flags, s12_a12); } void geod_directline(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, real s12, unsigned caps) { geod_gendirectline(l, g, lat1, lon1, azi1, GEOD_NOFLAGS, s12, caps); } real geod_genposition(const struct geod_geodesicline* l, unsigned flags, real s12_a12, real* plat2, real* plon2, real* pazi2, real* ps12, real* pm12, real* pM12, real* pM21, real* pS12) { real lat2 = 0, lon2 = 0, azi2 = 0, s12 = 0, m12 = 0, M12 = 0, M21 = 0, S12 = 0; /* Avoid warning about uninitialized B12. */ real sig12, ssig12, csig12, B12 = 0, AB1 = 0; real omg12, lam12, lon12; real ssig2, csig2, sbet2, cbet2, somg2, comg2, salp2, calp2, dn2; unsigned outmask = (plat2 ? GEOD_LATITUDE : GEOD_NONE) | (plon2 ? GEOD_LONGITUDE : GEOD_NONE) | (pazi2 ? GEOD_AZIMUTH : GEOD_NONE) | (ps12 ? GEOD_DISTANCE : GEOD_NONE) | (pm12 ? GEOD_REDUCEDLENGTH : GEOD_NONE) | (pM12 || pM21 ? GEOD_GEODESICSCALE : GEOD_NONE) | (pS12 ? GEOD_AREA : GEOD_NONE); outmask &= l->caps & OUT_ALL; if (!( (flags & GEOD_ARCMODE || (l->caps & (GEOD_DISTANCE_IN & OUT_ALL))) )) /* Impossible distance calculation requested */ return NaN; if (flags & GEOD_ARCMODE) { /* Interpret s12_a12 as spherical arc length */ sig12 = s12_a12 * degree; sincosdx(s12_a12, &ssig12, &csig12); } else { /* Interpret s12_a12 as distance */ real tau12 = s12_a12 / (l->b * (1 + l->A1m1)), s = sin(tau12), c = cos(tau12); /* tau2 = tau1 + tau12 */ B12 = - SinCosSeries(TRUE, l->stau1 * c + l->ctau1 * s, l->ctau1 * c - l->stau1 * s, l->C1pa, nC1p); sig12 = tau12 - (B12 - l->B11); ssig12 = sin(sig12); csig12 = cos(sig12); if (fabs(l->f) > 0.01) { /* Reverted distance series is inaccurate for |f| > 1/100, so correct * sig12 with 1 Newton iteration. The following table shows the * approximate maximum error for a = WGS_a() and various f relative to * GeodesicExact. * erri = the error in the inverse solution (nm) * errd = the error in the direct solution (series only) (nm) * errda = the error in the direct solution (series + 1 Newton) (nm) * * f erri errd errda * -1/5 12e6 1.2e9 69e6 * -1/10 123e3 12e6 765e3 * -1/20 1110 108e3 7155 * -1/50 18.63 200.9 27.12 * -1/100 18.63 23.78 23.37 * -1/150 18.63 21.05 20.26 * 1/150 22.35 24.73 25.83 * 1/100 22.35 25.03 25.31 * 1/50 29.80 231.9 30.44 * 1/20 5376 146e3 10e3 * 1/10 829e3 22e6 1.5e6 * 1/5 157e6 3.8e9 280e6 */ real serr; ssig2 = l->ssig1 * csig12 + l->csig1 * ssig12; csig2 = l->csig1 * csig12 - l->ssig1 * ssig12; B12 = SinCosSeries(TRUE, ssig2, csig2, l->C1a, nC1); serr = (1 + l->A1m1) * (sig12 + (B12 - l->B11)) - s12_a12 / l->b; sig12 = sig12 - serr / sqrt(1 + l->k2 * sq(ssig2)); ssig12 = sin(sig12); csig12 = cos(sig12); /* Update B12 below */ } } /* sig2 = sig1 + sig12 */ ssig2 = l->ssig1 * csig12 + l->csig1 * ssig12; csig2 = l->csig1 * csig12 - l->ssig1 * ssig12; dn2 = sqrt(1 + l->k2 * sq(ssig2)); if (outmask & (GEOD_DISTANCE | GEOD_REDUCEDLENGTH | GEOD_GEODESICSCALE)) { if (flags & GEOD_ARCMODE || fabs(l->f) > 0.01) B12 = SinCosSeries(TRUE, ssig2, csig2, l->C1a, nC1); AB1 = (1 + l->A1m1) * (B12 - l->B11); } /* sin(bet2) = cos(alp0) * sin(sig2) */ sbet2 = l->calp0 * ssig2; /* Alt: cbet2 = hypot(csig2, salp0 * ssig2); */ cbet2 = hypot(l->salp0, l->calp0 * csig2); if (cbet2 == 0) /* I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case */ cbet2 = csig2 = tiny; /* tan(alp0) = cos(sig2)*tan(alp2) */ salp2 = l->salp0; calp2 = l->calp0 * csig2; /* No need to normalize */ if (outmask & GEOD_DISTANCE) s12 = (flags & GEOD_ARCMODE) ? l->b * ((1 + l->A1m1) * sig12 + AB1) : s12_a12; if (outmask & GEOD_LONGITUDE) { real E = copysign(1, l->salp0); /* east or west going? */ /* tan(omg2) = sin(alp0) * tan(sig2) */ somg2 = l->salp0 * ssig2; comg2 = csig2; /* No need to normalize */ /* omg12 = omg2 - omg1 */ omg12 = (flags & GEOD_LONG_UNROLL) ? E * (sig12 - (atan2( ssig2, csig2) - atan2( l->ssig1, l->csig1)) + (atan2(E * somg2, comg2) - atan2(E * l->somg1, l->comg1))) : atan2(somg2 * l->comg1 - comg2 * l->somg1, comg2 * l->comg1 + somg2 * l->somg1); lam12 = omg12 + l->A3c * ( sig12 + (SinCosSeries(TRUE, ssig2, csig2, l->C3a, nC3-1) - l->B31)); lon12 = lam12 / degree; lon2 = (flags & GEOD_LONG_UNROLL) ? l->lon1 + lon12 : AngNormalize(AngNormalize(l->lon1) + AngNormalize(lon12)); } if (outmask & GEOD_LATITUDE) lat2 = atan2dx(sbet2, l->f1 * cbet2); if (outmask & GEOD_AZIMUTH) azi2 = atan2dx(salp2, calp2); if (outmask & (GEOD_REDUCEDLENGTH | GEOD_GEODESICSCALE)) { real B22 = SinCosSeries(TRUE, ssig2, csig2, l->C2a, nC2), AB2 = (1 + l->A2m1) * (B22 - l->B21), J12 = (l->A1m1 - l->A2m1) * sig12 + (AB1 - AB2); if (outmask & GEOD_REDUCEDLENGTH) /* Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure * accurate cancellation in the case of coincident points. */ m12 = l->b * ((dn2 * (l->csig1 * ssig2) - l->dn1 * (l->ssig1 * csig2)) - l->csig1 * csig2 * J12); if (outmask & GEOD_GEODESICSCALE) { real t = l->k2 * (ssig2 - l->ssig1) * (ssig2 + l->ssig1) / (l->dn1 + dn2); M12 = csig12 + (t * ssig2 - csig2 * J12) * l->ssig1 / l->dn1; M21 = csig12 - (t * l->ssig1 - l->csig1 * J12) * ssig2 / dn2; } } if (outmask & GEOD_AREA) { real B42 = SinCosSeries(FALSE, ssig2, csig2, l->C4a, nC4); real salp12, calp12; if (l->calp0 == 0 || l->salp0 == 0) { /* alp12 = alp2 - alp1, used in atan2 so no need to normalize */ salp12 = salp2 * l->calp1 - calp2 * l->salp1; calp12 = calp2 * l->calp1 + salp2 * l->salp1; } 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 = l->calp0 * l->salp0 * (csig12 <= 0 ? l->csig1 * (1 - csig12) + ssig12 * l->ssig1 : ssig12 * (l->csig1 * ssig12 / (1 + csig12) + l->ssig1)); calp12 = sq(l->salp0) + sq(l->calp0) * l->csig1 * csig2; } S12 = l->c2 * atan2(salp12, calp12) + l->A4 * (B42 - l->B41); } /* In the pattern * * if ((outmask & GEOD_XX) && pYY) * *pYY = YY; * * the second check "&& pYY" is redundant. It's there to make the CLang * static analyzer happy. */ if ((outmask & GEOD_LATITUDE) && plat2) *plat2 = lat2; if ((outmask & GEOD_LONGITUDE) && plon2) *plon2 = lon2; if ((outmask & GEOD_AZIMUTH) && pazi2) *pazi2 = azi2; if ((outmask & GEOD_DISTANCE) && ps12) *ps12 = s12; if ((outmask & GEOD_REDUCEDLENGTH) && pm12) *pm12 = m12; if (outmask & GEOD_GEODESICSCALE) { if (pM12) *pM12 = M12; if (pM21) *pM21 = M21; } if ((outmask & GEOD_AREA) && pS12) *pS12 = S12; return (flags & GEOD_ARCMODE) ? s12_a12 : sig12 / degree; } void geod_setdistance(struct geod_geodesicline* l, real s13) { l->s13 = s13; l->a13 = geod_genposition(l, GEOD_NOFLAGS, l->s13, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); } static void geod_setarc(struct geod_geodesicline* l, real a13) { l->a13 = a13; l->s13 = NaN; geod_genposition(l, GEOD_ARCMODE, l->a13, nullptr, nullptr, nullptr, &l->s13, nullptr, nullptr, nullptr, nullptr); } void geod_gensetdistance(struct geod_geodesicline* l, unsigned flags, real s13_a13) { (flags & GEOD_ARCMODE) ? geod_setarc(l, s13_a13) : geod_setdistance(l, s13_a13); } void geod_position(const struct geod_geodesicline* l, real s12, real* plat2, real* plon2, real* pazi2) { geod_genposition(l, FALSE, s12, plat2, plon2, pazi2, nullptr, nullptr, nullptr, nullptr, nullptr); } real geod_gendirect(const struct geod_geodesic* g, real lat1, real lon1, real azi1, unsigned flags, real s12_a12, real* plat2, real* plon2, real* pazi2, real* ps12, real* pm12, real* pM12, real* pM21, real* pS12) { struct geod_geodesicline l; unsigned outmask = (plat2 ? GEOD_LATITUDE : GEOD_NONE) | (plon2 ? GEOD_LONGITUDE : GEOD_NONE) | (pazi2 ? GEOD_AZIMUTH : GEOD_NONE) | (ps12 ? GEOD_DISTANCE : GEOD_NONE) | (pm12 ? GEOD_REDUCEDLENGTH : GEOD_NONE) | (pM12 || pM21 ? GEOD_GEODESICSCALE : GEOD_NONE) | (pS12 ? GEOD_AREA : GEOD_NONE); geod_lineinit(&l, g, lat1, lon1, azi1, /* Automatically supply GEOD_DISTANCE_IN if necessary */ outmask | ((flags & GEOD_ARCMODE) ? GEOD_NONE : GEOD_DISTANCE_IN)); return geod_genposition(&l, flags, s12_a12, plat2, plon2, pazi2, ps12, pm12, pM12, pM21, pS12); } void geod_direct(const struct geod_geodesic* g, real lat1, real lon1, real azi1, real s12, real* plat2, real* plon2, real* pazi2) { geod_gendirect(g, lat1, lon1, azi1, GEOD_NOFLAGS, s12, plat2, plon2, pazi2, nullptr, nullptr, nullptr, nullptr, nullptr); } static real geod_geninverse_int(const struct geod_geodesic* g, real lat1, real lon1, real lat2, real lon2, real* ps12, real* psalp1, real* pcalp1, real* psalp2, real* pcalp2, real* pm12, real* pM12, real* pM21, real* pS12) { real s12 = 0, m12 = 0, M12 = 0, M21 = 0, S12 = 0; real lon12, lon12s; int latsign, lonsign, swapp; real sbet1, cbet1, sbet2, cbet2, s12x = 0, m12x = 0; real dn1, dn2, lam12, slam12, clam12; real a12 = 0, sig12, calp1 = 0, salp1 = 0, calp2 = 0, salp2 = 0; real Ca[nC]; boolx meridian; /* somg12 > 1 marks that it needs to be calculated */ real omg12 = 0, somg12 = 2, comg12 = 0; unsigned outmask = (ps12 ? GEOD_DISTANCE : GEOD_NONE) | (pm12 ? GEOD_REDUCEDLENGTH : GEOD_NONE) | (pM12 || pM21 ? GEOD_GEODESICSCALE : GEOD_NONE) | (pS12 ? GEOD_AREA : GEOD_NONE); outmask &= OUT_ALL; /* Compute longitude difference (AngDiff does this carefully). Result is * in [-180, 180] but -180 is only for west-going geodesics. 180 is for * east-going and meridional geodesics. */ lon12 = AngDiff(lon1, lon2, &lon12s); /* Make longitude difference positive. */ lonsign = lon12 >= 0 ? 1 : -1; /* If very close to being on the same half-meridian, then make it so. */ lon12 = lonsign * AngRound(lon12); lon12s = AngRound((180 - lon12) - lonsign * lon12s); lam12 = lon12 * degree; if (lon12 > 90) { sincosdx(lon12s, &slam12, &clam12); clam12 = -clam12; } else sincosdx(lon12, &slam12, &clam12); /* If really close to the equator, treat as on equator. */ lat1 = AngRound(LatFix(lat1)); lat2 = AngRound(LatFix(lat2)); /* Swap points so that point with higher (abs) latitude is point 1 * If one latitude is a nan, then it becomes lat1. */ swapp = fabs(lat1) < fabs(lat2) ? -1 : 1; if (swapp < 0) { lonsign *= -1; swapx(&lat1, &lat2); } /* Make lat1 <= 0 */ 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. */ sincosdx(lat1, &sbet1, &cbet1); sbet1 *= g->f1; /* Ensure cbet1 = +epsilon at poles */ norm2(&sbet1, &cbet1); cbet1 = maxx(tiny, cbet1); sincosdx(lat2, &sbet2, &cbet2); sbet2 *= g->f1; /* Ensure cbet2 = +epsilon at poles */ norm2(&sbet2, &cbet2); cbet2 = maxx(tiny, 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 (fabs(sbet2) == -sbet1) cbet2 = cbet1; } dn1 = sqrt(1 + g->ep2 * sq(sbet1)); dn2 = sqrt(1 + g->ep2 * sq(sbet2)); meridian = lat1 == -90 || slam12 == 0; if (meridian) { /* Endpoints are on a single full meridian, so the geodesic might lie on * a meridian. */ real ssig1, csig1, ssig2, csig2; 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 = atan2(maxx((real)(0), csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); Lengths(g, g->n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, &s12x, &m12x, nullptr, (outmask & GEOD_GEODESICSCALE) ? &M12 : nullptr, (outmask & GEOD_GEODESICSCALE) ? &M21 : nullptr, Ca); /* Add the check for sig12 since zero length geodesics might yield m12 < * 0. Test case was * * echo 20.001 0 20.001 0 | GeodSolve -i * * In fact, we will have sig12 > pi/2 for meridional geodesic which is * not a shortest path. */ if (sig12 < 1 || m12x >= 0) { /* Need at least 2, to handle 90 0 90 180 */ if (sig12 < 3 * tiny || // Prevent negative s12 or m12 for short lines (sig12 < tol0 && (s12x < 0 || m12x < 0))) sig12 = m12x = s12x = 0; m12x *= g->b; s12x *= g->b; a12 = sig12 / degree; } else /* m12 < 0, i.e., prolate and too close to anti-podal */ meridian = FALSE; } if (!meridian && sbet1 == 0 && /* and sbet2 == 0 */ /* Mimic the way Lambda12 works with calp1 = 0 */ (g->f <= 0 || lon12s >= g->f * 180)) { /* Geodesic runs along equator */ calp1 = calp2 = 0; salp1 = salp2 = 1; s12x = g->a * lam12; sig12 = omg12 = lam12 / g->f1; m12x = g->b * sin(sig12); if (outmask & GEOD_GEODESICSCALE) M12 = M21 = cos(sig12); a12 = lon12 / g->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 */ real dnm = 0; sig12 = InverseStart(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, &salp1, &calp1, &salp2, &calp2, &dnm, Ca); if (sig12 >= 0) { /* Short lines (InverseStart sets salp2, calp2, dnm) */ s12x = sig12 * g->b * dnm; m12x = sq(dnm) * g->b * sin(sig12 / dnm); if (outmask & GEOD_GEODESICSCALE) M12 = M21 = cos(sig12 / dnm); a12 = sig12 / degree; omg12 = lam12 / (g->f1 * dnm); } else { /* Newton's method. This is a straightforward solution of f(alp1) = * lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one * root in the interval (0, pi) and its derivative is positive at the * root. Thus f(alp) is positive for alp > alp1 and negative for alp < * alp1. During the course of the iteration, a range (alp1a, alp1b) is * maintained which brackets the root and with each evaluation of * f(alp) the range is shrunk, if possible. Newton's method is * restarted whenever the derivative of f is negative (because the new * value of alp1 is then further from the solution) or if the new * estimate of alp1 lies outside (0,pi); in this case, the new starting * guess is taken to be (alp1a + alp1b) / 2. */ real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0, domg12 = 0; unsigned numit = 0; /* Bracketing range */ real salp1a = tiny, calp1a = 1, salp1b = tiny, calp1b = -1; boolx tripn = FALSE; boolx tripb = FALSE; for (; numit < maxit2; ++numit) { /* the WGS84 test set: mean = 1.47, sd = 1.25, max = 16 * WGS84 and random input: mean = 2.85, sd = 0.60 */ real dv = 0, v = Lambda12(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, &salp2, &calp2, &sig12, &ssig1, &csig1, &ssig2, &csig2, &eps, &domg12, numit < maxit1, &dv, Ca); /* Reversed test to allow escape with NaNs */ if (tripb || !(fabs(v) >= (tripn ? 8 : 1) * tol0)) break; /* Update bracketing values */ if (v > 0 && (numit > maxit1 || calp1/salp1 > calp1b/salp1b)) { salp1b = salp1; calp1b = calp1; } else if (v < 0 && (numit > maxit1 || calp1/salp1 < calp1a/salp1a)) { salp1a = salp1; calp1a = calp1; } if (numit < maxit1 && dv > 0) { real dalp1 = -v/dv; real sdalp1 = sin(dalp1), cdalp1 = cos(dalp1), nsalp1 = salp1 * cdalp1 + calp1 * sdalp1; if (nsalp1 > 0 && fabs(dalp1) < pi) { calp1 = calp1 * cdalp1 - salp1 * sdalp1; salp1 = nsalp1; norm2(&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). */ tripn = fabs(v) <= 16 * tol0; continue; } } /* Either dv was not positive or updated value was outside legal * range. Use the midpoint of the bracket as the next estimate. * This mechanism is not needed for the WGS84 ellipsoid, but it does * catch problems with more eccentric ellipsoids. Its efficacy is * such for the WGS84 test set with the starting guess set to alp1 = * 90deg: * the WGS84 test set: mean = 5.21, sd = 3.93, max = 24 * WGS84 and random input: mean = 4.74, sd = 0.99 */ salp1 = (salp1a + salp1b)/2; calp1 = (calp1a + calp1b)/2; norm2(&salp1, &calp1); tripn = FALSE; tripb = (fabs(salp1a - salp1) + (calp1a - calp1) < tolb || fabs(salp1 - salp1b) + (calp1 - calp1b) < tolb); } Lengths(g, eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, &s12x, &m12x, nullptr, (outmask & GEOD_GEODESICSCALE) ? &M12 : nullptr, (outmask & GEOD_GEODESICSCALE) ? &M21 : nullptr, Ca); m12x *= g->b; s12x *= g->b; a12 = sig12 / degree; if (outmask & GEOD_AREA) { /* omg12 = lam12 - domg12 */ real sdomg12 = sin(domg12), cdomg12 = cos(domg12); somg12 = slam12 * cdomg12 - clam12 * sdomg12; comg12 = clam12 * cdomg12 + slam12 * sdomg12; } } } if (outmask & GEOD_DISTANCE) s12 = 0 + s12x; /* Convert -0 to 0 */ if (outmask & GEOD_REDUCEDLENGTH) m12 = 0 + m12x; /* Convert -0 to 0 */ if (outmask & GEOD_AREA) { real /* From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) */ salp0 = salp1 * cbet1, calp0 = 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 = sq(calp0) * g->ep2, eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2), /* Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). */ A4 = sq(g->a) * calp0 * salp0 * g->e2; real B41, B42; norm2(&ssig1, &csig1); norm2(&ssig2, &csig2); C4f(g, eps, Ca); B41 = SinCosSeries(FALSE, ssig1, csig1, Ca, nC4); B42 = SinCosSeries(FALSE, ssig2, csig2, Ca, nC4); S12 = A4 * (B42 - B41); } else /* Avoid problems with indeterminate sig1, sig2 on equator */ S12 = 0; if (!meridian && somg12 > 1) { somg12 = sin(omg12); comg12 = cos(omg12); } if (!meridian && /* omg12 < 3/4 * pi */ comg12 > -(real)(0.7071) && /* Long difference not too big */ sbet2 - sbet1 < (real)(1.75)) { /* Lat difference not 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 domg12 = 1 + comg12, 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 += g->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) { swapx(&salp1, &salp2); swapx(&calp1, &calp2); if (outmask & GEOD_GEODESICSCALE) swapx(&M12, &M21); } salp1 *= swapp * lonsign; calp1 *= swapp * latsign; salp2 *= swapp * lonsign; calp2 *= swapp * latsign; if (psalp1) *psalp1 = salp1; if (pcalp1) *pcalp1 = calp1; if (psalp2) *psalp2 = salp2; if (pcalp2) *pcalp2 = calp2; if (outmask & GEOD_DISTANCE) *ps12 = s12; if (outmask & GEOD_REDUCEDLENGTH) *pm12 = m12; if (outmask & GEOD_GEODESICSCALE) { if (pM12) *pM12 = M12; if (pM21) *pM21 = M21; } if (outmask & GEOD_AREA) *pS12 = S12; /* Returned value in [0, 180] */ return a12; } real geod_geninverse(const struct geod_geodesic* g, real lat1, real lon1, real lat2, real lon2, real* ps12, real* pazi1, real* pazi2, real* pm12, real* pM12, real* pM21, real* pS12) { real salp1, calp1, salp2, calp2, a12 = geod_geninverse_int(g, lat1, lon1, lat2, lon2, ps12, &salp1, &calp1, &salp2, &calp2, pm12, pM12, pM21, pS12); if (pazi1) *pazi1 = atan2dx(salp1, calp1); if (pazi2) *pazi2 = atan2dx(salp2, calp2); return a12; } void geod_inverseline(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real lat2, real lon2, unsigned caps) { real salp1, calp1, a12 = geod_geninverse_int(g, lat1, lon1, lat2, lon2, nullptr, &salp1, &calp1, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr), azi1 = atan2dx(salp1, calp1); caps = caps ? caps : GEOD_DISTANCE_IN | GEOD_LONGITUDE; /* Ensure that a12 can be converted to a distance */ if (caps & (OUT_ALL & GEOD_DISTANCE_IN)) caps |= GEOD_DISTANCE; geod_lineinit_int(l, g, lat1, lon1, azi1, salp1, calp1, caps); geod_setarc(l, a12); } void geod_inverse(const struct geod_geodesic* g, real lat1, real lon1, real lat2, real lon2, real* ps12, real* pazi1, real* pazi2) { geod_geninverse(g, lat1, lon1, lat2, lon2, ps12, pazi1, pazi2, nullptr, nullptr, nullptr, nullptr); } real SinCosSeries(boolx sinp, real sinx, real cosx, const real c[], int 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 */ real ar, y0, y1; c += (n + sinp); /* Point to one beyond last element */ 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) */ } void Lengths(const struct geod_geodesic* g, real eps, real sig12, real ssig1, real csig1, real dn1, real ssig2, real csig2, real dn2, real cbet1, real cbet2, real* ps12b, real* pm12b, real* pm0, real* pM12, real* pM21, /* Scratch area of the right size */ real Ca[]) { real m0 = 0, J12 = 0, A1 = 0, A2 = 0; real Cb[nC]; /* Return m12b = (reduced length)/b; also calculate s12b = distance/b, * and m0 = coefficient of secular term in expression for reduced length. */ boolx redlp = pm12b || pm0 || pM12 || pM21; if (ps12b || redlp) { A1 = A1m1f(eps); C1f(eps, Ca); if (redlp) { A2 = A2m1f(eps); C2f(eps, Cb); m0 = A1 - A2; A2 = 1 + A2; } A1 = 1 + A1; } if (ps12b) { real B1 = SinCosSeries(TRUE, ssig2, csig2, Ca, nC1) - SinCosSeries(TRUE, ssig1, csig1, Ca, nC1); /* Missing a factor of b */ *ps12b = A1 * (sig12 + B1); if (redlp) { real B2 = SinCosSeries(TRUE, ssig2, csig2, Cb, nC2) - SinCosSeries(TRUE, ssig1, csig1, Cb, nC2); J12 = m0 * sig12 + (A1 * B1 - A2 * B2); } } else if (redlp) { /* Assume here that nC1 >= nC2 */ int l; for (l = 1; l <= nC2; ++l) Cb[l] = A1 * Ca[l] - A2 * Cb[l]; J12 = m0 * sig12 + (SinCosSeries(TRUE, ssig2, csig2, Cb, nC2) - SinCosSeries(TRUE, ssig1, csig1, Cb, nC2)); } if (pm0) *pm0 = m0; if (pm12b) /* Missing a factor of b. * Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure * accurate cancellation in the case of coincident points. */ *pm12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12; if (pM12 || pM21) { real csig12 = csig1 * csig2 + ssig1 * ssig2; real t = g->ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2); if (pM12) *pM12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1; if (pM21) *pM21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2; } } real Astroid(real x, real 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. */ real k; real p = sq(x), q = 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 = sq(r), r3 = r * r2, /* The discriminant 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; real v, uv, w; if (disc >= 0) { real T3 = S + r3, T; /* 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. */ T = 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); } v = sqrt(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 + 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; } real InverseStart(const struct geod_geodesic* g, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real lam12, real slam12, real clam12, real* psalp1, real* pcalp1, /* Only updated if return val >= 0 */ real* psalp2, real* pcalp2, /* Only updated for short lines */ real* pdnm, /* Scratch area of the right size */ real Ca[]) { real salp1 = 0, calp1 = 0, salp2 = 0, calp2 = 0, dnm = 0; /* 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; real sbet12a; boolx shortline = cbet12 >= 0 && sbet12 < (real)(0.5) && cbet2 * lam12 < (real)(0.5); real somg12, comg12, ssig12, csig12; sbet12a = sbet2 * cbet1 + cbet2 * sbet1; if (shortline) { real sbetm2 = sq(sbet1 + sbet2), omg12; /* sin((bet1+bet2)/2)^2 * = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) */ sbetm2 /= sbetm2 + sq(cbet1 + cbet2); dnm = sqrt(1 + g->ep2 * sbetm2); omg12 = lam12 / (g->f1 * dnm); somg12 = sin(omg12); comg12 = cos(omg12); } else { somg12 = slam12; comg12 = clam12; } salp1 = cbet2 * somg12; calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * sq(somg12) / (1 - comg12); ssig12 = hypot(salp1, calp1); csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12; if (shortline && ssig12 < g->etol2) { /* really short lines */ salp2 = cbet1 * somg12; calp2 = sbet12 - cbet1 * sbet2 * (comg12 >= 0 ? sq(somg12) / (1 + comg12) : 1 - comg12); norm2(&salp2, &calp2); /* Set return value */ sig12 = atan2(ssig12, csig12); } else if (fabs(g->n) > (real)(0.1) || /* No astroid calc if too eccentric */ csig12 >= 0 || ssig12 >= 6 * fabs(g->n) * pi * 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; real lam12x = atan2(-slam12, -clam12); /* lam12 - pi */ if (g->f >= 0) { /* In fact f == 0 does not get here */ /* x = dlong, y = dlat */ { real k2 = sq(sbet1) * g->ep2, eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2); lamscale = g->f * cbet1 * A3f(g, eps) * pi; } betscale = lamscale * cbet1; x = lam12x / lamscale; y = sbet12a / betscale; } else { /* f < 0 */ /* x = dlat, y = dlong */ real cbet12a = cbet2 * cbet1 - sbet2 * sbet1, bet12a = atan2(sbet12a, cbet12a); real m12b, m0; /* In the case of lon12 = 180, this repeats a calculation made in * Inverse. */ Lengths(g, g->n, pi + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, nullptr, &m12b, &m0, nullptr, nullptr, Ca); x = -1 + m12b / (cbet1 * cbet2 * m0 * pi); betscale = x < -(real)(0.01) ? sbet12a / x : -g->f * sq(cbet1) * pi; lamscale = betscale / cbet1; y = lam12x / lamscale; } if (y > -tol1 && x > -1 - xthresh) { /* strip near cut */ if (g->f >= 0) { salp1 = minx((real)(1), -(real)(x)); calp1 = - sqrt(1 - sq(salp1)); } else { calp1 = maxx((real)(x > -tol1 ? 0 : -1), (real)(x)); salp1 = sqrt(1 - 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 * ( g->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 * sq(somg12) / (1 - comg12); } } /* Sanity check on starting guess. Backwards check allows NaN through. */ if (!(salp1 <= 0)) norm2(&salp1, &calp1); else { salp1 = 1; calp1 = 0; } *psalp1 = salp1; *pcalp1 = calp1; if (shortline) *pdnm = dnm; if (sig12 >= 0) { *psalp2 = salp2; *pcalp2 = calp2; } return sig12; } real Lambda12(const struct geod_geodesic* g, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real salp1, real calp1, real slam120, real clam120, real* psalp2, real* pcalp2, real* psig12, real* pssig1, real* pcsig1, real* pssig2, real* pcsig2, real* peps, real* pdomg12, boolx diffp, real* pdlam12, /* Scratch area of the right size */ real Ca[]) { real salp2 = 0, calp2 = 0, sig12 = 0, ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0, domg12 = 0, dlam12 = 0; real salp0, calp0; real somg1, comg1, somg2, comg2, somg12, comg12, lam12; real B312, eta, k2; if (sbet1 == 0 && calp1 == 0) /* Break degeneracy of equatorial line. This case has already been * handled. */ calp1 = -tiny; /* sin(alp1) * cos(bet1) = sin(alp0) */ salp0 = salp1 * cbet1; calp0 = hypot(calp1, salp1 * sbet1); /* calp0 > 0 */ /* 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; norm2(&ssig1, &csig1); /* norm2(&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 || fabs(sbet2) != -sbet1 ? sqrt(sq(calp1 * cbet1) + (cbet1 < -sbet1 ? (cbet2 - cbet1) * (cbet1 + cbet2) : (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 : fabs(calp1); /* tan(bet2) = tan(sig2) * cos(alp2) * tan(omg2) = sin(alp0) * tan(sig2). */ ssig2 = sbet2; somg2 = salp0 * sbet2; csig2 = comg2 = calp2 * cbet2; norm2(&ssig2, &csig2); /* norm2(&somg2, &comg2); -- don't need to normalize! */ /* sig12 = sig2 - sig1, limit to [0, pi] */ sig12 = atan2(maxx((real)(0), csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); /* omg12 = omg2 - omg1, limit to [0, pi] */ somg12 = maxx((real)(0), comg1 * somg2 - somg1 * comg2); comg12 = comg1 * comg2 + somg1 * somg2; /* eta = omg12 - lam120 */ eta = atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120); k2 = sq(calp0) * g->ep2; eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2); C3f(g, eps, Ca); B312 = (SinCosSeries(TRUE, ssig2, csig2, Ca, nC3-1) - SinCosSeries(TRUE, ssig1, csig1, Ca, nC3-1)); domg12 = -g->f * A3f(g, eps) * salp0 * (sig12 + B312); lam12 = eta + domg12; if (diffp) { if (calp2 == 0) dlam12 = - 2 * g->f1 * dn1 / sbet1; else { Lengths(g, eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, nullptr, &dlam12, nullptr, nullptr, nullptr, Ca); dlam12 *= g->f1 / (calp2 * cbet2); } } *psalp2 = salp2; *pcalp2 = calp2; *psig12 = sig12; *pssig1 = ssig1; *pcsig1 = csig1; *pssig2 = ssig2; *pcsig2 = csig2; *peps = eps; *pdomg12 = domg12; if (diffp) *pdlam12 = dlam12; return lam12; } real A3f(const struct geod_geodesic* g, real eps) { /* Evaluate A3 */ return polyval(nA3 - 1, g->A3x, eps); } void C3f(const struct geod_geodesic* g, real eps, real c[]) { /* Evaluate C3 coeffs * Elements c[1] through c[nC3 - 1] are set */ real mult = 1; int o = 0, l; for (l = 1; l < nC3; ++l) { /* l is index of C3[l] */ int m = nC3 - l - 1; /* order of polynomial in eps */ mult *= eps; c[l] = mult * polyval(m, g->C3x + o, eps); o += m + 1; } } void C4f(const struct geod_geodesic* g, real eps, real c[]) { /* Evaluate C4 coeffs * Elements c[0] through c[nC4 - 1] are set */ real mult = 1; int o = 0, l; for (l = 0; l < nC4; ++l) { /* l is index of C4[l] */ int m = nC4 - l - 1; /* order of polynomial in eps */ c[l] = mult * polyval(m, g->C4x + o, eps); o += m + 1; mult *= eps; } } /* The scale factor A1-1 = mean value of (d/dsigma)I1 - 1 */ real A1m1f(real eps) { static const real coeff[] = { /* (1-eps)*A1-1, polynomial in eps2 of order 3 */ 1, 4, 64, 0, 256, }; int m = nA1/2; real t = polyval(m, coeff, sq(eps)) / coeff[m + 1]; return (t + eps) / (1 - eps); } /* The coefficients C1[l] in the Fourier expansion of B1 */ void C1f(real eps, real c[]) { static const real coeff[] = { /* C1[1]/eps^1, polynomial in eps2 of order 2 */ -1, 6, -16, 32, /* C1[2]/eps^2, polynomial in eps2 of order 2 */ -9, 64, -128, 2048, /* C1[3]/eps^3, polynomial in eps2 of order 1 */ 9, -16, 768, /* C1[4]/eps^4, polynomial in eps2 of order 1 */ 3, -5, 512, /* C1[5]/eps^5, polynomial in eps2 of order 0 */ -7, 1280, /* C1[6]/eps^6, polynomial in eps2 of order 0 */ -7, 2048, }; real eps2 = sq(eps), d = eps; int o = 0, l; for (l = 1; l <= nC1; ++l) { /* l is index of C1p[l] */ int m = (nC1 - l) / 2; /* order of polynomial in eps^2 */ c[l] = d * polyval(m, coeff + o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } /* The coefficients C1p[l] in the Fourier expansion of B1p */ void C1pf(real eps, real c[]) { static const real coeff[] = { /* C1p[1]/eps^1, polynomial in eps2 of order 2 */ 205, -432, 768, 1536, /* C1p[2]/eps^2, polynomial in eps2 of order 2 */ 4005, -4736, 3840, 12288, /* C1p[3]/eps^3, polynomial in eps2 of order 1 */ -225, 116, 384, /* C1p[4]/eps^4, polynomial in eps2 of order 1 */ -7173, 2695, 7680, /* C1p[5]/eps^5, polynomial in eps2 of order 0 */ 3467, 7680, /* C1p[6]/eps^6, polynomial in eps2 of order 0 */ 38081, 61440, }; real eps2 = sq(eps), d = eps; int o = 0, l; for (l = 1; l <= nC1p; ++l) { /* l is index of C1p[l] */ int m = (nC1p - l) / 2; /* order of polynomial in eps^2 */ c[l] = d * polyval(m, coeff + o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } /* The scale factor A2-1 = mean value of (d/dsigma)I2 - 1 */ real A2m1f(real eps) { static const real coeff[] = { /* (eps+1)*A2-1, polynomial in eps2 of order 3 */ -11, -28, -192, 0, 256, }; int m = nA2/2; real t = polyval(m, coeff, sq(eps)) / coeff[m + 1]; return (t - eps) / (1 + eps); } /* The coefficients C2[l] in the Fourier expansion of B2 */ void C2f(real eps, real c[]) { static const real coeff[] = { /* C2[1]/eps^1, polynomial in eps2 of order 2 */ 1, 2, 16, 32, /* C2[2]/eps^2, polynomial in eps2 of order 2 */ 35, 64, 384, 2048, /* C2[3]/eps^3, polynomial in eps2 of order 1 */ 15, 80, 768, /* C2[4]/eps^4, polynomial in eps2 of order 1 */ 7, 35, 512, /* C2[5]/eps^5, polynomial in eps2 of order 0 */ 63, 1280, /* C2[6]/eps^6, polynomial in eps2 of order 0 */ 77, 2048, }; real eps2 = sq(eps), d = eps; int o = 0, l; for (l = 1; l <= nC2; ++l) { /* l is index of C2[l] */ int m = (nC2 - l) / 2; /* order of polynomial in eps^2 */ c[l] = d * polyval(m, coeff + o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } /* The scale factor A3 = mean value of (d/dsigma)I3 */ void A3coeff(struct geod_geodesic* g) { static const real coeff[] = { /* A3, coeff of eps^5, polynomial in n of order 0 */ -3, 128, /* A3, coeff of eps^4, polynomial in n of order 1 */ -2, -3, 64, /* A3, coeff of eps^3, polynomial in n of order 2 */ -1, -3, -1, 16, /* A3, coeff of eps^2, polynomial in n of order 2 */ 3, -1, -2, 8, /* A3, coeff of eps^1, polynomial in n of order 1 */ 1, -1, 2, /* A3, coeff of eps^0, polynomial in n of order 0 */ 1, 1, }; int o = 0, k = 0, j; for (j = nA3 - 1; j >= 0; --j) { /* coeff of eps^j */ int m = nA3 - j - 1 < j ? nA3 - j - 1 : j; /* order of polynomial in n */ g->A3x[k++] = polyval(m, coeff + o, g->n) / coeff[o + m + 1]; o += m + 2; } } /* The coefficients C3[l] in the Fourier expansion of B3 */ void C3coeff(struct geod_geodesic* g) { static const real coeff[] = { /* C3[1], coeff of eps^5, polynomial in n of order 0 */ 3, 128, /* C3[1], coeff of eps^4, polynomial in n of order 1 */ 2, 5, 128, /* C3[1], coeff of eps^3, polynomial in n of order 2 */ -1, 3, 3, 64, /* C3[1], coeff of eps^2, polynomial in n of order 2 */ -1, 0, 1, 8, /* C3[1], coeff of eps^1, polynomial in n of order 1 */ -1, 1, 4, /* C3[2], coeff of eps^5, polynomial in n of order 0 */ 5, 256, /* C3[2], coeff of eps^4, polynomial in n of order 1 */ 1, 3, 128, /* C3[2], coeff of eps^3, polynomial in n of order 2 */ -3, -2, 3, 64, /* C3[2], coeff of eps^2, polynomial in n of order 2 */ 1, -3, 2, 32, /* C3[3], coeff of eps^5, polynomial in n of order 0 */ 7, 512, /* C3[3], coeff of eps^4, polynomial in n of order 1 */ -10, 9, 384, /* C3[3], coeff of eps^3, polynomial in n of order 2 */ 5, -9, 5, 192, /* C3[4], coeff of eps^5, polynomial in n of order 0 */ 7, 512, /* C3[4], coeff of eps^4, polynomial in n of order 1 */ -14, 7, 512, /* C3[5], coeff of eps^5, polynomial in n of order 0 */ 21, 2560, }; int o = 0, k = 0, l, j; for (l = 1; l < nC3; ++l) { /* l is index of C3[l] */ for (j = nC3 - 1; j >= l; --j) { /* coeff of eps^j */ int m = nC3 - j - 1 < j ? nC3 - j - 1 : j; /* order of polynomial in n */ g->C3x[k++] = polyval(m, coeff + o, g->n) / coeff[o + m + 1]; o += m + 2; } } } /* The coefficients C4[l] in the Fourier expansion of I4 */ void C4coeff(struct geod_geodesic* g) { static const real coeff[] = { /* C4[0], coeff of eps^5, polynomial in n of order 0 */ 97, 15015, /* C4[0], coeff of eps^4, polynomial in n of order 1 */ 1088, 156, 45045, /* C4[0], coeff of eps^3, polynomial in n of order 2 */ -224, -4784, 1573, 45045, /* C4[0], coeff of eps^2, polynomial in n of order 3 */ -10656, 14144, -4576, -858, 45045, /* C4[0], coeff of eps^1, polynomial in n of order 4 */ 64, 624, -4576, 6864, -3003, 15015, /* C4[0], coeff of eps^0, polynomial in n of order 5 */ 100, 208, 572, 3432, -12012, 30030, 45045, /* C4[1], coeff of eps^5, polynomial in n of order 0 */ 1, 9009, /* C4[1], coeff of eps^4, polynomial in n of order 1 */ -2944, 468, 135135, /* C4[1], coeff of eps^3, polynomial in n of order 2 */ 5792, 1040, -1287, 135135, /* C4[1], coeff of eps^2, polynomial in n of order 3 */ 5952, -11648, 9152, -2574, 135135, /* C4[1], coeff of eps^1, polynomial in n of order 4 */ -64, -624, 4576, -6864, 3003, 135135, /* C4[2], coeff of eps^5, polynomial in n of order 0 */ 8, 10725, /* C4[2], coeff of eps^4, polynomial in n of order 1 */ 1856, -936, 225225, /* C4[2], coeff of eps^3, polynomial in n of order 2 */ -8448, 4992, -1144, 225225, /* C4[2], coeff of eps^2, polynomial in n of order 3 */ -1440, 4160, -4576, 1716, 225225, /* C4[3], coeff of eps^5, polynomial in n of order 0 */ -136, 63063, /* C4[3], coeff of eps^4, polynomial in n of order 1 */ 1024, -208, 105105, /* C4[3], coeff of eps^3, polynomial in n of order 2 */ 3584, -3328, 1144, 315315, /* C4[4], coeff of eps^5, polynomial in n of order 0 */ -128, 135135, /* C4[4], coeff of eps^4, polynomial in n of order 1 */ -2560, 832, 405405, /* C4[5], coeff of eps^5, polynomial in n of order 0 */ 128, 99099, }; int o = 0, k = 0, l, j; for (l = 0; l < nC4; ++l) { /* l is index of C4[l] */ for (j = nC4 - 1; j >= l; --j) { /* coeff of eps^j */ int m = nC4 - j - 1; /* order of polynomial in n */ g->C4x[k++] = polyval(m, coeff + o, g->n) / coeff[o + m + 1]; o += m + 2; } } } int transit(real lon1, real lon2) { real lon12; /* Return 1 or -1 if crossing prime meridian in east or west direction. * Otherwise return zero. */ /* Compute lon12 the same way as Geodesic::Inverse. */ lon1 = AngNormalize(lon1); lon2 = AngNormalize(lon2); lon12 = AngDiff(lon1, lon2, nullptr); return lon1 <= 0 && lon2 > 0 && lon12 > 0 ? 1 : (lon2 <= 0 && lon1 > 0 && lon12 < 0 ? -1 : 0); } int transitdirect(real lon1, real lon2) { /* Compute exactly the parity of int(ceil(lon2 / 360)) - int(ceil(lon1 / 360)) */ lon1 = remainder(lon1, (real)(720)); lon2 = remainder(lon2, (real)(720)); return ( (lon2 <= 0 && lon2 > -360 ? 1 : 0) - (lon1 <= 0 && lon1 > -360 ? 1 : 0) ); } void accini(real s[]) { /* Initialize an accumulator; this is an array with two elements. */ s[0] = s[1] = 0; } void acccopy(const real s[], real t[]) { /* Copy an accumulator; t = s. */ t[0] = s[0]; t[1] = s[1]; } void accadd(real s[], real y) { /* Add y to an accumulator. */ real u, z = sumx(y, s[1], &u); s[0] = sumx(z, s[0], &s[1]); if (s[0] == 0) s[0] = u; else s[1] = s[1] + u; } real accsum(const real s[], real y) { /* Return accumulator + y (but don't add to accumulator). */ real t[2]; acccopy(s, t); accadd(t, y); return t[0]; } void accneg(real s[]) { /* Negate an accumulator. */ s[0] = -s[0]; s[1] = -s[1]; } void accrem(real s[], real y) { /* Reduce to [-y/2, y/2]. */ s[0] = remainder(s[0], y); accadd(s, (real)(0)); } void geod_polygon_init(struct geod_polygon* p, boolx polylinep) { p->polyline = (polylinep != 0); geod_polygon_clear(p); } void geod_polygon_clear(struct geod_polygon* p) { p->lat0 = p->lon0 = p->lat = p->lon = NaN; accini(p->P); accini(p->A); p->num = p->crossings = 0; } void geod_polygon_addpoint(const struct geod_geodesic* g, struct geod_polygon* p, real lat, real lon) { lon = AngNormalize(lon); if (p->num == 0) { p->lat0 = p->lat = lat; p->lon0 = p->lon = lon; } else { real s12, S12 = 0; /* Initialize S12 to stop Visual Studio warning */ geod_geninverse(g, p->lat, p->lon, lat, lon, &s12, nullptr, nullptr, nullptr, nullptr, nullptr, p->polyline ? nullptr : &S12); accadd(p->P, s12); if (!p->polyline) { accadd(p->A, S12); p->crossings += transit(p->lon, lon); } p->lat = lat; p->lon = lon; } ++p->num; } void geod_polygon_addedge(const struct geod_geodesic* g, struct geod_polygon* p, real azi, real s) { if (p->num) { /* Do nothing is num is zero */ /* Initialize S12 to stop Visual Studio warning. Initialization of lat and * lon is to make CLang static analyzer happy. */ real lat = 0, lon = 0, S12 = 0; geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s, &lat, &lon, nullptr, nullptr, nullptr, nullptr, nullptr, p->polyline ? nullptr : &S12); accadd(p->P, s); if (!p->polyline) { accadd(p->A, S12); p->crossings += transitdirect(p->lon, lon); } p->lat = lat; p->lon = lon; ++p->num; } } unsigned geod_polygon_compute(const struct geod_geodesic* g, const struct geod_polygon* p, boolx reverse, boolx sign, real* pA, real* pP) { real s12, S12, t[2]; if (p->num < 2) { if (pP) *pP = 0; if (!p->polyline && pA) *pA = 0; return p->num; } if (p->polyline) { if (pP) *pP = p->P[0]; return p->num; } geod_geninverse(g, p->lat, p->lon, p->lat0, p->lon0, &s12, nullptr, nullptr, nullptr, nullptr, nullptr, &S12); if (pP) *pP = accsum(p->P, s12); acccopy(p->A, t); accadd(t, S12); if (pA) *pA = areareduceA(t, 4 * pi * g->c2, p->crossings + transit(p->lon, p->lon0), reverse, sign); return p->num; } unsigned geod_polygon_testpoint(const struct geod_geodesic* g, const struct geod_polygon* p, real lat, real lon, boolx reverse, boolx sign, real* pA, real* pP) { real perimeter, tempsum; int crossings, i; unsigned num = p->num + 1; if (num == 1) { if (pP) *pP = 0; if (!p->polyline && pA) *pA = 0; return num; } perimeter = p->P[0]; tempsum = p->polyline ? 0 : p->A[0]; crossings = p->crossings; for (i = 0; i < (p->polyline ? 1 : 2); ++i) { real s12, S12 = 0; /* Initialize S12 to stop Visual Studio warning */ geod_geninverse(g, i == 0 ? p->lat : lat, i == 0 ? p->lon : lon, i != 0 ? p->lat0 : lat, i != 0 ? p->lon0 : lon, &s12, nullptr, nullptr, nullptr, nullptr, nullptr, p->polyline ? nullptr : &S12); perimeter += s12; if (!p->polyline) { tempsum += S12; crossings += transit(i == 0 ? p->lon : lon, i != 0 ? p->lon0 : lon); } } if (pP) *pP = perimeter; if (p->polyline) return num; if (pA) *pA = areareduceB(tempsum, 4 * pi * g->c2, crossings, reverse, sign); return num; } unsigned geod_polygon_testedge(const struct geod_geodesic* g, const struct geod_polygon* p, real azi, real s, boolx reverse, boolx sign, real* pA, real* pP) { real perimeter, tempsum; int crossings; unsigned num = p->num + 1; if (num == 1) { /* we don't have a starting point! */ if (pP) *pP = NaN; if (!p->polyline && pA) *pA = NaN; return 0; } perimeter = p->P[0] + s; if (p->polyline) { if (pP) *pP = perimeter; return num; } tempsum = p->A[0]; crossings = p->crossings; { /* Initialization of lat, lon, and S12 is to make CLang static analyzer * happy. */ real lat = 0, lon = 0, s12, S12 = 0; geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s, &lat, &lon, nullptr, nullptr, nullptr, nullptr, nullptr, &S12); tempsum += S12; crossings += transitdirect(p->lon, lon); geod_geninverse(g, lat, lon, p->lat0, p->lon0, &s12, nullptr, nullptr, nullptr, nullptr, nullptr, &S12); perimeter += s12; tempsum += S12; crossings += transit(lon, p->lon0); } if (pP) *pP = perimeter; if (pA) *pA = areareduceB(tempsum, 4 * pi * g->c2, crossings, reverse, sign); return num; } void geod_polygonarea(const struct geod_geodesic* g, real lats[], real lons[], int n, real* pA, real* pP) { int i; struct geod_polygon p; geod_polygon_init(&p, FALSE); for (i = 0; i < n; ++i) geod_polygon_addpoint(g, &p, lats[i], lons[i]); geod_polygon_compute(g, &p, FALSE, TRUE, pA, pP); } real areareduceA(real area[], real area0, int crossings, boolx reverse, boolx sign) { accrem(area, area0); if (crossings & 1) accadd(area, (area[0] < 0 ? 1 : -1) * area0/2); /* area is with the clockwise sense. If !reverse convert to * counter-clockwise convention. */ if (!reverse) accneg(area); /* If sign put area in (-area0/2, area0/2], else put area in [0, area0) */ if (sign) { if (area[0] > area0/2) accadd(area, -area0); else if (area[0] <= -area0/2) accadd(area, +area0); } else { if (area[0] >= area0) accadd(area, -area0); else if (area[0] < 0) accadd(area, +area0); } return 0 + area[0]; } real areareduceB(real area, real area0, int crossings, boolx reverse, boolx sign) { area = remainder(area, area0); if (crossings & 1) area += (area < 0 ? 1 : -1) * area0/2; /* area is with the clockwise sense. If !reverse convert to * counter-clockwise convention. */ if (!reverse) area *= -1; /* If sign put area in (-area0/2, area0/2], else put area in [0, area0) */ if (sign) { if (area > area0/2) area -= area0; else if (area <= -area0/2) area += area0; } else { if (area >= area0) area -= area0; else if (area < 0) area += area0; } return 0 + area; } /** @endcond */ GeographicLib-1.52/legacy/C/geodesic.h0000644000771000077100000013031114064202371017375 0ustar ckarneyckarney/** * \file geodesic.h * \brief API for the geodesic routines in C * * This an implementation in C of the geodesic algorithms described in * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * geod-addenda.html. * . * The principal advantages of these algorithms over previous ones (e.g., * Vincenty, 1975) are * - accurate to round off for |f| < 1/50; * - the solution of the inverse problem is always found; * - differential and integral properties of geodesics are computed. * * The shortest path between two points on the 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 forward azimuths * \e azi1 and \e azi2 at the two end points. * * Traditionally two geodesic problems are considered: * - the direct problem -- given \e lat1, \e lon1, \e s12, and \e azi1, * determine \e lat2, \e lon2, and \e azi2. This is solved by the function * geod_direct(). * - the inverse problem -- given \e lat1, \e lon1, and \e lat2, \e lon2, * determine \e s12, \e azi1, and \e azi2. This is solved by the function * geod_inverse(). * * The ellipsoid is specified by its equatorial radius \e a (typically in * meters) and flattening \e f. The routines are accurate to round off with * double precision arithmetic provided that |f| < 1/50; for the * WGS84 ellipsoid, the errors are less than 15 nanometers. (Reasonably * accurate results are obtained for |f| < 1/5.) For a prolate * ellipsoid, specify \e f < 0. * * The routines also calculate several other quantities of interest * - \e 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 (\e lat1,\e lon1), (0,\e lon1), (0,\e lon2), * and (\e lat2,\e lon2). * - \e m12, the reduced length of the geodesic is defined such that if * the initial azimuth is perturbed by \e dazi1 (radians) then the * second point is displaced by \e m12 \e dazi1 in the direction * perpendicular to the geodesic. 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. * - \e M12 and \e M21 are geodesic scales. If two geodesics are * parallel at point 1 and separated by a small distance \e dt, then * they are separated by a distance \e M12 \e dt at point 2. \e M21 * is defined similarly (with the geodesics being parallel to one * another at point 2). On a flat surface, we have \e M12 = \e M21 * = 1. * - \e a12 is the arc length on the auxiliary sphere. This is a * construct for converting the problem to one in spherical * trigonometry. \e a12 is measured in degrees. The spherical arc * length from one equator crossing to the next is always 180°. * * If points 1, 2, and 3 lie on a single geodesic, then the following * addition rules hold: * - \e s13 = \e s12 + \e s23 * - \e a13 = \e a12 + \e a23 * - \e S13 = \e S12 + \e S23 * - \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 * * The shortest distance returned by the solution of the inverse problem is * (obviously) uniquely defined. However, in a few special cases there are * multiple azimuths which yield the same shortest distance. Here is a * catalog of those cases: * - \e lat1 = −\e lat2 (with neither point at a pole). If \e azi1 = \e * azi2, the geodesic is unique. Otherwise there are two geodesics and the * second one is obtained by setting [\e azi1, \e azi2] → [\e azi2, \e * azi1], [\e M12, \e M21] → [\e M21, \e M12], \e S12 → −\e * S12. (This occurs when the longitude difference is near ±180° * for oblate ellipsoids.) * - \e lon2 = \e lon1 ± 180° (with neither point at a pole). If \e * azi1 = 0° or ±180°, the geodesic is unique. Otherwise * there are two geodesics and the second one is obtained by setting [\e * azi1, \e azi2] → [−\e azi1, −\e azi2], \e S12 → * −\e S12. (This occurs when \e lat2 is near −\e lat1 for * prolate ellipsoids.) * - Points 1 and 2 at opposite poles. There are infinitely many geodesics * which can be generated by setting [\e azi1, \e azi2] → [\e azi1, \e * azi2] + [\e d, −\e d], for arbitrary \e d. (For spheres, this * prescription applies when points 1 and 2 are antipodal.) * - \e s12 = 0 (coincident points). There are infinitely many geodesics which * can be generated by setting [\e azi1, \e azi2] → [\e azi1, \e azi2] + * [\e d, \e d], for arbitrary \e d. * * These routines are a simple transcription of the corresponding C++ classes * in GeographicLib. The * "class data" is represented by the structs geod_geodesic, geod_geodesicline, * geod_polygon and pointers to these objects are passed as initial arguments * to the member functions. Most of the internal comments have been retained. * However, in the process of transcription some documentation has been lost * and the documentation for the C++ classes, GeographicLib::Geodesic, * GeographicLib::GeodesicLine, and GeographicLib::PolygonAreaT, should be * consulted. The C++ code remains the "reference implementation". Think * twice about restructuring the internals of the C code since this may make * porting fixes from the C++ code more difficult. * * Copyright (c) Charles Karney (2012-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * This library was distributed with * GeographicLib 1.52. **********************************************************************/ #if !defined(GEODESIC_H) #define GEODESIC_H 1 /** * The major version of the geodesic library. (This tracks the version of * GeographicLib.) **********************************************************************/ #define GEODESIC_VERSION_MAJOR 1 /** * The minor version of the geodesic library. (This tracks the version of * GeographicLib.) **********************************************************************/ #define GEODESIC_VERSION_MINOR 52 /** * The patch level of the geodesic library. (This tracks the version of * GeographicLib.) **********************************************************************/ #define GEODESIC_VERSION_PATCH 0 /** * Pack the version components into a single integer. Users should not rely on * this particular packing of the components of the version number; see the * documentation for GEODESIC_VERSION, below. **********************************************************************/ #define GEODESIC_VERSION_NUM(a,b,c) ((((a) * 10000 + (b)) * 100) + (c)) /** * The version of the geodesic library as a single integer, packed as MMmmmmpp * where MM is the major version, mmmm is the minor version, and pp is the * patch level. Users should not rely on this particular packing of the * components of the version number. Instead they should use a test such as * @code{.c} #if GEODESIC_VERSION >= GEODESIC_VERSION_NUM(1,40,0) ... #endif * @endcode **********************************************************************/ #define GEODESIC_VERSION \ GEODESIC_VERSION_NUM(GEODESIC_VERSION_MAJOR, \ GEODESIC_VERSION_MINOR, \ GEODESIC_VERSION_PATCH) #if !defined(GEOD_DLL) #if defined(_MSC_VER) && defined(PROJ_MSVC_DLL_EXPORT) #define GEOD_DLL __declspec(dllexport) #elif defined(__GNUC__) #define GEOD_DLL __attribute__ ((visibility("default"))) #else #define GEOD_DLL #endif #endif #if defined(PROJ_RENAME_SYMBOLS) #include "proj_symbol_rename.h" #endif #if defined(__cplusplus) extern "C" { #endif /** * The struct containing information about the ellipsoid. This must be * initialized by geod_init() before use. **********************************************************************/ struct geod_geodesic { double a; /**< the equatorial radius */ double f; /**< the flattening */ /**< @cond SKIP */ double f1, e2, ep2, n, b, c2, etol2; double A3x[6], C3x[15], C4x[21]; /**< @endcond */ }; /** * The struct containing information about a single geodesic. This must be * initialized by geod_lineinit(), geod_directline(), geod_gendirectline(), * or geod_inverseline() before use. **********************************************************************/ struct geod_geodesicline { double lat1; /**< the starting latitude */ double lon1; /**< the starting longitude */ double azi1; /**< the starting azimuth */ double a; /**< the equatorial radius */ double f; /**< the flattening */ double salp1; /**< sine of \e azi1 */ double calp1; /**< cosine of \e azi1 */ double a13; /**< arc length to reference point */ double s13; /**< distance to reference point */ /**< @cond SKIP */ double b, c2, f1, salp0, calp0, k2, ssig1, csig1, dn1, stau1, ctau1, somg1, comg1, A1m1, A2m1, A3c, B11, B21, B31, A4, B41; double C1a[6+1], C1pa[6+1], C2a[6+1], C3a[6], C4a[6]; /**< @endcond */ unsigned caps; /**< the capabilities */ }; /** * The struct for accumulating information about a geodesic polygon. This is * used for computing the perimeter and area of a polygon. This must be * initialized by geod_polygon_init() before use. **********************************************************************/ struct geod_polygon { double lat; /**< the current latitude */ double lon; /**< the current longitude */ /**< @cond SKIP */ double lat0; double lon0; double A[2]; double P[2]; int polyline; int crossings; /**< @endcond */ unsigned num; /**< the number of points so far */ }; /** * Initialize a geod_geodesic object. * * @param[out] g a pointer to the object to be initialized. * @param[in] a the equatorial radius (meters). * @param[in] f the flattening. **********************************************************************/ void GEOD_DLL geod_init(struct geod_geodesic* g, double a, double f); /** * Solve the direct geodesic problem. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @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 from point 1 to point 2 (meters); it can be * negative. * @param[out] plat2 pointer to the latitude of point 2 (degrees). * @param[out] plon2 pointer to the longitude of point 2 (degrees). * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * * \e g must have been initialized with a call to geod_init(). \e lat1 * should be in the range [−90°, 90°]. The values of \e lon2 * and \e azi2 returned are in the range [−180°, 180°]. Any of * the "return" arguments \e plat2, etc., may be replaced by 0, if you do not * need some quantities computed. * * If either point is at a pole, the azimuth is defined by keeping the * longitude fixed, writing \e lat = ±(90° − ε), and * taking the limit ε → 0+. An arc length greater that 180° * 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°.) * * Example, determine the point 10000 km NE of JFK: @code{.c} struct geod_geodesic g; double lat, lon; geod_init(&g, 6378137, 1/298.257223563); geod_direct(&g, 40.64, -73.78, 45.0, 10e6, &lat, &lon, 0); printf("%.5f %.5f\n", lat, lon); @endcode **********************************************************************/ void GEOD_DLL geod_direct(const struct geod_geodesic* g, double lat1, double lon1, double azi1, double s12, double* plat2, double* plon2, double* pazi2); /** * The general direct geodesic problem. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @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] flags bitor'ed combination of geod_flags(); \e flags & * GEOD_ARCMODE determines the meaning of \e s12_a12 and \e flags & * GEOD_LONG_UNROLL "unrolls" \e lon2. * @param[in] s12_a12 if \e flags & GEOD_ARCMODE is 0, this is the distance * from point 1 to point 2 (meters); otherwise it is the arc length * from point 1 to point 2 (degrees); it can be negative. * @param[out] plat2 pointer to the latitude of point 2 (degrees). * @param[out] plon2 pointer to the longitude of point 2 (degrees). * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * @param[out] ps12 pointer to the distance from point 1 to point 2 * (meters). * @param[out] pm12 pointer to the reduced length of geodesic (meters). * @param[out] pM12 pointer to the geodesic scale of point 2 relative to * point 1 (dimensionless). * @param[out] pM21 pointer to the geodesic scale of point 1 relative to * point 2 (dimensionless). * @param[out] pS12 pointer to the area under the geodesic * (meters2). * @return \e a12 arc length from point 1 to point 2 (degrees). * * \e g must have been initialized with a call to geod_init(). \e lat1 * should be in the range [−90°, 90°]. The function value \e * a12 equals \e s12_a12 if \e flags & GEOD_ARCMODE. Any of the "return" * arguments, \e plat2, etc., may be replaced by 0, if you do not need some * quantities computed. * * With \e flags & GEOD_LONG_UNROLL bit set, the longitude is "unrolled" so * that the quantity \e lon2 − \e lon1 indicates how many times and in * what sense the geodesic encircles the ellipsoid. **********************************************************************/ double GEOD_DLL geod_gendirect(const struct geod_geodesic* g, double lat1, double lon1, double azi1, unsigned flags, double s12_a12, double* plat2, double* plon2, double* pazi2, double* ps12, double* pm12, double* pM12, double* pM21, double* pS12); /** * Solve the inverse geodesic problem. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @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] ps12 pointer to the distance from point 1 to point 2 * (meters). * @param[out] pazi1 pointer to the azimuth at point 1 (degrees). * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * * \e g must have been initialized with a call to geod_init(). \e lat1 and * \e lat2 should be in the range [−90°, 90°]. The values of * \e azi1 and \e azi2 returned are in the range [−180°, 180°]. * Any of the "return" arguments, \e ps12, etc., may be replaced by 0, if you * do not need some quantities computed. * * If either point is at a pole, the azimuth is defined by keeping the * longitude fixed, writing \e lat = ±(90° − ε), and * taking the limit ε → 0+. * * The solution to the inverse problem is found using Newton's method. If * this fails to converge (this is very unlikely in geodetic applications * but does occur for very eccentric ellipsoids), then the bisection method * is used to refine the solution. * * Example, determine the distance between JFK and Singapore Changi Airport: @code{.c} struct geod_geodesic g; double s12; geod_init(&g, 6378137, 1/298.257223563); geod_inverse(&g, 40.64, -73.78, 1.36, 103.99, &s12, 0, 0); printf("%.3f\n", s12); @endcode **********************************************************************/ void GEOD_DLL geod_inverse(const struct geod_geodesic* g, double lat1, double lon1, double lat2, double lon2, double* ps12, double* pazi1, double* pazi2); /** * The general inverse geodesic calculation. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @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] ps12 pointer to the distance from point 1 to point 2 * (meters). * @param[out] pazi1 pointer to the azimuth at point 1 (degrees). * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * @param[out] pm12 pointer to the reduced length of geodesic (meters). * @param[out] pM12 pointer to the geodesic scale of point 2 relative to * point 1 (dimensionless). * @param[out] pM21 pointer to the geodesic scale of point 1 relative to * point 2 (dimensionless). * @param[out] pS12 pointer to the area under the geodesic * (meters2). * @return \e a12 arc length from point 1 to point 2 (degrees). * * \e g must have been initialized with a call to geod_init(). \e lat1 and * \e lat2 should be in the range [−90°, 90°]. Any of the * "return" arguments \e ps12, etc., may be replaced by 0, if you do not need * some quantities computed. **********************************************************************/ double GEOD_DLL geod_geninverse(const struct geod_geodesic* g, double lat1, double lon1, double lat2, double lon2, double* ps12, double* pazi1, double* pazi2, double* pm12, double* pM12, double* pM21, double* pS12); /** * Initialize a geod_geodesicline object. * * @param[out] l a pointer to the object to be initialized. * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @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 geod_mask() values specifying the * capabilities the geod_geodesicline object should possess, i.e., which * quantities can be returned in calls to geod_position() and * geod_genposition(). * * \e g must have been initialized with a call to geod_init(). \e lat1 * should be in the range [−90°, 90°]. * * The geod_mask values are [see geod_mask()]: * - \e caps |= GEOD_LATITUDE for the latitude \e lat2; this is * added automatically, * - \e caps |= GEOD_LONGITUDE for the latitude \e lon2, * - \e caps |= GEOD_AZIMUTH for the latitude \e azi2; this is * added automatically, * - \e caps |= GEOD_DISTANCE for the distance \e s12, * - \e caps |= GEOD_REDUCEDLENGTH for the reduced length \e m12, * - \e caps |= GEOD_GEODESICSCALE for the geodesic scales \e M12 * and \e M21, * - \e caps |= GEOD_AREA for the area \e S12, * - \e caps |= GEOD_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. * . * A value of \e caps = 0 is treated as GEOD_LATITUDE | GEOD_LONGITUDE | * GEOD_AZIMUTH | GEOD_DISTANCE_IN (to support the solution of the "standard" * direct problem). * * When initialized by this function, point 3 is undefined (l->s13 = l->a13 = * NaN). **********************************************************************/ void GEOD_DLL geod_lineinit(struct geod_geodesicline* l, const struct geod_geodesic* g, double lat1, double lon1, double azi1, unsigned caps); /** * Initialize a geod_geodesicline object in terms of the direct geodesic * problem. * * @param[out] l a pointer to the object to be initialized. * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @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 from point 1 to point 2 (meters); it can be * negative. * @param[in] caps bitor'ed combination of geod_mask() values specifying the * capabilities the geod_geodesicline object should possess, i.e., which * quantities can be returned in calls to geod_position() and * geod_genposition(). * * This function sets point 3 of the geod_geodesicline to correspond to point * 2 of the direct geodesic problem. See geod_lineinit() for more * information. **********************************************************************/ void GEOD_DLL geod_directline(struct geod_geodesicline* l, const struct geod_geodesic* g, double lat1, double lon1, double azi1, double s12, unsigned caps); /** * Initialize a geod_geodesicline object in terms of the direct geodesic * problem specified in terms of either distance or arc length. * * @param[out] l a pointer to the object to be initialized. * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @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] flags either GEOD_NOFLAGS or GEOD_ARCMODE to determining the * meaning of the \e s12_a12. * @param[in] s12_a12 if \e flags = GEOD_NOFLAGS, this is the distance * from point 1 to point 2 (meters); if \e flags = GEOD_ARCMODE, it is * the arc length from point 1 to point 2 (degrees); it can be * negative. * @param[in] caps bitor'ed combination of geod_mask() values specifying the * capabilities the geod_geodesicline object should possess, i.e., which * quantities can be returned in calls to geod_position() and * geod_genposition(). * * This function sets point 3 of the geod_geodesicline to correspond to point * 2 of the direct geodesic problem. See geod_lineinit() for more * information. **********************************************************************/ void GEOD_DLL geod_gendirectline(struct geod_geodesicline* l, const struct geod_geodesic* g, double lat1, double lon1, double azi1, unsigned flags, double s12_a12, unsigned caps); /** * Initialize a geod_geodesicline object in terms of the inverse geodesic * problem. * * @param[out] l a pointer to the object to be initialized. * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @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] caps bitor'ed combination of geod_mask() values specifying the * capabilities the geod_geodesicline object should possess, i.e., which * quantities can be returned in calls to geod_position() and * geod_genposition(). * * This function sets point 3 of the geod_geodesicline to correspond to point * 2 of the inverse geodesic problem. See geod_lineinit() for more * information. **********************************************************************/ void GEOD_DLL geod_inverseline(struct geod_geodesicline* l, const struct geod_geodesic* g, double lat1, double lon1, double lat2, double lon2, unsigned caps); /** * Compute the position along a geod_geodesicline. * * @param[in] l a pointer to the geod_geodesicline object specifying the * geodesic line. * @param[in] s12 distance from point 1 to point 2 (meters); it can be * negative. * @param[out] plat2 pointer to the latitude of point 2 (degrees). * @param[out] plon2 pointer to the longitude of point 2 (degrees); requires * that \e l was initialized with \e caps |= GEOD_LONGITUDE. * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * * \e l must have been initialized with a call, e.g., to geod_lineinit(), * with \e caps |= GEOD_DISTANCE_IN (or \e caps = 0). The values of \e lon2 * and \e azi2 returned are in the range [−180°, 180°]. Any of * the "return" arguments \e plat2, etc., may be replaced by 0, if you do not * need some quantities computed. * * Example, compute way points between JFK and Singapore Changi Airport * the "obvious" way using geod_direct(): @code{.c} struct geod_geodesic g; double s12, azi1, lat[101],lon[101]; int i; geod_init(&g, 6378137, 1/298.257223563); geod_inverse(&g, 40.64, -73.78, 1.36, 103.99, &s12, &azi1, 0); for (i = 0; i < 101; ++i) { geod_direct(&g, 40.64, -73.78, azi1, i * s12 * 0.01, lat + i, lon + i, 0); printf("%.5f %.5f\n", lat[i], lon[i]); } @endcode * A faster way using geod_position(): @code{.c} struct geod_geodesic g; struct geod_geodesicline l; double lat[101],lon[101]; int i; geod_init(&g, 6378137, 1/298.257223563); geod_inverseline(&l, &g, 40.64, -73.78, 1.36, 103.99, 0); for (i = 0; i <= 100; ++i) { geod_position(&l, i * l.s13 * 0.01, lat + i, lon + i, 0); printf("%.5f %.5f\n", lat[i], lon[i]); } @endcode **********************************************************************/ void GEOD_DLL geod_position(const struct geod_geodesicline* l, double s12, double* plat2, double* plon2, double* pazi2); /** * The general position function. * * @param[in] l a pointer to the geod_geodesicline object specifying the * geodesic line. * @param[in] flags bitor'ed combination of geod_flags(); \e flags & * GEOD_ARCMODE determines the meaning of \e s12_a12 and \e flags & * GEOD_LONG_UNROLL "unrolls" \e lon2; if \e flags & GEOD_ARCMODE is 0, * then \e l must have been initialized with \e caps |= GEOD_DISTANCE_IN. * @param[in] s12_a12 if \e flags & GEOD_ARCMODE is 0, this is the * distance from point 1 to point 2 (meters); otherwise it is the * arc length from point 1 to point 2 (degrees); it can be * negative. * @param[out] plat2 pointer to the latitude of point 2 (degrees). * @param[out] plon2 pointer to the longitude of point 2 (degrees); requires * that \e l was initialized with \e caps |= GEOD_LONGITUDE. * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * @param[out] ps12 pointer to the distance from point 1 to point 2 * (meters); requires that \e l was initialized with \e caps |= * GEOD_DISTANCE. * @param[out] pm12 pointer to the reduced length of geodesic (meters); * requires that \e l was initialized with \e caps |= GEOD_REDUCEDLENGTH. * @param[out] pM12 pointer to the geodesic scale of point 2 relative to * point 1 (dimensionless); requires that \e l was initialized with \e caps * |= GEOD_GEODESICSCALE. * @param[out] pM21 pointer to the geodesic scale of point 1 relative to * point 2 (dimensionless); requires that \e l was initialized with \e caps * |= GEOD_GEODESICSCALE. * @param[out] pS12 pointer to the area under the geodesic * (meters2); requires that \e l was initialized with \e caps |= * GEOD_AREA. * @return \e a12 arc length from point 1 to point 2 (degrees). * * \e l must have been initialized with a call to geod_lineinit() with \e * caps |= GEOD_DISTANCE_IN. The value \e azi2 returned is in the range * [−180°, 180°]. Any of the "return" arguments \e plat2, * etc., may be replaced by 0, if you do not need some quantities * computed. Requesting a value which \e l is not capable of computing * is not an error; the corresponding argument will not be altered. * * With \e flags & GEOD_LONG_UNROLL bit set, the longitude is "unrolled" so * that the quantity \e lon2 − \e lon1 indicates how many times and in * what sense the geodesic encircles the ellipsoid. * * Example, compute way points between JFK and Singapore Changi Airport using * geod_genposition(). In this example, the points are evenly space in arc * length (and so only approximately equally spaced in distance). This is * faster than using geod_position() and would be appropriate if drawing the * path on a map. @code{.c} struct geod_geodesic g; struct geod_geodesicline l; double lat[101], lon[101]; int i; geod_init(&g, 6378137, 1/298.257223563); geod_inverseline(&l, &g, 40.64, -73.78, 1.36, 103.99, GEOD_LATITUDE | GEOD_LONGITUDE); for (i = 0; i <= 100; ++i) { geod_genposition(&l, GEOD_ARCMODE, i * l.a13 * 0.01, lat + i, lon + i, 0, 0, 0, 0, 0, 0); printf("%.5f %.5f\n", lat[i], lon[i]); } @endcode **********************************************************************/ double GEOD_DLL geod_genposition(const struct geod_geodesicline* l, unsigned flags, double s12_a12, double* plat2, double* plon2, double* pazi2, double* ps12, double* pm12, double* pM12, double* pM21, double* pS12); /** * Specify position of point 3 in terms of distance. * * @param[in,out] l a pointer to the geod_geodesicline object. * @param[in] s13 the distance from point 1 to point 3 (meters); it * can be negative. * * This is only useful if the geod_geodesicline object has been constructed * with \e caps |= GEOD_DISTANCE_IN. **********************************************************************/ void GEOD_DLL geod_setdistance(struct geod_geodesicline* l, double s13); /** * Specify position of point 3 in terms of either distance or arc length. * * @param[in,out] l a pointer to the geod_geodesicline object. * @param[in] flags either GEOD_NOFLAGS or GEOD_ARCMODE to determining the * meaning of the \e s13_a13. * @param[in] s13_a13 if \e flags = GEOD_NOFLAGS, this is the distance * from point 1 to point 3 (meters); if \e flags = GEOD_ARCMODE, it is * the arc length from point 1 to point 3 (degrees); it can be * negative. * * If flags = GEOD_NOFLAGS, this calls geod_setdistance(). If flags = * GEOD_ARCMODE, the \e s13 is only set if the geod_geodesicline object has * been constructed with \e caps |= GEOD_DISTANCE. **********************************************************************/ void GEOD_DLL geod_gensetdistance(struct geod_geodesicline* l, unsigned flags, double s13_a13); /** * Initialize a geod_polygon object. * * @param[out] p a pointer to the object to be initialized. * @param[in] polylinep non-zero if a polyline instead of a polygon. * * If \e polylinep is zero, then the sequence of vertices and edges added by * geod_polygon_addpoint() and geod_polygon_addedge() define a polygon and * the perimeter and area are returned by geod_polygon_compute(). If \e * polylinep is non-zero, then the vertices and edges define a polyline and * only the perimeter is returned by geod_polygon_compute(). * * The area and perimeter are accumulated at 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. * * An example of the use of this function is given in the documentation for * geod_polygon_compute(). **********************************************************************/ void GEOD_DLL geod_polygon_init(struct geod_polygon* p, int polylinep); /** * Clear the polygon, allowing a new polygon to be started. * * @param[in,out] p a pointer to the object to be cleared. **********************************************************************/ void GEOD_DLL geod_polygon_clear(struct geod_polygon* p); /** * Add a point to the polygon or polyline. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in,out] p a pointer to the geod_polygon object specifying the * polygon. * @param[in] lat the latitude of the point (degrees). * @param[in] lon the longitude of the point (degrees). * * \e g and \e p must have been initialized with calls to geod_init() and * geod_polygon_init(), respectively. The same \e g must be used for all the * points and edges in a polygon. \e lat should be in the range * [−90°, 90°]. * * An example of the use of this function is given in the documentation for * geod_polygon_compute(). **********************************************************************/ void GEOD_DLL geod_polygon_addpoint(const struct geod_geodesic* g, struct geod_polygon* p, double lat, double lon); /** * Add an edge to the polygon or polyline. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in,out] p a pointer to the geod_polygon object specifying the * polygon. * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to next point (meters). * * \e g and \e p must have been initialized with calls to geod_init() and * geod_polygon_init(), respectively. The same \e g must be used for all the * points and edges in a polygon. This does nothing if no points have been * added yet. The \e lat and \e lon fields of \e p give the location of the * new vertex. **********************************************************************/ void GEOD_DLL geod_polygon_addedge(const struct geod_geodesic* g, struct geod_polygon* p, double azi, double s); /** * Return the results for a polygon. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] p a pointer to the geod_polygon object specifying the polygon. * @param[in] reverse if non-zero then clockwise (instead of * counter-clockwise) traversal counts as a positive area. * @param[in] sign if non-zero 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] pA pointer to the area of the polygon (meters2); * only set if \e polyline is non-zero in the call to geod_polygon_init(). * @param[out] pP pointer to the perimeter of the polygon or length of the * polyline (meters). * @return the number of points. * * The area and perimeter are accumulated at two times the standard floating * point precision to guard against the loss of accuracy with many-sided * polygons. Arbitrarily complex polygons are allowed. In the case of * self-intersecting polygons the area is accumulated "algebraically", e.g., * the areas of the 2 loops in a figure-8 polygon will partially cancel. * There's no need to "close" the polygon by repeating the first vertex. Set * \e pA or \e pP to zero, if you do not want the corresponding quantity * returned. * * More points can be added to the polygon after this call. * * Example, compute the perimeter and area of the geodesic triangle with * vertices (0°N,0°E), (0°N,90°E), (90°N,0°E). @code{.c} double A, P; int n; struct geod_geodesic g; struct geod_polygon p; geod_init(&g, 6378137, 1/298.257223563); geod_polygon_init(&p, 0); geod_polygon_addpoint(&g, &p, 0, 0); geod_polygon_addpoint(&g, &p, 0, 90); geod_polygon_addpoint(&g, &p, 90, 0); n = geod_polygon_compute(&g, &p, 0, 1, &A, &P); printf("%d %.8f %.3f\n", n, P, A); @endcode **********************************************************************/ unsigned GEOD_DLL geod_polygon_compute(const struct geod_geodesic* g, const struct geod_polygon* p, int reverse, int sign, double* pA, double* pP); /** * 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 geod_polygon_addpoint() and geod_polygon_compute() are used. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] p a pointer to the geod_polygon object specifying the polygon. * @param[in] lat the latitude of the test point (degrees). * @param[in] lon the longitude of the test point (degrees). * @param[in] reverse if non-zero then clockwise (instead of * counter-clockwise) traversal counts as a positive area. * @param[in] sign if non-zero 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] pA pointer to the area of the polygon (meters2); * only set if \e polyline is non-zero in the call to geod_polygon_init(). * @param[out] pP pointer to the perimeter of the polygon or length of the * polyline (meters). * @return the number of points. * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ unsigned GEOD_DLL geod_polygon_testpoint(const struct geod_geodesic* g, const struct geod_polygon* p, double lat, double lon, int reverse, int sign, double* pA, double* pP); /** * Return the results assuming a tentative final test point is added via an * azimuth and distance; 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 geod_polygon_addedge() and * geod_polygon_compute() are used. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] p a pointer to the geod_polygon object specifying the polygon. * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to final test point (meters). * @param[in] reverse if non-zero then clockwise (instead of * counter-clockwise) traversal counts as a positive area. * @param[in] sign if non-zero 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] pA pointer to the area of the polygon (meters2); * only set if \e polyline is non-zero in the call to geod_polygon_init(). * @param[out] pP pointer to the perimeter of the polygon or length of the * polyline (meters). * @return the number of points. **********************************************************************/ unsigned GEOD_DLL geod_polygon_testedge(const struct geod_geodesic* g, const struct geod_polygon* p, double azi, double s, int reverse, int sign, double* pA, double* pP); /** * A simple interface for computing the area of a geodesic polygon. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lats an array of latitudes of the polygon vertices (degrees). * @param[in] lons an array of longitudes of the polygon vertices (degrees). * @param[in] n the number of vertices. * @param[out] pA pointer to the area of the polygon (meters2). * @param[out] pP pointer to the perimeter of the polygon (meters). * * \e lats should be in the range [−90°, 90°]. * * Arbitrarily complex polygons are allowed. In the case self-intersecting * of polygons the area is accumulated "algebraically", e.g., the areas of * the 2 loops in a figure-8 polygon will partially cancel. There's no need * to "close" the polygon by repeating the first vertex. The area returned * is signed with counter-clockwise traversal being treated as positive. * * Example, compute the area of Antarctica: @code{.c} double lats[] = {-72.9, -71.9, -74.9, -74.3, -77.5, -77.4, -71.7, -65.9, -65.7, -66.6, -66.9, -69.8, -70.0, -71.0, -77.3, -77.9, -74.7}, lons[] = {-74, -102, -102, -131, -163, 163, 172, 140, 113, 88, 59, 25, -4, -14, -33, -46, -61}; struct geod_geodesic g; double A, P; geod_init(&g, 6378137, 1/298.257223563); geod_polygonarea(&g, lats, lons, (sizeof lats) / (sizeof lats[0]), &A, &P); printf("%.0f %.2f\n", A, P); @endcode **********************************************************************/ void GEOD_DLL geod_polygonarea(const struct geod_geodesic* g, double lats[], double lons[], int n, double* pA, double* pP); /** * mask values for the \e caps argument to geod_lineinit(). **********************************************************************/ enum geod_mask { GEOD_NONE = 0U, /**< Calculate nothing */ GEOD_LATITUDE = 1U<<7 | 0U, /**< Calculate latitude */ GEOD_LONGITUDE = 1U<<8 | 1U<<3, /**< Calculate longitude */ GEOD_AZIMUTH = 1U<<9 | 0U, /**< Calculate azimuth */ GEOD_DISTANCE = 1U<<10 | 1U<<0, /**< Calculate distance */ GEOD_DISTANCE_IN = 1U<<11 | 1U<<0 | 1U<<1,/**< Allow distance as input */ GEOD_REDUCEDLENGTH= 1U<<12 | 1U<<0 | 1U<<2,/**< Calculate reduced length */ GEOD_GEODESICSCALE= 1U<<13 | 1U<<0 | 1U<<2,/**< Calculate geodesic scale */ GEOD_AREA = 1U<<14 | 1U<<4, /**< Calculate reduced length */ GEOD_ALL = 0x7F80U| 0x1FU /**< Calculate everything */ }; /** * flag values for the \e flags argument to geod_gendirect() and * geod_genposition() **********************************************************************/ enum geod_flags { GEOD_NOFLAGS = 0U, /**< No flags */ GEOD_ARCMODE = 1U<<0, /**< Position given in terms of arc distance */ GEOD_LONG_UNROLL = 1U<<15 /**< Unroll the longitude */ }; #if defined(__cplusplus) } #endif #endif GeographicLib-1.52/legacy/C/geodtest.c0000644000771000077100000012703014064202371017430 0ustar ckarneyckarney/** * \file geodtest.c * \brief Test suite for the geodesic routines in C * * Run these tests by configuring with cmake and running "make test". * * Copyright (c) Charles Karney (2015-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ /** @cond SKIP */ #include "geodesic.h" #include #include #if defined(_MSC_VER) /* Squelch warnings about assignment within conditional expression */ # pragma warning (disable: 4706) #endif #if !defined(__cplusplus) #define nullptr 0 #endif static const double wgs84_a = 6378137, wgs84_f = 1/298.257223563; /* WGS84 */ static int checkEquals(double x, double y, double d) { if (fabs(x - y) <= d) return 0; printf("checkEquals fails: %.7g != %.7g +/- %.7g\n", x, y, d); return 1; } static int checkNaN(double x) { /* cppcheck-suppress duplicateExpression */ if (isnan(x)) return 0; printf("checkNaN fails: %.7g\n", x); return 1; } static const int ncases = 20; static const double testcases[20][12] = { {35.60777, -139.44815, 111.098748429560326, -11.17491, -69.95921, 129.289270889708762, 8935244.5604818305, 80.50729714281974, 6273170.2055303837, 0.16606318447386067, 0.16479116945612937, 12841384694976.432}, {55.52454, 106.05087, 22.020059880982801, 77.03196, 197.18234, 109.112041110671519, 4105086.1713924406, 36.892740690445894, 3828869.3344387607, 0.80076349608092607, 0.80101006984201008, 61674961290615.615}, {-21.97856, 142.59065, -32.44456876433189, 41.84138, 98.56635, -41.84359951440466, 8394328.894657671, 75.62930491011522, 6161154.5773110616, 0.24816339233950381, 0.24930251203627892, -6637997720646.717}, {-66.99028, 112.2363, 173.73491240878403, -12.70631, 285.90344, 2.512956620913668, 11150344.2312080241, 100.278634181155759, 6289939.5670446687, -0.17199490274700385, -0.17722569526345708, -121287239862139.744}, {-17.42761, 173.34268, -159.033557661192928, -15.84784, 5.93557, -20.787484651536988, 16076603.1631180673, 144.640108810286253, 3732902.1583877189, -0.81273638700070476, -0.81299800519154474, 97825992354058.708}, {32.84994, 48.28919, 150.492927788121982, -56.28556, 202.29132, 48.113449399816759, 16727068.9438164461, 150.565799985466607, 3147838.1910180939, -0.87334918086923126, -0.86505036767110637, -72445258525585.010}, {6.96833, 52.74123, 92.581585386317712, -7.39675, 206.17291, 90.721692165923907, 17102477.2496958388, 154.147366239113561, 2772035.6169917581, -0.89991282520302447, -0.89986892177110739, -1311796973197.995}, {-50.56724, -16.30485, -105.439679907590164, -33.56571, -94.97412, -47.348547835650331, 6455670.5118668696, 58.083719495371259, 5409150.7979815838, 0.53053508035997263, 0.52988722644436602, 41071447902810.047}, {-58.93002, -8.90775, 140.965397902500679, -8.91104, 133.13503, 19.255429433416599, 11756066.0219864627, 105.755691241406877, 6151101.2270708536, -0.26548622269867183, -0.27068483874510741, -86143460552774.735}, {-68.82867, -74.28391, 93.774347763114881, -50.63005, -8.36685, 34.65564085411343, 3956936.926063544, 35.572254987389284, 3708890.9544062657, 0.81443963736383502, 0.81420859815358342, -41845309450093.787}, {-10.62672, -32.0898, -86.426713286747751, 5.883, -134.31681, -80.473780971034875, 11470869.3864563009, 103.387395634504061, 6184411.6622659713, -0.23138683500430237, -0.23155097622286792, 4198803992123.548}, {-21.76221, 166.90563, 29.319421206936428, 48.72884, 213.97627, 43.508671946410168, 9098627.3986554915, 81.963476716121964, 6299240.9166992283, 0.13965943368590333, 0.14152969707656796, 10024709850277.476}, {-19.79938, -174.47484, 71.167275780171533, -11.99349, -154.35109, 65.589099775199228, 2319004.8601169389, 20.896611684802389, 2267960.8703918325, 0.93427001867125849, 0.93424887135032789, -3935477535005.785}, {-11.95887, -116.94513, 92.712619830452549, 4.57352, 7.16501, 78.64960934409585, 13834722.5801401374, 124.688684161089762, 5228093.177931598, -0.56879356755666463, -0.56918731952397221, -9919582785894.853}, {-87.85331, 85.66836, -65.120313040242748, 66.48646, 16.09921, -4.888658719272296, 17286615.3147144645, 155.58592449699137, 2635887.4729110181, -0.90697975771398578, -0.91095608883042767, 42667211366919.534}, {1.74708, 128.32011, -101.584843631173858, -11.16617, 11.87109, -86.325793296437476, 12942901.1241347408, 116.650512484301857, 5682744.8413270572, -0.44857868222697644, -0.44824490340007729, 10763055294345.653}, {-25.72959, -144.90758, -153.647468693117198, -57.70581, -269.17879, -48.343983158876487, 9413446.7452453107, 84.664533838404295, 6356176.6898881281, 0.09492245755254703, 0.09737058264766572, 74515122850712.444}, {-41.22777, 122.32875, 14.285113402275739, -7.57291, 130.37946, 10.805303085187369, 3812686.035106021, 34.34330804743883, 3588703.8812128856, 0.82605222593217889, 0.82572158200920196, -2456961531057.857}, {11.01307, 138.25278, 79.43682622782374, 6.62726, 247.05981, 103.708090215522657, 11911190.819018408, 107.341669954114577, 6070904.722786735, -0.29767608923657404, -0.29785143390252321, 17121631423099.696}, {-29.47124, 95.14681, -163.779130441688382, -27.46601, -69.15955, -15.909335945554969, 13487015.8381145492, 121.294026715742277, 5481428.9945736388, -0.51527225545373252, -0.51556587964721788, 104679964020340.318}}; static int testinverse() { double lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12; double azi1a, azi2a, s12a, a12a, m12a, M12a, M21a, S12a; struct geod_geodesic g; int i, result = 0; geod_init(&g, wgs84_a, wgs84_f); for (i = 0; i < ncases; ++i) { lat1 = testcases[i][0]; lon1 = testcases[i][1]; azi1 = testcases[i][2]; lat2 = testcases[i][3]; lon2 = testcases[i][4]; azi2 = testcases[i][5]; s12 = testcases[i][6]; a12 = testcases[i][7]; m12 = testcases[i][8]; M12 = testcases[i][9]; M21 = testcases[i][10]; S12 = testcases[i][11]; a12a = geod_geninverse(&g, lat1, lon1, lat2, lon2, &s12a, &azi1a, &azi2a, &m12a, &M12a, &M21a, &S12a); result += checkEquals(azi1, azi1a, 1e-13); result += checkEquals(azi2, azi2a, 1e-13); result += checkEquals(s12, s12a, 1e-8); result += checkEquals(a12, a12a, 1e-13); result += checkEquals(m12, m12a, 1e-8); result += checkEquals(M12, M12a, 1e-15); result += checkEquals(M21, M21a, 1e-15); result += checkEquals(S12, S12a, 0.1); } return result; } static int testdirect() { double lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12; double lat2a, lon2a, azi2a, a12a, m12a, M12a, M21a, S12a; struct geod_geodesic g; int i, result = 0; unsigned flags = GEOD_LONG_UNROLL; geod_init(&g, wgs84_a, wgs84_f); for (i = 0; i < ncases; ++i) { lat1 = testcases[i][0]; lon1 = testcases[i][1]; azi1 = testcases[i][2]; lat2 = testcases[i][3]; lon2 = testcases[i][4]; azi2 = testcases[i][5]; s12 = testcases[i][6]; a12 = testcases[i][7]; m12 = testcases[i][8]; M12 = testcases[i][9]; M21 = testcases[i][10]; S12 = testcases[i][11]; a12a = geod_gendirect(&g, lat1, lon1, azi1, flags, s12, &lat2a, &lon2a, &azi2a, nullptr, &m12a, &M12a, &M21a, &S12a); result += checkEquals(lat2, lat2a, 1e-13); result += checkEquals(lon2, lon2a, 1e-13); result += checkEquals(azi2, azi2a, 1e-13); result += checkEquals(a12, a12a, 1e-13); result += checkEquals(m12, m12a, 1e-8); result += checkEquals(M12, M12a, 1e-15); result += checkEquals(M21, M21a, 1e-15); result += checkEquals(S12, S12a, 0.1); } return result; } static int testarcdirect() { double lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12; double lat2a, lon2a, azi2a, s12a, m12a, M12a, M21a, S12a; struct geod_geodesic g; int i, result = 0; unsigned flags = GEOD_ARCMODE | GEOD_LONG_UNROLL; geod_init(&g, wgs84_a, wgs84_f); for (i = 0; i < ncases; ++i) { lat1 = testcases[i][0]; lon1 = testcases[i][1]; azi1 = testcases[i][2]; lat2 = testcases[i][3]; lon2 = testcases[i][4]; azi2 = testcases[i][5]; s12 = testcases[i][6]; a12 = testcases[i][7]; m12 = testcases[i][8]; M12 = testcases[i][9]; M21 = testcases[i][10]; S12 = testcases[i][11]; geod_gendirect(&g, lat1, lon1, azi1, flags, a12, &lat2a, &lon2a, &azi2a, &s12a, &m12a, &M12a, &M21a, &S12a); result += checkEquals(lat2, lat2a, 1e-13); result += checkEquals(lon2, lon2a, 1e-13); result += checkEquals(azi2, azi2a, 1e-13); result += checkEquals(s12, s12a, 1e-8); result += checkEquals(m12, m12a, 1e-8); result += checkEquals(M12, M12a, 1e-15); result += checkEquals(M21, M21a, 1e-15); result += checkEquals(S12, S12a, 0.1); } return result; } static int GeodSolve0() { double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 40.6, -73.8, 49.01666667, 2.55, &s12, &azi1, &azi2); result += checkEquals(azi1, 53.47022, 0.5e-5); result += checkEquals(azi2, 111.59367, 0.5e-5); result += checkEquals(s12, 5853226, 0.5); return result; } static int GeodSolve1() { double lat2, lon2, azi2; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_direct(&g, 40.63972222, -73.77888889, 53.5, 5850e3, &lat2, &lon2, &azi2); result += checkEquals(lat2, 49.01467, 0.5e-5); result += checkEquals(lon2, 2.56106, 0.5e-5); result += checkEquals(azi2, 111.62947, 0.5e-5); return result; } static int GeodSolve2() { /* Check fix for antipodal prolate bug found 2010-09-04 */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, 6.4e6, -1/150.0); geod_inverse(&g, 0.07476, 0, -0.07476, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 90.00078, 0.5e-5); result += checkEquals(azi2, 90.00078, 0.5e-5); result += checkEquals(s12, 20106193, 0.5); geod_inverse(&g, 0.1, 0, -0.1, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 90.00105, 0.5e-5); result += checkEquals(azi2, 90.00105, 0.5e-5); result += checkEquals(s12, 20106193, 0.5); return result; } static int GeodSolve4() { /* Check fix for short line bug found 2010-05-21 */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 36.493349428792, 0, 36.49334942879201, .0000008, &s12, nullptr, nullptr); result += checkEquals(s12, 0.072, 0.5e-3); return result; } static int GeodSolve5() { /* Check fix for point2=pole bug found 2010-05-03 */ double lat2, lon2, azi2; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_direct(&g, 0.01777745589997, 30, 0, 10e6, &lat2, &lon2, &azi2); result += checkEquals(lat2, 90, 0.5e-5); if (lon2 < 0) { result += checkEquals(lon2, -150, 0.5e-5); result += checkEquals(fabs(azi2), 180, 0.5e-5); } else { result += checkEquals(lon2, 30, 0.5e-5); result += checkEquals(azi2, 0, 0.5e-5); } return result; } static int GeodSolve6() { /* 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). */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 88.202499451857, 0, -88.202499451857, 179.981022032992859592, &s12, nullptr, nullptr); result += checkEquals(s12, 20003898.214, 0.5e-3); geod_inverse(&g, 89.262080389218, 0, -89.262080389218, 179.992207982775375662, &s12, nullptr, nullptr); result += checkEquals(s12, 20003925.854, 0.5e-3); geod_inverse(&g, 89.333123580033, 0, -89.333123580032997687, 179.99295812360148422, &s12, nullptr, nullptr); result += checkEquals(s12, 20003926.881, 0.5e-3); return result; } static int GeodSolve9() { /* Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 56.320923501171, 0, -56.320923501171, 179.664747671772880215, &s12, nullptr, nullptr); result += checkEquals(s12, 19993558.287, 0.5e-3); return result; } static int GeodSolve10() { /* Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio * 10 rel + debug) */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 52.784459512564, 0, -52.784459512563990912, 179.634407464943777557, &s12, nullptr, nullptr); result += checkEquals(s12, 19991596.095, 0.5e-3); return result; } static int GeodSolve11() { /* Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio * 10 rel + debug) */ double s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 48.522876735459, 0, -48.52287673545898293, 179.599720456223079643, &s12, nullptr, nullptr); result += checkEquals(s12, 19989144.774, 0.5e-3); return result; } static int GeodSolve12() { /* Check fix for inverse geodesics on extreme prolate/oblate * ellipsoids Reported 2012-08-29 Stefan Guenther * ; fixed 2012-10-07 */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, 89.8, -1.83); geod_inverse(&g, 0, 0, -10, 160, &s12, &azi1, &azi2); result += checkEquals(azi1, 120.27, 1e-2); result += checkEquals(azi2, 105.15, 1e-2); result += checkEquals(s12, 266.7, 1e-1); return result; } static int GeodSolve14() { /* Check fix for inverse ignoring lon12 = nan */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 0, 0, 1, nan("0"), &s12, &azi1, &azi2); result += checkNaN(azi1); result += checkNaN(azi2); result += checkNaN(s12); return result; } static int GeodSolve15() { /* Initial implementation of Math::eatanhe was wrong for e^2 < 0. This * checks that this is fixed. */ double S12; struct geod_geodesic g; int result = 0; geod_init(&g, 6.4e6, -1/150.0); geod_gendirect(&g, 1, 2, 3, 0, 4, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &S12); result += checkEquals(S12, 23700, 0.5); return result; } static int GeodSolve17() { /* Check fix for LONG_UNROLL bug found on 2015-05-07 */ double lat2, lon2, azi2; struct geod_geodesic g; struct geod_geodesicline l; int result = 0; unsigned flags = GEOD_LONG_UNROLL; geod_init(&g, wgs84_a, wgs84_f); geod_gendirect(&g, 40, -75, -10, flags, 2e7, &lat2, &lon2, &azi2, nullptr, nullptr, nullptr, nullptr, nullptr); result += checkEquals(lat2, -39, 1); result += checkEquals(lon2, -254, 1); result += checkEquals(azi2, -170, 1); geod_lineinit(&l, &g, 40, -75, -10, 0); geod_genposition(&l, flags, 2e7, &lat2, &lon2, &azi2, nullptr, nullptr, nullptr, nullptr, nullptr); result += checkEquals(lat2, -39, 1); result += checkEquals(lon2, -254, 1); result += checkEquals(azi2, -170, 1); geod_direct(&g, 40, -75, -10, 2e7, &lat2, &lon2, &azi2); result += checkEquals(lat2, -39, 1); result += checkEquals(lon2, 105, 1); result += checkEquals(azi2, -170, 1); geod_position(&l, 2e7, &lat2, &lon2, &azi2); result += checkEquals(lat2, -39, 1); result += checkEquals(lon2, 105, 1); result += checkEquals(azi2, -170, 1); return result; } static int GeodSolve26() { /* Check 0/0 problem with area calculation on sphere 2015-09-08 */ double S12; struct geod_geodesic g; int result = 0; geod_init(&g, 6.4e6, 0); geod_geninverse(&g, 1, 2, 3, 4, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &S12); result += checkEquals(S12, 49911046115.0, 0.5); return result; } static int GeodSolve28() { /* Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in * Java implementation fixed on 2015-05-19). */ double a12; struct geod_geodesic g; int result = 0; geod_init(&g, 6.4e6, 0.1); a12 = geod_gendirect(&g, 1, 2, 10, 0, 5e6, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); result += checkEquals(a12, 48.55570690, 0.5e-8); return result; } static int GeodSolve33() { /* Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- * sind(-0.0) = +0.0 -- and in some version of Visual Studio -- * fmod(-0.0, 360.0) = +0.0. */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 0, 0, 0, 179, &s12, &azi1, &azi2); result += checkEquals(azi1, 90.00000, 0.5e-5); result += checkEquals(azi2, 90.00000, 0.5e-5); result += checkEquals(s12, 19926189, 0.5); geod_inverse(&g, 0, 0, 0, 179.5, &s12, &azi1, &azi2); result += checkEquals(azi1, 55.96650, 0.5e-5); result += checkEquals(azi2, 124.03350, 0.5e-5); result += checkEquals(s12, 19980862, 0.5); geod_inverse(&g, 0, 0, 0, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 0.00000, 0.5e-5); result += checkEquals(fabs(azi2), 180.00000, 0.5e-5); result += checkEquals(s12, 20003931, 0.5); geod_inverse(&g, 0, 0, 1, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 0.00000, 0.5e-5); result += checkEquals(fabs(azi2), 180.00000, 0.5e-5); result += checkEquals(s12, 19893357, 0.5); geod_init(&g, 6.4e6, 0); geod_inverse(&g, 0, 0, 0, 179, &s12, &azi1, &azi2); result += checkEquals(azi1, 90.00000, 0.5e-5); result += checkEquals(azi2, 90.00000, 0.5e-5); result += checkEquals(s12, 19994492, 0.5); geod_inverse(&g, 0, 0, 0, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 0.00000, 0.5e-5); result += checkEquals(fabs(azi2), 180.00000, 0.5e-5); result += checkEquals(s12, 20106193, 0.5); geod_inverse(&g, 0, 0, 1, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 0.00000, 0.5e-5); result += checkEquals(fabs(azi2), 180.00000, 0.5e-5); result += checkEquals(s12, 19994492, 0.5); geod_init(&g, 6.4e6, -1/300.0); geod_inverse(&g, 0, 0, 0, 179, &s12, &azi1, &azi2); result += checkEquals(azi1, 90.00000, 0.5e-5); result += checkEquals(azi2, 90.00000, 0.5e-5); result += checkEquals(s12, 19994492, 0.5); geod_inverse(&g, 0, 0, 0, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 90.00000, 0.5e-5); result += checkEquals(azi2, 90.00000, 0.5e-5); result += checkEquals(s12, 20106193, 0.5); geod_inverse(&g, 0, 0, 0.5, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 33.02493, 0.5e-5); result += checkEquals(azi2, 146.97364, 0.5e-5); result += checkEquals(s12, 20082617, 0.5); geod_inverse(&g, 0, 0, 1, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 0.00000, 0.5e-5); result += checkEquals(fabs(azi2), 180.00000, 0.5e-5); result += checkEquals(s12, 20027270, 0.5); return result; } static int GeodSolve55() { /* Check fix for nan + point on equator or pole not returning all nans in * Geodesic::Inverse, found 2015-09-23. */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, nan("0"), 0, 0, 90, &s12, &azi1, &azi2); result += checkNaN(azi1); result += checkNaN(azi2); result += checkNaN(s12); geod_inverse(&g, nan("0"), 0, 90, 9, &s12, &azi1, &azi2); result += checkNaN(azi1); result += checkNaN(azi2); result += checkNaN(s12); return result; } static int GeodSolve59() { /* Check for points close with longitudes close to 180 deg apart. */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 5, 0.00000000000001, 10, 180, &s12, &azi1, &azi2); result += checkEquals(azi1, 0.000000000000035, 1.5e-14); result += checkEquals(azi2, 179.99999999999996, 1.5e-14); result += checkEquals(s12, 18345191.174332713, 5e-9); return result; } static int GeodSolve61() { /* Make sure small negative azimuths are west-going */ double lat2, lon2, azi2; struct geod_geodesic g; struct geod_geodesicline l; int result = 0; unsigned flags = GEOD_LONG_UNROLL; geod_init(&g, wgs84_a, wgs84_f); geod_gendirect(&g, 45, 0, -0.000000000000000003, flags, 1e7, &lat2, &lon2, &azi2, nullptr, nullptr, nullptr, nullptr, nullptr); result += checkEquals(lat2, 45.30632, 0.5e-5); result += checkEquals(lon2, -180, 0.5e-5); result += checkEquals(fabs(azi2), 180, 0.5e-5); geod_inverseline(&l, &g, 45, 0, 80, -0.000000000000000003, 0); geod_genposition(&l, flags, 1e7, &lat2, &lon2, &azi2, nullptr, nullptr, nullptr, nullptr, nullptr); result += checkEquals(lat2, 45.30632, 0.5e-5); result += checkEquals(lon2, -180, 0.5e-5); result += checkEquals(fabs(azi2), 180, 0.5e-5); return result; } static int GeodSolve65() { /* Check for bug in east-going check in GeodesicLine (needed to check for * sign of 0) and sign error in area calculation due to a bogus override of * the code for alp12. Found/fixed on 2015-12-19. */ double lat2, lon2, azi2, s12, a12, m12, M12, M21, S12; struct geod_geodesic g; struct geod_geodesicline l; int result = 0; unsigned flags = GEOD_LONG_UNROLL, caps = GEOD_ALL; geod_init(&g, wgs84_a, wgs84_f); geod_inverseline(&l, &g, 30, -0.000000000000000001, -31, 180, caps); a12 = geod_genposition(&l, flags, 1e7, &lat2, &lon2, &azi2, &s12, &m12, &M12, &M21, &S12); result += checkEquals(lat2, -60.23169, 0.5e-5); result += checkEquals(lon2, -0.00000, 0.5e-5); result += checkEquals(fabs(azi2), 180.00000, 0.5e-5); result += checkEquals(s12, 10000000, 0.5); result += checkEquals(a12, 90.06544, 0.5e-5); result += checkEquals(m12, 6363636, 0.5); result += checkEquals(M12, -0.0012834, 0.5e-7); result += checkEquals(M21, 0.0013749, 0.5e-7); result += checkEquals(S12, 0, 0.5); a12 = geod_genposition(&l, flags, 2e7, &lat2, &lon2, &azi2, &s12, &m12, &M12, &M21, &S12); result += checkEquals(lat2, -30.03547, 0.5e-5); result += checkEquals(lon2, -180.00000, 0.5e-5); result += checkEquals(azi2, -0.00000, 0.5e-5); result += checkEquals(s12, 20000000, 0.5); result += checkEquals(a12, 179.96459, 0.5e-5); result += checkEquals(m12, 54342, 0.5); result += checkEquals(M12, -1.0045592, 0.5e-7); result += checkEquals(M21, -0.9954339, 0.5e-7); result += checkEquals(S12, 127516405431022.0, 0.5); return result; } static int GeodSolve67() { /* Check for InverseLine if line is slightly west of S and that s13 is * correctly set. */ double lat2, lon2, azi2; struct geod_geodesic g; struct geod_geodesicline l; int result = 0; unsigned flags = GEOD_LONG_UNROLL; geod_init(&g, wgs84_a, wgs84_f); geod_inverseline(&l, &g, -5, -0.000000000000002, -10, 180, 0); geod_genposition(&l, flags, 2e7, &lat2, &lon2, &azi2, nullptr, nullptr, nullptr, nullptr, nullptr); result += checkEquals(lat2, 4.96445, 0.5e-5); result += checkEquals(lon2, -180.00000, 0.5e-5); result += checkEquals(azi2, -0.00000, 0.5e-5); geod_genposition(&l, flags, 0.5 * l.s13, &lat2, &lon2, &azi2, nullptr, nullptr, nullptr, nullptr, nullptr); result += checkEquals(lat2, -87.52461, 0.5e-5); result += checkEquals(lon2, -0.00000, 0.5e-5); result += checkEquals(azi2, -180.00000, 0.5e-5); return result; } static int GeodSolve71() { /* Check that DirectLine sets s13. */ double lat2, lon2, azi2; struct geod_geodesic g; struct geod_geodesicline l; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_directline(&l, &g, 1, 2, 45, 1e7, 0); geod_position(&l, 0.5 * l.s13, &lat2, &lon2, &azi2); result += checkEquals(lat2, 30.92625, 0.5e-5); result += checkEquals(lon2, 37.54640, 0.5e-5); result += checkEquals(azi2, 55.43104, 0.5e-5); return result; } static int GeodSolve73() { /* Check for backwards from the pole bug reported by Anon on 2016-02-13. * This only affected the Java implementation. It was introduced in Java * version 1.44 and fixed in 1.46-SNAPSHOT on 2016-01-17. * Also the + sign on azi2 is a check on the normalizing of azimuths * (converting -0.0 to +0.0). */ double lat2, lon2, azi2; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_direct(&g, 90, 10, 180, -1e6, &lat2, &lon2, &azi2); result += checkEquals(lat2, 81.04623, 0.5e-5); result += checkEquals(lon2, -170, 0.5e-5); result += azi2 == 0 ? 0 : 1; result += 1/azi2 > 0 ? 0 : 1; /* Check that azi2 = +0.0 not -0.0 */ return result; } static void planimeter(const struct geod_geodesic* g, double points[][2], int N, double* perimeter, double* area) { struct geod_polygon p; int i; geod_polygon_init(&p, 0); for (i = 0; i < N; ++i) geod_polygon_addpoint(g, &p, points[i][0], points[i][1]); geod_polygon_compute(g, &p, 0, 1, area, perimeter); } static void polylength(const struct geod_geodesic* g, double points[][2], int N, double* perimeter) { struct geod_polygon p; int i; geod_polygon_init(&p, 1); for (i = 0; i < N; ++i) geod_polygon_addpoint(g, &p, points[i][0], points[i][1]); geod_polygon_compute(g, &p, 0, 1, nullptr, perimeter); } static int GeodSolve74() { /* Check fix for inaccurate areas, bug introduced in v1.46, fixed * 2015-10-16. */ double a12, s12, azi1, azi2, m12, M12, M21, S12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); a12 = geod_geninverse(&g, 54.1589, 15.3872, 54.1591, 15.3877, &s12, &azi1, &azi2, &m12, &M12, &M21, &S12); result += checkEquals(azi1, 55.723110355, 5e-9); result += checkEquals(azi2, 55.723515675, 5e-9); result += checkEquals(s12, 39.527686385, 5e-9); result += checkEquals(a12, 0.000355495, 5e-9); result += checkEquals(m12, 39.527686385, 5e-9); result += checkEquals(M12, 0.999999995, 5e-9); result += checkEquals(M21, 0.999999995, 5e-9); result += checkEquals(S12, 286698586.30197, 5e-4); return result; } static int GeodSolve76() { /* The distance from Wellington and Salamanca (a classic failure of * Vincenty) */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, -(41+19/60.0), 174+49/60.0, 40+58/60.0, -(5+30/60.0), &s12, &azi1, &azi2); result += checkEquals(azi1, 160.39137649664, 0.5e-11); result += checkEquals(azi2, 19.50042925176, 0.5e-11); result += checkEquals(s12, 19960543.857179, 0.5e-6); return result; } static int GeodSolve78() { /* An example where the NGS calculator fails to converge */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 27.2, 0.0, -27.1, 179.5, &s12, &azi1, &azi2); result += checkEquals(azi1, 45.82468716758, 0.5e-11); result += checkEquals(azi2, 134.22776532670, 0.5e-11); result += checkEquals(s12, 19974354.765767, 0.5e-6); return result; } static int GeodSolve80() { /* Some tests to add code coverage: computing scale in special cases + zero * length geodesic (includes GeodSolve80 - GeodSolve83) + using an incapable * line. */ double a12, s12, azi1, azi2, m12, M12, M21, S12; struct geod_geodesic g; struct geod_geodesicline l; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_geninverse(&g, 0, 0, 0, 90, nullptr, nullptr, nullptr, nullptr, &M12, &M21, nullptr); result += checkEquals(M12, -0.00528427534, 0.5e-10); result += checkEquals(M21, -0.00528427534, 0.5e-10); geod_geninverse(&g, 0, 0, 1e-6, 1e-6, nullptr, nullptr, nullptr, nullptr, &M12, &M21, nullptr); result += checkEquals(M12, 1, 0.5e-10); result += checkEquals(M21, 1, 0.5e-10); a12 = geod_geninverse(&g, 20.001, 0, 20.001, 0, &s12, &azi1, &azi2, &m12, &M12, &M21, &S12); result += checkEquals(a12, 0, 1e-13); result += checkEquals(s12, 0, 1e-8); result += checkEquals(azi1, 180, 1e-13); result += checkEquals(azi2, 180, 1e-13); result += checkEquals(m12, 0, 1e-8); result += checkEquals(M12, 1, 1e-15); result += checkEquals(M21, 1, 1e-15); result += checkEquals(S12, 0, 1e-10); result += 1/a12 > 0 ? 0 : 1; result += 1/s12 > 0 ? 0 : 1; result += 1/m12 > 0 ? 0 : 1; a12 = geod_geninverse(&g, 90, 0, 90, 180, &s12, &azi1, &azi2, &m12, &M12, &M21, &S12); result += checkEquals(a12, 0, 1e-13); result += checkEquals(s12, 0, 1e-8); result += checkEquals(azi1, 0, 1e-13); result += checkEquals(azi2, 180, 1e-13); result += checkEquals(m12, 0, 1e-8); result += checkEquals(M12, 1, 1e-15); result += checkEquals(M21, 1, 1e-15); result += checkEquals(S12, 127516405431022.0, 0.5); /* An incapable line which can't take distance as input */ geod_lineinit(&l, &g, 1, 2, 90, GEOD_LATITUDE); a12 = geod_genposition(&l, 0, 1000, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); result += checkNaN(a12); return result; } static int GeodSolve84() { /* Tests for python implementation to check fix for range errors with * {fmod,sin,cos}(inf) (includes GeodSolve84 - GeodSolve86). */ double lat2, lon2, azi2, inf; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); { /* a round about way to set inf = 0 */ geod_direct(&g, 0, 0, 90, 0, &inf, nullptr, nullptr); /* so that this doesn't give a compiler time error on Windows */ inf = 1.0/inf; } geod_direct(&g, 0, 0, 90, inf, &lat2, &lon2, &azi2); result += checkNaN(lat2); result += checkNaN(lon2); result += checkNaN(azi2); geod_direct(&g, 0, 0, 90, nan("0"), &lat2, &lon2, &azi2); result += checkNaN(lat2); result += checkNaN(lon2); result += checkNaN(azi2); geod_direct(&g, 0, 0, inf, 1000, &lat2, &lon2, &azi2); result += checkNaN(lat2); result += checkNaN(lon2); result += checkNaN(azi2); geod_direct(&g, 0, 0, nan("0"), 1000, &lat2, &lon2, &azi2); result += checkNaN(lat2); result += checkNaN(lon2); result += checkNaN(azi2); geod_direct(&g, 0, inf, 90, 1000, &lat2, &lon2, &azi2); result += lat2 == 0 ? 0 : 1; result += checkNaN(lon2); result += azi2 == 90 ? 0 : 1; geod_direct(&g, 0, nan("0"), 90, 1000, &lat2, &lon2, &azi2); result += lat2 == 0 ? 0 : 1; result += checkNaN(lon2); result += azi2 == 90 ? 0 : 1; geod_direct(&g, inf, 0, 90, 1000, &lat2, &lon2, &azi2); result += checkNaN(lat2); result += checkNaN(lon2); result += checkNaN(azi2); geod_direct(&g, nan("0"), 0, 90, 1000, &lat2, &lon2, &azi2); result += checkNaN(lat2); result += checkNaN(lon2); result += checkNaN(azi2); return result; } static int GeodSolve92() { /* Check fix for inaccurate hypot with python 3.[89]. Problem reported * by agdhruv https://github.com/geopy/geopy/issues/466 ; see * https://bugs.python.org/issue43088 */ double azi1, azi2, s12; struct geod_geodesic g; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_inverse(&g, 37.757540000000006, -122.47018, 37.75754, -122.470177, &s12, &azi1, &azi2); result += checkEquals(azi1, 89.99999923, 1e-7 ); result += checkEquals(azi2, 90.00000106, 1e-7 ); result += checkEquals(s12, 0.264, 0.5e-3); return result; } static int Planimeter0() { /* Check fix for pole-encircling bug found 2011-03-16 */ double pa[4][2] = {{89, 0}, {89, 90}, {89, 180}, {89, 270}}; double pb[4][2] = {{-89, 0}, {-89, 90}, {-89, 180}, {-89, 270}}; double pc[4][2] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}}; double pd[3][2] = {{90, 0}, {0, 0}, {0, 90}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, pa, 4, &perimeter, &area); result += checkEquals(perimeter, 631819.8745, 1e-4); result += checkEquals(area, 24952305678.0, 1); planimeter(&g, pb, 4, &perimeter, &area); result += checkEquals(perimeter, 631819.8745, 1e-4); result += checkEquals(area, -24952305678.0, 1); planimeter(&g, pc, 4, &perimeter, &area); result += checkEquals(perimeter, 627598.2731, 1e-4); result += checkEquals(area, 24619419146.0, 1); planimeter(&g, pd, 3, &perimeter, &area); result += checkEquals(perimeter, 30022685, 1); result += checkEquals(area, 63758202715511.0, 1); polylength(&g, pd, 3, &perimeter); result += checkEquals(perimeter, 20020719, 1); return result; } static int Planimeter5() { /* Check fix for Planimeter pole crossing bug found 2011-06-24 */ double points[3][2] = {{89, 0.1}, {89, 90.1}, {89, -179.9}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, points, 3, &perimeter, &area); result += checkEquals(perimeter, 539297, 1); result += checkEquals(area, 12476152838.5, 1); return result; } static int Planimeter6() { /* Check fix for Planimeter lon12 rounding bug found 2012-12-03 */ double pa[3][2] = {{9, -0.00000000000001}, {9, 180}, {9, 0}}; double pb[3][2] = {{9, 0.00000000000001}, {9, 0}, {9, 180}}; double pc[3][2] = {{9, 0.00000000000001}, {9, 180}, {9, 0}}; double pd[3][2] = {{9, -0.00000000000001}, {9, 0}, {9, 180}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, pa, 3, &perimeter, &area); result += checkEquals(perimeter, 36026861, 1); result += checkEquals(area, 0, 1); planimeter(&g, pb, 3, &perimeter, &area); result += checkEquals(perimeter, 36026861, 1); result += checkEquals(area, 0, 1); planimeter(&g, pc, 3, &perimeter, &area); result += checkEquals(perimeter, 36026861, 1); result += checkEquals(area, 0, 1); planimeter(&g, pd, 3, &perimeter, &area); result += checkEquals(perimeter, 36026861, 1); result += checkEquals(area, 0, 1); return result; } static int Planimeter12() { /* Area of arctic circle (not really -- adjunct to rhumb-area test) */ double points[2][2] = {{66.562222222, 0}, {66.562222222, 180}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, points, 2, &perimeter, &area); result += checkEquals(perimeter, 10465729, 1); result += checkEquals(area, 0, 1); return result; } static int Planimeter13() { /* Check encircling pole twice */ double points[6][2] = {{89,-360}, {89,-240}, {89,-120}, {89,0}, {89,120}, {89,240}}; struct geod_geodesic g; double perimeter, area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); planimeter(&g, points, 6, &perimeter, &area); result += checkEquals(perimeter, 1160741, 1); result += checkEquals(area, 32415230256.0, 1); return result; } static int Planimeter15() { /* Coverage tests, includes Planimeter15 - Planimeter18 (combinations of * reverse and sign) + calls to testpoint, testedge, geod_polygonarea. */ struct geod_geodesic g; struct geod_polygon p; double lat[] = {2, 1, 3}, lon[] = {1, 2, 3}; double area, s12, azi1; double r = 18454562325.45119, a0 = 510065621724088.5093; /* ellipsoid area */ int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_polygon_init(&p, 0); geod_polygon_addpoint(&g, &p, lat[0], lon[0]); geod_polygon_addpoint(&g, &p, lat[1], lon[1]); geod_polygon_testpoint(&g, &p, lat[2], lon[2], 0, 1, &area, nullptr); result += checkEquals(area, r, 0.5); geod_polygon_testpoint(&g, &p, lat[2], lon[2], 0, 0, &area, nullptr); result += checkEquals(area, r, 0.5); geod_polygon_testpoint(&g, &p, lat[2], lon[2], 1, 1, &area, nullptr); result += checkEquals(area, -r, 0.5); geod_polygon_testpoint(&g, &p, lat[2], lon[2], 1, 0, &area, nullptr); result += checkEquals(area, a0-r, 0.5); geod_inverse(&g, lat[1], lon[1], lat[2], lon[2], &s12, &azi1, nullptr); geod_polygon_testedge(&g, &p, azi1, s12, 0, 1, &area, nullptr); result += checkEquals(area, r, 0.5); geod_polygon_testedge(&g, &p, azi1, s12, 0, 0, &area, nullptr); result += checkEquals(area, r, 0.5); geod_polygon_testedge(&g, &p, azi1, s12, 1, 1, &area, nullptr); result += checkEquals(area, -r, 0.5); geod_polygon_testedge(&g, &p, azi1, s12, 1, 0, &area, nullptr); result += checkEquals(area, a0-r, 0.5); geod_polygon_addpoint(&g, &p, lat[2], lon[2]); geod_polygon_compute(&g, &p, 0, 1, &area, nullptr); result += checkEquals(area, r, 0.5); geod_polygon_compute(&g, &p, 0, 0, &area, nullptr); result += checkEquals(area, r, 0.5); geod_polygon_compute(&g, &p, 1, 1, &area, nullptr); result += checkEquals(area, -r, 0.5); geod_polygon_compute(&g, &p, 1, 0, &area, nullptr); result += checkEquals(area, a0-r, 0.5); geod_polygonarea(&g, lat, lon, 3, &area, nullptr); result += checkEquals(area, r, 0.5); return result; } static int Planimeter19() { /* Coverage tests, includes Planimeter19 - Planimeter20 (degenerate * polygons) + extra cases. */ struct geod_geodesic g; struct geod_polygon p; double area, perim; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_polygon_init(&p, 0); geod_polygon_compute(&g, &p, 0, 1, &area, &perim); result += area == 0 ? 0 : 1; result += perim == 0 ? 0 : 1; geod_polygon_testpoint(&g, &p, 1, 1, 0, 1, &area, &perim); result += area == 0 ? 0 : 1; result += perim == 0 ? 0 : 1; geod_polygon_testedge(&g, &p, 90, 1000, 0, 1, &area, &perim); result += checkNaN(area); result += checkNaN(perim); geod_polygon_addpoint(&g, &p, 1, 1); geod_polygon_compute(&g, &p, 0, 1, &area, &perim); result += area == 0 ? 0 : 1; result += perim == 0 ? 0 : 1; geod_polygon_init(&p, 1); geod_polygon_compute(&g, &p, 0, 1, nullptr, &perim); result += perim == 0 ? 0 : 1; geod_polygon_testpoint(&g, &p, 1, 1, 0, 1, nullptr, &perim); result += perim == 0 ? 0 : 1; geod_polygon_testedge(&g, &p, 90, 1000, 0, 1, nullptr, &perim); result += checkNaN(perim); geod_polygon_addpoint(&g, &p, 1, 1); geod_polygon_compute(&g, &p, 0, 1, nullptr, &perim); result += perim == 0 ? 0 : 1; geod_polygon_addpoint(&g, &p, 1, 1); geod_polygon_testedge(&g, &p, 90, 1000, 0, 1, nullptr, &perim); result += checkEquals(perim, 1000, 1e-10); geod_polygon_testpoint(&g, &p, 2, 2, 0, 1, nullptr, &perim); result += checkEquals(perim, 156876.149, 0.5e-3); return result; } static int Planimeter21() { /* Some test to add code coverage: multiple circlings of pole (includes * Planimeter21 - Planimeter28) + invocations via testpoint and testedge. */ struct geod_geodesic g; struct geod_polygon p; double area, lat = 45, a = 39.2144607176828184218, s = 8420705.40957178156285, r = 39433884866571.4277, /* Area for one circuit */ a0 = 510065621724088.5093; /* Ellipsoid area */ int result = 0, i; geod_init(&g, wgs84_a, wgs84_f); geod_polygon_init(&p, 0); geod_polygon_addpoint(&g, &p, lat, 60); geod_polygon_addpoint(&g, &p, lat, 180); geod_polygon_addpoint(&g, &p, lat, -60); geod_polygon_addpoint(&g, &p, lat, 60); geod_polygon_addpoint(&g, &p, lat, 180); geod_polygon_addpoint(&g, &p, lat, -60); for (i = 3; i <= 4; ++i) { geod_polygon_addpoint(&g, &p, lat, 60); geod_polygon_addpoint(&g, &p, lat, 180); geod_polygon_testpoint(&g, &p, lat, -60, 0, 1, &area, nullptr); result += checkEquals(area, i*r, 0.5); geod_polygon_testpoint(&g, &p, lat, -60, 0, 0, &area, nullptr); result += checkEquals(area, i*r, 0.5); geod_polygon_testpoint(&g, &p, lat, -60, 1, 1, &area, nullptr); result += checkEquals(area, -i*r, 0.5); geod_polygon_testpoint(&g, &p, lat, -60, 1, 0, &area, nullptr); result += checkEquals(area, -i*r + a0, 0.5); geod_polygon_testedge(&g, &p, a, s, 0, 1, &area, nullptr); result += checkEquals(area, i*r, 0.5); geod_polygon_testedge(&g, &p, a, s, 0, 0, &area, nullptr); result += checkEquals(area, i*r, 0.5); geod_polygon_testedge(&g, &p, a, s, 1, 1, &area, nullptr); result += checkEquals(area, -i*r, 0.5); geod_polygon_testedge(&g, &p, a, s, 1, 0, &area, nullptr); result += checkEquals(area, -i*r + a0, 0.5); geod_polygon_addpoint(&g, &p, lat, -60); geod_polygon_compute(&g, &p, 0, 1, &area, nullptr); result += checkEquals(area, i*r, 0.5); geod_polygon_compute(&g, &p, 0, 0, &area, nullptr); result += checkEquals(area, i*r, 0.5); geod_polygon_compute(&g, &p, 1, 1, &area, nullptr); result += checkEquals(area, -i*r, 0.5); geod_polygon_compute(&g, &p, 1, 0, &area, nullptr); result += checkEquals(area, -i*r + a0, 0.5); } return result; } static int Planimeter29() { /* Check fix to transitdirect vs transit zero handling inconsistency */ struct geod_geodesic g; struct geod_polygon p; double area; int result = 0; geod_init(&g, wgs84_a, wgs84_f); geod_polygon_init(&p, 0); geod_polygon_addpoint(&g, &p, 0, 0); geod_polygon_addedge(&g, &p, 90, 1000); geod_polygon_addedge(&g, &p, 0, 1000); geod_polygon_addedge(&g, &p, -90, 1000); geod_polygon_compute(&g, &p, 0, 1, &area, nullptr); /* The area should be 1e6. Prior to the fix it was 1e6 - A/2, where * A = ellipsoid area. */ result += checkEquals(area, 1000000.0, 0.01); return result; } int main() { int n = 0, i; if ((i = testinverse())) {++n; printf("testinverse fail: %d\n", i);} if ((i = testdirect())) {++n; printf("testdirect fail: %d\n", i);} if ((i = testarcdirect())) {++n; printf("testarcdirect fail: %d\n", i);} if ((i = GeodSolve0())) {++n; printf("GeodSolve0 fail: %d\n", i);} if ((i = GeodSolve1())) {++n; printf("GeodSolve1 fail: %d\n", i);} if ((i = GeodSolve2())) {++n; printf("GeodSolve2 fail: %d\n", i);} if ((i = GeodSolve4())) {++n; printf("GeodSolve4 fail: %d\n", i);} if ((i = GeodSolve5())) {++n; printf("GeodSolve5 fail: %d\n", i);} if ((i = GeodSolve6())) {++n; printf("GeodSolve6 fail: %d\n", i);} if ((i = GeodSolve9())) {++n; printf("GeodSolve9 fail: %d\n", i);} if ((i = GeodSolve10())) {++n; printf("GeodSolve10 fail: %d\n", i);} if ((i = GeodSolve11())) {++n; printf("GeodSolve11 fail: %d\n", i);} if ((i = GeodSolve12())) {++n; printf("GeodSolve12 fail: %d\n", i);} if ((i = GeodSolve14())) {++n; printf("GeodSolve14 fail: %d\n", i);} if ((i = GeodSolve15())) {++n; printf("GeodSolve15 fail: %d\n", i);} if ((i = GeodSolve17())) {++n; printf("GeodSolve17 fail: %d\n", i);} if ((i = GeodSolve26())) {++n; printf("GeodSolve26 fail: %d\n", i);} if ((i = GeodSolve28())) {++n; printf("GeodSolve28 fail: %d\n", i);} if ((i = GeodSolve33())) {++n; printf("GeodSolve33 fail: %d\n", i);} if ((i = GeodSolve55())) {++n; printf("GeodSolve55 fail: %d\n", i);} if ((i = GeodSolve59())) {++n; printf("GeodSolve59 fail: %d\n", i);} if ((i = GeodSolve61())) {++n; printf("GeodSolve61 fail: %d\n", i);} if ((i = GeodSolve65())) {++n; printf("GeodSolve65 fail: %d\n", i);} if ((i = GeodSolve67())) {++n; printf("GeodSolve67 fail: %d\n", i);} if ((i = GeodSolve71())) {++n; printf("GeodSolve71 fail: %d\n", i);} if ((i = GeodSolve73())) {++n; printf("GeodSolve73 fail: %d\n", i);} if ((i = GeodSolve74())) {++n; printf("GeodSolve74 fail: %d\n", i);} if ((i = GeodSolve76())) {++n; printf("GeodSolve76 fail: %d\n", i);} if ((i = GeodSolve78())) {++n; printf("GeodSolve78 fail: %d\n", i);} if ((i = GeodSolve80())) {++n; printf("GeodSolve80 fail: %d\n", i);} if ((i = GeodSolve84())) {++n; printf("GeodSolve84 fail: %d\n", i);} if ((i = GeodSolve92())) {++n; printf("GeodSolve92 fail: %d\n", i);} if ((i = Planimeter0())) {++n; printf("Planimeter0 fail: %d\n", i);} if ((i = Planimeter5())) {++n; printf("Planimeter5 fail: %d\n", i);} if ((i = Planimeter6())) {++n; printf("Planimeter6 fail: %d\n", i);} if ((i = Planimeter12())) {++n; printf("Planimeter12 fail: %d\n", i);} if ((i = Planimeter13())) {++n; printf("Planimeter13 fail: %d\n", i);} if ((i = Planimeter15())) {++n; printf("Planimeter15 fail: %d\n", i);} if ((i = Planimeter19())) {++n; printf("Planimeter19 fail: %d\n", i);} if ((i = Planimeter21())) {++n; printf("Planimeter21 fail: %d\n", i);} if ((i = Planimeter29())) {++n; printf("Planimeter29 fail: %d\n", i);} return n; } /** @endcond */ GeographicLib-1.52/legacy/C/inverse.c0000644000771000077100000000163714064202371017271 0ustar ckarneyckarney/** * @file inverse.c * @brief A test program for geod_inverse() **********************************************************************/ #include #include "geodesic.h" #if defined(_MSC_VER) /* Squelch warnings about scanf */ # pragma warning (disable: 4996) #endif /** * A simple program to solve the inverse geodesic problem. * * This program reads in lines with lat1, lon1, lat2, lon2 and prints out lines * with azi1, azi2, s12 (for the WGS84 ellipsoid). **********************************************************************/ int main() { double a = 6378137, f = 1/298.257223563; /* WGS84 */ double lat1, lon1, azi1, lat2, lon2, azi2, s12; struct geod_geodesic g; geod_init(&g, a, f); while (scanf("%lf %lf %lf %lf", &lat1, &lon1, &lat2, &lon2) == 4) { geod_inverse(&g, lat1, lon1, lat2, lon2, &s12, &azi1, &azi2); printf("%.15f %.15f %.10f\n", azi1, azi2, s12); } return 0; } GeographicLib-1.52/legacy/C/planimeter.c0000644000771000077100000000203214064202371017744 0ustar ckarneyckarney/** * @file planimeter.c * @brief A test program for geod_polygon_compute() **********************************************************************/ #include #include "geodesic.h" #if defined(_MSC_VER) /* Squelch warnings about scanf */ # pragma warning (disable: 4996) #endif /** * A simple program to compute the area of a geodesic polygon. * * This program reads in lines with lat, lon for each vertex * of a polygon. At the end of input, the program prints the number of * vertices, the perimeter of the polygon and its area (for the WGS84 * ellipsoid). **********************************************************************/ int main() { double a = 6378137, f = 1/298.257223563; /* WGS84 */ double lat, lon, A, P; int n; struct geod_geodesic g; struct geod_polygon p; geod_init(&g, a, f); geod_polygon_init(&p, 0); while (scanf("%lf %lf", &lat, &lon) == 2) geod_polygon_addpoint(&g, &p, lat, lon); n = geod_polygon_compute(&g, &p, 0, 1, &A, &P); printf("%d %.8f %.3f\n", n, P, A); return 0; } GeographicLib-1.52/legacy/Fortran/00README.txt0000644000771000077100000000167514064202371020543 0ustar ckarneyckarneyThis is a Fortran implementation of the geodesic algorithms described in C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); https://doi.org/10.1007/s00190-012-0578-z Addenda: https://geographiclib.sourceforge.io/geod-addenda.html For documentation, see https://geographiclib.sourceforge.io/html/Fortran/ The code in this directory is entirely self-contained. In particular, it does not depend on the C++ classes. You can compile and link the example programs directly with something like: f95 -o geodinverse geodinverse.for geodesic.for echo 30 0 29.5 179.5 | ./geodinverse Alternatively, you can build the examples using cmake. For example, on Linux systems you might do: mkdir BUILD cd BUILD cmake .. make echo 30 0 29.5 179.5 | ./geodinverse The two tools ngsforward and ngsinverse are replacements for the NGS tools FORWARD and INVERSE available from http://www.ngs.noaa.gov/PC_PROD/Inv_Fwd/ GeographicLib-1.52/legacy/Fortran/CMakeLists.txt0000644000771000077100000000341414064202371021436 0ustar ckarneyckarneyproject (GeographicLib-Fortran Fortran) cmake_minimum_required (VERSION 3.1.0) # 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 () # Make the compiler more picky. if (MSVC) set_target_properties (${TOOLS} PROPERTIES COMPILE_FLAGS "/W4") else () set_target_properties (${TOOLS} PROPERTIES COMPILE_FLAGS "-Wall -Wextra -pedantic -std=f95 -fimplicit-none -Wno-compare-reals") endif () # Tell Intel compiler to do arithmetic accurately. This is needed to # stop the compiler from ignoring parentheses in expressions like # (a + b) + c and from simplifying 0.0 + x to x (which is wrong if # x = -0.0). if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") if (MSVC) set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /fp:precise /Qdiag-disable:11074,11076") set (CMAKE_Fortan_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model precise -diag-disable=11074,11076") endif () endif () if (CONVERT_WARNINGS_TO_ERRORS) if (MSVC) set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} /WX") else () set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Werror") endif () endif () set (TOOLS geoddirect geodinverse planimeter geodtest) foreach (TOOL ${TOOLS}) add_executable (${TOOL} ${TOOL}.for geodesic.for geodesic.inc) endforeach () # Work alikes for NGS geodesic tools. This uses legacy code from NGS # and so they trigger multiple errors and warnings if compiled with the # compile flags above. add_executable (ngsforward ngsforward.for ngscommon.for geodesic.for) add_executable (ngsinverse ngsinverse.for ngscommon.for geodesic.for) # Turn on testing enable_testing () # Run the test suite add_test (NAME geodtest COMMAND geodtest) GeographicLib-1.52/legacy/Fortran/geoddirect.for0000644000771000077100000000162714064202371021523 0ustar ckarneyckarney*> @file geoddirect.for *! @brief A test program for direct() *> A simple program to solve the direct geodesic problem. *! *! This program reads in lines with lat1, lon1, azi1, s12 and prints out *! lines with lat2, lon2, azi2 (for the WGS84 ellipsoid). program geoddirect implicit none include 'geodesic.inc' double precision a, f, lat1, lon1, azi1, lat2, lon2, azi2, s12, + dummy1, dummy2, dummy3, dummy4, dummy5 integer flags, omask * WGS84 values a = 6378137d0 f = 1/298.257223563d0 flags = 0 omask = 0 10 continue read(*, *, end=90, err=90) lat1, lon1, azi1, s12 call direct(a, f, lat1, lon1, azi1, s12, flags, + lat2, lon2, azi2, omask, + dummy1, dummy2, dummy3, dummy4, dummy5) print 20, lat2, lon2, azi2 20 format(1x, f20.15, 1x, f20.15, 1x, f20.15) go to 10 90 continue stop end GeographicLib-1.52/legacy/Fortran/geodesic.for0000644000771000077100000021571514064202371021201 0ustar ckarneyckarney* The subroutines in this files are documented at * https://geographiclib.sourceforge.io/html/Fortran/ * *> @file geodesic.for *! @brief Implementation of geodesic routines in Fortran *! *! This is a Fortran implementation of the geodesic algorithms described *! in *! - C. F. F. Karney, *! *! Algorithms for geodesics, *! J. Geodesy 87, 43--55 (2013); *! DOI: *! 10.1007/s00190-012-0578-z; *! addenda: *! geod-addenda.html. *! . *! The principal advantages of these algorithms over previous ones *! (e.g., Vincenty, 1975) are *! - accurate to round off for |f| < 1/50; *! - the solution of the inverse problem is always found; *! - differential and integral properties of geodesics are computed. *! *! The shortest path between two points on the 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 forward azimuths *! \e azi1 and \e azi2 at the two end points. *! *! Traditionally two geodesic problems are considered: *! - the direct problem -- given \e lat1, \e lon1, \e s12, and \e azi1, *! determine \e lat2, \e lon2, and \e azi2. This is solved by the *! subroutine direct(). *! - the inverse problem -- given \e lat1, \e lon1, \e lat2, \e lon2, *! determine \e s12, \e azi1, and \e azi2. This is solved by the *! subroutine invers(). *! *! The ellipsoid is specified by its equatorial radius \e a (typically *! in meters) and flattening \e f. The routines are accurate to round *! off with double precision arithmetic provided that |f| < *! 1/50; for the WGS84 ellipsoid, the errors are less than 15 *! nanometers. (Reasonably accurate results are obtained for |f| *! < 1/5.) For a prolate ellipsoid, specify \e f < 0. *! *! The routines also calculate several other quantities of interest *! - \e SS12 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 geodesic quadrilateral with corners (\e lat1,\e lon1), (0,\e *! lon1), (0,\e lon2), and (\e lat2,\e lon2). *! - \e m12, the reduced length of the geodesic is defined such that if *! the initial azimuth is perturbed by \e dazi1 (radians) then the *! second point is displaced by \e m12 \e dazi1 in the direction *! perpendicular to the geodesic. 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. *! - \e MM12 and \e MM21 are geodesic scales. If two geodesics are *! parallel at point 1 and separated by a small distance \e dt, then *! they are separated by a distance \e MM12 \e dt at point 2. \e MM21 *! is defined similarly (with the geodesics being parallel to one *! another at point 2). On a flat surface, we have \e MM12 = \e MM21 *! = 1. *! - \e a12 is the arc length on the auxiliary sphere. This is a *! construct for converting the problem to one in spherical *! trigonometry. \e a12 is measured in degrees. The spherical arc *! length from one equator crossing to the next is always 180°. *! *! If points 1, 2, and 3 lie on a single geodesic, then the following *! addition rules hold: *! - \e s13 = \e s12 + \e s23 *! - \e a13 = \e a12 + \e a23 *! - \e SS13 = \e SS12 + \e SS23 *! - \e m13 = \e m12 \e MM23 + \e m23 \e MM21 *! - \e MM13 = \e MM12 \e MM23 − (1 − \e MM12 \e MM21) \e *! m23 / \e m12 *! - \e MM31 = \e MM32 \e MM21 − (1 − \e MM23 \e MM32) \e *! m12 / \e m23 *! *! The shortest distance returned by the solution of the inverse problem *! is (obviously) uniquely defined. However, in a few special cases *! there are multiple azimuths which yield the same shortest distance. *! Here is a catalog of those cases: *! - \e lat1 = −\e lat2 (with neither point at a pole). If \e *! azi1 = \e azi2, the geodesic is unique. Otherwise there are two *! geodesics and the second one is obtained by setting [\e azi1, \e *! azi2] → [\e azi2, \e azi1], [\e MM12, \e MM21] → [\e *! MM21, \e MM12], \e SS12 → −\e SS12. (This occurs when *! the longitude difference is near ±180° for oblate *! ellipsoids.) *! - \e lon2 = \e lon1 ± 180° (with neither point at a pole). *! If \e azi1 = 0° or ±180°, the geodesic is unique. *! Otherwise there are two geodesics and the second one is obtained by *! setting [\e azi1, \e azi2] → [−\e azi1, −\e azi2], *! \e SS12 → −\e SS12. (This occurs when \e lat2 is near *! −\e lat1 for prolate ellipsoids.) *! - Points 1 and 2 at opposite poles. There are infinitely many *! geodesics which can be generated by setting [\e azi1, \e azi2] *! → [\e azi1, \e azi2] + [\e d, −\e d], for arbitrary \e *! d. (For spheres, this prescription applies when points 1 and 2 are *! antipodal.) *! - \e s12 = 0 (coincident points). There are infinitely many *! geodesics which can be generated by setting [\e azi1, \e azi2] *! → [\e azi1, \e azi2] + [\e d, \e d], for arbitrary \e d. *! *! These routines are a simple transcription of the corresponding C++ *! classes in *! GeographicLib. Because of the limitations of Fortran 77, the *! classes have been replaced by simple subroutines with no attempt to *! save "state" across subroutine calls. Most of the internal comments *! have been retained. However, in the process of transcription some *! documentation has been lost and the documentation for the C++ *! classes, GeographicLib::Geodesic, GeographicLib::GeodesicLine, and *! GeographicLib::PolygonAreaT, should be consulted. The C++ code *! remains the "reference implementation". Think twice about *! restructuring the internals of the Fortran code since this may make *! porting fixes from the C++ code more difficult. *! *! Copyright (c) Charles Karney (2012-2021) and *! licensed under the MIT/X11 License. For more information, see *! https://geographiclib.sourceforge.io/ *! *! This library was distributed with *! GeographicLib 1.52. *> Solve the direct geodesic problem *! *! @param[in] a the equatorial radius (meters). *! @param[in] f the flattening of the ellipsoid. Setting \e f = 0 gives *! a sphere. Negative \e f gives a prolate ellipsoid. *! @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] s12a12 if \e arcmode is not set, this is the distance *! from point 1 to point 2 (meters); otherwise it is the arc *! length from point 1 to point 2 (degrees); it can be negative. *! @param[in] flags a bitor'ed combination of the \e arcmode and \e *! unroll flags. *! @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[in] omask a bitor'ed combination of mask values *! specifying which of the following parameters should be set. *! @param[out] a12s12 if \e arcmode is not set, this is the arc length *! from point 1 to point 2 (degrees); otherwise it is the distance *! from point 1 to point 2 (meters). *! @param[out] m12 reduced length of geodesic (meters). *! @param[out] MM12 geodesic scale of point 2 relative to point 1 *! (dimensionless). *! @param[out] MM21 geodesic scale of point 1 relative to point 2 *! (dimensionless). *! @param[out] SS12 area under the geodesic (meters2). *! *! \e flags is an integer in [0, 4) whose binary bits are interpreted *! as follows *! - 1 the \e arcmode flag *! - 2 the \e unroll flag *! . *! If \e arcmode is not set, \e s12a12 is \e s12 and \e a12s12 is \e *! a12; otherwise, \e s12a12 is \e a12 and \e a12s12 is \e s12. It \e *! unroll is not set, the value \e lon2 returned is in the range *! [−180°, 180°]; if unroll is set, the longitude variable *! is "unrolled" so that \e lon2 − \e lon1 indicates how many *! times and in what sense the geodesic encircles the ellipsoid. *! *! \e omask is an integer in [0, 16) whose binary bits are interpreted *! as follows *! - 1 return \e a12 *! - 2 return \e m12 *! - 4 return \e MM12 and \e MM21 *! - 8 return \e SS12 *! *! \e lat1 should be in the range [−90°, 90°]. The value *! \e azi2 returned is in the range [−180°, 180°]. *! *! If either point is at a pole, the azimuth is defined by keeping the *! longitude fixed, writing \e lat = \e lat = ±(90° − *! ε), and taking the limit ε → 0+. An arc length *! greater that 180° 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°.) *! *! Example of use: *! \include geoddirect.for subroutine direct(a, f, lat1, lon1, azi1, s12a12, flags, + lat2, lon2, azi2, omask, a12s12, m12, MM12, MM21, SS12) * input double precision a, f, lat1, lon1, azi1, s12a12 integer flags, omask * output double precision lat2, lon2, azi2 * optional output double precision a12s12, m12, MM12, MM21, SS12 integer ord, nC1, nC1p, nC2, nA3, nA3x, nC3, nC3x, nC4, nC4x parameter (ord = 6, nC1 = ord, nC1p = ord, + nC2 = ord, nA3 = ord, nA3x = nA3, + nC3 = ord, nC3x = (nC3 * (nC3 - 1)) / 2, + nC4 = ord, nC4x = (nC4 * (nC4 + 1)) / 2) double precision A3x(0:nA3x-1), C3x(0:nC3x-1), C4x(0:nC4x-1), + C1a(nC1), C1pa(nC1p), C2a(nC2), C3a(nC3-1), C4a(0:nC4-1) double precision atanhx, hypotx, + AngNm, AngRnd, TrgSum, A1m1f, A2m1f, A3f, atn2dx, LatFix logical arcmod, unroll, arcp, redlp, scalp, areap double precision e2, f1, ep2, n, b, c2, + salp0, calp0, k2, eps, + salp1, calp1, ssig1, csig1, cbet1, sbet1, dn1, somg1, comg1, + salp2, calp2, ssig2, csig2, sbet2, cbet2, dn2, somg2, comg2, + ssig12, csig12, salp12, calp12, omg12, lam12, lon12, + sig12, stau1, ctau1, tau12, t, s, c, serr, E, + A1m1, A2m1, A3c, A4, AB1, AB2, + B11, B12, B21, B22, B31, B41, B42, J12 double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init if (.not.init) call geoini e2 = f * (2 - f) ep2 = e2 / (1 - e2) f1 = 1 - f n = f / (2 - f) b = a * f1 c2 = 0 arcmod = mod(flags/1, 2) .eq. 1 unroll = mod(flags/2, 2) .eq. 1 arcp = mod(omask/1, 2) .eq. 1 redlp = mod(omask/2, 2) .eq. 1 scalp = mod(omask/4, 2) .eq. 1 areap = mod(omask/8, 2) .eq. 1 if (areap) then if (e2 .eq. 0) then c2 = a**2 else if (e2 .gt. 0) then c2 = (a**2 + b**2 * atanhx(sqrt(e2)) / sqrt(e2)) / 2 else c2 = (a**2 + b**2 * atan(sqrt(abs(e2))) / sqrt(abs(e2))) / 2 end if end if call A3cof(n, A3x) call C3cof(n, C3x) if (areap) call C4cof(n, C4x) * Guard against underflow in salp0 call sncsdx(AngRnd(azi1), salp1, calp1) call sncsdx(AngRnd(LatFix(lat1)), sbet1, cbet1) sbet1 = f1 * sbet1 call norm2x(sbet1, cbet1) * Ensure cbet1 = +dbleps at poles cbet1 = max(tiny, cbet1) dn1 = sqrt(1 + ep2 * sbet1**2) * Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), * alp0 in [0, pi/2 - |bet1|] salp0 = salp1 * cbet1 * Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following * is slightly better (consider the case salp1 = 0). calp0 = hypotx(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 = +dbleps. * With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi. ssig1 = sbet1 somg1 = salp0 * sbet1 if (sbet1 .ne. 0 .or. calp1 .ne. 0) then csig1 = cbet1 * calp1 else csig1 = 1 end if comg1 = csig1 * sig1 in (-pi, pi] call norm2x(ssig1, csig1) * norm2x(somg1, comg1); -- don't need to normalize! k2 = calp0**2 * ep2 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2) A1m1 = A1m1f(eps) call C1f(eps, C1a) B11 = TrgSum(.true., ssig1, csig1, C1a, nC1) 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 = -TrgSum(true, stau1, ctau1, C1pa, nC1p) if (.not. arcmod) call C1pf(eps, C1pa) if (redlp .or. scalp) then A2m1 = A2m1f(eps) call C2f(eps, C2a) B21 = TrgSum(.true., ssig1, csig1, C2a, nC2) else * Suppress bogus warnings about unitialized variables A2m1 = 0 B21 = 0 end if call C3f(eps, C3x, C3a) A3c = -f * salp0 * A3f(eps, A3x) B31 = TrgSum(.true., ssig1, csig1, C3a, nC3-1) if (areap) then call C4f(eps, C4x, C4a) * Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) A4 = a**2 * calp0 * salp0 * e2 B41 = TrgSum(.false., ssig1, csig1, C4a, nC4) else * Suppress bogus warnings about unitialized variables A4 = 0 B41 = 0 end if if (arcmod) then * Interpret s12a12 as spherical arc length sig12 = s12a12 * degree call sncsdx(s12a12, ssig12, csig12) * Suppress bogus warnings about unitialized variables B12 = 0 else * Interpret s12a12 as distance tau12 = s12a12 / (b * (1 + A1m1)) s = sin(tau12) c = cos(tau12) * tau2 = tau1 + tau12 B12 = - TrgSum(.true., + stau1 * c + ctau1 * s, ctau1 * c - stau1 * s, C1pa, nC1p) sig12 = tau12 - (B12 - B11) ssig12 = sin(sig12) csig12 = cos(sig12) if (abs(f) .gt. 0.01d0) then * Reverted distance series is inaccurate for |f| > 1/100, so correct * sig12 with 1 Newton iteration. The following table shows the * approximate maximum error for a = WGS_a() and various f relative to * GeodesicExact. * erri = the error in the inverse solution (nm) * errd = the error in the direct solution (series only) (nm) * errda = the error in the direct solution (series + 1 Newton) (nm) * * f erri errd errda * -1/5 12e6 1.2e9 69e6 * -1/10 123e3 12e6 765e3 * -1/20 1110 108e3 7155 * -1/50 18.63 200.9 27.12 * -1/100 18.63 23.78 23.37 * -1/150 18.63 21.05 20.26 * 1/150 22.35 24.73 25.83 * 1/100 22.35 25.03 25.31 * 1/50 29.80 231.9 30.44 * 1/20 5376 146e3 10e3 * 1/10 829e3 22e6 1.5e6 * 1/5 157e6 3.8e9 280e6 ssig2 = ssig1 * csig12 + csig1 * ssig12 csig2 = csig1 * csig12 - ssig1 * ssig12 B12 = TrgSum(.true., ssig2, csig2, C1a, nC1) serr = (1 + A1m1) * (sig12 + (B12 - B11)) - s12a12 / b sig12 = sig12 - serr / sqrt(1 + k2 * ssig2**2) ssig12 = sin(sig12) csig12 = cos(sig12) * Update B12 below end if end if * sig2 = sig1 + sig12 ssig2 = ssig1 * csig12 + csig1 * ssig12 csig2 = csig1 * csig12 - ssig1 * ssig12 dn2 = sqrt(1 + k2 * ssig2**2) if (arcmod .or. abs(f) .gt. 0.01d0) + B12 = TrgSum(.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 = hypotx(salp0, calp0 * csig2) if (cbet2 .eq. 0) then * I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case cbet2 = tiny csig2 = cbet2 end if * tan(omg2) = sin(alp0) * tan(sig2) * No need to normalize somg2 = salp0 * ssig2 comg2 = csig2 * tan(alp0) = cos(sig2)*tan(alp2) * No need to normalize salp2 = salp0 calp2 = calp0 * csig2 * East or west going? E = sign(1d0, salp0) * omg12 = omg2 - omg1 if (unroll) then omg12 = E * (sig12 + - (atan2( ssig2, csig2) - atan2( ssig1, csig1)) + + (atan2(E * somg2, comg2) - atan2(E * somg1, comg1))) else omg12 = atan2(somg2 * comg1 - comg2 * somg1, + comg2 * comg1 + somg2 * somg1) end if lam12 = omg12 + A3c * + ( sig12 + (TrgSum(.true., ssig2, csig2, C3a, nC3-1) + - B31)) lon12 = lam12 / degree if (unroll) then lon2 = lon1 + lon12 else lon2 = AngNm(AngNm(lon1) + AngNm(lon12)) end if lat2 = atn2dx(sbet2, f1 * cbet2) azi2 = atn2dx(salp2, calp2) if (redlp .or. scalp) then B22 = TrgSum(.true., ssig2, csig2, C2a, nC2) AB2 = (1 + A2m1) * (B22 - B21) J12 = (A1m1 - A2m1) * sig12 + (AB1 - AB2) end if * Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure * accurate cancellation in the case of coincident points. if (redlp) m12 = b * ((dn2 * (csig1 * ssig2) - + dn1 * (ssig1 * csig2)) - csig1 * csig2 * J12) if (scalp) then t = k2 * (ssig2 - ssig1) * (ssig2 + ssig1) / (dn1 + dn2) MM12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1 MM21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2 end if if (areap) then B42 = TrgSum(.false., ssig2, csig2, C4a, nC4) if (calp0 .eq. 0 .or. salp0 .eq. 0) then * alp12 = alp2 - alp1, used in atan2 so no need to normalize salp12 = salp2 * calp1 - calp2 * salp1 calp12 = calp2 * calp1 + salp2 * salp1 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 if (csig12 .le. 0) then salp12 = csig1 * (1 - csig12) + ssig12 * ssig1 else salp12 = ssig12 * (csig1 * ssig12 / (1 + csig12) + ssig1) end if salp12 = calp0 * salp0 * salp12 calp12 = salp0**2 + calp0**2 * csig1 * csig2 end if SS12 = c2 * atan2(salp12, calp12) + A4 * (B42 - B41) end if if (arcp) then if (arcmod) then a12s12 = b * ((1 + A1m1) * sig12 + AB1) else a12s12 = sig12 / degree end if end if return end *> Solve the inverse geodesic problem. *! *! @param[in] a the equatorial radius (meters). *! @param[in] f the flattening of the ellipsoid. Setting \e f = 0 gives *! a sphere. Negative \e f gives a prolate ellipsoid. *! @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 from point 1 to point 2 (meters). *! @param[out] azi1 azimuth at point 1 (degrees). *! @param[out] azi2 (forward) azimuth at point 2 (degrees). *! @param[in] omask a bitor'ed combination of mask values *! specifying which of the following parameters should be set. *! @param[out] a12 arc length from point 1 to point 2 (degrees). *! @param[out] m12 reduced length of geodesic (meters). *! @param[out] MM12 geodesic scale of point 2 relative to point 1 *! (dimensionless). *! @param[out] MM21 geodesic scale of point 1 relative to point 2 *! (dimensionless). *! @param[out] SS12 area under the geodesic (meters2). *! *! \e omask is an integer in [0, 16) whose binary bits are interpreted *! as follows *! - 1 return \e a12 *! - 2 return \e m12 *! - 4 return \e MM12 and \e MM21 *! - 8 return \e SS12 *! *! \e lat1 and \e lat2 should be in the range [−90°, 90°]. *! 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, writing \e lat = ±(90° − *! ε), and taking the limit ε → 0+. *! *! The solution to the inverse problem is found using Newton's method. *! If this fails to converge (this is very unlikely in geodetic *! applications but does occur for very eccentric ellipsoids), then the *! bisection method is used to refine the solution. *! *! Example of use: *! \include geodinverse.for subroutine invers(a, f, lat1, lon1, lat2, lon2, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) * input double precision a, f, lat1, lon1, lat2, lon2 integer omask * output double precision s12, azi1, azi2 * optional output double precision a12, m12, MM12, MM21, SS12 integer ord, nA3, nA3x, nC3, nC3x, nC4, nC4x, nC parameter (ord = 6, nA3 = ord, nA3x = nA3, + nC3 = ord, nC3x = (nC3 * (nC3 - 1)) / 2, + nC4 = ord, nC4x = (nC4 * (nC4 + 1)) / 2, + nC = ord) double precision A3x(0:nA3x-1), C3x(0:nC3x-1), C4x(0:nC4x-1), + Ca(nC) double precision atanhx, hypotx, + AngDif, AngRnd, TrgSum, Lam12f, InvSta, atn2dx, LatFix integer latsgn, lonsgn, swapp, numit logical arcp, redlp, scalp, areap, merid, tripn, tripb double precision e2, f1, ep2, n, b, c2, + lat1x, lat2x, salp0, calp0, k2, eps, + salp1, calp1, ssig1, csig1, cbet1, sbet1, dbet1, dn1, + salp2, calp2, ssig2, csig2, sbet2, cbet2, dbet2, dn2, + slam12, clam12, salp12, calp12, omg12, lam12, lon12, lon12s, + salp1a, calp1a, salp1b, calp1b, + dalp1, sdalp1, cdalp1, nsalp1, alp12, somg12, comg12, domg12, + sig12, v, dv, dnm, dummy, + A4, B41, B42, s12x, m12x, a12x, sdomg12, cdomg12 double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2, lmask logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init if (.not.init) call geoini f1 = 1 - f e2 = f * (2 - f) ep2 = e2 / f1**2 n = f / ( 2 - f) b = a * f1 c2 = 0 arcp = mod(omask/1, 2) .eq. 1 redlp = mod(omask/2, 2) .eq. 1 scalp = mod(omask/4, 2) .eq. 1 areap = mod(omask/8, 2) .eq. 1 if (scalp) then lmask = 16 + 2 + 4 else lmask = 16 + 2 end if if (areap) then if (e2 .eq. 0) then c2 = a**2 else if (e2 .gt. 0) then c2 = (a**2 + b**2 * atanhx(sqrt(e2)) / sqrt(e2)) / 2 else c2 = (a**2 + b**2 * atan(sqrt(abs(e2))) / sqrt(abs(e2))) / 2 end if end if call A3cof(n, A3x) call C3cof(n, C3x) if (areap) call C4cof(n, C4x) * Compute longitude difference (AngDiff does this carefully). Result is * in [-180, 180] but -180 is only for west-going geodesics. 180 is for * east-going and meridional geodesics. * If very close to being on the same half-meridian, then make it so. lon12 = AngDif(lon1, lon2, lon12s) * Make longitude difference positive. if (lon12 .ge. 0) then lonsgn = 1 else lonsgn = -1 end if lon12 = lonsgn * AngRnd(lon12) lon12s = AngRnd((180 - lon12) - lonsgn * lon12s) lam12 = lon12 * degree if (lon12 .gt. 90) then call sncsdx(lon12s, slam12, clam12) clam12 = -clam12 else call sncsdx(lon12, slam12, clam12) end if * If really close to the equator, treat as on equator. lat1x = AngRnd(LatFix(lat1)) lat2x = AngRnd(LatFix(lat2)) * Swap points so that point with higher (abs) latitude is point 1 * If one latitude is a nan, then it becomes lat1. if (abs(lat1x) .lt. abs(lat2x)) then swapp = -1 else swapp = 1 end if if (swapp .lt. 0) then lonsgn = -lonsgn call swap(lat1x, lat2x) end if * Make lat1 <= 0 if (lat1x .lt. 0) then latsgn = 1 else latsgn = -1 end if lat1x = lat1x * latsgn lat2x = lat2x * latsgn * Now we have * * 0 <= lon12 <= 180 * -90 <= lat1 <= 0 * lat1 <= lat2 <= -lat1 * * longsign, swapp, latsgn 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. call sncsdx(lat1x, sbet1, cbet1) sbet1 = f1 * sbet1 call norm2x(sbet1, cbet1) * Ensure cbet1 = +dbleps at poles cbet1 = max(tiny, cbet1) call sncsdx(lat2x, sbet2, cbet2) sbet2 = f1 * sbet2 call norm2x(sbet2, cbet2) * Ensure cbet2 = +dbleps at poles cbet2 = max(tiny, 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 .lt. -sbet1) then if (cbet2 .eq. cbet1) sbet2 = sign(sbet1, sbet2) else if (abs(sbet2) .eq. -sbet1) cbet2 = cbet1 end if dn1 = sqrt(1 + ep2 * sbet1**2) dn2 = sqrt(1 + ep2 * sbet2**2) * Suppress bogus warnings about unitialized variables a12x = 0 merid = lat1x .eq. -90 .or. slam12 .eq. 0 if (merid) then * Endpoints are on a single full meridian, so the geodesic might lie on * a meridian. * Head to the target longitude calp1 = clam12 salp1 = slam12 * At the target we're heading north calp2 = 1 salp2 = 0 * tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1 csig1 = calp1 * cbet1 ssig2 = sbet2 csig2 = calp2 * cbet2 * sig12 = sig2 - sig1 sig12 = atan2(0d0 + max(0d0, csig1 * ssig2 - ssig1 * csig2), + csig1 * csig2 + ssig1 * ssig2) call Lengs(n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, lmask, + s12x, m12x, dummy, MM12, MM21, ep2, Ca) * Add the check for sig12 since zero length geodesics might yield m12 < * 0. Test case was * * echo 20.001 0 20.001 0 | GeodSolve -i * * In fact, we will have sig12 > pi/2 for meridional geodesic which is * not a shortest path. if (sig12 .lt. 1 .or. m12x .ge. 0) then if (sig12 .lt. 3 * tiny .or. + (sig12 .lt. tol0 .and. + (s12x .lt. 0 .or. m12x .lt. 0))) then * Prevent negative s12 or m12 for short lines sig12 = 0 m12x = 0 s12x = 0 end if m12x = m12x * b s12x = s12x * b a12x = sig12 / degree else * m12 < 0, i.e., prolate and too close to anti-podal merid = .false. end if end if omg12 = 0 * somg12 > 1 marks that it needs to be calculated somg12 = 2 comg12 = 0 if (.not. merid .and. sbet1 .eq. 0 .and. + (f .le. 0 .or. lon12s .ge. f * 180)) then * Geodesic runs along equator calp1 = 0 calp2 = 0 salp1 = 1 salp2 = 1 s12x = a * lam12 sig12 = lam12 / f1 omg12 = sig12 m12x = b * sin(sig12) if (scalp) then MM12 = cos(sig12) MM21 = MM12 end if a12x = lon12 / f1 else if (.not. merid) then * 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 = InvSta(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, + slam12, clam12, f, A3x, salp1, calp1, salp2, calp2, dnm, Ca) if (sig12 .ge. 0) then * Short lines (InvSta sets salp2, calp2, dnm) s12x = sig12 * b * dnm m12x = dnm**2 * b * sin(sig12 / dnm) if (scalp) then MM12 = cos(sig12 / dnm) MM21 = MM12 end if a12x = sig12 / degree omg12 = lam12 / (f1 * dnm) else * Newton's method. This is a straightforward solution of f(alp1) = * lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one * root in the interval (0, pi) and its derivative is positive at the * root. Thus f(alp) is positive for alp > alp1 and negative for alp < * alp1. During the course of the iteration, a range (alp1a, alp1b) is * maintained which brackets the root and with each evaluation of * f(alp) the range is shrunk, if possible. Newton's method is * restarted whenever the derivative of f is negative (because the new * value of alp1 is then further from the solution) or if the new * estimate of alp1 lies outside (0,pi); in this case, the new starting * guess is taken to be (alp1a + alp1b) / 2. * Bracketing range salp1a = tiny calp1a = 1 salp1b = tiny calp1b = -1 tripn = .false. tripb = .false. do 10 numit = 0, maxit2-1 * the WGS84 test set: mean = 1.47, sd = 1.25, max = 16 * WGS84 and random input: mean = 2.85, sd = 0.60 v = Lam12f(sbet1, cbet1, dn1, sbet2, cbet2, dn2, + salp1, calp1, slam12, clam12, f, A3x, C3x, salp2, calp2, + sig12, ssig1, csig1, ssig2, csig2, + eps, domg12, numit .lt. maxit1, dv, Ca) * Reversed test to allow escape with NaNs if (tripn) then dummy = 8 else dummy = 1 end if if (tripb .or. .not. (abs(v) .ge. dummy * tol0)) + go to 20 * Update bracketing values if (v .gt. 0 .and. (numit .gt. maxit1 .or. + calp1/salp1 .gt. calp1b/salp1b)) then salp1b = salp1 calp1b = calp1 else if (v .lt. 0 .and. (numit .gt. maxit1 .or. + calp1/salp1 .lt. calp1a/salp1a)) then salp1a = salp1 calp1a = calp1 end if if (numit .lt. maxit1 .and. dv .gt. 0) then dalp1 = -v/dv sdalp1 = sin(dalp1) cdalp1 = cos(dalp1) nsalp1 = salp1 * cdalp1 + calp1 * sdalp1 if (nsalp1 .gt. 0 .and. abs(dalp1) .lt. pi) then calp1 = calp1 * cdalp1 - salp1 * sdalp1 salp1 = nsalp1 call norm2x(salp1, calp1) * In some regimes we don't get quadratic convergence because * slope -> 0. So use convergence conditions based on dbleps * instead of sqrt(dbleps). tripn = abs(v) .le. 16 * tol0 go to 10 end if end if * Either dv was not positive or updated value was outside legal * range. Use the midpoint of the bracket as the next estimate. * This mechanism is not needed for the WGS84 ellipsoid, but it does * catch problems with more eccentric ellipsoids. Its efficacy is * such for the WGS84 test set with the starting guess set to alp1 = * 90deg: * the WGS84 test set: mean = 5.21, sd = 3.93, max = 24 * WGS84 and random input: mean = 4.74, sd = 0.99 salp1 = (salp1a + salp1b)/2 calp1 = (calp1a + calp1b)/2 call norm2x(salp1, calp1) tripn = .false. tripb = abs(salp1a - salp1) + (calp1a - calp1) .lt. tolb + .or. abs(salp1 - salp1b) + (calp1 - calp1b) .lt. tolb 10 continue 20 continue call Lengs(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, lmask, + s12x, m12x, dummy, MM12, MM21, ep2, Ca) m12x = m12x * b s12x = s12x * b a12x = sig12 / degree if (areap) then sdomg12 = sin(domg12) cdomg12 = cos(domg12) somg12 = slam12 * cdomg12 - clam12 * sdomg12 comg12 = clam12 * cdomg12 + slam12 * sdomg12 end if end if end if * Convert -0 to 0 s12 = 0 + s12x if (redlp) m12 = 0 + m12x if (areap) then * From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1 calp0 = hypotx(calp1, salp1 * sbet1) if (calp0 .ne. 0 .and. salp0 .ne. 0) then * From Lambda12: tan(bet) = tan(sig) * cos(alp) ssig1 = sbet1 csig1 = calp1 * cbet1 ssig2 = sbet2 csig2 = calp2 * cbet2 k2 = calp0**2 * ep2 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2) * Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = a**2 * calp0 * salp0 * e2 call norm2x(ssig1, csig1) call norm2x(ssig2, csig2) call C4f(eps, C4x, Ca) B41 = TrgSum(.false., ssig1, csig1, Ca, nC4) B42 = TrgSum(.false., ssig2, csig2, Ca, nC4) SS12 = A4 * (B42 - B41) else * Avoid problems with indeterminate sig1, sig2 on equator SS12 = 0 end if if (.not. merid .and. somg12 .gt. 1) then somg12 = sin(omg12) comg12 = cos(omg12) end if if (.not. merid .and. comg12 .ge. 0.7071d0 + .and. sbet2 - sbet1 .lt. 1.75d0) then * 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)) domg12 = 1 + comg12 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 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 .eq. 0 .and. calp12 .lt. 0) then salp12 = tiny * calp1 calp12 = -1 end if alp12 = atan2(salp12, calp12) end if SS12 = SS12 + c2 * alp12 SS12 = SS12 * swapp * lonsgn * latsgn * Convert -0 to 0 SS12 = 0 + SS12 end if * Convert calp, salp to azimuth accounting for lonsgn, swapp, latsgn. if (swapp .lt. 0) then call swap(salp1, salp2) call swap(calp1, calp2) if (scalp) call swap(MM12, MM21) end if salp1 = salp1 * swapp * lonsgn calp1 = calp1 * swapp * latsgn salp2 = salp2 * swapp * lonsgn calp2 = calp2 * swapp * latsgn azi1 = atn2dx(salp1, calp1) azi2 = atn2dx(salp2, calp2) if (arcp) a12 = a12x return end *> Determine the area of a geodesic polygon *! *! @param[in] a the equatorial radius (meters). *! @param[in] f the flattening of the ellipsoid. Setting \e f = 0 gives *! a sphere. Negative \e f gives a prolate ellipsoid. *! @param[in] lats an array of the latitudes of the vertices (degrees). *! @param[in] lons an array of the longitudes of the vertices (degrees). *! @param[in] n the number of vertices. *! @param[out] AA the (signed) area of the polygon (meters2). *! @param[out] PP the perimeter of the polygon. *! *! \e lats should be in the range [−90°, 90°]. *! *! Arbitrarily complex polygons are allowed. In the case of *! self-intersecting polygons the area is accumulated "algebraically", *! e.g., the areas of the 2 loops in a figure-8 polygon will partially *! cancel. There's no need to "close" the polygon by repeating the *! first vertex. The area returned is signed with counter-clockwise *! traversal being treated as positive. subroutine area(a, f, lats, lons, n, AA, PP) * input integer n double precision a, f, lats(n), lons(n) * output double precision AA, PP integer i, omask, cross, trnsit double precision s12, azi1, azi2, dummy, SS12, b, e2, c2, area0, + atanhx, Aacc(2), Pacc(2) double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init omask = 8 call accini(Aacc) call accini(Pacc) cross = 0 do 10 i = 0, n-1 call invers(a, f, lats(i+1), lons(i+1), + lats(mod(i+1,n)+1), lons(mod(i+1,n)+1), + s12, azi1, azi2, omask, dummy, dummy, dummy, dummy, SS12) call accadd(Pacc, s12) call accadd(Aacc, -SS12) cross = cross + trnsit(lons(i+1), lons(mod(i+1,n)+1)) 10 continue PP = Pacc(1) b = a * (1 - f) e2 = f * (2 - f) if (e2 .eq. 0) then c2 = a**2 else if (e2 .gt. 0) then c2 = (a**2 + b**2 * atanhx(sqrt(e2)) / sqrt(e2)) / 2 else c2 = (a**2 + b**2 * atan(sqrt(abs(e2))) / sqrt(abs(e2))) / 2 end if area0 = 4 * pi * c2 call accrem(Aacc, area0) if (mod(abs(cross), 2) .eq. 1) then if (Aacc(1) .lt. 0) then call accadd(Aacc, +area0/2) else call accadd(Aacc, -area0/2) end if end if if (Aacc(1) .gt. area0/2) then call accadd(Aacc, -area0) else if (Aacc(1) .le. -area0/2) then call accadd(Aacc, +area0) end if AA = Aacc(1) return end *> Return the version numbers for this package. *! *! @param[out] major the major version number. *! @param[out] minor the minor version number. *! @param[out] patch the patch number. *! *! This subroutine was added with version 1.44. subroutine geover(major, minor, patch) * output integer major, minor, patch major = 1 minor = 52 patch = 0 return end *> @cond SKIP block data geodat double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init data init /.false./ common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init end subroutine geoini double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init digits = 53 dblmin = 0.5d0**1022 dbleps = 0.5d0**(digits-1) pi = atan2(0d0, -1d0) degree = pi/180 * This is about cbrt(dblmin). With other implementations, sqrt(dblmin) * is used. The larger value is used here to avoid complaints about a * IEEE_UNDERFLOW_FLAG IEEE_DENORMAL signal. This is triggered when * invers is called with points at opposite poles. tiny = 0.5d0**((1022+1)/3) tol0 = dbleps * 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) tol1 = 200 * tol0 tol2 = sqrt(tol0) * Check on bisection interval tolb = tol0 * tol2 xthrsh = 1000 * tol2 maxit1 = 20 maxit2 = maxit1 + digits + 10 init = .true. return end subroutine Lengs(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, omask, + s12b, m12b, m0, MM12, MM21, ep2, Ca) * input double precision eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, ep2 integer omask * optional output double precision s12b, m12b, m0, MM12, MM21 * temporary storage double precision Ca(*) integer ord, nC1, nC2 parameter (ord = 6, nC1 = ord, nC2 = ord) double precision A1m1f, A2m1f, TrgSum double precision m0x, J12, A1, A2, B1, B2, csig12, t, Cb(nC2) logical distp, redlp, scalp integer l * Return m12b = (reduced length)/b; also calculate s12b = distance/b, * and m0 = coefficient of secular term in expression for reduced length. distp = (mod(omask/16, 2) .eq. 1) redlp = (mod(omask/2, 2) .eq. 1) scalp = (mod(omask/4, 2) .eq. 1) * Suppress compiler warnings m0x = 0 J12 = 0 A1 = 0 A2 = 0 if (distp .or. redlp .or. scalp) then A1 = A1m1f(eps) call C1f(eps, Ca) if (redlp .or. scalp) then A2 = A2m1f(eps) call C2f(eps, Cb) m0x = A1 - A2 A2 = 1 + A2 end if A1 = 1 + A1 end if if (distp) then B1 = TrgSum(.true., ssig2, csig2, Ca, nC1) - + TrgSum(.true., ssig1, csig1, Ca, nC1) * Missing a factor of b s12b = A1 * (sig12 + B1) if (redlp .or. scalp) then B2 = Trgsum(.true., ssig2, csig2, Cb, nC2) - + TrgSum(.true., ssig1, csig1, Cb, nC2) J12 = m0x * sig12 + (A1 * B1 - A2 * B2) end if else if (redlp .or. scalp) then * Assume here that nC1 >= nC2 do 10 l = 1, nC2 Cb(l) = A1 * Ca(l) - A2 * Cb(l) 10 continue J12 = m0x * sig12 + (TrgSum(.true., ssig2, csig2, Cb, nC2) - + TrgSum(.true., ssig1, csig1, Cb, nC2)) end if if (redlp) then m0 = m0x * Missing a factor of b. * Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure * accurate cancellation in the case of coincident points. m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - + csig1 * csig2 * J12 end if if (scalp) then csig12 = csig1 * csig2 + ssig1 * ssig2 t = ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2) MM12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1 MM21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2 end if return end double precision function Astrd(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. * input double precision x, y double precision cbrt double precision k, p, q, r, S, r2, r3, disc, u, + T3, T, ang, v, uv, w p = x**2 q = y**2 r = (p + q - 1) / 6 if ( .not. (q .eq. 0 .and. r .lt. 0) ) then * Avoid possible division by zero when r = 0 by multiplying equations * for s and t by r^3 and r, resp. * S = r^3 * s S = p * q / 4 r2 = r**2 r3 = r * r2 * The discriminant 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 .ge. 0) then 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 = (r * t)^3 if (T3 .lt. 0) then disc = -sqrt(disc) else disc = sqrt(disc) end if T3 = T3 + disc * N.B. cbrt always returns the real root. cbrt(-8) = -2. * T = r * t T = cbrt(T3) * T can be zero; but then r2 / T -> 0. if (T .ne. 0) u = u + T + r2 / T else * T is complex, but the way u is defined the result is 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 = u + 2 * r * cos(ang / 3) end if * guaranteed positive v = sqrt(u**2 + q) * Avoid loss of accuracy when u < 0. * u+v, guaranteed positive if (u .lt. 0) then uv = q / (v - u) else uv = u + v end if * positive? w = (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. * guaranteed positive k = uv / (sqrt(uv + w**2) + w) 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 end if Astrd = k return end double precision function InvSta(sbet1, cbet1, dn1, + sbet2, cbet2, dn2, lam12, slam12, clam12, f, A3x, + salp1, calp1, salp2, calp2, dnm, + Ca) * 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, calp2, and dnm and function value is sig12. * input double precision sbet1, cbet1, dn1, sbet2, cbet2, dn2, + lam12, slam12, clam12, f, A3x(*) * output double precision salp1, calp1, salp2, calp2, dnm * temporary double precision Ca(*) double precision hypotx, A3f, Astrd logical shortp double precision f1, e2, ep2, n, etol2, k2, eps, sig12, + sbet12, cbet12, sbt12a, omg12, somg12, comg12, ssig12, csig12, + x, y, lamscl, betscl, cbt12a, bt12a, m12b, m0, dummy, + k, omg12a, sbetm2, lam12x double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init f1 = 1 - f e2 = f * (2 - f) ep2 = e2 / (1 - e2) n = f / (2 - f) * The sig12 threshold for "really short". Using the auxiliary sphere * solution with dnm computed at (bet1 + bet2) / 2, the relative error in * the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. * (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a * given f and sig12, the max error occurs for lines near the pole. If * the old rule for computing dnm = (dn1 + dn2)/2 is used, then the error * increases by a factor of 2.) Setting this equal to epsilon gives * sig12 = etol2. Here 0.1 is a safety factor (error decreased by 100) * and max(0.001, abs(f)) stops etol2 getting too large in the nearly * spherical case. etol2 = 0.1d0 * tol2 / + sqrt( max(0.001d0, abs(f)) * min(1d0, 1 - f/2) / 2 ) * Return value sig12 = -1 * bet12 = bet2 - bet1 in [0, pi); bt12a = bet2 + bet1 in (-pi, 0] sbet12 = sbet2 * cbet1 - cbet2 * sbet1 cbet12 = cbet2 * cbet1 + sbet2 * sbet1 sbt12a = sbet2 * cbet1 + cbet2 * sbet1 shortp = cbet12 .ge. 0 .and. sbet12 .lt. 0.5d0 .and. + cbet2 * lam12 .lt. 0.5d0 if (shortp) then sbetm2 = (sbet1 + sbet2)**2 * sin((bet1+bet2)/2)^2 * = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) sbetm2 = sbetm2 / (sbetm2 + (cbet1 + cbet2)**2) dnm = sqrt(1 + ep2 * sbetm2) omg12 = lam12 / (f1 * dnm) somg12 = sin(omg12) comg12 = cos(omg12) else somg12 = slam12 comg12 = clam12 end if salp1 = cbet2 * somg12 if (comg12 .ge. 0) then calp1 = sbet12 + cbet2 * sbet1 * somg12**2 / (1 + comg12) else calp1 = sbt12a - cbet2 * sbet1 * somg12**2 / (1 - comg12) end if ssig12 = hypotx(salp1, calp1) csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12 if (shortp .and. ssig12 .lt. etol2) then * really short lines salp2 = cbet1 * somg12 if (comg12 .ge. 0) then calp2 = somg12**2 / (1 + comg12) else calp2 = 1 - comg12 end if calp2 = sbet12 - cbet1 * sbet2 * calp2 call norm2x(salp2, calp2) * Set return value sig12 = atan2(ssig12, csig12) else if (abs(n) .gt. 0.1d0 .or. csig12 .ge. 0 .or. + ssig12 .ge. 6 * abs(n) * pi * cbet1**2) then * Nothing to do, zeroth order spherical approximation is OK continue else * lam12 - pi lam12x = atan2(-slam12, -clam12) * Scale lam12 and bet2 to x, y coordinate system where antipodal point * is at origin and singular point is at y = 0, x = -1. if (f .ge. 0) then * x = dlong, y = dlat k2 = sbet1**2 * ep2 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2) lamscl = f * cbet1 * A3f(eps, A3x) * pi betscl = lamscl * cbet1 x = lam12x / lamscl y = sbt12a / betscl else * f < 0: x = dlat, y = dlong cbt12a = cbet2 * cbet1 - sbet2 * sbet1 bt12a = atan2(sbt12a, cbt12a) * In the case of lon12 = 180, this repeats a calculation made in * Inverse. call Lengs(n, pi + bt12a, + sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, 2, + dummy, m12b, m0, dummy, dummy, ep2, Ca) x = -1 + m12b / (cbet1 * cbet2 * m0 * pi) if (x .lt. -0.01d0) then betscl = sbt12a / x else betscl = -f * cbet1**2 * pi end if lamscl = betscl / cbet1 y = lam12x / lamscl end if if (y .gt. -tol1 .and. x .gt. -1 - xthrsh) then * strip near cut if (f .ge. 0) then salp1 = min(1d0, -x) calp1 = - sqrt(1 - salp1**2) else if (x .gt. -tol1) then calp1 = 0 else calp1 = 1 end if calp1 = max(calp1, x) salp1 = sqrt(1 - calp1**2) end if 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 = Astrd(x, y) if (f .ge. 0) then omg12a = -x * k/(1 + k) else omg12a = -y * (1 + k)/k end if omg12a = lamscl * omg12a somg12 = sin(omg12a) comg12 = -cos(omg12a) * Update spherical estimate of alp1 using omg12 instead of lam12 salp1 = cbet2 * somg12 calp1 = sbt12a - cbet2 * sbet1 * somg12**2 / (1 - comg12) end if end if * Sanity check on starting guess. Backwards check allows NaN through. if (.not. (salp1 .le. 0)) then call norm2x(salp1, calp1) else salp1 = 1 calp1 = 0 end if InvSta = sig12 return end double precision function Lam12f(sbet1, cbet1, dn1, + sbet2, cbet2, dn2, salp1, calp1, slm120, clm120, f, A3x, C3x, + salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, + domg12, diffp, dlam12, Ca) * input double precision sbet1, cbet1, dn1, sbet2, cbet2, dn2, + salp1, calp1, slm120, clm120, f, A3x(*), C3x(*) logical diffp * output double precision salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, + eps, domg12 * optional output double precision dlam12 * temporary double precision Ca(*) integer ord, nC3 parameter (ord = 6, nC3 = ord) double precision hypotx, A3f, TrgSum double precision f1, e2, ep2, salp0, calp0, + somg1, comg1, somg2, comg2, somg12, comg12, + lam12, eta, B312, k2, dummy double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init f1 = 1 - f e2 = f * (2 - f) ep2 = e2 / (1 - e2) * Break degeneracy of equatorial line. This case has already been * handled. if (sbet1 .eq. 0 .and. calp1 .eq. 0) calp1 = -tiny * sin(alp1) * cos(bet1) = sin(alp0) salp0 = salp1 * cbet1 * calp0 > 0 calp0 = hypotx(calp1, salp1 * sbet1) * tan(bet1) = tan(sig1) * cos(alp1) * tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1) ssig1 = sbet1 somg1 = salp0 * sbet1 csig1 = calp1 * cbet1 comg1 = csig1 call norm2x(ssig1, csig1) * norm2x(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) if (cbet2 .ne. cbet1) then salp2 = salp0 / cbet2 else salp2 = salp1 end if * 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]). if (cbet2 .ne. cbet1 .or. abs(sbet2) .ne. -sbet1) then if (cbet1 .lt. -sbet1) then calp2 = (cbet2 - cbet1) * (cbet1 + cbet2) else calp2 = (sbet1 - sbet2) * (sbet1 + sbet2) end if calp2 = sqrt((calp1 * cbet1)**2 + calp2) / cbet2 else calp2 = abs(calp1) end if * tan(bet2) = tan(sig2) * cos(alp2) * tan(omg2) = sin(alp0) * tan(sig2). ssig2 = sbet2 somg2 = salp0 * sbet2 csig2 = calp2 * cbet2 comg2 = csig2 call norm2x(ssig2, csig2) * norm2x(somg2, comg2); -- don't need to normalize! * sig12 = sig2 - sig1, limit to [0, pi] sig12 = atan2(0d0 + max(0d0, csig1 * ssig2 - ssig1 * csig2), + csig1 * csig2 + ssig1 * ssig2) * omg12 = omg2 - omg1, limit to [0, pi] somg12 = 0d0 + max(0d0, comg1 * somg2 - somg1 * comg2) comg12 = comg1 * comg2 + somg1 * somg2 * eta = omg12 - lam120 eta = atan2(somg12 * clm120 - comg12 * slm120, + comg12 * clm120 + somg12 * slm120) k2 = calp0**2 * ep2 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2) call C3f(eps, C3x, Ca) B312 = (TrgSum(.true., ssig2, csig2, Ca, nC3-1) - + TrgSum(.true., ssig1, csig1, Ca, nC3-1)) domg12 = -f * A3f(eps, A3x) * salp0 * (sig12 + B312) lam12 = eta + domg12 if (diffp) then if (calp2 .eq. 0) then dlam12 = - 2 * f1 * dn1 / sbet1 else call Lengs(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, + cbet1, cbet2, 2, + dummy, dlam12, dummy, dummy, dummy, ep2, Ca) dlam12 = dlam12 * f1 / (calp2 * cbet2) end if end if Lam12f = lam12 return end double precision function A3f(eps, A3x) * Evaluate A3 integer ord, nA3, nA3x parameter (ord = 6, nA3 = ord, nA3x = nA3) * input double precision eps * output double precision A3x(0: nA3x-1) double precision polval A3f = polval(nA3 - 1, A3x, eps) return end subroutine C3f(eps, C3x, c) * Evaluate C3 coeffs * Elements c[1] thru c[nC3-1] are set integer ord, nC3, nC3x parameter (ord = 6, nC3 = ord, nC3x = (nC3 * (nC3 - 1)) / 2) * input double precision eps, C3x(0:nC3x-1) * output double precision c(nC3-1) integer o, m, l double precision mult, polval mult = 1 o = 0 do 10 l = 1, nC3 - 1 m = nC3 - l - 1 mult = mult * eps c(l) = mult * polval(m, C3x(o), eps) o = o + m + 1 10 continue return end subroutine C4f(eps, C4x, c) * Evaluate C4 * Elements c[0] thru c[nC4-1] are set integer ord, nC4, nC4x parameter (ord = 6, nC4 = ord, nC4x = (nC4 * (nC4 + 1)) / 2) * input double precision eps, C4x(0:nC4x-1) *output double precision c(0:nC4-1) integer o, m, l double precision mult, polval mult = 1 o = 0 do 10 l = 0, nC4 - 1 m = nC4 - l - 1 c(l) = mult * polval(m, C4x(o), eps) o = o + m + 1 mult = mult * eps 10 continue return end double precision function A1m1f(eps) * The scale factor A1-1 = mean value of (d/dsigma)I1 - 1 * input double precision eps double precision t integer ord, nA1, o, m parameter (ord = 6, nA1 = ord) double precision polval, coeff(nA1/2 + 2) data coeff /1, 4, 64, 0, 256/ o = 1 m = nA1/2 t = polval(m, coeff(o), eps**2) / coeff(o + m + 1) A1m1f = (t + eps) / (1 - eps) return end subroutine C1f(eps, c) * The coefficients C1[l] in the Fourier expansion of B1 integer ord, nC1 parameter (ord = 6, nC1 = ord) * input double precision eps * output double precision c(nC1) double precision eps2, d integer o, m, l double precision polval, coeff((nC1**2 + 7*nC1 - 2*(nC1/2))/4) data coeff / + -1, 6, -16, 32, + -9, 64, -128, 2048, + 9, -16, 768, + 3, -5, 512, + -7, 1280, + -7, 2048/ eps2 = eps**2 d = eps o = 1 do 10 l = 1, nC1 m = (nC1 - l) / 2 c(l) = d * polval(m, coeff(o), eps2) / coeff(o + m + 1) o = o + m + 2 d = d * eps 10 continue return end subroutine C1pf(eps, c) * The coefficients C1p[l] in the Fourier expansion of B1p integer ord, nC1p parameter (ord = 6, nC1p = ord) * input double precision eps * output double precision c(nC1p) double precision eps2, d integer o, m, l double precision polval, coeff((nC1p**2 + 7*nC1p - 2*(nC1p/2))/4) data coeff / + 205, -432, 768, 1536, + 4005, -4736, 3840, 12288, + -225, 116, 384, + -7173, 2695, 7680, + 3467, 7680, + 38081, 61440/ eps2 = eps**2 d = eps o = 1 do 10 l = 1, nC1p m = (nC1p - l) / 2 c(l) = d * polval(m, coeff(o), eps2) / coeff(o + m + 1) o = o + m + 2 d = d * eps 10 continue return end * The scale factor A2-1 = mean value of (d/dsigma)I2 - 1 double precision function A2m1f(eps) * input double precision eps double precision t integer ord, nA2, o, m parameter (ord = 6, nA2 = ord) double precision polval, coeff(nA2/2 + 2) data coeff /-11, -28, -192, 0, 256/ o = 1 m = nA2/2 t = polval(m, coeff(o), eps**2) / coeff(o + m + 1) A2m1f = (t - eps) / (1 + eps) return end subroutine C2f(eps, c) * The coefficients C2[l] in the Fourier expansion of B2 integer ord, nC2 parameter (ord = 6, nC2 = ord) * input double precision eps * output double precision c(nC2) double precision eps2, d integer o, m, l double precision polval, coeff((nC2**2 + 7*nC2 - 2*(nC2/2))/4) data coeff / + 1, 2, 16, 32, + 35, 64, 384, 2048, + 15, 80, 768, + 7, 35, 512, + 63, 1280, + 77, 2048/ eps2 = eps**2 d = eps o = 1 do 10 l = 1, nC2 m = (nC2 - l) / 2 c(l) = d * polval(m, coeff(o), eps2) / coeff(o + m + 1) o = o + m + 2 d = d * eps 10 continue return end subroutine A3cof(n, A3x) * The scale factor A3 = mean value of (d/dsigma)I3 integer ord, nA3, nA3x parameter (ord = 6, nA3 = ord, nA3x = nA3) * input double precision n * output double precision A3x(0:nA3x-1) integer o, m, k, j double precision polval, coeff((nA3**2 + 7*nA3 - 2*(nA3/2))/4) data coeff / + -3, 128, + -2, -3, 64, + -1, -3, -1, 16, + 3, -1, -2, 8, + 1, -1, 2, + 1, 1/ o = 1 k = 0 do 10 j = nA3 - 1, 0, -1 m = min(nA3 - j - 1, j) A3x(k) = polval(m, coeff(o), n) / coeff(o + m + 1) k = k + 1 o = o + m + 2 10 continue return end subroutine C3cof(n, C3x) * The coefficients C3[l] in the Fourier expansion of B3 integer ord, nC3, nC3x parameter (ord = 6, nC3 = ord, nC3x = (nC3 * (nC3 - 1)) / 2) * input double precision n * output double precision C3x(0:nC3x-1) integer o, m, l, j, k double precision polval, + coeff(((nC3-1)*(nC3**2 + 7*nC3 - 2*(nC3/2)))/8) data coeff / + 3, 128, + 2, 5, 128, + -1, 3, 3, 64, + -1, 0, 1, 8, + -1, 1, 4, + 5, 256, + 1, 3, 128, + -3, -2, 3, 64, + 1, -3, 2, 32, + 7, 512, + -10, 9, 384, + 5, -9, 5, 192, + 7, 512, + -14, 7, 512, + 21, 2560/ o = 1 k = 0 do 20 l = 1, nC3 - 1 do 10 j = nC3 - 1, l, -1 m = min(nC3 - j - 1, j) C3x(k) = polval(m, coeff(o), n) / coeff(o + m + 1) k = k + 1 o = o + m + 2 10 continue 20 continue return end subroutine C4cof(n, C4x) * The coefficients C4[l] in the Fourier expansion of I4 integer ord, nC4, nC4x parameter (ord = 6, nC4 = ord, nC4x = (nC4 * (nC4 + 1)) / 2) * input double precision n * output double precision C4x(0:nC4x-1) integer o, m, l, j, k double precision polval, coeff((nC4 * (nC4 + 1) * (nC4 + 5)) / 6) data coeff / + 97, 15015, 1088, 156, 45045, -224, -4784, 1573, 45045, + -10656, 14144, -4576, -858, 45045, + 64, 624, -4576, 6864, -3003, 15015, + 100, 208, 572, 3432, -12012, 30030, 45045, + 1, 9009, -2944, 468, 135135, 5792, 1040, -1287, 135135, + 5952, -11648, 9152, -2574, 135135, + -64, -624, 4576, -6864, 3003, 135135, + 8, 10725, 1856, -936, 225225, -8448, 4992, -1144, 225225, + -1440, 4160, -4576, 1716, 225225, + -136, 63063, 1024, -208, 105105, + 3584, -3328, 1144, 315315, + -128, 135135, -2560, 832, 405405, 128, 99099/ o = 1 k = 0 do 20 l = 0, nC4 - 1 do 10 j = nC4 - 1, l, -1 m = nC4 - j - 1 C4x(k) = polval(m, coeff(o), n) / coeff(o + m + 1) k = k + 1 o = o + m + 2 10 continue 20 continue return end double precision function sumx(u, v, t) * input double precision u, v * output double precision t double precision up, vpp sumx = u + v up = sumx - v vpp = sumx - up up = up - u vpp = vpp - v t = -(up + vpp) return end double precision function remx(x, y) * the remainder function but not worrying how ties are handled * y must be positive * input double precision x, y remx = mod(x, y) if (remx .lt. -y/2) then remx = remx + y else if (remx .gt. +y/2) then remx = remx - y end if return end double precision function AngNm(x) * input double precision x double precision remx AngNm = remx(x, 360d0) if (AngNm .eq. -180) then AngNm = 180 end if return end double precision function LatFix(x) * input double precision x LatFix = x if (.not. (abs(x) .gt. 90)) return * concoct a NaN LatFix = sqrt(90 - abs(x)) return end double precision function AngDif(x, y, e) * Compute y - x. x and y must both lie in [-180, 180]. The result is * equivalent to computing the difference exactly, reducing it to (-180, * 180] and rounding the result. Note that this prescription allows -180 * to be returned (e.g., if x is tiny and negative and y = 180). The * error in the difference is returned in e * input double precision x, y * output double precision e double precision d, t, sumx, AngNm d = AngNm(sumx(AngNm(-x), AngNm(y), t)) if (d .eq. 180 .and. t .gt. 0) then d = -180 end if AngDif = sumx(d, t, e) return end double precision function AngRnd(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). This also * converts -0 to +0. * input double precision x double precision y, z z = 1/16d0 y = abs(x) * The compiler mustn't "simplify" z - (z - y) to y if (y .lt. z) y = z - (z - y) AngRnd = sign(y, x) if (x .eq. 0) AngRnd = 0 return end subroutine swap(x, y) * input/output double precision x, y double precision z z = x x = y y = z return end double precision function hypotx(x, y) * input double precision x, y * With Fortran 2008, this becomes: hypotx = hypot(x, y) hypotx = sqrt(x**2 + y**2) return end subroutine norm2x(x, y) * input/output double precision x, y double precision hypotx, r r = hypotx(x, y) x = x/r y = y/r return end double precision function log1px(x) * input double precision x double precision y, z y = 1 + x z = y - 1 if (z .eq. 0) then log1px = x else log1px = x * log(y) / z end if return end double precision function atanhx(x) * input double precision x * With Fortran 2008, this becomes: atanhx = atanh(x) double precision log1px, y y = abs(x) y = log1px(2 * y/(1 - y))/2 atanhx = sign(y, x) return end double precision function cbrt(x) * input double precision x cbrt = sign(abs(x)**(1/3d0), x) return end double precision function TrgSum(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, 1, n) * using Clenshaw summation. * Approx operation count = (n + 5) mult and (2 * n + 2) add * input logical sinp integer n double precision sinx, cosx, c(n) double precision ar, y0, y1 integer n2, k * 2 * cos(2 * x) ar = 2 * (cosx - sinx) * (cosx + sinx) * accumulators for sum if (mod(n, 2) .eq. 1) then y0 = c(n) n2 = n - 1 else y0 = 0 n2 = n end if y1 = 0 * Now n2 is even do 10 k = n2, 2, -2 * Unroll loop x 2, so accumulators return to their original role y1 = ar * y0 - y1 + c(k) y0 = ar * y1 - y0 + c(k-1) 10 continue if (sinp) then * sin(2 * x) * y0 TrgSum = 2 * sinx * cosx * y0 else * cos(x) * (y0 - y1) TrgSum = cosx * (y0 - y1) end if return end integer function trnsit(lon1, lon2) * input double precision lon1, lon2 double precision lon1x, lon2x, lon12, AngNm, AngDif, e lon1x = AngNm(lon1) lon2x = AngNm(lon2) lon12 = AngDif(lon1x, lon2x, e) trnsit = 0 if (lon1x .le. 0 .and. lon2x .gt. 0 .and. lon12 .gt. 0) then trnsit = 1 else if (lon2x .le. 0 .and. lon1x .gt. 0 .and. lon12 .lt. 0) then trnsit = -1 end if return end subroutine accini(s) * Initialize an accumulator; this is an array with two elements. * input/output double precision s(2) s(1) = 0 s(2) = 0 return end subroutine accadd(s, y) * Add y to an accumulator. * input double precision y * input/output double precision s(2) double precision z, u, sumx z = sumx(y, s(2), u) s(1) = sumx(z, s(1), s(2)) if (s(1) .eq. 0) then s(1) = u else s(2) = s(2) + u end if return end subroutine accrem(s, y) * Reduce s to [-y/2, y/2]. * input double precision y * input/output double precision s(2) double precision remx s(1) = remx(s(1), y) call accadd(s, 0d0) return end subroutine sncsdx(x, sinx, cosx) * Compute sin(x) and cos(x) with x in degrees * input double precision x * input/output double precision sinx, cosx double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init double precision r, s, c integer q r = mod(x, 360d0) q = nint(r / 90) r = (r - 90 * q) * degree s = sin(r) * sin(-0) isn't reliably -0, so... if (x .eq. 0) s = x c = cos(r) q = mod(q + 4, 4) if (q .eq. 0) then sinx = s cosx = c else if (q .eq. 1) then sinx = c cosx = -s else if (q .eq. 2) then sinx = -s cosx = -c else * q.eq.3 sinx = -c cosx = s end if if (x .ne. 0) then sinx = 0d0 + sinx cosx = 0d0 + cosx end if return end double precision function atn2dx(y, x) * input double precision x, y double precision dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh integer digits, maxit1, maxit2 logical init common /geocom/ dblmin, dbleps, pi, degree, tiny, + tol0, tol1, tol2, tolb, xthrsh, digits, maxit1, maxit2, init double precision xx, yy integer q if (abs(y) .gt. abs(x)) then xx = y yy = x q = 2 else xx = x yy = y q = 0 end if if (xx .lt. 0) then xx = -xx q = q + 1 end if atn2dx = atan2(yy, xx) / degree if (q .eq. 1) then if (yy .ge. 0) then atn2dx = 180 - atn2dx else atn2dx = -180 - atn2dx end if else if (q .eq. 2) then atn2dx = 90 - atn2dx else if (q .eq. 3) then atn2dx = -90 + atn2dx end if return end double precision function polval(N, p, x) * input integer N double precision p(0:N), x integer i if (N .lt. 0) then polval = 0 else polval = p(0) end if do 10 i = 1, N polval = polval * x + p(i) 10 continue return end * Table of name abbreviations to conform to the 6-char limit and * potential name conflicts. * A3coeff A3cof * C3coeff C3cof * C4coeff C4cof * AngNormalize AngNm * AngDiff AngDif * AngRound AngRnd * arcmode arcmod * Astroid Astrd * betscale betscl * lamscale lamscl * cbet12a cbt12a * sbet12a sbt12a * epsilon dbleps * realmin dblmin * geodesic geod * inverse invers * InverseStart InvSta * Lambda12 Lam12f * latsign latsgn * lonsign lonsgn * Lengths Lengs * meridian merid * outmask omask * shortline shortp * norm norm2x * SinCosSeries TrgSum * xthresh xthrsh * transit trnsit * polyval polval * LONG_UNROLL unroll * sincosd sncsdx * atan2d atn2dx *> @endcond SKIP GeographicLib-1.52/legacy/Fortran/geodesic.inc0000644000771000077100000000303514064202371021152 0ustar ckarneyckarney*> @file geodesic.inc *! @brief The interface file for the geodesic routines in Fortran *! *! Optinally insert \code *! include 'geodesic.inc' \endcode *! into the declaration portion of a subroutine that uses this library. *! *! See geodesic.for for documentation on these routines. interface * omask bits: 1 = a12; 2 = m12; 4 = MM12 + MM21; 8 = SS12 * flags bits: 1 = arcmode; 2 = unroll subroutine direct(a, f, lat1, lon1, azi1, s12a12, flags, + lat2, lon2, azi2, omask, a12s12, m12, MM12, MM21, SS12) double precision, intent(in) :: a, f, lat1, lon1, azi1, s12a12 integer, intent(in) :: flags, omask double precision, intent(out) :: lat2, lon2, azi2 double precision, intent(out) :: a12s12, m12, MM12, MM21, SS12 end subroutine direct subroutine invers(a, f, lat1, lon1, lat2, lon2, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) double precision, intent(in) :: a, f, lat1, lon1, lat2, lon2 integer, intent(in) :: omask double precision, intent(out) :: s12, azi1, azi2 double precision, intent(out) :: a12, m12, MM12, MM21, SS12 end subroutine invers subroutine area(a, f, lats, lons, n, AA, PP) integer, intent(in) :: n double precision, intent(in) :: a, f, lats(n), lons(n) double precision, intent(out) :: AA, PP end subroutine area subroutine geover(major, minor, patch) integer, intent(out) :: major, minor, patch end subroutine geover end interface GeographicLib-1.52/legacy/Fortran/geodinverse.for0000644000771000077100000000157414064202371021725 0ustar ckarneyckarney*> @file geodinverse.for *! @brief A test program for invers() *> A simple program to solve the inverse geodesic problem. *! *! This program reads in lines with lat1, lon1, lon2, lat2 and prints *! out lines with azi1, azi2, s12 (for the WGS84 ellipsoid). program geodinverse implicit none include 'geodesic.inc' double precision a, f, lat1, lon1, azi1, lat2, lon2, azi2, s12, + dummy1, dummy2, dummy3, dummy4, dummy5 integer omask * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 10 continue read(*, *, end=90, err=90) lat1, lon1, lat2, lon2 call invers(a, f, lat1, lon1, lat2, lon2, + s12, azi1, azi2, omask, + dummy1, dummy2, dummy3, dummy4, dummy5) print 20, azi1, azi2, s12 20 format(1x, f20.15, 1x, f20.15, 1x, f19.10) go to 10 90 continue stop end GeographicLib-1.52/legacy/Fortran/geodtest.for0000644000771000077100000013122214064202371021223 0ustar ckarneyckarney*> @file geodtest.for *! @brief Test suite for the geodesic routines in Fortran *! *! Run these tests by configuring with cmake and running "make test". *! *! Copyright (c) Charles Karney (2015-2021) and *! licensed under the MIT/X11 License. For more information, see *! https://geographiclib.sourceforge.io/ *> @cond SKIP block data tests integer j double precision tstdat(20, 12) common /tstcom/ tstdat data (tstdat(1,j), j = 1,12) / + 35.60777d0,-139.44815d0,111.098748429560326d0, + -11.17491d0,-69.95921d0,129.289270889708762d0, + 8935244.5604818305d0,80.50729714281974d0,6273170.2055303837d0, + 0.16606318447386067d0,0.16479116945612937d0, + 12841384694976.432d0 / data (tstdat(2,j), j = 1,12) / + 55.52454d0,106.05087d0,22.020059880982801d0, + 77.03196d0,197.18234d0,109.112041110671519d0, + 4105086.1713924406d0,36.892740690445894d0, + 3828869.3344387607d0, + 0.80076349608092607d0,0.80101006984201008d0, + 61674961290615.615d0 / data (tstdat(3,j), j = 1,12) / + -21.97856d0,142.59065d0,-32.44456876433189d0, + 41.84138d0,98.56635d0,-41.84359951440466d0, + 8394328.894657671d0,75.62930491011522d0,6161154.5773110616d0, + 0.24816339233950381d0,0.24930251203627892d0, + -6637997720646.717d0 / data (tstdat(4,j), j = 1,12) / + -66.99028d0,112.2363d0,173.73491240878403d0, + -12.70631d0,285.90344d0,2.512956620913668d0, + 11150344.2312080241d0,100.278634181155759d0, + 6289939.5670446687d0, + -0.17199490274700385d0,-0.17722569526345708d0, + -121287239862139.744d0 / data (tstdat(5,j), j = 1,12) / + -17.42761d0,173.34268d0,-159.033557661192928d0, + -15.84784d0,5.93557d0,-20.787484651536988d0, + 16076603.1631180673d0,144.640108810286253d0, + 3732902.1583877189d0, + -0.81273638700070476d0,-0.81299800519154474d0, + 97825992354058.708d0 / data (tstdat(6,j), j = 1,12) / + 32.84994d0,48.28919d0,150.492927788121982d0, + -56.28556d0,202.29132d0,48.113449399816759d0, + 16727068.9438164461d0,150.565799985466607d0, + 3147838.1910180939d0, + -0.87334918086923126d0,-0.86505036767110637d0, + -72445258525585.010d0 / data (tstdat(7,j), j = 1,12) / + 6.96833d0,52.74123d0,92.581585386317712d0, + -7.39675d0,206.17291d0,90.721692165923907d0, + 17102477.2496958388d0,154.147366239113561d0, + 2772035.6169917581d0, + -0.89991282520302447d0,-0.89986892177110739d0, + -1311796973197.995d0 / data (tstdat(8,j), j = 1,12) / + -50.56724d0,-16.30485d0,-105.439679907590164d0, + -33.56571d0,-94.97412d0,-47.348547835650331d0, + 6455670.5118668696d0,58.083719495371259d0, + 5409150.7979815838d0, + 0.53053508035997263d0,0.52988722644436602d0, + 41071447902810.047d0 / data (tstdat(9,j), j = 1,12) / + -58.93002d0,-8.90775d0,140.965397902500679d0, + -8.91104d0,133.13503d0,19.255429433416599d0, + 11756066.0219864627d0,105.755691241406877d0, + 6151101.2270708536d0, + -0.26548622269867183d0,-0.27068483874510741d0, + -86143460552774.735d0 / data (tstdat(10,j), j = 1,12) / + -68.82867d0,-74.28391d0,93.774347763114881d0, + -50.63005d0,-8.36685d0,34.65564085411343d0, + 3956936.926063544d0,35.572254987389284d0,3708890.9544062657d0, + 0.81443963736383502d0,0.81420859815358342d0, + -41845309450093.787d0 / data (tstdat(11,j), j = 1,12) / + -10.62672d0,-32.0898d0,-86.426713286747751d0, + 5.883d0,-134.31681d0,-80.473780971034875d0, + 11470869.3864563009d0,103.387395634504061d0, + 6184411.6622659713d0, + -0.23138683500430237d0,-0.23155097622286792d0, + 4198803992123.548d0 / data (tstdat(12,j), j = 1,12) / + -21.76221d0,166.90563d0,29.319421206936428d0, + 48.72884d0,213.97627d0,43.508671946410168d0, + 9098627.3986554915d0,81.963476716121964d0, + 6299240.9166992283d0, + 0.13965943368590333d0,0.14152969707656796d0, + 10024709850277.476d0 / data (tstdat(13,j), j = 1,12) / + -19.79938d0,-174.47484d0,71.167275780171533d0, + -11.99349d0,-154.35109d0,65.589099775199228d0, + 2319004.8601169389d0,20.896611684802389d0, + 2267960.8703918325d0, + 0.93427001867125849d0,0.93424887135032789d0, + -3935477535005.785d0 / data (tstdat(14,j), j = 1,12) / + -11.95887d0,-116.94513d0,92.712619830452549d0, + 4.57352d0,7.16501d0,78.64960934409585d0, + 13834722.5801401374d0,124.688684161089762d0, + 5228093.177931598d0, + -0.56879356755666463d0,-0.56918731952397221d0, + -9919582785894.853d0 / data (tstdat(15,j), j = 1,12) / + -87.85331d0,85.66836d0,-65.120313040242748d0, + 66.48646d0,16.09921d0,-4.888658719272296d0, + 17286615.3147144645d0,155.58592449699137d0, + 2635887.4729110181d0, + -0.90697975771398578d0,-0.91095608883042767d0, + 42667211366919.534d0 / data (tstdat(16,j), j = 1,12) / + 1.74708d0,128.32011d0,-101.584843631173858d0, + -11.16617d0,11.87109d0,-86.325793296437476d0, + 12942901.1241347408d0,116.650512484301857d0, + 5682744.8413270572d0, + -0.44857868222697644d0,-0.44824490340007729d0, + 10763055294345.653d0 / data (tstdat(17,j), j = 1,12) / + -25.72959d0,-144.90758d0,-153.647468693117198d0, + -57.70581d0,-269.17879d0,-48.343983158876487d0, + 9413446.7452453107d0,84.664533838404295d0, + 6356176.6898881281d0, + 0.09492245755254703d0,0.09737058264766572d0, + 74515122850712.444d0 / data (tstdat(18,j), j = 1,12) / + -41.22777d0,122.32875d0,14.285113402275739d0, + -7.57291d0,130.37946d0,10.805303085187369d0, + 3812686.035106021d0,34.34330804743883d0,3588703.8812128856d0, + 0.82605222593217889d0,0.82572158200920196d0, + -2456961531057.857d0 / data (tstdat(19,j), j = 1,12) / + 11.01307d0,138.25278d0,79.43682622782374d0, + 6.62726d0,247.05981d0,103.708090215522657d0, + 11911190.819018408d0,107.341669954114577d0, + 6070904.722786735d0, + -0.29767608923657404d0,-0.29785143390252321d0, + 17121631423099.696d0 / data (tstdat(20,j), j = 1,12) / + -29.47124d0,95.14681d0,-163.779130441688382d0, + -27.46601d0,-69.15955d0,-15.909335945554969d0, + 13487015.8381145492d0,121.294026715742277d0, + 5481428.9945736388d0, + -0.51527225545373252d0,-0.51556587964721788d0, + 104679964020340.318d0 / end integer function assert(x, y, d) double precision x, y, d if (abs(x - y) .le. d) then assert = 0 else assert = 1 print 10, x, y, d 10 format(1x, 'assert fails: ', + g14.7, ' != ', g14.7, ' +/- ', g10.3) end if return end integer function chknan(x) double precision x if (x .ne. x) then chknan = 0 else chknan = 1 end if return end integer function tstinv() double precision tstdat(20, 12) common /tstcom/ tstdat double precision lat1, lon1, azi1, lat2, lon2, azi2, + s12, a12, m12, MM12, MM21, SS12 double precision azi1a, azi2a, s12a, a12a, + m12a, MM12a, MM21a, SS12a double precision a, f integer r, assert, i, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 1 + 2 + 4 + 8 r = 0 do 10 i = 1,20 lat1 = tstdat(i, 1) lon1 = tstdat(i, 2) azi1 = tstdat(i, 3) lat2 = tstdat(i, 4) lon2 = tstdat(i, 5) azi2 = tstdat(i, 6) s12 = tstdat(i, 7) a12 = tstdat(i, 8) m12 = tstdat(i, 9) MM12 = tstdat(i, 10) MM21 = tstdat(i, 11) SS12 = tstdat(i, 12) call invers(a, f, lat1, lon1, lat2, lon2, + s12a, azi1a, azi2a, omask, a12a, m12a, MM12a, MM21a, SS12a) r = r + assert(azi1, azi1a, 1d-13) r = r + assert(azi2, azi2a, 1d-13) r = r + assert(s12, s12a, 1d-8) r = r + assert(a12, a12a, 1d-13) r = r + assert(m12, m12a, 1d-8) r = r + assert(MM12, MM12a, 1d-15) r = r + assert(MM21, MM21a, 1d-15) r = r + assert(SS12, SS12a, 0.1d0) 10 continue tstinv = r return end integer function tstdir() double precision tstdat(20, 12) common /tstcom/ tstdat double precision lat1, lon1, azi1, lat2, lon2, azi2, + s12, a12, m12, MM12, MM21, SS12 double precision lat2a, lon2a, azi2a, a12a, + m12a, MM12a, MM21a, SS12a double precision a, f integer r, assert, i, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 1 + 2 + 4 + 8 flags = 2 r = 0 do 10 i = 1,20 lat1 = tstdat(i, 1) lon1 = tstdat(i, 2) azi1 = tstdat(i, 3) lat2 = tstdat(i, 4) lon2 = tstdat(i, 5) azi2 = tstdat(i, 6) s12 = tstdat(i, 7) a12 = tstdat(i, 8) m12 = tstdat(i, 9) MM12 = tstdat(i, 10) MM21 = tstdat(i, 11) SS12 = tstdat(i, 12) call direct(a, f, lat1, lon1, azi1, s12, flags, + lat2a, lon2a, azi2a, omask, a12a, m12a, MM12a, MM21a, SS12a) r = r + assert(lat2, lat2a, 1d-13) r = r + assert(lon2, lon2a, 1d-13) r = r + assert(azi2, azi2a, 1d-13) r = r + assert(a12, a12a, 1d-13) r = r + assert(m12, m12a, 1d-8) r = r + assert(MM12, MM12a, 1d-15) r = r + assert(MM21, MM21a, 1d-15) r = r + assert(SS12, SS12a, 0.1d0) 10 continue tstdir = r return end integer function tstarc() double precision tstdat(20, 12) common /tstcom/ tstdat double precision lat1, lon1, azi1, lat2, lon2, azi2, + s12, a12, m12, MM12, MM21, SS12 double precision lat2a, lon2a, azi2a, s12a, + m12a, MM12a, MM21a, SS12a double precision a, f integer r, assert, i, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 1 + 2 + 4 + 8 flags = 1 + 2 r = 0 do 10 i = 1,20 lat1 = tstdat(i, 1) lon1 = tstdat(i, 2) azi1 = tstdat(i, 3) lat2 = tstdat(i, 4) lon2 = tstdat(i, 5) azi2 = tstdat(i, 6) s12 = tstdat(i, 7) a12 = tstdat(i, 8) m12 = tstdat(i, 9) MM12 = tstdat(i, 10) MM21 = tstdat(i, 11) SS12 = tstdat(i, 12) call direct(a, f, lat1, lon1, azi1, a12, flags, + lat2a, lon2a, azi2a, omask, s12a, m12a, MM12a, MM21a, SS12a) r = r + assert(lat2, lat2a, 1d-13) r = r + assert(lon2, lon2a, 1d-13) r = r + assert(azi2, azi2a, 1d-13) r = r + assert(s12, s12a, 1d-8) r = r + assert(m12, m12a, 1d-8) r = r + assert(MM12, MM12a, 1d-15) r = r + assert(MM21, MM21a, 1d-15) r = r + assert(SS12, SS12a, 0.1d0) 10 continue tstarc = r return end integer function tstg0() double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 40.6d0, -73.8d0, 49.01666667d0, 2.55d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 53.47022d0, 0.5d-5) r = r + assert(azi2, 111.59367d0, 0.5d-5) r = r + assert(s12, 5853226d0, 0.5d0) tstg0 = r return end integer function tstg1() double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 flags = 0 r = 0 call direct(a, f, 40.63972222d0, -73.77888889d0, 53.5d0, 5850d3, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, 49.01467d0, 0.5d-5) r = r + assert(lon2, 2.56106d0, 0.5d-5) r = r + assert(azi2, 111.62947d0, 0.5d-5) tstg1 = r return end integer function tstg2() * Check fix for antipodal prolate bug found 2010-09-04 double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' a = 6.4d6 f = -1/150d0 omask = 0 r = 0 call invers(a, f, 0.07476d0, 0d0, -0.07476d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00078d0, 0.5d-5) r = r + assert(azi2, 90.00078d0, 0.5d-5) r = r + assert(s12, 20106193d0, 0.5d0) call invers(a, f, 0.1d0, 0d0, -0.1d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00105d0, 0.5d-5) r = r + assert(azi2, 90.00105d0, 0.5d-5) r = r + assert(s12, 20106193d0, 0.5d0) tstg2 = r return end integer function tstg4() * Check fix for short line bug found 2010-05-21 double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, + 36.493349428792d0, 0d0, 36.49334942879201d0, .0000008d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 0.072d0, 0.5d-3) tstg4 = r return end integer function tstg5() double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 flags = 0 r = 0 call direct(a, f, 0.01777745589997d0, 30d0, 0d0, 10d6, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) if (lon2 .lt. 0) then r = r + assert(lon2, -150d0, 0.5d-5) r = r + assert(abs(azi2), 180d0, 0.5d-5) else r = r + assert(lon2, 30d0, 0.5d-5) r = r + assert(azi2, 0d0, 0.5d-5) end if tstg5 = r return end integer function tstg6() * Check fix for volatile sbet12a bug found 2011-06-25 (gcc 4.4d0.4d0 * x86 -O3). Found again on 2012-03-27 with tdm-mingw32 (g++ 4.6d0.1d0). double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 88.202499451857d0, 0d0, + -88.202499451857d0, 179.981022032992859592d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 20003898.214d0, 0.5d-3) call invers(a, f, 89.262080389218d0, 0d0, + -89.262080389218d0, 179.992207982775375662d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 20003925.854d0, 0.5d-3) call invers(a, f, 89.333123580033d0, 0d0, + -89.333123580032997687d0, 179.99295812360148422d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 20003926.881d0, 0.5d-3) tstg6 = r return end integer function tstg9() * Check fix for volatile x bug found 2011-06-25 (gcc 4.4d0.4d0 x86 -O3) double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 56.320923501171d0, 0d0, + -56.320923501171d0, 179.664747671772880215d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 19993558.287d0, 0.5d-3) tstg9 = r return end integer function tstg10() * Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio 10 rel * + debug) double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 52.784459512564d0, 0d0, + -52.784459512563990912d0, 179.634407464943777557d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 19991596.095d0, 0.5d-3) tstg10 = r return end integer function tstg11() * Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio 10 rel * + debug) double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 48.522876735459d0, 0d0, + -48.52287673545898293d0, 179.599720456223079643d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(s12, 19989144.774d0, 0.5d-3) tstg11 = r return end integer function tstg12() * Check fix for inverse geodesics on extreme prolate/oblate ellipsoids * Reported 2012-08-29 Stefan Guenther ; fixed * 2012-10-07 double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' a = 89.8d0 f = -1.83d0 omask = 0 r = 0 call invers(a, f, 0d0, 0d0, -10d0, 160d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 120.27d0, 1d-2) r = r + assert(azi2, 105.15d0, 1d-2) r = r + assert(s12, 266.7d0, 1d-1) tstg12 = r return end integer function tstg14() * Check fix for inverse ignoring lon12 = nan double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f, LatFix integer r, chknan, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 0d0, 0d0, 1d0, LatFix(91d0), + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + chknan(azi1) r = r + chknan(azi2) r = r + chknan(s12) tstg14 = r return end integer function tstg15() * Initial implementation of Math::eatanhe was wrong for e^2 < 0. This * checks that this is fixed. double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' a = 6.4d6 f = -1/150.0d0 omask = 8 flags = 0 r = 0 call direct(a, f, 1d0, 2d0, 3d0, 4d0, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(SS12, 23700d0, 0.5d0) tstg15 = r return end integer function tstg17() * Check fix for LONG_UNROLL bug found on 2015-05-07 double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 flags = 2 r = 0 call direct(a, f, 40d0, -75d0, -10d0, 2d7, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, -39d0, 1d0) r = r + assert(lon2, -254d0, 1d0) r = r + assert(azi2, -170d0, 1d0) flags = 0 call direct(a, f, 40d0, -75d0, -10d0, 2d7, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, -39d0, 1d0) r = r + assert(lon2, 105d0, 1d0) r = r + assert(azi2, -170d0, 1d0) tstg17 = r return end integer function tstg26() * Check 0/0 problem with area calculation on sphere 2015-09-08 double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' a = 6.4d6 f = 0 omask = 8 r = 0 call invers(a, f, 1d0, 2d0, 3d0, 4d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(SS12, 49911046115.0d0, 0.5d0) tstg26 = r return end integer function tstg28() * Check fix for LONG_UNROLL bug found on 2015-05-07 double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' a = 6.4d6 f = 0.1d0 omask = 1 + 2 + 4 + 8 flags = 0 r = 0 call direct(a, f, 1d0, 2d0, 10d0, 5d6, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(a12, 48.55570690d0, 0.5d-8) tstg28 = r return end integer function tstg33() * Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- * sind(-0.0) = +0.0 -- and in some version of Visual Studio -- * fmod(-0.0, 360.0) = +0.0. double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 0d0, 0d0, 0d0, 179d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00000d0, 0.5d-5) r = r + assert(azi2, 90.00000d0, 0.5d-5) r = r + assert(s12, 19926189d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0d0, 179.5d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 55.96650d0, 0.5d-5) r = r + assert(azi2, 124.03350d0, 0.5d-5) r = r + assert(s12, 19980862d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(abs(azi2), 180.00000d0, 0.5d-5) r = r + assert(s12, 20003931d0, 0.5d0) call invers(a, f, 0d0, 0d0, 1d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(abs(azi2), 180.00000d0, 0.5d-5) r = r + assert(s12, 19893357d0, 0.5d0) a = 6.4d6 f = 0 call invers(a, f, 0d0, 0d0, 0d0, 179d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00000d0, 0.5d-5) r = r + assert(azi2, 90.00000d0, 0.5d-5) r = r + assert(s12, 19994492d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(abs(azi2), 180.00000d0, 0.5d-5) r = r + assert(s12, 20106193d0, 0.5d0) call invers(a, f, 0d0, 0d0, 1d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(abs(azi2), 180.00000d0, 0.5d-5) r = r + assert(s12, 19994492d0, 0.5d0) a = 6.4d6 f = -1/300.0d0 call invers(a, f, 0d0, 0d0, 0d0, 179d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00000d0, 0.5d-5) r = r + assert(azi2, 90.00000d0, 0.5d-5) r = r + assert(s12, 19994492d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 90.00000d0, 0.5d-5) r = r + assert(azi2, 90.00000d0, 0.5d-5) r = r + assert(s12, 20106193d0, 0.5d0) call invers(a, f, 0d0, 0d0, 0.5d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 33.02493d0, 0.5d-5) r = r + assert(azi2, 146.97364d0, 0.5d-5) r = r + assert(s12, 20082617d0, 0.5d0) call invers(a, f, 0d0, 0d0, 1d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.00000d0, 0.5d-5) r = r + assert(abs(azi2), 180.00000d0, 0.5d-5) r = r + assert(s12, 20027270d0, 0.5d0) tstg33 = r return end integer function tstg55() * Check fix for nan + point on equator or pole not returning all nans in * Geodesic::Inverse, found 2015-09-23. double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, chknan, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 91d0, 0d0, 0d0, 90d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + chknan(azi1) r = r + chknan(azi2) r = r + chknan(s12) call invers(a, f, 91d0, 0d0, 90d0, 9d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + chknan(azi1) r = r + chknan(azi2) r = r + chknan(s12) tstg55 = r return end integer function tstg59() * Check for points close with longitudes close to 180 deg apart. double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 5d0, 0.00000000000001d0, 10d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 0.000000000000035d0, 1.5d-14) r = r + assert(azi2, 179.99999999999996d0, 1.5d-14) r = r + assert(s12, 18345191.174332713d0, 5d-9) tstg59 = r return end integer function tstg61() * Make sure small negative azimuths are west-going double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 flags = 2 r = 0 call direct(a, f, 45d0, 0d0, -0.000000000000000003d0, 1d7, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, 45.30632d0, 0.5d-5) r = r + assert(lon2, -180d0, 0.5d-5) r = r + assert(abs(azi2), 180d0, 0.5d-5) tstg61 = r return end integer function tstg73() * Check for backwards from the pole bug reported by Anon on 2016-02-13. * This only affected the Java implementation. It was introduced in Java * version 1.44 and fixed in 1.46-SNAPSHOT on 2016-01-17. * Also the + sign on azi2 is a check on the normalizing of azimuths * (converting -0.0 to +0.0). double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 flags = 0 r = 0 call direct(a, f, 90d0, 10d0, 180d0, -1d6, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, 81.04623d0, 0.5d-5) r = r + assert(lon2, -170d0, 0.5d-5) r = r + assert(azi2, 0d0, 0d0) r = r + assert(sign(1d0, azi2), 1d0, 0d0) tstg73 = r return end integer function tstg74() * Check fix for inaccurate areas, bug introduced in v1.46, fixed * 2015-10-16. double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 1 + 2 + 4 + 8 r = 0 call invers(a, f, 54.1589d0, 15.3872d0, 54.1591d0, 15.3877d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 55.723110355d0, 5d-9) r = r + assert(azi2, 55.723515675d0, 5d-9) r = r + assert(s12, 39.527686385d0, 5d-9) r = r + assert(a12, 0.000355495d0, 5d-9) r = r + assert(m12, 39.527686385d0, 5d-9) r = r + assert(MM12, 0.999999995d0, 5d-9) r = r + assert(MM21, 0.999999995d0, 5d-9) r = r + assert(SS12, 286698586.30197d0, 5d-4) tstg74 = r return end integer function tstg76() * The distance from Wellington and Salamanca (a classic failure of * Vincenty double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, + -(41+19/60d0), 174+49/60d0, 40+58/60d0, -(5+30/60d0), + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 160.39137649664d0, 0.5d-11) r = r + assert(azi2, 19.50042925176d0, 0.5d-11) r = r + assert(s12, 19960543.857179d0, 0.5d-6) tstg76 = r return end integer function tstg78() * An example where the NGS calculator fails to converge double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, 27.2d0, 0d0, -27.1d0, 179.5d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 45.82468716758d0, 0.5d-11) r = r + assert(azi2, 134.22776532670d0, 0.5d-11) r = r + assert(s12, 19974354.765767d0, 0.5d-6) tstg78 = r return end integer function tstg80() * Some tests to add code coverage: computing scale in special cases + zero * length geodesic (includes GeodSolve80 - GeodSolve83). double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 4 r = 0 call invers(a, f, 0d0, 0d0, 0d0, 90d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(MM12, -0.00528427534d0, 0.5d-10) r = r + assert(MM21, -0.00528427534d0, 0.5d-10) call invers(a, f, 0d0, 0d0, 1d-6, 1d-6, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(MM12, 1d0, 0.5d-10) r = r + assert(MM21, 1d0, 0.5d-10) omask = 15 call invers(a, f, 20.001d0, 0d0, 20.001d0, 0d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(a12, 0d0, 1d-13) r = r + assert(s12, 0d0, 1d-8) r = r + assert(azi1, 180d0, 1d-13) r = r + assert(azi2, 180d0, 1d-13) r = r + assert(m12, 0d0, 1d-8) r = r + assert(MM12, 1d0, 1d-15) r = r + assert(MM21, 1d0, 1d-15) r = r + assert(SS12, 0d0, 1d-10) r = r + assert(sign(1d0, a12), 1d0, 0d0) r = r + assert(sign(1d0, s12), 1d0, 0d0) r = r + assert(sign(1d0, m12), 1d0, 0d0) call invers(a, f, 90d0, 0d0, 90d0, 180d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(a12, 0d0, 1d-13) r = r + assert(s12, 0d0, 1d-8) r = r + assert(azi1, 0d0, 1d-13) r = r + assert(azi2, 180d0, 1d-13) r = r + assert(m12, 0d0, 1d-8) r = r + assert(MM12, 1d0, 1d-15) r = r + assert(MM21, 1d0, 1d-15) r = r + assert(SS12, 127516405431022d0, 0.5d0) tstg80 = r return end integer function tstg84() * Tests for python implementation to check fix for range errors with * {fmod,sin,cos}(inf) (includes GeodSolve84 - GeodSolve86). double precision lat2, lon2, azi2, a12, m12, MM12, MM21, SS12 double precision a, f, nan, inf, LatFix integer r, assert, chknan, omask, flags include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 flags = 0 inf = 1d0/LatFix(0d0) nan = LatFix(91d0) r = 0 call direct(a, f, 0d0, 0d0, 90d0, inf, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + chknan(lat2) r = r + chknan(lon2) r = r + chknan(azi2) call direct(a, f, 0d0, 0d0, 90d0, nan, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + chknan(lat2) r = r + chknan(lon2) r = r + chknan(azi2) call direct(a, f, 0d0, 0d0, inf, 1000d0, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + chknan(lat2) r = r + chknan(lon2) r = r + chknan(azi2) call direct(a, f, 0d0, 0d0, nan, 1000d0, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + chknan(lat2) r = r + chknan(lon2) r = r + chknan(azi2) call direct(a, f, 0d0, inf, 90d0, 1000d0, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, 0d0, 0d0) r = r + chknan(lon2) r = r + assert(azi2, 90d0, 0d0) call direct(a, f, 0d0, nan, 90d0, 1000d0, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(lat2, 0d0, 0d0) r = r + chknan(lon2) r = r + assert(azi2, 90d0, 0d0) call direct(a, f, inf, 0d0, 90d0, 1000d0, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + chknan(lat2) r = r + chknan(lon2) r = r + chknan(azi2) call direct(a, f, nan, 0d0, 90d0, 1000d0, + flags, lat2, lon2, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + chknan(lat2) r = r + chknan(lon2) r = r + chknan(azi2) tstg84 = r return end integer function tstg92() * Check fix for inaccurate hypot with python 3.[89]. Problem reported * by agdhruv https://github.com/geopy/geopy/issues/466 ; see * https://bugs.python.org/issue43088 double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12 double precision a, f integer r, assert, omask include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 omask = 0 r = 0 call invers(a, f, + 37.757540000000006d0, -122.47018d0, + 37.75754d0, -122.470177d0, + s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12) r = r + assert(azi1, 89.99999923d0, 1d-7 ) r = r + assert(azi2, 90.00000106d0, 1d-7 ) r = r + assert(s12, 0.264d0, 0.5d-3) tstg92 = r return end integer function tstp0() * Check fix for pole-encircling bug found 2011-03-16 double precision lata(4), lona(4) data lata / 89d0, 89d0, 89d0, 89d0 / data lona / 0d0, 90d0, 180d0, 270d0 / double precision latb(4), lonb(4) data latb / -89d0, -89d0, -89d0, -89d0 / data lonb / 0d0, 90d0, 180d0, 270d0 / double precision latc(4), lonc(4) data latc / 0d0, -1d0, 0d0, 1d0 / data lonc / -1d0, 0d0, 1d0, 0d0 / double precision latd(3), lond(3) data latd / 90d0, 0d0, 0d0 / data lond / 0d0, 0d0, 90d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lata, lona, 4, AA, PP) r = r + assert(PP, 631819.8745d0, 1d-4) r = r + assert(AA, 24952305678.0d0, 1d0) call area(a, f, latb, lonb, 4, AA, PP) r = r + assert(PP, 631819.8745d0, 1d-4) r = r + assert(AA, -24952305678.0d0, 1d0) call area(a, f, latc, lonc, 4, AA, PP) r = r + assert(PP, 627598.2731d0, 1d-4) r = r + assert(AA, 24619419146.0d0, 1d0) call area(a, f, latd, lond, 3, AA, PP) r = r + assert(PP, 30022685d0, 1d0) r = r + assert(AA, 63758202715511.0d0, 1d0) tstp0 = r return end integer function tstp5() * Check fix for Planimeter pole crossing bug found 2011-06-24 double precision lat(3), lon(3) data lat / 89d0, 89d0, 89d0 / data lon / 0.1d0, 90.1d0, -179.9d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lat, lon, 3, AA, PP) r = r + assert(PP, 539297d0, 1d0) r = r + assert(AA, 12476152838.5d0, 1d0) tstp5 = r return end integer function tstp6() * Check fix for pole-encircling bug found 2011-03-16 double precision lata(3), lona(3) data lata / 9d0, 9d0, 9d0 / data lona / -0.00000000000001d0, 180d0, 0d0 / double precision latb(3), lonb(3) data latb / 9d0, 9d0, 9d0 / data lonb / 0.00000000000001d0, 0d0, 180d0 / double precision latc(3), lonc(3) data latc / 9d0, 9d0, 9d0 / data lonc / 0.00000000000001d0, 180d0, 0d0 / double precision latd(3), lond(3) data latd / 9d0, 9d0, 9d0 / data lond / -0.00000000000001d0, 0d0, 180d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lata, lona, 3, AA, PP) r = r + assert(PP, 36026861d0, 1d0) r = r + assert(AA, 0d0, 1d0) tstp6 = r return end integer function tstp12() * AA of arctic circle (not really -- adjunct to rhumb-AA test) double precision lat(2), lon(2) data lat / 66.562222222d0, 66.562222222d0 / data lon / 0d0, 180d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lat, lon, 2, AA, PP) r = r + assert(PP, 10465729d0, 1d0) r = r + assert(AA, 0d0, 1d0) tstp12 = r return end integer function tstp13() * Check encircling pole twice double precision lat(6), lon(6) data lat / 89d0, 89d0, 89d0, 89d0, 89d0, 89d0 / data lon / -360d0, -240d0, -120d0, 0d0, 120d0, 240d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lat, lon, 6, AA, PP) r = r + assert(PP, 1160741d0, 1d0) r = r + assert(AA, 32415230256.0d0, 1d0) tstp13 = r return end integer function tstp15() * Coverage tests, includes Planimeter15 - Planimeter18 (combinations of * reverse and sign). But flags aren't supported in the Fortran * implementation. double precision lat(3), lon(3) data lat / 2d0, 1d0, 3d0 / data lon / 1d0, 2d0, 3d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lat, lon, 3, AA, PP) r = r + assert(AA, 18454562325.45119d0, 1d0) * Interchanging lat and lon is equivalent to traversing the polygon * backwards. call area(a, f, lon, lat, 3, AA, PP) r = r + assert(AA, -18454562325.45119d0, 1d0) tstp15 = r return end integer function tstp19() * Coverage tests, includes Planimeter19 - Planimeter20 (degenerate * polygons). double precision lat(1), lon(1) data lat / 1d0 / data lon / 1d0 / double precision a, f, AA, PP integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 call area(a, f, lat, lon, 1, AA, PP) r = r + assert(AA, 0d0, 0d0) r = r + assert(PP, 0d0, 0d0) tstp19 = r return end integer function tstp21() * Some test to add code coverage: multiple circlings of pole (includes * Planimeter21 - Planimeter28). double precision lat(12), lon(12), lonr(12) data lat / 12*45d0 / data lon / 60d0, 180d0, -60d0, + 60d0, 180d0, -60d0, + 60d0, 180d0, -60d0, + 60d0, 180d0, -60d0 / data lonr / -60d0, 180d0, 60d0, + -60d0, 180d0, 60d0, + -60d0, 180d0, 60d0, + -60d0, 180d0, 60d0 / double precision a, f, AA, PP, AA1 integer r, assert include 'geodesic.inc' * WGS84 values a = 6378137d0 f = 1/298.257223563d0 r = 0 * Area for one circuit AA1 = 39433884866571.4277d0 do 10 i = 3,4 call area(a, f, lat, lon, 3*i, AA, PP) r = r + assert(AA, AA1*i, 0.5d0) call area(a, f, lat, lonr, 3*i, AA, PP) r = r + assert(AA, -AA1*i, 0.5d0) 10 continue tstp21 = r return end program geodtest integer n, i integer tstinv, tstdir, tstarc, + tstg0, tstg1, tstg2, tstg5, tstg6, tstg9, tstg10, tstg11, + tstg12, tstg14, tstg15, tstg17, tstg26, tstg28, tstg33, + tstg55, tstg59, tstg61, tstg73, tstg74, tstg76, tstg78, + tstg80, tstg84, tstg92, + tstp0, tstp5, tstp6, tstp12, tstp13, tstp15, tstp19, tstp21 n = 0 i = tstinv() if (i .gt. 0) then n = n + 1 print *, 'tstinv fail:', i end if i = tstdir() if (i .gt. 0) then n = n + 1 print *, 'tstdir fail:', i end if i = tstarc() if (i .gt. 0) then n = n + 1 print *, 'tstarc fail:', i end if i = tstg0() if (i .gt. 0) then n = n + 1 print *, 'tstg0 fail:', i end if i = tstg1() if (i .gt. 0) then n = n + 1 print *, 'tstg1 fail:', i end if i = tstg2() if (i .gt. 0) then n = n + 1 print *, 'tstg2 fail:', i end if i = tstg5() if (i .gt. 0) then n = n + 1 print *, 'tstg5 fail:', i end if i = tstg6() if (i .gt. 0) then n = n + 1 print *, 'tstg6 fail:', i end if i = tstg9() if (i .gt. 0) then n = n + 1 print *, 'tstg9 fail:', i end if i = tstg10() if (i .gt. 0) then n = n + 1 print *, 'tstg10 fail:', i end if i = tstg11() if (i .gt. 0) then n = n + 1 print *, 'tstg11 fail:', i end if i = tstg12() if (i .gt. 0) then n = n + 1 print *, 'tstg12 fail:', i end if i = tstg14() if (i .gt. 0) then n = n + 1 print *, 'tstg14 fail:', i end if i = tstg15() if (i .gt. 0) then n = n + 1 print *, 'tstg15 fail:', i end if i = tstg17() if (i .gt. 0) then n = n + 1 print *, 'tstg17 fail:', i end if i = tstg26() if (i .gt. 0) then n = n + 1 print *, 'tstg26 fail:', i end if i = tstg28() if (i .gt. 0) then n = n + 1 print *, 'tstg28 fail:', i end if i = tstg33() if (i .gt. 0) then n = n + 1 print *, 'tstg33 fail:', i end if i = tstg55() if (i .gt. 0) then n = n + 1 print *, 'tstg55 fail:', i end if i = tstg59() if (i .gt. 0) then n = n + 1 print *, 'tstg59 fail:', i end if i = tstg61() if (i .gt. 0) then n = n + 1 print *, 'tstg61 fail:', i end if i = tstg73() if (i .gt. 0) then n = n + 1 print *, 'tstg73 fail:', i end if i = tstg74() if (i .gt. 0) then n = n + 1 print *, 'tstg74 fail:', i end if i = tstg76() if (i .gt. 0) then n = n + 1 print *, 'tstg76 fail:', i end if i = tstg78() if (i .gt. 0) then n = n + 1 print *, 'tstg78 fail:', i end if i = tstg80() if (i .gt. 0) then n = n + 1 print *, 'tstg80 fail:', i end if i = tstg84() if (i .gt. 0) then n = n + 1 print *, 'tstg84 fail:', i end if i = tstg92() if (i .gt. 0) then n = n + 1 print *, 'tstg92 fail:', i end if i = tstp0() if (i .gt. 0) then n = n + 1 print *, 'tstp0 fail:', i end if i = tstp5() if (i .gt. 0) then n = n + 1 print *, 'tstp5 fail:', i end if i = tstp6() if (i .gt. 0) then n = n + 1 print *, 'tstp6 fail:', i end if i = tstp12() if (i .gt. 0) then n = n + 1 print *, 'tstp12 fail:', i end if i = tstp13() if (i .gt. 0) then n = n + 1 print *, 'tstp13 fail:', i end if i = tstp15() if (i .gt. 0) then n = n + 1 print *, 'tstp15 fail:', i end if i = tstp19() if (i .gt. 0) then n = n + 1 print *, 'tstp19 fail:', i end if i = tstp21() if (i .gt. 0) then n = n + 1 print *, 'tstp21 fail:', i end if if (n .gt. 0) then stop 1 end if stop end *> @endcond SKIP GeographicLib-1.52/legacy/Fortran/ngscommon.for0000644000771000077100000004042214064202371021406 0ustar ckarneyckarney subroutine bufdms (buff,lgh,hem,dd,dm,ds,ierror) implicit double precision (a-h, o-z) implicit integer (i-n) c logical done,flag c character*1 buff(*),abuf(21) character*1 ch character*1 hem integer*4 ll,lgh integer*4 i4,id,im,is,icond,ierror real*8 x(5) c c set the "error flag" c ierror = 0 icond = 0 c c set defaults for dd,dm,ds c dd = 0.0d0 dm = 0.0d0 ds = 0.0d0 c c set default limits for "hem" flag c if( hem.eq.'N' .or. hem.eq.'S' )then ddmax = 90.0d0 elseif( hem.eq.'E' .or. hem.eq.'W' )then ddmax = 360.0d0 elseif( hem.eq.'A' )then ddmax = 360.0d0 elseif( hem.eq.'Z' )then ddmax = 180.0d0 elseif( hem.eq.'*' )then ddmax = 0.0d0 ierror = 1 else ddmax = 360.0d0 endif c do 1 i=1,5 x(i) = 0.0d0 1 continue c icolon = 0 ipoint = 0 icount = 0 flag = .true. jlgh = lgh c do 2 i=1,jlgh if( buff(i).eq.':' )then icolon = icolon+1 endif if( buff(i).eq.'.' )then ipoint = ipoint+1 flag = .false. endif if( flag )then icount = icount+1 endif 2 continue c if( ipoint.eq.1 .and. icolon.eq.0 )then c c load temp buffer c do 3 i=1,jlgh abuf(i) = buff(i) 3 continue abuf(jlgh+1) = '$' ll = jlgh c call gvalr8 (abuf,ll,r8,icond) c if( icount.ge.5 )then c c value is a packed decimal of ==> DDMMSS.sssss c ss = r8/10000.0d0 id = idint( ss ) c r8 = r8-10000.0d0*dble(float(id)) ss = r8/100.0d0 im = idint( ss ) c r8 = r8-100.0d0*dble(float(im)) else c c value is a decimal of ==> .xx X.xxx X. c id = idint( r8 ) r8 = (r8-id)*60.0d0 im = idint( r8 ) r8 = (r8-im)*60.0d0 endif c c account for rounding error c is = idnint( r8*1.0d5 ) if( is.ge.6000000 )then r8 = 0.0d0 im = im+1 endif c if( im.ge.60 )then im = 0 id = id+1 endif c dd = dble( float( id ) ) dm = dble( float( im ) ) ds = r8 else c c buff() value is a d,m,s of ==> NN:NN:XX.xxx c k = 0 next = 1 done = .false. ie = jlgh c do 100 j=1,5 ib = next do 90 i=ib,ie ch = buff(i) last = i if( i.eq.jlgh .or. ch.eq.':' )then if( i.eq.jlgh )then done = .true. endif if( ch.eq.':' )then last = i-1 endif goto 91 endif 90 continue goto 98 c 91 ipoint = 0 ik = 0 do 92 i=next,last ik = ik+1 ch = buff(i) if( ch.eq.'.' )then ipoint = ipoint+1 endif abuf(ik) = buff(i) 92 continue abuf(ik+1) = '$' c ll = ik if( ipoint.eq.0 )then call gvali4 (abuf,ll,i4,icond) r8 = dble(float( i4 )) else call gvalr8 (abuf,ll,r8,icond) endif c k = k+1 x(k) = r8 c 98 if( done )then goto 101 endif c next = last 99 next = next+1 if( buff(next).eq.':' )then goto 99 endif 100 continue c c load dd,dm,ds c 101 if( k.ge.1 )then dd = x(1) endif c if( k.ge.2 )then dm = x(2) endif c if( k.ge.3 )then ds = x(3) endif endif c if( dd.gt.ddmax .or. 1 dm.ge.60.0d0 .or. 1 ds.ge.60.0d0 )then ierror = 1 dd = 0.0d0 dm = 0.0d0 ds = 0.0d0 endif c if( icond.ne.0 )then ierror = 1 endif c return end subroutine elipss (elips) implicit double precision(a-h,o-z) character*1 answer character*30 elips common/elipsoid/a,f write(*,*) ' Other Ellipsoids.' write(*,*) ' -----------------' write(*,*) ' ' write(*,*) ' A) Airy 1858' write(*,*) ' B) Airy Modified' write(*,*) ' C) Australian National' write(*,*) ' D) Bessel 1841' write(*,*) ' E) Clarke 1880' write(*,*) ' F) Everest 1830' write(*,*) ' G) Everest Modified' write(*,*) ' H) Fisher 1960' write(*,*) ' I) Fisher 1968' write(*,*) ' J) Hough 1956' write(*,*) ' K) International (Hayford)' write(*,*) ' L) Krassovsky 1938' write(*,*) ' M) NWL-9D (WGS 66)' write(*,*) ' N) South American 1969' write(*,*) ' O) Soviet Geod. System 1985' write(*,*) ' P) WGS 72' write(*,*) ' Q-Z) User defined.' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) answer 10 format(a1) c if(answer.eq.'A'.or.answer.eq.'a') then a=6377563.396d0 f=1.d0/299.3249646d0 elips='Airy 1858' elseif(answer.eq.'B'.or.answer.eq.'b') then a=6377340.189d0 f=1.d0/299.3249646d0 elips='Airy Modified' elseif(answer.eq.'C'.or.answer.eq.'c') then a=6378160.d0 f=1.d0/298.25d0 elips='Australian National' elseif(answer.eq.'D'.or.answer.eq.'d') then a=6377397.155d0 f=1.d0/299.1528128d0 elips='Bessel 1841' elseif(answer.eq.'E'.or.answer.eq.'e') then a=6378249.145d0 f=1.d0/293.465d0 elips='Clarke 1880' elseif(answer.eq.'F'.or.answer.eq.'f') then a=6377276.345d0 f=1.d0/300.8017d0 elips='Everest 1830' elseif(answer.eq.'G'.or.answer.eq.'g') then a=6377304.063d0 f=1.d0/300.8017d0 elips='Everest Modified' elseif(answer.eq.'H'.or.answer.eq.'h') then a=6378166.d0 f=1.d0/298.3d0 elips='Fisher 1960' elseif(answer.eq.'I'.or.answer.eq.'i') then a=6378150.d0 f=1.d0/298.3d0 elips='Fisher 1968' elseif(answer.eq.'J'.or.answer.eq.'j') then a=6378270.d0 f=1.d0/297.d0 elips='Hough 1956' elseif(answer.eq.'K'.or.answer.eq.'k') then a=6378388.d0 f=1.d0/297.d0 elips='International (Hayford)' elseif(answer.eq.'L'.or.answer.eq.'l') then a=6378245.d0 f=1.d0/298.3d0 elips='Krassovsky 1938' elseif(answer.eq.'M'.or.answer.eq.'m') then a=6378145.d0 f=1.d0/298.25d0 elips='NWL-9D (WGS 66)' elseif(answer.eq.'N'.or.answer.eq.'n') then a=6378160.d0 f=1.d0/298.25d0 elips='South American 1969' elseif(answer.eq.'O'.or.answer.eq.'o') then a=6378136.d0 f=1.d0/298.257d0 elips='Soviet Geod. System 1985' elseif(answer.eq.'P'.or.answer.eq.'p') then a=6378135.d0 f=1.d0/298.26d0 elips='WGS 72' else elips = 'User defined.' c write(*,*) ' Enter Equatorial axis, a : ' read(*,*) a a = dabs(a) c write(*,*) ' Enter either Polar axis, b or ' write(*,*) ' Reciprocal flattening, 1/f : ' read(*,*) ss ss = dabs(ss) c f = 0.0d0 if( 200.0d0.le.ss .and. ss.le.310.0d0 )then f = 1.d0/ss elseif( 6000000.0d0.lt.ss .and. ss.lt.a )then f = (a-ss)/a else elips = 'Error: default GRS80 used.' a = 6378137.0d0 f = 1.0d0/298.25722210088d0 endif endif c return end subroutine fixdms (ideg, min, sec, tol ) c implicit double precision (a-h, o-z) implicit integer (i-n) c c test for seconds near 60.0-tol c if( sec.ge.( 60.0d0-tol ) )then sec = 0.0d0 min = min+1 endif c c test for minutes near 60 c if( min.ge.60 )then min = 0 ideg = ideg+1 endif c c test for degrees near 360 c if( ideg.ge.360 )then ideg = 0 endif c return end subroutine hem_ns ( lat_sn, hem ) implicit integer (i-n) character*6 hem c if( lat_sn.eq.1 ) then hem = 'North ' else hem = 'South ' endif c return end subroutine hem_ew ( lon_sn, hem ) implicit integer (i-n) character*6 hem c if( lon_sn.eq.1 ) then hem = 'East ' else hem = 'West ' endif c return end subroutine getdeg(d,m,sec,isign,val) *** comvert deg, min, sec to degrees implicit double precision(a-h,j-z) val=(d+m/60.d0+sec/3600.d0) val=dble(isign)*val return end subroutine gvali4 (buff,ll,vali4,icond) implicit integer (i-n) c logical plus,sign,done,error character*1 buff(*) character*1 ch c c integer*2 i c integer*2 l1 c integer*4 ich,icond integer*4 ll integer*4 vali4 c l1 = ll vali4 = 0 icond = 0 plus = .true. sign = .false. done = .false. error = .false. c i = 0 10 i = i+1 if( i.gt.l1 .or. done )then go to 1000 else ch = buff(i) ich = ichar( buff(i) ) endif c if( ch.eq.'+' )then c c enter on plus sign c if( sign )then goto 150 else sign = .true. goto 10 endif elseif( ch.eq.'-' )then c c enter on minus sign c if( sign )then goto 150 else sign = .true. plus = .false. goto 10 endif elseif( ch.ge.'0' .and. ch.le.'9' )then goto 100 elseif( ch.eq.' ' )then c c enter on space -- ignore leading spaces c if( .not.sign )then goto 10 else buff(i) = '0' ich = 48 goto 100 endif elseif( ch.eq.':' )then c c enter on colon -- ignore c if( .not.sign )then goto 10 else goto 1000 endif elseif( ch.eq.'$' )then c c enter on dollar "$" c done = .true. goto 10 else c c something wrong c goto 150 endif c c enter on numeric c 100 vali4 = 10*vali4+(ich-48) sign = .true. goto 10 c c treat illegal character c 150 buff(i) = '0' vali4 = 0 icond = 1 c 1000 if( .not.plus )then vali4 = -vali4 endif c return end subroutine gvalr8 (buff,ll,valr8,icond) implicit integer (i-n) c logical plus,sign,dpoint,done c character*1 buff(*) character*1 ch c c integer*2 i, ip c integer*2 l1 c integer*2 nn, num, n48 c integer*4 ich,icond integer*4 ll c real*8 ten real*8 valr8 real*8 zero c data zero,ten/0.0d0,10.0d0/ c n48 = 48 l1 = ll icond = 0 valr8 = zero plus = .true. sign = .false. dpoint = .false. done = .false. c c start loop thru buffer c i = 0 10 i = i+1 if( i.gt.l1 .or. done )then go to 1000 else ch = buff(i) nn = ichar( ch ) ich = nn endif c if( ch.eq.'+' )then c c enter on plus sign c if( sign )then goto 150 else sign = .true. goto 10 endif elseif( ch.eq.'-' )then c c enter on minus sign c if( sign )then goto 150 else sign = .true. plus = .false. goto 10 endif elseif( ch.eq.'.' )then c c enter on decimal point c ip = 0 sign = .true. dpoint = .true. goto 10 elseif( ch.ge.'0' .and. ch.le.'9' )then goto 100 elseif( ch.eq.' ' )then c c enter on space c if( .not.sign )then goto 10 else buff(i) = '0' ich = 48 goto 100 endif elseif( ch.eq.':' .or. ch.eq.'$' )then c c enter on colon or "$" sign c done = .true. goto 10 else c c something wrong c goto 150 endif c c enter on numeric c 100 sign = .true. if( dpoint )then ip = ip+1 endif c num = ich valr8 = ten*valr8+dble(float( num-n48 )) goto 10 c c treat illegal character c 150 buff(i) = '0' valr8 = 0.0d0 icond = 1 c 1000 if( dpoint )then valr8 = valr8/(ten**ip) endif c if( .not.plus )then valr8 = -valr8 endif c return end subroutine todmsp(val,id,im,s,isign) *** convert position degrees to deg,min,sec *** range is [-180 to +180] implicit double precision(a-h,o-z) 1 if(val.gt.180) then val=val-180-180 go to 1 endif 2 if(val.lt.-180) then val=val+180+180 go to 2 endif if(val.lt.0.d0) then isign=-1 else isign=+1 endif s=dabs(val) id=idint(s) s=(s-id)*60.d0 im=idint(s) s=(s-im)*60.d0 *** account for rounding error is=idnint(s*1.d5) if(is.ge.6000000) then s=0.d0 im=im+1 endif if(im.ge.60) then im=0 id=id+1 endif return end subroutine trim (buff,lgh,hem) c implicit integer (i-n) character*1 ch,hem character*1 buff(*) integer*4 lgh c ibeg = 1 do 10 i=1,50 if( buff(i).ne.' ' )then goto 11 endif ibeg = ibeg+1 10 continue 11 continue if( ibeg.ge.50 )then ibeg = 1 buff(ibeg) = '0' endif c iend = 50 do 20 i=1,50 j = 51-i if( buff(j).eq.' ' )then iend = iend-1 else goto 21 endif 20 continue 21 continue c ch = buff(ibeg) if( hem.eq.'N' )then if( ch.eq.'N' .or. ch.eq.'n' .or. ch.eq.'+' )then hem = 'N' ibeg = ibeg+1 endif if( ch.eq.'S' .or. ch.eq.'s' .or. ch.eq.'-' )then hem = 'S' ibeg = ibeg+1 endif c c check for wrong hemisphere entry c if( ch.eq.'E' .or. ch.eq.'e' )then hem = '*' ibeg = ibeg+1 endif if( ch.eq.'W' .or. ch.eq.'w' )then hem = '*' ibeg = ibeg+1 endif elseif( hem.eq.'W' )then if( ch.eq.'E' .or. ch.eq.'e' .or. ch.eq.'+' )then hem = 'E' ibeg = ibeg+1 endif if( ch.eq.'W' .or. ch.eq.'w' .or. ch.eq.'-' )then hem = 'W' ibeg = ibeg+1 endif c c check for wrong hemisphere entry c if( ch.eq.'N' .or. ch.eq.'n' )then hem = '*' ibeg = ibeg+1 endif if( ch.eq.'S' .or. ch.eq.'s' )then hem = '*' ibeg = ibeg+1 endif elseif( hem.eq.'A' )then if( .not.('0'.le.ch .and. ch.le.'9') )then hem = '*' ibeg = ibeg+1 endif else c do nothing endif c c do 30 i=ibeg,iend ch = buff(i) c if( ch.eq.':' .or. ch.eq.'.' )then goto 30 elseif( ch.eq.' ' .or. ch.eq.',' )then buff(i) = ':' elseif( '0'.le.ch .and. ch.le.'9' )then goto 30 else buff(i) = ':' endif c 30 continue c c left justify buff() array to its first character position c also check for a ":" char in the starting position, c if found!! skip it c j = 0 ib = ibeg ie = iend c do 40 i=ib,ie if( i.eq.ibeg .and. buff(i).eq.':' )then c c move the 1st position pointer to the next char & c do not put ":" char in buff(j) array where j=1 c ibeg = ibeg+1 goto 40 endif j = j+1 buff(j) = buff(i) 40 continue c c lgh = iend-ibeg+1 j = lgh+1 buff(j) = '$' c c clean-up the rest of the buff() array c do 50 i=j+1,50 buff(i) = ' ' 50 continue c c save a maximum of 20 characters c if( lgh.gt.20 )then lgh = 20 j = lgh+1 buff(j) = '$' endif c return end GeographicLib-1.52/legacy/Fortran/ngsforward.for0000644000771000077100000003343414064202371021567 0ustar ckarneyckarneycb::forward c program forward c c********1*********2*********3*********4*********5*********6*********7** c c name: forward c version: 201211.29 c author: stephen j. frakes c last mod: Charles Karney c purpose: to compute a geodetic forward (direct problem) c and then display output information c c input parameters: c ----------------- c c output parameters: c ------------------ c c local variables and constants: c ------------------------------ c answer user prompt response c arc meridional arc distance latitude p1 to p2 (meters) c b semiminor axis polar (in meters) c baz azimuth back (in radians) c blimit geodetic distance allowed on ellipsoid (in meters) c buff input char buffer array c dd,dm,ds temporary values for degrees, minutes, seconds c dmt,d_mt char constants for units (in meters) c dd_max maximum ellipsoid distance -1 (in meters) c edist ellipsoid distance (in meters) c elips ellipsoid choice c esq eccentricity squared for reference ellipsoid c faz azimuth forward (in radians) c filout output file name c finv reciprocal flattening c hem hemisphere flag for lat & lon entry c ierror error condition flag with d,m,s conversion c lgh length of buff() array c option user prompt response c r1,r2 temporary variables c ss temporary value for ellipsoid distance c tol tolerance for conversion of seconds c c name1 name of station one c ld1,lm1,sl1 latitude sta one - degrees,minutes,seconds c ald1,alm1,sl1 latitude sta one - degrees,minutes,seconds c lat1sn latitude sta one - sign (+/- 1) c d_ns1 latitude sta one - char ('N','S') c lod1,lom1,slo1 longitude sta one - degrees,minutes,seconds c alod1,alom1,slo1 longitude sta one - degrees,minutes,seconds c lon1sn longitude sta one - sign (+/- 1) c d_ew1 longitude sta one - char ('E','W') c iaz1,maz1,saz1 forward azimuth - degrees,minutes,seconds c isign1 forward azimuth - flag (+/- 1) c azd1,azm1,saz1 forward azimuth - degrees,minutes,seconds c iazsn forward azimuth - flag (+/- 1) c glat1,glon1 station one - (lat & lon in radians ) c c name2 name of station two c ld2,lm2,sl2 latitude sta two - degrees,minutes,seconds c lat2sn latitude sta two - sign (+/- 1) c d_ns2 latitude sta two - char ('N','S') c lod2,lom2,slo2 longitude sta two - degrees,minutes,seconds c lon2sn longitude sta two - sign (+/- 1) c d_ew2 longitude sta two - char ('E','W') c iaz2,maz2,saz2 back azimuth - degrees,minutes,seconds c isign2 back azimuth - flag (+/- 1) c glat2,glon2 station two - (lat & lon in radians ) c c global variables and constants: c ------------------------------- c a semimajor axis equatorial (in meters) c f flattening c pi constant 3.14159.... c rad constant 180.0/pi c c this module called by: n/a c c this module calls: elipss, getdeg, dirct1, todmsp c gethem, trim, bufdms, gvalr8, gvali4, fixdms c datan, write, read, dabs, open, stop c c include files used: n/a c c common blocks used: const, elipsoid c c references: see comments within subroutines c c comments: c c********1*********2*********3*********4*********5*********6*********7** c::modification history c::1990mm.dd, sjf, creation of program c::199412.15, bmt, creation of program on viper c::200203.08, crs, modified by c.schwarz to correct spelling of Clarke c:: at request of Dave Doyle c::200207.18, rws, modified i/o & standardized program documentation c:: added subs trim, bufdms, gethem, gvali4, gvalr8 c::200207.23, rws, added sub gpnarc c::200208.15, rws, fixed an error in bufdms c:: - renamed ellips to elipss "common error" with dirct2 c:: - added FAZ & BAZ to printed output c::200208.19, rws, added more error flags for web interface c:: - added logical nowebb c::200208.xx, sjf, program version number 2.0 c::201211.29, cffk, program version number 3.1 c:: - drop in replacement routines from c:: "Algorithms for Geodesics" c********1*********2*********3*********4*********5*********6*********7** ce::forward c implicit double precision (a-h, o-z) implicit integer (i-n) c logical nowebb c character*1 answer,option,dmt,buff(50),hem character*6 d_ns1, d_ew1, d_ns2, d_ew2, d_mt character*30 filout,name1,name2,elips c integer*4 ierror integer*4 lgh c common/const/pi,rad common/elipsoid/a,f c c ms_unix 0 = web version c 1 = ms_dos or unix c parameter ( ms_unix = 0 ) c pi=4.d0*datan(1.d0) rad=180.d0/pi dmt='m' d_mt='Meters' c if( ms_unix.eq.1 )then nowebb = .true. else nowebb = .false. endif c 1 do 2 i=1,25 write(*,*) ' ' 2 continue 5 write(*,*) ' Program Forward - Version 3.1 ' write(*,*) ' ' write(*,*) ' Ellipsoid options : ' write(*,*) ' ' write(*,*) ' 1) GRS80 / WGS84 (NAD83) ' write(*,*) ' 2) Clarke 1866 (NAD27) ' write(*,*) ' 3) Any other ellipsoid ' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) option 10 format(a1) c if(option.eq.'1') then a=6378137.d0 f=1.d0/298.25722210088d0 elips='GRS80 / WGS84 (NAD83)' elseif(option.eq.'2') then a=6378206.4d0 f=1.d0/294.9786982138d0 elips='Clarke 1866 (NAD27)' elseif(option.eq.'3') then call elipss (elips) else write(*,*) ' Enter 1, 2, or 3 ! Try again --' goto 5 endif c esq = f*(2.0d0-f) c c compute the geodetic limit distance (blimit), it is equal c to twice the equatorial circumference minus one meter c blimit = 2*pi*a-1.0d0 c c maximum distance allowed on ellipsoid c dd_max = blimit c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' c 15 write(*,*) ' Enter First Station ' write(*,16) 16 format(18x,'(Separate D,M,S by blanks or commas)') write(*,*) 'hDD MM SS.sssss Latitude : (h default = N )' c 11 format(50a1) c 22 hem='N' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlat1 = 0 else irlat1 = 1 write(*,*) ' Invalid Latitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 22 endif endif c ald1 = dd alm1 = dm sl1 = ds c if( hem.eq.'N' ) then lat1sn = +1 else lat1sn = -1 endif c write(*,*) 'hDDD MM SS.sssss Longitude : (h default = W )' c 23 hem='W' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlon1 = 0 else irlon1 = 1 write(*,*) ' Invalid Longitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 23 endif endif c alod1 = dd alom1 = dm slo1 = ds c if( hem.eq.'E' ) then lon1sn = +1 else lon1sn = -1 endif c call getdeg(ald1, alm1, sl1, lat1sn, glat1) call getdeg(alod1,alom1,slo1,lon1sn, glon1) c 20 write(*,*) 'DDD MM SS.sss Forward Azimuth : (from north)' c 24 hem='A' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then iazsn = 1 irazi1 = 0 else irazi1 = 1 write(*,*) ' Invalid Azimuth ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 24 endif endif c azd1 = dd azm1 = dm saz1 = ds c call getdeg(azd1,azm1,saz1,iazsn,faz) c write(*,*) 'DDDDDD.dddd Ellipsoidal Distance : (in meters)' c 25 ss = 0.0d0 read(*,*) ss ss = dabs(ss) c if( ss.lt.dd_max )then edist = ss irdst1 = 0 else irdst1 = 1 write(*,*) ' Invalid Distance ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 25 endif edist = 0.001d0 endif c call direct (a, f, glat1, glon1, faz, edist, 0, + glat2, glon2, baz, 0, dummy, dummy, dummy, dummy, dummy) if (baz .ge. 0) then baz = baz - 180 else baz = baz + 180 end if c c set the azimuth seconds tolerance c tol = 0.00005d0 c call todmsp(faz,iaz1,maz1,saz1,isign1) if(isign1.lt.0) then iaz1=359-iaz1 maz1=59-maz1 saz1=60.d0-saz1 endif call fixdms ( iaz1, maz1, saz1, tol ) c call todmsp(baz,iaz2,maz2,saz2,isign2) if(isign2.lt.0) then iaz2=359-iaz2 maz2=59-maz2 saz2=60.d0-saz2 endif call fixdms ( iaz2, maz2, saz2, tol ) c call todmsp(glat1, ld1, lm1, sl1, lat1sn) call todmsp(glon1, lod1, lom1, slo1, lon1sn) call todmsp(glat2, ld2, lm2, sl2, lat2sn) call todmsp(glon2, lod2, lom2, slo2, lon2sn) c call hem_ns ( lat1sn, d_ns1 ) call hem_ew ( lon1sn, d_ew1 ) call hem_ns ( lat2sn, d_ns2 ) call hem_ew ( lon2sn, d_ew2 ) c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,49) elips 49 format(' Ellipsoid : ',a30) finv=1.d0/f b=a*(1.d0-f) write(*,50) a,b,finv 50 format(' Equatorial axis, a = ',f15.4,/, * ' Polar axis, b = ',f15.4,/, * ' Inverse flattening, 1/f = ',f16.11) c 18 format(' LAT = ',i3,1x,i2,1x,f8.5,1x,a6) 19 format(' LON = ',i3,1x,i2,1x,f8.5,1x,a6) c write(*,*) ' ' write(*,*) ' First Station : ' write(*,*) ' ---------------- ' write(*,18) ld1, lm1, sl1, d_ns1 write(*,19) lod1,lom1,slo1,d_ew1 c write(*,*) ' ' write(*,*) ' Second Station : ' write(*,*) ' ---------------- ' write(*,18) ld2, lm2, sl2, d_ns2 write(*,19) lod2,lom2,slo2,d_ew2 c c 32 format(' Ellipsoidal distance S = ',f14.4,1x,a1) 34 format(' Forward azimuth FAZ = ',i3,1x,i2,1x,f7.4, 1 ' From North') 35 format(' Back azimuth BAZ = ',i3,1x,i2,1x,f7.4, 1 ' From North') c write(*,*) ' ' write(*,34) iaz1,maz1,saz1 write(*,35) iaz2,maz2,saz2 write(*,32) edist,dmt write(*,*) ' ' write(*,*) ' Do you want to save this output into a file (y/n)?' read(*,10) answer c if( answer.eq.'Y'.or.answer.eq.'y' )then 39 write(*,*) ' Enter the output filename : ' read(*,40) filout 40 format(a30) open(3,file=filout,status='new',err=99) goto 98 c 99 write(*,*) ' File already exists, try again.' go to 39 c 98 continue write(3,*) ' ' write(3,49) elips write(3,50) a,b,finv write(*,*) ' Enter the First Station name : ' read(*,40) name1 write(*,*) ' Enter the Second Station name : ' read(*,40) name2 c 41 format(' First Station : ',a30) 42 format(' Second Station : ',a30) 84 format(' Error: First Station ... Invalid Latitude ') 85 format(' Error: First Station ... Invalid Longitude ') 86 format(' Error: Forward Azimuth .. Invalid Entry ') 87 format(' Error: Ellipsoid Distance .. Invalid Entry ') 88 format(1x,65(1h*)) 91 format(' DD(0-89) MM(0-59) SS(0-59.999...) ') 92 format(' DDD(0-359) MM(0-59) SS(0-59.999...) ') 93 format(' Geodetic distance is too long ') c write(3,*) ' ' write(3,41) name1 write(3,*) ' ---------------- ' c if( irlat1.eq.0 )then write(3,18) ld1, lm1, sl1, d_ns1 else write(3,88) write(3,84) write(3,91) write(3,88) endif c if( irlon1.eq.0 )then write(3,19) lod1,lom1,slo1,d_ew1 else write(3,88) write(3,85) write(3,92) write(3,88) endif c write(3,*) ' ' write(3,42) name2 write(3,*) ' ---------------- ' write(3,18) ld2, lm2, sl2, d_ns2 write(3,19) lod2,lom2,slo2,d_ew2 c write(3,*) ' ' if( irazi1.eq.0 )then write(3,34) iaz1,maz1,saz1 else write(3,88) write(3,86) write(3,92) write(3,88) endif c write(3,35) iaz2,maz2,saz2 c if( irdst1.eq.0 )then write(3,32) edist,dmt else write(3,88) write(3,87) write(3,93) write(3,88) endif c write(3,*) ' ' endif c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' 1) Another forward, different ellipsoid.' write(*,*) ' 2) Same ellipsoid, two new stations.' write(*,*) ' 3) Same ellipsoid, same First Station.' write(*,*) ' 4) Let the Second Station be the First Station.' write(*,*) ' 5) Done.' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) answer c if( answer.eq.'1')then goto 1 elseif(answer.eq.'2')then goto 15 elseif(answer.eq.'3')then goto 20 elseif(answer.eq.'4')then glat1 = glat2 glon1 = glon2 goto 20 else write(*,*) ' Thats all, folks!' endif c c stop end GeographicLib-1.52/legacy/Fortran/ngsinverse.for0000644000771000077100000003461114064202371021574 0ustar ckarneyckarneycb::inverse c program inverse c c********1*********2*********3*********4*********5*********6*********7** c c name: inverse c version: 201211.29 c author: stephen j. frakes c last mod: Charles Karney c purpose: to compute a geodetic inverse c and then display output information c c input parameters: c ----------------- c c output parameters: c ------------------ c c local variables and constants: c ------------------------------ c answer user prompt response c b semiminor axis polar (in meters) c baz azimuth back (in radians) c buff input char buffer array c dd,dm,ds temporary values for degrees, minutes, seconds c dlon temporary value for difference in longitude (radians) c dmt,d_mt char constants for meter units c edist ellipsoid distance (in meters) c elips ellipsoid choice c esq eccentricity squared for reference ellipsoid c faz azimuth forward (in radians) c filout output file name c finv reciprocal flattening c hem hemisphere flag for lat & lon entry c ierror error condition flag with d,m,s conversion c lgh length of buff() array c option user prompt response c r1,r2 temporary variables c ss temporary variable c tol tolerance for conversion of seconds c c name1 name of station one c ld1,lm1,sl1 latitude sta one - degrees,minutes,seconds c ald1,alm1,sl1 latitude sta one - degrees,minutes,seconds c lat1sn latitude sta one - sign (+/- 1) c d_ns1 latitude sta one - char ('N','S') c lod1,lom1,slo1 longitude sta one - degrees,minutes,seconds c alod1,alom1,slo1 longitude sta one - degrees,minutes,seconds c lon1sn longitude sta one - sign (+/- 1) c d_ew1 longitude sta one - char ('E','W') c iaz1,maz1,saz1 forward azimuth - degrees,minutes,seconds c isign1 forward azimuth - flag (+/- 1) c glat1,glon1 station one - (lat & lon in radians ) c p1,e1 standpoint one - (lat & lon in radians ) c c name2 name of station two c ld2,lm2,sl2 latitude sta two - degrees,minutes,seconds c ald2,alm2,sl2 latitude sta two - degrees,minutes,seconds c lat2sn latitude sta two - sign (+/- 1) c d_ns2 latitude sta two - char ('N','S') c lod2,lom2,slo2 longitude sta two - degrees,minutes,seconds c alod2,alom2,slo2 longitude sta one - degrees,minutes,seconds c lon2sn longitude sta two - sign (+/- 1) c d_ew2 longitude sta two - char ('E','W') c iaz2,maz2,saz2 back azimuth - degrees,minutes,seconds c isign2 back azimuth - flag (+/- 1) c glat2,glon2 station two - (lat & lon in radians ) c p2,e2 forepoint two - (lat & lon in radians ) c c global variables and constants: c ------------------------------- c a semimajor axis equatorial (in meters) c f flattening c pi constant 3.14159.... c rad constant 180.0/pi c c this module called by: n/a c c this module calls: elipss, getdeg, inver1, todmsp c gethem, trim, bufdms, gvalr8, gvali4, fixdms, gpnhri *********** c gethem, trim, bufdms, gvalr8, gvali4, fixdms, invers <---------- c datan, write, read, dabs, open, stop c c include files used: n/a c c common blocks used: const, elipsoid c c references: see comments within subroutines c c comments: c c********1*********2*********3*********4*********5*********6*********7** c::modification history c::1990mm.dd, sjf, creation of program c::199412.15, bmt, creation of program on viper c::200203.08, crs, modified by c.schwarz to correct spelling of Clarke c::200207.15, rws, modified i/o & standardized program documentation c:: added subs trim, bufdms, gethem, gvali4, gvalr8 c::200207.23, rws, replaced sub inver1 with gpnarc, gpnloa, gpnhri c::200208.15, rws, fixed an error in bufdms c:: - renamed ellips to elipss "common error" with dirct2 c:: - added FAZ & BAZ to printed output c::200208.19, rws, added more error flags for web interface code c:: - added logical nowebb c::200208.xx, sjf, program version number 2.0 c::201105.xx, dgm, program version number 3.0 c:: - replaced sub gpnarc, gpnloa, gpnhri with invers c:: - tested for valid antipodal solutions (+/- 0.1 mm) c:: - tested for polar solutions (+/- 0.1 mm) c:: - needs improvement for long-line/antipodal boundary c::201211.29, cffk, program version numer 3.1 c:: - drop in replacement routines from c:: "Algorithms for Geodesics" c********1*********2*********3*********4*********5*********6*********7** ce::inverse c implicit double precision (a-h, o-z) implicit integer (i-n) c logical nowebb c character*1 answer,option,dmt,buff(50),hem character*6 d_ns1, d_ew1, d_ns2, d_ew2, d_mt character*30 filout,name1,name2,elips c integer*4 ierror integer*4 lgh c common/const/pi,rad common/elipsoid/a,f c c ms_unix 0 = web version c 1 = ms_dos or unix version c parameter ( ms_unix = 0 ) c pi = 4.d0*datan(1.d0) rad = 180.d0/pi dmt = 'm' d_mt = 'Meters' c if( ms_unix.eq.1 )then nowebb = .true. else nowebb = .false. endif c 1 do 2 i=1,25 write(*,*) ' ' 2 continue c 5 write(*,*) ' Program Inverse - Version 3.1 ' write(*,*) ' ' write(*,*) ' Ellipsoid options : ' write(*,*) ' ' write(*,*) ' 1) GRS80 / WGS84 (NAD83) ' write(*,*) ' 2) Clarke 1866 (NAD27) ' write(*,*) ' 3) Any other ellipsoid ' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) option 10 format(a1) c if(option.eq.'1') then a=6378137.d0 f=1.d0/298.257222100882711243162836600094d0 elips='GRS80 / WGS84 (NAD83)' elseif(option.eq.'2') then a=6378206.4d0 f=1.d0/294.9786982138d0 elips='Clarke 1866 (NAD27)' elseif(option.eq.'3') then call elipss (elips) else write(*,*) ' Enter 1, 2, or 3 ! Try again --' goto 5 endif c esq = f*(2.0d0-f) c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' c 15 write(*,*) ' Enter First Station ' write(*,16) 16 format(18x,'(Separate D,M,S by blanks or commas)') write(*,*) 'hDD MM SS.sssss Latitude : (h default = N )' 11 format(50a1) c 22 hem='N' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlat1 = 0 else irlat1 = 1 write(*,*) ' Invalid Latitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 22 endif endif c ald1 = dd alm1 = dm sl1 = ds c if( hem.eq.'N' ) then lat1sn = +1 else lat1sn = -1 endif c write(*,*) 'hDDD MM SS.sssss Longitude : (h default = W )' c 23 hem='W' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlon1 = 0 else irlon1 = 1 write(*,*) ' Invalid Longitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 23 endif endif c alod1 = dd alom1 = dm slo1 = ds c if( hem.eq.'E' ) then lon1sn = +1 else lon1sn = -1 endif c call getdeg(ald1, alm1, sl1, lat1sn, glat1) call getdeg(alod1,alom1,slo1,lon1sn, glon1) c write(*,*) ' ' write(*,*) ' ' c 20 write(*,*) ' Enter Second Station ' write(*,16) write(*,*) 'hDD MM SS.sssss Latitude : (h default = N )' c 24 hem='N' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlat2 = 0 else irlat2 = 1 write(*,*) ' Invalid Latitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 24 endif endif c ald2 = dd alm2 = dm sl2 = ds c if( hem.eq.'N' ) then lat2sn = +1 else lat2sn = -1 endif c write(*,*) 'hDDD MM SS.sssss Longitude : (h default = W )' c 25 hem='W' read(*,11) buff call trim (buff,lgh,hem) call bufdms (buff,lgh,hem,dd,dm,ds,ierror) c if( ierror.eq.0 )then irlon2 = 0 else irlon2 = 1 write(*,*) ' Invalid Longitude ... Please re-enter it ' write(*,*) ' ' if( nowebb )then goto 25 endif endif c alod2 = dd alom2 = dm slo2 = ds c if( hem.eq.'E' )then lon2sn = +1 else lon2sn = -1 endif c call getdeg(ald2, alm2, sl2, lat2sn, glat2) call getdeg(alod2,alom2,slo2,lon2sn, glon2) c p1 = glat1 e1 = glon1 p2 = glat2 e2 = glon2 c if( e1.lt.0.0d0 )then e1 = e1+2.0d0*pi endif if( e2.lt.0.0d0 )then e2 = e2+2.0d0*pi endif c c compute the geodetic inverse c call invers(a, f, p1, e1, p2, e2, + edist, faz, baz, 0, dummy, dummy, dummy, dummy, dummy) if (baz .ge. 0) then baz = baz - 180 else baz = baz + 180 end if c c set the tolerance (in seconds) for the azimuth conversion c tol = 0.00005d0 c call todmsp(faz,iaz1,maz1,saz1,isign1) if(isign1.lt.0) then iaz1=359-iaz1 maz1=59-maz1 saz1=60.d0-saz1 endif call fixdms ( iaz1, maz1, saz1, tol ) c call todmsp(baz,iaz2,maz2,saz2,isign2) if(isign2.lt.0) then iaz2=359-iaz2 maz2=59-maz2 saz2=60.d0-saz2 endif call fixdms ( iaz2, maz2, saz2, tol ) c call todmsp(glat1, ld1, lm1, sl1, lat1sn) call todmsp(glon1, lod1, lom1, slo1, lon1sn) call todmsp(glat2, ld2, lm2, sl2, lat2sn) call todmsp(glon2, lod2, lom2, slo2, lon2sn) c call hem_ns ( lat1sn, d_ns1 ) call hem_ew ( lon1sn, d_ew1 ) call hem_ns ( lat2sn, d_ns2 ) call hem_ew ( lon2sn, d_ew2 ) c write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,49) elips 49 format(' Ellipsoid : ',a30) finv=1.d0/f b=a*(1.d0-f) write(*,50) a,b,finv 50 format(' Equatorial axis, a = ',f15.4,/, * ' Polar axis, b = ',f15.4,/, * ' Inverse flattening, 1/f = ',f16.11) c 18 format(' LAT = ',i3,1x,i2,1x,f8.5,1x,a6) 19 format(' LON = ',i3,1x,i2,1x,f8.5,1x,a6) c write(*,*) ' ' write(*,*) ' First Station : ' write(*,*) ' ---------------- ' write(*,18) ld1, lm1, sl1, d_ns1 write(*,19) lod1,lom1,slo1,d_ew1 c write(*,*) ' ' write(*,*) ' Second Station : ' write(*,*) ' ---------------- ' write(*,18) ld2, lm2, sl2, d_ns2 write(*,19) lod2,lom2,slo2,d_ew2 c 32 format(' Ellipsoidal distance S = ',f14.4,1x,a1) 34 format(' Forward azimuth FAZ = ',i3,1x,i2,1x,f7.4, 1 ' From North') 35 format(' Back azimuth BAZ = ',i3,1x,i2,1x,f7.4, 1 ' From North') c write(*,*) ' ' write(*,34) iaz1,maz1,saz1 write(*,35) iaz2,maz2,saz2 write(*,32) edist,dmt write(*,*) ' ' write(*,*) ' Do you want to save this output into a file (y/n)?' read(*,10) answer c if( answer.eq.'Y'.or.answer.eq.'y' )then 39 write(*,*) ' Enter the output filename : ' read(*,40) filout 40 format(a30) open(3,file=filout,status='new',err=99) goto 98 c 99 write(*,*) ' File already exists, try again.' go to 39 c 98 continue write(3,*) ' ' write(3,49) elips finv=1.d0/f b=a*(1.d0-f) write(3,50) a,b,finv write(*,*) ' Enter the First Station name : ' read(*,40) name1 write(*,*) ' Enter the Second Station name : ' read(*,40) name2 c 41 format(' First Station : ',a30) 42 format(' Second Station : ',a30) 84 format(' Error: First Station ... Invalid Latitude ') 85 format(' Error: First Station ... Invalid Longitude ') 86 format(' Error: Second Station ... Invalid Latitude ') 87 format(' Error: Second Station ... Invalid Longitude ') 88 format(1x,65(1h*)) 91 format(' DD(0-89) MM(0-59) SS(0-59.999...) ') 92 format(' DDD(0-359) MM(0-59) SS(0-59.999...) ') c write(3,*) ' ' write(3,41) name1 write(3,*) ' ---------------- ' if( irlat1.eq.0 )then write(3,18) ld1, lm1, sl1, d_ns1 else write(3,88) write(3,84) write(3,91) write(3,88) endif c if( irlon1.eq.0 )then write(3,19) lod1,lom1,slo1,d_ew1 else write(3,88) write(3,85) write(3,92) write(3,88) endif c write(3,*) ' ' write(3,42) name2 write(3,*) ' ---------------- ' c if( irlat2.eq.0 )then write(3,18) ld2, lm2, sl2, d_ns2 else write(3,88) write(3,86) write(3,91) write(3,88) endif c if( irlon2.eq.0 )then write(3,19) lod2,lom2,slo2,d_ew2 else write(3,88) write(3,87) write(3,92) write(3,88) endif c write(3,*) ' ' write(3,34) iaz1,maz1,saz1 write(3,35) iaz2,maz2,saz2 write(3,32) edist,dmt write(3,*) ' ' endif c 80 write(*,*) ' ' write(*,*) ' ' write(*,*) ' ' write(*,*) ' 1) Another inverse, different ellipsoid.' write(*,*) ' 2) Same ellipsoid, two new stations.' write(*,*) ' 3) Same ellipsoid, same First Station.' write(*,*) ' 4) Done.' write(*,*) ' ' write(*,*) ' Enter choice : ' read(*,10) answer c if( answer.eq.'1' )then goto 1 elseif( answer.eq.'2' )then goto 15 elseif( answer.eq.'3' )then goto 20 else write(*,*) ' Thats all, folks!' endif c stop end GeographicLib-1.52/legacy/Fortran/planimeter.for0000644000771000077100000000162714064202371021552 0ustar ckarneyckarney*> @file planimeter.for *! @brief A test program for area() *> A simple program to compute the area of a geodesic polygon. *! *! This program reads in up to 100000 lines with lat, lon for each vertex *! of a polygon. At the end of input, the program prints the number of *! vertices, the perimeter of the polygon and its area (for the WGS84 *! ellipsoid). program planimeter implicit none include 'geodesic.inc' integer maxpts parameter (maxpts = 100000) double precision a, f, lats(maxpts), lons(maxpts), S, P integer n * WGS84 values a = 6378137d0 f = 1/298.257223563d0 n = 0 10 continue if (n .ge. maxpts) go to 20 read(*, *, end=20, err=20) lats(n+1), lons(n+1) n = n+1 go to 10 20 continue call area(a, f, lats, lons, n, S, P) print 30, n, P, S 30 format(i6, 1x, f20.8, 1x, f20.3) stop end GeographicLib-1.52/man/CMakeLists.txt0000644000771000077100000001033714064202371017334 0ustar ckarneyckarney# 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) endif () set (MANPAGES) set (USAGE) set (HTMLMAN) set (SYSMANPAGES) # 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} ${CMAKE_CURRENT_BINARY_DIR}/${TOOL}.1) set (USAGE ${USAGE} ${CMAKE_CURRENT_BINARY_DIR}/${TOOL}.usage) set (HTMLMAN ${HTMLMAN} ${CMAKE_CURRENT_BINARY_DIR}/${TOOL}.1.html) if (MAINTAINER) add_custom_command (OUTPUT ${TOOL}.1 COMMAND pod2man --center=\"GeographicLib Utilities\" --release=\"GeographicLib ${PROJECT_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 --title "'${TOOL}(1)'" --noindex ${CMAKE_CURRENT_SOURCE_DIR}/${TOOL}.pod | sed -e 's%%%' -e 's%\\\([^<>]*\\\)\(\\\(.\\\)\)%&%'g > ${TOOL}.1.html && cp ${TOOL}.1.html ../doc/html-stage/ 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 ${PROJECT_VERSION} > ${TOOL}.usage COMMENT "Building usage code for ${TOOL}" MAIN_DEPENDENCY ${TOOL}.pod) else () if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${TOOL}.usage) file (COPY ${TOOL}.usage DESTINATION .) else () configure_file (dummy.usage.in ${TOOL}.usage @ONLY) endif () if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${TOOL}.1) file (COPY ${TOOL}.1 DESTINATION .) else () configure_file (dummy.1.in ${TOOL}.1 @ONLY) endif () if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${TOOL}.1.html) file (COPY ${TOOL}.1.html DESTINATION .) else () configure_file (dummy.1.html.in ${TOOL}.1.html @ONLY) endif () if (DOXYGEN_FOUND) file (COPY ${CMAKE_CURRENT_BINARY_DIR}/${TOOL}.1.html DESTINATION ../doc/html-stage) endif () endif () endforeach () if (NOT WIN32) foreach (SCRIPT ${SCRIPTS}) string (REPLACE geographiclib-get- "" DATA ${SCRIPT}) set (SYSMANPAGES ${SYSMANPAGES} ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT}.8) configure_file (script.8.in ${SCRIPT}.8 @ONLY) endforeach () endif () # 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 install -C -m 644 "$$f" ${CMAKE_CURRENT_SOURCE_DIR}\; done COMMENT "Installing man documentation page in source tree") else () add_custom_target (htmlman ALL DEPENDS ${HTMLMAN}) endif () # Install the man pages. install (FILES ${MANPAGES} DESTINATION share/man/man1) if (NOT WIN32) install (FILES ${SYSMANPAGES} DESTINATION share/man/man8) endif () GeographicLib-1.52/man/CartConvert.pod0000644000771000077100000001200714064202371017526 0ustar ckarneyckarney=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<-w> ] [ 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 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 details on the allowed formats for latitude and longitude, see the C section of GeoConvert(1). 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. In general there are multiple solutions and the result which minimizes the absolute value of I is returned, i.e., (I, I) corresponds to the closest point on the ellipsoid. =item B<-l> I I I specifies conversions to and from a local cartesion coordinate systems with origin I I I, instead of a geocentric coordinate system. The B<-w> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before B<-l>. =item B<-e> I I specify the ellipsoid via the equatorial radius, I and the flattening, 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. By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<-w> toggle the longitude first flag (it starts off); if the flag is on, then 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<-p> I set the output precision to I (default 6). I is the number of digits after the decimal point for geocentric and local cartesion coordinates and for the height (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is I + 5. =item B<--comment-delimiter> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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.52/man/ConicProj.pod0000644000771000077100000001301714064202371017164 0ustar ckarneyckarney=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<-w> ] [ 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 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 details on the allowed formats for latitude and longitude, see the C section of GeoConvert(1). 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> I I use the Lambert conformal conic projection with standard parallels I and I. =item B<-a> I I use the Albers equal area projection with standard parallels I and I. =item B<-l> I specify the longitude of origin I (degrees, default 0). =item B<-k> I 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> I I specify the ellipsoid via the equatorial radius, I and the flattening, 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. By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<-w> toggle the longitude first flag (it starts off); if the flag is on, then 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<-p> I set the output precision to I (default 6). I is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is I + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is I + 6. =item B<--comment-delimiter> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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.52/man/GeoConvert.pod0000644000771000077100000003317314064202371017356 0ustar ckarneyckarney=head1 NAME GeoConvert -- convert geographic coordinates =head1 SYNOPSIS B [ B<-g> | B<-d> | B<-:> | B<-u> | B<-m> | B<-c> ] [ B<-z> I | B<-s> | B<-t> | B<-S> | B<-T> ] [ B<-n> ] [ B<-w> ] [ B<-p> I ] [ B<-l> | B<-a> ] [ 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, and seconds. Latitude is given first (unless the B<-w> option is given). See L for a description of the format. 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) or 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. The meridian convergence is the bearing of grid north given as degrees clockwise from true north. =item B<-z> I 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, 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<-S> or B<-T> behave the same as B<-s> and B<-t>, respectively, until the first legal conversion is performed. For subsequent points, the zone and hemisphere of that conversion are used. This enables a sequence of points to be converted into UTM or UPS using a consistent coordinate system. =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> toggle the longitude first flag (it starts off); if the flag is on, then 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<-p> I set the output precision to I (default 0); I is the precision relative to 1 m. See L. =item B<-l> on output, UTM/UPS uses the long forms I and I to designate the hemisphere instead of I or I. =item B<-a> on output, UTM/UPS uses the abbreviations I and I to designate the hemisphere instead of I or I; this is the default representation. =item B<--comment-delimiter> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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. For MGRS, The number of digits per coordinate is 5 + I; I = -6 results in just the grid zone. 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 (-6 for MGRS) 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 GEOGRAPHIC COORDINATES The utility accepts geographic coordinates, latitude and longitude, in a number of common formats. Latitude precedes longitude, unless the B<-w> option is given which switches this convention. On input, either coordinate may be given first by appending or prepending I or I to the latitude and I or I to the longitude. These hemisphere designators carry an implied sign, positive for I and I and negative for I and I. This sign multiplies any +/- sign prefixing the coordinate. The coordinates may be given as decimal degree or as degrees, minutes, and 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.) Alternatively, : (colon) may be used to separate the various components. Only the final component of coordinate can include a decimal point, and the minutes and seconds components must be less than 60. It is also possible to carry out addition or subtraction operations in geographic coordinates. If the coordinate includes interior signs (i.e., not at the beginning or immediately after an initial hemisphere designator), then the coordinate is split before such signs; the pieces are parsed separately and the results summed. For example the point 15" east of 39N 70W is 39N 70W+0:0:15E B "Exponential" notation is not recognized for geographic coordinates. Thus 7.0E1 is illegal, while 7.0E+1 is parsed as (7.0E) + (+1), yielding the same result as 8.0E. 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; in addition two single quotes can be used to represent ". The other GeographicLib utilities use the same rules for interpreting geographic coordinates; in addition, azimuths and arc lengths are interpreted the same way. =head1 QUOTING Unfortunately the characters ' and " have special meanings in many shells and have to be entered with care. However note (1) that the trailing designator is optional and that (2) you can use colons as a separator character. Thus 10d20' can be entered as 10d20 or 10:20 and 10d20'30" can be entered as 10:20:30. =over =item Unix shells (sh, bash, tsch) The characters ' and " can be quoted by preceding them with a \ (backslash); or you can quote a string containing ' with a pair of "s. The two alternatives are illustrated by echo 10d20\'30\" "20d30'40" | GeoConvert -d -p -1 => 10d20'30"N 020d30'40"E Quoting of command line arguments is similar GeoConvert -d -p -1 --input-string "10d20'30\" 20d30'40" => 10d20'30"N 020d30'40"E =item Windows command shell (cmd) The ' character needs no quoting; the " character can either be quoted by a ^ or can be represented by typing ' twice. (This quoting is usually unnecessary because the trailing designator can be omitted.) Thus echo 10d20'30'' 20d30'40 | GeoConvert -d -p -1 => 10d20'30"N 020d30'40"E Use \ to quote the " character in a command line argument GeoConvert -d -p -1 --input-string "10d20'30\" 20d30'40" => 10d20'30"N 020d30'40"E =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 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. When an MGRS coordinate is provided as input, B treats this as a representative point within the square. By default, this representative point is the I

of the square (C<38n 444500 3688500> in the example above). (This leads to a stable conversion between MGRS and geographic coordinates.) 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>, and 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 Is I is specified with a hemisphere, then this is honored when printing UTM coordinates: echo -1 3 | GeoConvert -u => 31s 500000 9889470 echo -1 3 | GeoConvert -u -z 31 => 31s 500000 9889470 echo -1 3 | GeoConvert -u -z 31s => 31s 500000 9889470 echo -1 3 | GeoConvert -u -z 31n => 31n 500000 -110530 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 (or I); replace I thru I by I (or I). =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 GeoConvert can be used to do simple arithmetic using degree, minutes, and seconds. For example, sometimes data is tiled in 15 second squares tagged by the DMS representation of the SW corner. The tags of the tile at 38:59:45N 077:02:00W and its 8 neighbors are then given by t=0:0:15 for y in -$t +0 +$t; do for x in -$t +0 +$t; do echo 38:59:45N$y 077:02:00W$x done done | GeoConvert -: -p -1 | tr -d ': ' => 385930N0770215W 385930N0770200W 385930N0770145W 385945N0770215W 385945N0770200W 385945N0770145W 390000N0770215W 390000N0770200W 390000N0770145W =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 An online version of this utility is availbable at L. The algorithms for the transverse Mercator projection are described in C. F. F. Karney, I, J. Geodesy 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.52/man/GeodSolve.pod0000644000771000077100000003302114064202371017162 0ustar ckarneyckarney=head1 NAME GeodSolve -- perform geodesic calculations =head1 SYNOPSIS B [ B<-i> | B<-L> I I I | B<-D> I I I I | B<-I> I I I I ] [ B<-a> ] [ B<-e> I I ] [ B<-u> ] [ B<-F> ] [ B<-d> | B<-:> ] [ B<-w> ] [ B<-b> ] [ B<-f> ] [ B<-p> I ] [ B<-E> ] [ 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 forward 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. 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. =item 3. 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. Command line arguments B<-D> and B<-I> work similarly with the geodesic line defined in terms of a direct or inverse geodesic calculation, respectively. =back =head1 OPTIONS =over =item B<-i> perform an inverse geodesic calculation (see 2 above). =item B<-L> I I I line mode (see 3 above); generate a sequence of points along the geodesic specified by I I I. The B<-w> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before B<-L>. (B<-l> is an alternative, deprecated, spelling of this flag.) =item B<-D> I I I I line mode (see 3 above); generate a sequence of points along the geodesic specified by I I I I. The B<-w> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before B<-D>. Similarly, the B<-a> flag can be used to change the interpretation of I to I, provided that it appears before B<-D>. =item B<-I> I I I I line mode (see 3 above); generate a sequence of points along the geodesic specified by I I I I. The B<-w> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before B<-I>. =item B<-a> toggle the arc mode flag (it starts off); if this flag is on, then on input I output I is replaced by I the arc length (in degrees) on the auxiliary sphere. See L. =item B<-e> I I specify the ellipsoid via the equatorial radius, I and the flattening, 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. By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<-u> unroll the longitude. Normally, on output longitudes are reduced to lie in [-180deg,180deg). However with this option, the returned longitude I is "unrolled" so that I - I indicates how often and in what sense the geodesic has encircled the earth. Use the B<-f> option, to get both longitudes printed. =item B<-F> fractional mode. This only has any effect with the B<-D> and B<-I> options (and is otherwise ignored). The values read on standard input are interpreted as fractional distances to point 3, i.e., as I/I instead of I. If arc mode is in effect, then the values denote fractional arc length, i.e., I/I. The fractional distances can be entered as a simple fraction, e.g., 3/4. =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<-w> toggle the longitude first flag (it starts off); if the flag is on, then 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<-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> I set the output precision to I (default 3); I is the precision relative to 1 m. See L. =item B<-E> use "exact" algorithms (based on elliptic integrals) for the geodesic calculations. These are more accurate than the (default) series expansions for |I| E 0.02. =item B<--comment-delimiter> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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, and all areas (I) in meters^2. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees, minutes, seconds. For example, C<40d30>, C<40d30'>, C<40:30>, C<40.5d>, and C<40.5> are all equivalent. By default, latitude precedes longitude for each point (the B<-w> flag switches this convention); 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. For details on the allowed formats for angles, see the C section of GeoConvert(1). =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: s13 = s12 + s23, a13 = a12 + a23, S13 = S12 + S23, m13 = m12 M23 + m23 M21, M13 = M12 M23 - (1 - M12 M21) m23 / m12, M31 = M32 M21 - (1 - M23 M32) m12 / m23. 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 geodesic 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 I + 5. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is I + 1. 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 ACCURACY Using the (default) series solution, GeodSolve is accurate to about 15 nm (15 nanometers) for the WGS84 ellipsoid. The approximate maximum error (expressed as a distance) for an ellipsoid with the same equatorial radius as the WGS84 ellipsoid and different values of the flattening is |f| error 0.01 25 nm 0.02 30 nm 0.05 10 um 0.1 1.5 mm 0.2 300 mm If B<-E> is specified, GeodSolve is accurate to about 40 nm (40 nanometers) for the WGS84 ellipsoid. The approximate maximum error (expressed as a distance) for an ellipsoid with a quarter meridian of 10000 km and different values of the I = 1 - I is 1-f error (nm) 1/128 387 1/64 345 1/32 269 1/16 210 1/8 115 1/4 69 1/2 36 1 15 2 25 4 96 8 318 16 985 32 2352 64 6008 128 19024 =head1 MULTIPLE SOLUTIONS The shortest distance returned for the inverse problem is (obviously) uniquely defined. However, in a few special cases there are multiple azimuths which yield the same shortest distance. Here is a catalog of those cases: =over =item I = -I (with neither point at a pole) If I = I, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [I,I] = [I,I], [I,I] = [I,I], I = -I. (This occurs when the longitude difference is near +/-180 for oblate ellipsoids.) =item I = I +/- 180 (with neither point at a pole) If I = 0 or +/-180, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [I,I] = [-I,-I], I = -I. (This occurs when I is near -I for prolate ellipsoids.) =item Points 1 and 2 at opposite poles There are infinitely many geodesics which can be generated by setting [I,I] = [I,I] + [I,-I], for arbitrary I. (For spheres, this prescription applies when points 1 and 2 are antipodal.) =item I = 0 (coincident points) There are infinitely many geodesics which can be generated by setting [I,I] = [I,I] + [I,I], for arbitrary I. =back =head1 EXAMPLES Route from JFK Airport to Singapore Changi Airport: echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E | GeodSolve -i -: -p 0 003:18:29.9 177:29:09.2 15347628 Equally spaced waypoints on the route: for ((i = 0; i <= 10; ++i)); do echo $i/10; done | GeodSolve -I 40:38:23N 073:46:44W 01:21:33N 103:59:22E -F -: -p 0 40:38:23.0N 073:46:44.0W 003:18:29.9 54:24:51.3N 072:25:39.6W 004:18:44.1 68:07:37.7N 069:40:42.9W 006:44:25.4 81:38:00.4N 058:37:53.9W 017:28:52.7 83:43:26.0N 080:37:16.9E 156:26:00.4 70:20:29.2N 097:01:29.4E 172:31:56.4 56:38:36.0N 100:14:47.6E 175:26:10.5 42:52:37.1N 101:43:37.2E 176:34:28.6 29:03:57.0N 102:39:34.8E 177:07:35.2 15:13:18.6N 103:22:08.0E 177:23:44.7 01:21:33.0N 103:59:22.0E 177:29:09.2 =head1 SEE ALSO GeoConvert(1). An online version of this utility is availbable at L. The algorithms are described in C. F. F. Karney, I, J. Geodesy 87, 43-55 (2013); DOI: L; addenda: L. The Wikipedia page, Geodesics on an ellipsoid, L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in 2009-03. Prior to version 1.30, it was called B. (The name was changed to avoid a conflict with the B utility in I.) GeographicLib-1.52/man/GeodesicProj.pod0000644000771000077100000001306114064202371017652 0ustar ckarneyckarney=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<-w> ] [ 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 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 details on the allowed formats for latitude and longitude, see the C section of GeoConvert(1). 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> I I use the azimuthal equidistant projection centered at latitude = I, longitude = I. The B<-w> flag can be used to swap the default order of the 2 coordinates, provided that it appears before B<-z>. =item B<-c> I I use the Cassini-Soldner projection centered at latitude = I, longitude = I. The B<-w> flag can be used to swap the default order of the 2 coordinates, provided that it appears before B<-c>. =item B<-g> I I use the ellipsoidal gnomonic projection centered at latitude = I, longitude = I. The B<-w> flag can be used to swap the default order of the 2 coordinates, provided that it appears before B<-g>. =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> I I specify the ellipsoid via the equatorial radius, I and the flattening, 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. By default, the WGS84 ellipsoid is used, I = 6378137 m, I = 1/298.257223563. =item B<-w> toggle the longitude first flag (it starts off); if the flag is on, then 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<-p> I set the output precision to I (default 6). I is the number of digits after the decimal point for lengths (in meters). For latitudes, longitudes, and azimuths (in degrees), the number of digits after the decimal point is I + 5. For the scale, the number of digits after the decimal point is I + 6. =item B<--comment-delimiter> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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 8 of C. F. F. Karney, I, J. Geodesy 87, 43-55 (2013); DOI L; addenda: 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.52/man/GeoidEval.pod0000644000771000077100000002444214064202371017141 0ustar ckarneyckarney=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<-w> ] [ 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 heights of the geoid above the WGS84 ellipsoid on standard output. 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. The height of the geoid above the ellipsoid, I, is sometimes called the geoid undulation. It can be used to convert a height above the ellipsoid, I, to the corresponding height above the geoid (the orthometric height, roughly the height above mean sea level), I, using the relations =over I = I + I, EEI = -I + I. =back =head1 OPTIONS =over =item B<-n> I use geoid I instead of the default C. See L. =item B<-d> I 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> I I I I cache the data bounded by I I I I in memory. The first two arguments specify the SW corner of the cache and the last two arguments specify the NE corner. The B<-w> flag specifies that longitude precedes latitude for these corners, provided that it appears before B<-c>. See L. =item B<-w> toggle the longitude first flag (it starts off); if the flag is on, then when reading geographic coordinates, longitude precedes latitude (this can be overridden by a hemisphere designator, I, I, I, I). =item B<-z> I 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> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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. =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 geoid path. If it is set (and if B is not set), then $B/geoids 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), geographiclib-get-geoids(8). An online version of this utility is availbable at L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in 2009-09. GeographicLib-1.52/man/Gravity.pod0000644000771000077100000002071414064202371016725 0ustar ckarneyckarney=head1 NAME Gravity -- compute the earth's gravity field =head1 SYNOPSIS B [ B<-n> I ] [ B<-d> I ] [ B<-N> I ] [ B<-M> I ] [ B<-G> | B<-D> | B<-A> | B<-H> ] [ B<-c> I I ] [ B<-w> ] [ 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; for details on the allowed formats for latitude and longitude, see the C section of GeoConvert(1). 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, except for grs80, 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> I use gravity field model I instead of the default C. See L. =item B<-d> I read gravity models from I instead of the default. See L. =item B<-N> I limit the degree of the model to I. =item B<-M> I limit the order of the model to I. =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> I I 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<-w> toggle the longitude first flag (it starts off); if the flag is on, then 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<-p> I 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> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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 https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm84 egm96, earth gravity model 1996. See https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm96 egm2008, earth gravity model 2008. See https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm2008 wgs84, world geodetic system 1984. This returns the normal gravity for the WGS84 ellipsoid. grs80, geodetic reference system 1980. This returns the normal gravity for the GRS80 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), geographiclib-get-gravity(8). =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in version 1.16. GeographicLib-1.52/man/MagneticField.pod0000644000771000077100000002312214064202371017767 0ustar ckarneyckarney=head1 NAME MagneticField -- compute the earth's magnetic field =head1 SYNOPSIS B [ B<-n> I ] [ B<-d> I ] [ B<-N> I ] [ B<-M> I ] [ B<-t> I = 6378137 m, I = 1/298.257223563. =head1 OPTIONS =over =item B<-n> I use magnetic field model I instead of the default C. See L. =item B<-d> I read magnetic models from I instead of the default. See L. =item B<-N> I limit the degree of the model to I. =item B<-M> I limit the order of the model to I. =item B<-t> 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&%'g man1_MANS = $(MANPAGES) man8_MANS = $(SYSMANPAGES) SUFFIXES = .pod .1 .usage .1.html .8 all: man man: manpages usage htmlman sysmanpages manpages: $(MANPAGES) usage: $(USAGE) htmlman: $(HTMLMAN) sysmanpages: $(SYSMANPAGES) if HAVE_PODPROGS .pod.usage: sh $(srcdir)/makeusage.sh $< $(VERSION) > $@ .pod.1: $(POD2MAN) $^ > $@ .pod.1.html: pod2html --noindex --title "$*(1)" $^ | $(PODFIX) > $@ else USAGECMD = cat $(srcdir)/$@ 2> /dev/null || \ sed -e "s/@TOOL@/$*/g" -e "s/@PROJECT_VERSION@/$(VERSION)/g" \ $(srcdir)/dummy.usage.in > $@ MANCMD = cat $(srcdir)/$@ 2> /dev/null || \ sed -e "s/@TOOL@/$*/g" -e "s/@PROJECT_VERSION@/$(VERSION)/g" \ $(srcdir)/dummy.1.in > $@ HTMLCMD = cat $(srcdir)/$@ 2> /dev/null || \ sed -e "s/@TOOL@/$*/g" -e "s/@PROJECT_VERSION@/$(VERSION)/g" \ $(srcdir)/dummy.1.html.in > $@ CartConvert.usage: $(USAGECMD) ConicProj.usage: $(USAGECMD) GeodesicProj.usage: $(USAGECMD) GeoConvert.usage: $(USAGECMD) GeodSolve.usage: $(USAGECMD) GeoidEval.usage: $(USAGECMD) Gravity.usage: $(USAGECMD) MagneticField.usage: $(USAGECMD) Planimeter.usage: $(USAGECMD) RhumbSolve.usage: $(USAGECMD) TransverseMercatorProj.usage: $(USAGECMD) CartConvert.1: $(MANCMD) ConicProj.1: $(MANCMD) GeodesicProj.1: $(MANCMD) GeoConvert.1: $(MANCMD) GeodSolve.1: $(MANCMD) GeoidEval.1: $(MANCMD) Gravity.1: $(MANCMD) MagneticField.1: $(MANCMD) Planimeter.1: $(MANCMD) RhumbSolve.1: $(MANCMD) TransverseMercatorProj.1: $(MANCMD) CartConvert.1.html: $(HTMLCMD) ConicProj.1.html: $(HTMLCMD) GeodesicProj.1.html: $(HTMLCMD) GeoConvert.1.html: $(HTMLCMD) GeodSolve.1.html: $(HTMLCMD) GeoidEval.1.html: $(HTMLCMD) Gravity.1.html: $(HTMLCMD) MagneticField.1.html: $(HTMLCMD) Planimeter.1.html: $(HTMLCMD) RhumbSolve.1.html: $(HTMLCMD) TransverseMercatorProj.1.html: $(HTMLCMD) endif geographiclib_data = $(datadir)/GeographicLib SCRIPTMANCMD = sed -e "s/@SCRIPT@/$*/g" \ -e "s/@DATA@/`echo $* | cut -f3 -d-`/g" \ -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%g" \ $(srcdir)/script.8.in > $@ geographiclib-get-geoids.8: $(SCRIPTMANCMD) geographiclib-get-gravity.8: $(SCRIPTMANCMD) geographiclib-get-magnetic.8: $(SCRIPTMANCMD) EXTRA_DIST = Makefile.mk CMakeLists.txt makeusage.sh \ GeoConvert.pod TransverseMercatorProj.pod \ CartConvert.pod ConicProj.pod GeodSolve.pod GeodesicProj.pod \ GeoidEval.pod Gravity.pod MagneticField.pod Planimeter.pod \ RhumbSolve.pod $(MANPAGES) $(USAGE) $(HTMLMAN) \ dummy.usage.in dummy.1.in dummy.1.html.in script.8.in maintainer-clean-local: rm -rf *.usage *.1.html *.1 *.8 GeographicLib-1.52/man/Makefile.mk0000644000771000077100000000077014064202371016642 0ustar ckarneyckarneyPROGRAMS = CartConvert \ ConicProj \ GeoConvert \ GeodSolve \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ RhumbSolve \ TransverseMercatorProj MANPAGES = $(addsuffix .1,$(PROGRAMS)) USAGE = $(addsuffix .usage,$(PROGRAMS)) HTMLMAN = $(addsuffix .1.html,$(PROGRAMS)) DEST = $(PREFIX)/share/man/man1 all: $(MANPAGES) $(USAGE) $(HTMLMAN) INSTALL = install -b install: test -d $(DEST) || mkdir -p $(DEST) $(INSTALL) -m 644 $(MANPAGES) $(DEST)/ .PHONY: all install clean GeographicLib-1.52/man/Planimeter.pod0000644000771000077100000001774614064202371017413 0ustar ckarneyckarney=head1 NAME Planimeter -- compute the area of geodesic polygons =head1 SYNOPSIS B [ B<-r> ] [ B<-s> ] [ B<-l> ] [ B<-e> I I ] [ B<-w> ] [ B<-p> I ] [ B<-G> | B<-E> | B<-Q> | B<-R> ] [ 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). The edges of the polygon are given by the I geodesic between consecutive vertices. In certain cases, there may be two or many such shortest geodesics, and in that case, the polygon is not uniquely specified by its vertices. This only happens with very long edges (for the WGS84 ellipsoid, any edge shorter than 19970 km is uniquely specified by its end points). In such cases, insert an additional vertex near the middle of the long edge to define the boundary of the polygon. 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. Arbitrarily complex polygons are allowed. In the case of self-intersecting polygons the area is accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. 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> I I specify the ellipsoid via the equatorial radius, I and the flattening, 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. 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 always uses the WGS84 parameters. =item B<-w> toggle the longitude first flag (it starts off); if the flag is on, then when reading geographic coordinates, longitude precedes latitude (this can be overridden by a hemisphere designator, I, I, I, I). =item B<-p> I set the output precision to I (default 6); the perimeter is given (in meters) with I digits after the decimal point; the area is given (in meters^2) with (I - 5) digits after the decimal point. =item B<-G> use the series formulation for the geodesics. This is the default option and is recommended for terrestrial applications. This option, B<-G>, and the following three options, B<-E>, B<-Q>, and B<-R>, are mutually exclusive. =item B<-E> use "exact" algorithms (based on elliptic integrals) for the geodesic calculations. These are more accurate than the (default) series expansions for |I| E 0.02. (But note that the implementation of areas in GeodesicExact uses a high order series and this is only accurate for modest flattenings.) =item B<-Q> perform the calculation on the authalic sphere. The area calculation is accurate even if the flattening is large, I the edges are sufficiently short. The perimeter calculation is not accurate. =item B<-R> The lines joining the vertices are rhumb lines instead of geodesics. =item B<--comment-delimiter> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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 ACCURACY Using the B<-G> option (the default), the accuracy was estimated by computing the error in the area for 10^7 approximately regular polygons on the WGS84 ellipsoid. The centers and the orientations of the polygons were uniformly distributed, the number of vertices was log-uniformly distributed in [3, 300], and the center to vertex distance log-uniformly distributed in [0.1 m, 9000 km]. The maximum error in the perimeter was 200 nm, and the maximum error in the area was 0.0013 m^2 for perimeter < 10 km 0.0070 m^2 for perimeter < 100 km 0.070 m^2 for perimeter < 1000 km 0.11 m^2 for all perimeters =head1 SEE ALSO GeoConvert(1), GeodSolve(1). An online version of this utility is availbable at L. The algorithm for the area of geodesic polygon is given in Section 6 of C. F. F. Karney, I, J. Geodesy 87, 43-55 (2013); DOI L; addenda: L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in version 1.4. GeographicLib-1.52/man/RhumbSolve.pod0000644000771000077100000002113614064202371017365 0ustar ckarneyckarney=head1 NAME RhumbSolve -- perform rhumb line calculations =head1 SYNOPSIS B [ B<-i> | B<-L> I I I ] [ B<-e> I I ] [ B<-d> | B<-:> ] [ B<-w> ] [ B<-p> I ] [ B<-s> ] [ 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 path with constant heading between two points on the ellipsoid at (I, I) and (I, I) is called the rhumb line or loxodrome. Its length is I and the rhumb line has a forward azimuth I along its length. Also computed is I is the area between the rhumb line from point 1 to point 2 and the equator; i.e., it is the area, measured counter-clockwise, of the geodesic quadrilateral with corners (I,I), (0,I), (0,I), and (I,I). A point at a pole is treated as a point a tiny distance away from the pole on the given line of longitude. The longitude becomes indeterminate when a rhumb line passes through a pole, and B reports NaNs for the longitude and the area in this case. B the rhumb line is B the shortest path between two points; that is the geodesic and it is calculated by GeodSolve(1). 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 calculation. =item 2. With the B<-i> command line argument, B performs the inverse calculation. It reads lines containing I I I I and prints the values of I I I for the corresponding shortest rhumb lines. If the end points are on opposite meridians, there are two shortest rhumb lines and the east-going one is chosen. =item 3. Command line arguments B<-L> I I I specify a rhumb 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 rhumb line. =back =head1 OPTIONS =over =item B<-i> perform an inverse calculation (see 2 above). =item B<-L> I I I line mode (see 3 above); generate a sequence of points along the rhumb line specified by I I I. The B<-w> flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before B<-L>. (B<-l> is an alternative, deprecated, spelling of this flag.) =item B<-e> I I specify the ellipsoid via the equatorial radius, I and the flattening, 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. 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<-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<-p> I set the output precision to I (default 3); I is the precision relative to 1 m. See L. =item B<-s> By default, the rhumb line calculations are carried out exactly in terms of elliptic integrals. This includes the use of the addition theorem for elliptic integrals to compute the divided difference of the isometric and rectifying latitudes. If B<-s> is supplied this divided difference is computed using Krueger series for the transverse Mercator projection which is only accurate for |I| E 0.01. See L. =item B<--comment-delimiter> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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, all lengths (I) in meters, and all areas (I) in meters^2. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees, minutes, seconds. For example, C<40d30>, C<40d30'>, C<40:30>, C<40.5d>, and C<40.5> are all equivalent. By default, latitude precedes longitude for each point (the B<-w> flag switches this convention); 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. For details on the allowed formats for angles, see the C section of GeoConvert(1). =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 I + 5. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is I + 1. 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 ACCURACY The algorithm used by B uses exact formulas for converting between the latitude, rectifying latitude (I), and isometric latitude (I). These formulas are accurate for any value of the flattening. The computation of rhumb lines involves the ratio (I - I) / (I - I) and this is subject to large round-off errors if I is close to I. So this ratio is computed using divided differences using one of two methods: by default, this uses the addition theorem for elliptic integrals (accurate for all values of I); however, with the B<-s> options, it is computed using the series expansions used by TransverseMercatorProj(1) for the conversions between rectifying and conformal latitudes (accurate for |I| E 0.01). For the WGS84 ellipsoid, the error is about 10 nanometers using either method. =head1 EXAMPLES Route from JFK Airport to Singapore Changi Airport: echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E | RhumbSolve -i -: -p 0 103:34:58.2 18523563 N.B. This is B the route typically taken by aircraft because it's considerably longer than the geodesic given by GeodSolve(1). Waypoints on the route at intervals of 2000km: for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done | RhumbSolve -L 40:38:23N 073:46:44W 103:34:58.2 -: -p 0 40:38:23.0N 073:46:44.0W 0 36:24:30.3N 051:28:26.4W 9817078307821 32:10:26.8N 030:20:57.3W 18224745682005 27:56:13.2N 010:10:54.2W 25358020327741 23:41:50.1N 009:12:45.5E 31321269267102 19:27:18.7N 027:59:22.1E 36195163180159 15:12:40.2N 046:17:01.1E 40041499143669 10:57:55.9N 064:12:52.8E 42906570007050 06:43:07.3N 081:53:28.8E 44823504180200 02:28:16.2N 099:24:54.5E 45813843358737 01:46:36.0S 116:52:59.7E 45888525219677 =head1 SEE ALSO GeoConvert(1), GeodSolve(1), TransverseMercatorProj(1). An online version of this utility is availbable at L. The Wikipedia page, Rhumb line, L. =head1 AUTHOR B was written by Charles Karney. =head1 HISTORY B was added to GeographicLib, L, in version 1.37. GeographicLib-1.52/man/TransverseMercatorProj.pod0000644000771000077100000001330614064202371021763 0ustar ckarneyckarney=head1 NAME TransverseMercatorProj -- perform transverse Mercator projection =head1 SYNOPSIS B [ B<-s> | B<-t> ] [ B<-l> I ] [ B<-k> I ] [ B<-r> ] [ B<-e> I I ] [ B<-w> ] [ 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 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 detils on the allowed formats for latitude and longitude, see the C section of GeoConvert(1). 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 grid north (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 the exact algorithm with the L; this is the default. =item B<-l> I specify the longitude of origin I (degrees, default 0). =item B<-k> I 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> I I specify the ellipsoid via the equatorial radius, I and the flattening, 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. 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<-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<-p> I set the output precision to I (default 6). I is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is I + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is I + 6. =item B<--comment-delimiter> I 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> I read input from the file I instead of from standard input; a file name of "-" stands for standard input. =item B<--input-string> I 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> I set the line separator character to I. By default this is a semicolon. =item B<--output-file> I 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 = 82.636..., 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. Geodesy 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.52/man/dummy.1.html.in0000644000771000077100000000123014064202371017351 0ustar ckarneyckarney @TOOL@ -- a GeographicLib utility GeographicLib-1.52/man/dummy.1.in0000644000771000077100000000046214064202371016414 0ustar ckarneyckarney.TH @TOOL@ 1 "" "GeographicLib Utilities" "GeographicLib Utilities" .SH NAME @TOOL@ \-\- a GeographicLib utility .SH DESCRIPTION .B @TOOL@ is part of GeographicLib, . For documentation, see .PP https://geographiclib.sourceforge.io/@PROJECT_VERSION@/@TOOL@.1.html GeographicLib-1.52/man/dummy.usage.in0000644000771000077100000000045214064202371017357 0ustar ckarneyckarney// Dummy usage file to be used when the man page isn't available int usage(int retval, bool /* brief */) { ( retval ? std::cerr : std::cout ) << "For full documentation on @TOOL@, see\n" << " https://geographiclib.sourceforge.io/@PROJECT_VERSION@/@TOOL@.1.html\n"; return retval; } GeographicLib-1.52/man/makeusage.sh0000644000771000077100000000164514064202371017074 0ustar ckarneyckarney#! /bin/sh # Convert a pod file into a usage function for the GeographicLib utilities. SOURCE=$1 NAME=`basename $SOURCE .pod` VERSION=$2 ( 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 <. For documentation, supply the .B \-h option: .PP @SCRIPT@ \-h .PP By default, the datasets are installed in .I @GEOGRAPHICLIB_DATA@/@DATA@ and the script requires write access to this directory. GeographicLib-1.52/man/Makefile.in0000644000771000077100000005467214064202402016646 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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 VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)" man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man1_MANS) $(man8_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = pod2man --center="GeographicLib Utilities" \ --release="$(PACKAGE_STRING)" 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@ pkgconfigdir = @pkgconfigdir@ 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@ USAGE = \ CartConvert.usage \ ConicProj.usage \ GeodesicProj.usage \ GeoConvert.usage \ GeodSolve.usage \ GeoidEval.usage \ Gravity.usage \ MagneticField.usage \ Planimeter.usage \ RhumbSolve.usage \ TransverseMercatorProj.usage MANPAGES = \ CartConvert.1 \ ConicProj.1 \ GeodesicProj.1 \ GeoConvert.1 \ GeodSolve.1 \ GeoidEval.1 \ Gravity.1 \ MagneticField.1 \ Planimeter.1 \ RhumbSolve.1 \ TransverseMercatorProj.1 HTMLMAN = \ CartConvert.1.html \ ConicProj.1.html \ GeodesicProj.1.html \ GeoConvert.1.html \ GeodSolve.1.html \ GeoidEval.1.html \ Gravity.1.html \ MagneticField.1.html \ Planimeter.1.html \ RhumbSolve.1.html \ TransverseMercatorProj.1.html SYSMANPAGES = geographiclib-get-geoids.8 \ geographiclib-get-gravity.8 \ geographiclib-get-magnetic.8 PODFIX = sed \ -e 's%%%' \ -e 's%\([^<>]*\)(\(.\))%&%'g man1_MANS = $(MANPAGES) man8_MANS = $(SYSMANPAGES) SUFFIXES = .pod .1 .usage .1.html .8 @HAVE_PODPROGS_FALSE@USAGECMD = cat $(srcdir)/$@ 2> /dev/null || \ @HAVE_PODPROGS_FALSE@ sed -e "s/@TOOL@/$*/g" -e "s/@PROJECT_VERSION@/$(VERSION)/g" \ @HAVE_PODPROGS_FALSE@ $(srcdir)/dummy.usage.in > $@ @HAVE_PODPROGS_FALSE@MANCMD = cat $(srcdir)/$@ 2> /dev/null || \ @HAVE_PODPROGS_FALSE@ sed -e "s/@TOOL@/$*/g" -e "s/@PROJECT_VERSION@/$(VERSION)/g" \ @HAVE_PODPROGS_FALSE@ $(srcdir)/dummy.1.in > $@ @HAVE_PODPROGS_FALSE@HTMLCMD = cat $(srcdir)/$@ 2> /dev/null || \ @HAVE_PODPROGS_FALSE@ sed -e "s/@TOOL@/$*/g" -e "s/@PROJECT_VERSION@/$(VERSION)/g" \ @HAVE_PODPROGS_FALSE@ $(srcdir)/dummy.1.html.in > $@ geographiclib_data = $(datadir)/GeographicLib SCRIPTMANCMD = sed -e "s/@SCRIPT@/$*/g" \ -e "s/@DATA@/`echo $* | cut -f3 -d-`/g" \ -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%g" \ $(srcdir)/script.8.in > $@ EXTRA_DIST = Makefile.mk CMakeLists.txt makeusage.sh \ GeoConvert.pod TransverseMercatorProj.pod \ CartConvert.pod ConicProj.pod GeodSolve.pod GeodesicProj.pod \ GeoidEval.pod Gravity.pod MagneticField.pod Planimeter.pod \ RhumbSolve.pod $(MANPAGES) $(USAGE) $(HTMLMAN) \ dummy.usage.in dummy.1.in dummy.1.html.in script.8.in all: all-am .SUFFIXES: .SUFFIXES: .pod .1 .usage .1.html .8 $(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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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) @list1='$(man1_MANS)'; \ list2=''; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | 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,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man8: $(man8_MANS) @$(NORMAL_INSTALL) @list1='$(man8_MANS)'; \ list2=''; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.8[a-z]*$$/p'; \ fi; \ } | 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,^[^8][0-9a-z]*$$,8,;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)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$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)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)"; 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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-man8 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 uninstall-man8 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am 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-man8 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 \ tags-am uninstall uninstall-am uninstall-man uninstall-man1 \ uninstall-man8 .PRECIOUS: Makefile all: man man: manpages usage htmlman sysmanpages manpages: $(MANPAGES) usage: $(USAGE) htmlman: $(HTMLMAN) sysmanpages: $(SYSMANPAGES) @HAVE_PODPROGS_TRUE@.pod.usage: @HAVE_PODPROGS_TRUE@ sh $(srcdir)/makeusage.sh $< $(VERSION) > $@ @HAVE_PODPROGS_TRUE@.pod.1: @HAVE_PODPROGS_TRUE@ $(POD2MAN) $^ > $@ @HAVE_PODPROGS_TRUE@.pod.1.html: @HAVE_PODPROGS_TRUE@ pod2html --noindex --title "$*(1)" $^ | $(PODFIX) > $@ @HAVE_PODPROGS_FALSE@CartConvert.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@ConicProj.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@GeodesicProj.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@GeoConvert.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@GeodSolve.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@GeoidEval.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@Gravity.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@MagneticField.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@Planimeter.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@RhumbSolve.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@TransverseMercatorProj.usage: @HAVE_PODPROGS_FALSE@ $(USAGECMD) @HAVE_PODPROGS_FALSE@CartConvert.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@ConicProj.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@GeodesicProj.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@GeoConvert.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@GeodSolve.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@GeoidEval.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@Gravity.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@MagneticField.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@Planimeter.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@RhumbSolve.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@TransverseMercatorProj.1: @HAVE_PODPROGS_FALSE@ $(MANCMD) @HAVE_PODPROGS_FALSE@CartConvert.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@ConicProj.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@GeodesicProj.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@GeoConvert.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@GeodSolve.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@GeoidEval.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@Gravity.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@MagneticField.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@Planimeter.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@RhumbSolve.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) @HAVE_PODPROGS_FALSE@TransverseMercatorProj.1.html: @HAVE_PODPROGS_FALSE@ $(HTMLCMD) geographiclib-get-geoids.8: $(SCRIPTMANCMD) geographiclib-get-gravity.8: $(SCRIPTMANCMD) geographiclib-get-magnetic.8: $(SCRIPTMANCMD) maintainer-clean-local: rm -rf *.usage *.1.html *.1 *.8 # 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.52/man/CartConvert.10000644000771000077100000002355414064202407017115 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2021-06-21" "GeographicLib 1.52" "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\-w\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" 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 details on the allowed formats for latitude and longitude, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fBGeoConvert\fR\|(1). 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. In general there are multiple solutions and the result which minimizes the absolute value of \fIheight\fR is returned, i.e., (\fIlatitude\fR, \fIlongitude\fR) corresponds to the closest point on the ellipsoid. .IP "\fB\-l\fR \fIlat0\fR \fIlon0\fR \fIh0\fR" 4 .IX Item "-l lat0 lon0 h0" specifies conversions to and from a local cartesion coordinate systems with origin \fIlat0\fR \fIlon0\fR \fIh0\fR, instead of a geocentric coordinate system. The \fB\-w\fR flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before \fB\-l\fR. .IP "\fB\-e\fR \fIa\fR \fIf\fR" 4 .IX Item "-e a f" specify the ellipsoid via the equatorial radius, \fIa\fR and the flattening, \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. By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563. .IP "\fB\-w\fR" 4 .IX Item "-w" toggle the longitude first flag (it starts off); if the flag is on, then 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\-p\fR \fIprec\fR" 4 .IX Item "-p prec" set the output precision to \fIprec\fR (default 6). \fIprec\fR is the number of digits after the decimal point for geocentric and local cartesion coordinates and for the height (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is \&\fIprec\fR + 5. .IP "\fB\-\-comment\-delimiter\fR \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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.52/man/ConicProj.10000644000771000077100000002464214064202407016550 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2021-06-21" "GeographicLib 1.52" "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\-w\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" 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 details on the allowed formats for latitude and longitude, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fBGeoConvert\fR\|(1). 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 \fIlat1\fR \fIlat2\fR" 4 .IX Item "-c lat1 lat2" use the Lambert conformal conic projection with standard parallels \&\fIlat1\fR and \fIlat2\fR. .IP "\fB\-a\fR \fIlat1\fR \fIlat2\fR" 4 .IX Item "-a lat1 lat2" use the Albers equal area projection with standard parallels \fIlat1\fR and \&\fIlat2\fR. .IP "\fB\-l\fR \fIlon0\fR" 4 .IX Item "-l lon0" specify the longitude of origin \fIlon0\fR (degrees, default 0). .IP "\fB\-k\fR \fIk1\fR" 4 .IX Item "-k k1" 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 \fIa\fR \fIf\fR" 4 .IX Item "-e a f" specify the ellipsoid via the equatorial radius, \fIa\fR and the flattening, \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. By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563. .IP "\fB\-w\fR" 4 .IX Item "-w" toggle the longitude first flag (it starts off); if the flag is on, then 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\-p\fR \fIprec\fR" 4 .IX Item "-p prec" set the output precision to \fIprec\fR (default 6). \fIprec\fR is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is \fIprec\fR + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is \fIprec\fR + 6. .IP "\fB\-\-comment\-delimiter\fR \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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.52/man/GeodesicProj.10000644000771000077100000002474214064202407017240 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2021-06-21" "GeographicLib 1.52" "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\-w\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" 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 details on the allowed formats for latitude and longitude, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fBGeoConvert\fR\|(1). 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 \fIlat0\fR \fIlon0\fR" 4 .IX Item "-z lat0 lon0" use the azimuthal equidistant projection centered at latitude = \fIlat0\fR, longitude = \fIlon0\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 coordinates, provided that it appears before \fB\-z\fR. .IP "\fB\-c\fR \fIlat0\fR \fIlon0\fR" 4 .IX Item "-c lat0 lon0" use the Cassini-Soldner projection centered at latitude = \fIlat0\fR, longitude = \fIlon0\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 coordinates, provided that it appears before \fB\-c\fR. .IP "\fB\-g\fR \fIlat0\fR \fIlon0\fR" 4 .IX Item "-g lat0 lon0" use the ellipsoidal gnomonic projection centered at latitude = \fIlat0\fR, longitude = \fIlon0\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 coordinates, provided that it appears before \fB\-g\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 \fIa\fR \fIf\fR" 4 .IX Item "-e a f" specify the ellipsoid via the equatorial radius, \fIa\fR and the flattening, \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. By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563. .IP "\fB\-w\fR" 4 .IX Item "-w" toggle the longitude first flag (it starts off); if the flag is on, then 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\-p\fR \fIprec\fR" 4 .IX Item "-p prec" set the output precision to \fIprec\fR (default 6). \fIprec\fR is the number of digits after the decimal point for lengths (in meters). For latitudes, longitudes, and azimuths (in degrees), the number of digits after the decimal point is \fIprec\fR + 5. For the scale, the number of digits after the decimal point is \fIprec\fR + 6. .IP "\fB\-\-comment\-delimiter\fR \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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 8 of C. F. F. Karney, \fIAlgorithms for geodesics\fR, J. Geodesy 87, 43\-55 (2013); \s-1DOI\s0 ; addenda: . .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.52/man/GeoConvert.10000644000771000077100000005021314064202407016726 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2021-06-21" "GeographicLib 1.52" "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\-z\fR \fIzone\fR | \fB\-s\fR | \fB\-t\fR | \fB\-S\fR | \fB\-T\fR ] [ \fB\-n\fR ] [ \fB\-w\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-l\fR | \fB\-a\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, and seconds. Latitude is given first (unless the \fB\-w\fR option is given). See \&\*(L"\s-1GEOGRAPHIC COORDINATES\*(R"\s0 for a description of the format. 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 \fInorth\fR) or \fIs\fR (or \fIsouth\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. The meridian convergence is the bearing of grid north given as degrees clockwise from true north. .IP "\fB\-z\fR \fIzone\fR" 4 .IX Item "-z zone" 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, e.g., 38n. See \*(L"\s-1ZONE\*(R"\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\-S\fR or \fB\-T\fR" 4 .IX Item "-S or -T" behave the same as \fB\-s\fR and \fB\-t\fR, respectively, until the first legal conversion is performed. For subsequent points, the zone and hemisphere of that conversion are used. This enables a sequence of points to be converted into \s-1UTM\s0 or \s-1UPS\s0 using a consistent coordinate system. .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 \*(L"\s-1MGRS\*(R"\s0. .IP "\fB\-w\fR" 4 .IX Item "-w" toggle the longitude first flag (it starts off); if the flag is on, then 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\-p\fR \fIprec\fR" 4 .IX Item "-p prec" set the output precision to \fIprec\fR (default 0); \fIprec\fR is the precision relative to 1 m. See \*(L"\s-1PRECISION\*(R"\s0. .IP "\fB\-l\fR" 4 .IX Item "-l" on output, \s-1UTM/UPS\s0 uses the long forms \fInorth\fR and \fIsouth\fR to designate the hemisphere instead of \fIn\fR or \fIs\fR. .IP "\fB\-a\fR" 4 .IX Item "-a" on output, \s-1UTM/UPS\s0 uses the abbreviations \fIn\fR and \fIs\fR to designate the hemisphere instead of \fInorth\fR or \fIsouth\fR; this is the default representation. .IP "\fB\-\-comment\-delimiter\fR \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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 For \s-1MGRS,\s0 The number of digits per coordinate is 5 + \fIprec\fR; \fIprec\fR = \-6 results in just the grid zone. 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 (\-6 for \s-1MGRS\s0) and the maximum is 9 for \s-1UTM/UPS, 9\s0 for decimal degrees, 10 for \s-1DMS, 6\s0 for \s-1MGRS,\s0 and 8 for convergence and scale. .SH "GEOGRAPHIC COORDINATES" .IX Header "GEOGRAPHIC COORDINATES" The utility accepts geographic coordinates, latitude and longitude, in a number of common formats. Latitude precedes longitude, unless the \fB\-w\fR option is given which switches this convention. On input, either coordinate 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. These hemisphere designators carry an implied sign, positive for \fIN\fR and \fIE\fR and negative for \fIS\fR and \fIW\fR. This sign multiplies any +/\- sign prefixing the coordinate. The coordinates may be given as decimal degree or as degrees, minutes, and seconds. d, ', and " are used to denote degrees, minutes, and seconds, with the least significant designator optional. (See \*(L"\s-1QUOTING\*(R"\s0 for how to quote the characters ' and " when entering coordinates on the command line.) Alternatively, : (colon) may be used to separate the various components. Only the final component of coordinate can include a decimal point, and the minutes and seconds components must be less than 60. .PP It is also possible to carry out addition or subtraction operations in geographic coordinates. If the coordinate includes interior signs (i.e., not at the beginning or immediately after an initial hemisphere designator), then the coordinate is split before such signs; the pieces are parsed separately and the results summed. For example the point 15" east of 39N 70W is .PP .Vb 1 \& 39N 70W+0:0:15E .Ve .PP \&\fB\s-1WARNING:\s0\fR \*(L"Exponential\*(R" notation is not recognized for geographic coordinates. Thus 7.0E1 is illegal, while 7.0E+1 is parsed as (7.0E) + (+1), yielding the same result as 8.0E. .PP 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; in addition two single quotes can be used to represent ". .PP The other GeographicLib utilities use the same rules for interpreting geographic coordinates; in addition, azimuths and arc lengths are interpreted the same way. .SH "QUOTING" .IX Header "QUOTING" Unfortunately the characters ' and \*(L" have special meanings in many shells and have to be entered with care. However note (1) that the trailing designator is optional and that (2) you can use colons as a separator character. Thus 10d20' can be entered as 10d20 or 10:20 and 10d20'30\*(R" can be entered as 10:20:30. .IP "Unix shells (sh, bash, tsch)" 4 .IX Item "Unix shells (sh, bash, tsch)" The characters ' and \*(L" can be quoted by preceding them with a \e (backslash); or you can quote a string containing ' with a pair of \*(R"s. The two alternatives are illustrated by .Sp .Vb 2 \& echo 10d20\e\*(Aq30\e" "20d30\*(Aq40" | GeoConvert \-d \-p \-1 \& => 10d20\*(Aq30"N 020d30\*(Aq40"E .Ve .Sp Quoting of command line arguments is similar .Sp .Vb 2 \& GeoConvert \-d \-p \-1 \-\-input\-string "10d20\*(Aq30\e" 20d30\*(Aq40" \& => 10d20\*(Aq30"N 020d30\*(Aq40"E .Ve .IP "Windows command shell (cmd)" 4 .IX Item "Windows command shell (cmd)" The ' character needs no quoting; the " character can either be quoted by a ^ or can be represented by typing ' twice. (This quoting is usually unnecessary because the trailing designator can be omitted.) Thus .Sp .Vb 2 \& echo 10d20\*(Aq30\*(Aq\*(Aq 20d30\*(Aq40 | GeoConvert \-d \-p \-1 \& => 10d20\*(Aq30"N 020d30\*(Aq40"E .Ve .Sp Use \e to quote the " character in a command line argument .Sp .Vb 2 \& GeoConvert \-d \-p \-1 \-\-input\-string "10d20\*(Aq30\e" 20d30\*(Aq40" \& => 10d20\*(Aq30"N 020d30\*(Aq40"E .Ve .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 "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. When an \s-1MGRS\s0 coordinate is provided as input, \fBGeoConvert\fR treats this as a representative point within the square. By default, this representative point is the \&\fIcenter\fR of the square (\f(CW\*(C`38n 444500 3688500\*(C'\fR in the example above). (This leads to a stable conversion between \s-1MGRS\s0 and geographic coordinates.) 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, and \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 Is \fIzone\fR is specified with a hemisphere, then this is honored when printing \s-1UTM\s0 coordinates: .PP .Vb 4 \& echo \-1 3 | GeoConvert \-u => 31s 500000 9889470 \& echo \-1 3 | GeoConvert \-u \-z 31 => 31s 500000 9889470 \& echo \-1 3 | GeoConvert \-u \-z 31s => 31s 500000 9889470 \& echo \-1 3 | GeoConvert \-u \-z 31n => 31n 500000 \-110530 .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 (or \fIsouth\fR); replace \fIN\fR thru \fIX\fR by \&\fIn\fR (or \fInorth\fR). .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 .PP GeoConvert can be used to do simple arithmetic using degree, minutes, and seconds. For example, sometimes data is tiled in 15 second squares tagged by the \s-1DMS\s0 representation of the \s-1SW\s0 corner. The tags of the tile at 38:59:45N 077:02:00W and its 8 neighbors are then given by .PP .Vb 10 \& t=0:0:15 \& for y in \-$t +0 +$t; do \& for x in \-$t +0 +$t; do \& echo 38:59:45N$y 077:02:00W$x \& done \& done | GeoConvert \-: \-p \-1 | tr \-d \*(Aq: \*(Aq \& => \& 385930N0770215W \& 385930N0770200W \& 385930N0770145W \& 385945N0770215W \& 385945N0770200W \& 385945N0770145W \& 390000N0770215W \& 390000N0770200W \& 390000N0770145W .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" An online version of this utility is availbable at . .PP 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. Geodesy \fB85\fR(8), 475\-485 (Aug. 2011); \s-1DOI\s0 ; 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.52/man/GeodSolve.10000644000771000077100000004754114064202407016554 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "GEODSOLVE 1" .TH GEODSOLVE 1 "2021-06-21" "GeographicLib 1.52" "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" GeodSolve \-\- perform geodesic calculations .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBGeodSolve\fR [ \fB\-i\fR | \fB\-L\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR | \&\fB\-D\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR \fIs13\fR | \fB\-I\fR \fIlat1\fR \fIlon1\fR \fIlat3\fR \fIlon3\fR ] [ \fB\-a\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-u\fR ] [ \fB\-F\fR ] [ \fB\-d\fR | \fB\-:\fR ] [ \fB\-w\fR ] [ \fB\-b\fR ] [ \fB\-f\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-E\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 forward azimuths \&\fIazi1\fR and \fIazi2\fR at the two end points. .PP \&\fBGeodSolve\fR operates in one of three modes: .IP "1." 4 By default, \fBGeodSolve\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 With the \fB\-i\fR command line argument, \fBGeodSolve\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. .IP "3." 4 Command line arguments \fB\-L\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR specify a geodesic line. \fBGeodSolve\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. Command line arguments \fB\-D\fR and \fB\-I\fR work similarly with the geodesic line defined in terms of a direct or inverse geodesic calculation, respectively. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-i\fR" 4 .IX Item "-i" perform an inverse geodesic calculation (see 2 above). .IP "\fB\-L\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR" 4 .IX Item "-L lat1 lon1 azi1" line mode (see 3 above); generate a sequence of points along the geodesic specified by \fIlat1\fR \fIlon1\fR \fIazi1\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before \fB\-L\fR. (\fB\-l\fR is an alternative, deprecated, spelling of this flag.) .IP "\fB\-D\fR \fIlat1\fR \fIlon1\fR \fIazi1\fR \fIs13\fR" 4 .IX Item "-D lat1 lon1 azi1 s13" line mode (see 3 above); generate a sequence of points along the geodesic specified by \fIlat1\fR \fIlon1\fR \fIazi1\fR \fIs13\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before \fB\-D\fR. Similarly, the \fB\-a\fR flag can be used to change the interpretation of \fIs13\fR to \fIa13\fR, provided that it appears before \fB\-D\fR. .IP "\fB\-I\fR \fIlat1\fR \fIlon1\fR \fIlat3\fR \fIlon3\fR" 4 .IX Item "-I lat1 lon1 lat3 lon3" line mode (see 3 above); generate a sequence of points along the geodesic specified by \fIlat1\fR \fIlon1\fR \fIlat3\fR \fIlon3\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before \fB\-I\fR. .IP "\fB\-a\fR" 4 .IX Item "-a" toggle the arc mode flag (it starts off); if this flag is on, then 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 SPHERE\*(R"\s0. .IP "\fB\-e\fR \fIa\fR \fIf\fR" 4 .IX Item "-e a f" specify the ellipsoid via the equatorial radius, \fIa\fR and the flattening, \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. By default, the \s-1WGS84\s0 ellipsoid is used, \fIa\fR = 6378137 m, \fIf\fR = 1/298.257223563. .IP "\fB\-u\fR" 4 .IX Item "-u" unroll the longitude. Normally, on output longitudes are reduced to lie in [\-180deg,180deg). However with this option, the returned longitude \&\fIlon2\fR is \*(L"unrolled\*(R" so that \fIlon2\fR \- \fIlon1\fR indicates how often and in what sense the geodesic has encircled the earth. Use the \fB\-f\fR option, to get both longitudes printed. .IP "\fB\-F\fR" 4 .IX Item "-F" fractional mode. This only has any effect with the \fB\-D\fR and \fB\-I\fR options (and is otherwise ignored). The values read on standard input are interpreted as fractional distances to point 3, i.e., as \&\fIs12\fR/\fIs13\fR instead of \fIs12\fR. If arc mode is in effect, then the values denote fractional arc length, i.e., \fIa12\fR/\fIa13\fR. The fractional distances can be entered as a simple fraction, e.g., 3/4. .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\-w\fR" 4 .IX Item "-w" toggle the longitude first flag (it starts off); if the flag is on, then 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\-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 SPHERE\*(R"\s0. The four quantities \fIm12\fR, \fIM12\fR, \fIM21\fR, and \fIS12\fR are described in \&\*(L"\s-1ADDITIONAL QUANTITIES\*(R"\s0. .IP "\fB\-p\fR \fIprec\fR" 4 .IX Item "-p prec" set the output precision to \fIprec\fR (default 3); \fIprec\fR is the precision relative to 1 m. See \*(L"\s-1PRECISION\*(R"\s0. .IP "\fB\-E\fR" 4 .IX Item "-E" use \*(L"exact\*(R" algorithms (based on elliptic integrals) for the geodesic calculations. These are more accurate than the (default) series expansions for |\fIf\fR| > 0.02. .IP "\fB\-\-comment\-delimiter\fR \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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" \&\fBGeodSolve\fR measures all angles in degrees and all lengths (\fIs12\fR) in meters, and all areas (\fIS12\fR) in meters^2. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees, minutes, seconds. For example, \f(CW\*(C`40d30\*(C'\fR, \f(CW\*(C`40d30\*(Aq\*(C'\fR, \f(CW\*(C`40:30\*(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 (the \fB\-w\fR flag switches this convention); 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. .PP For details on the allowed formats for angles, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fBGeoConvert\fR\|(1). .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: .PP .Vb 6 \& s13 = s12 + s23, \& a13 = a12 + a23, \& S13 = S12 + S23, \& m13 = m12 M23 + m23 M21, \& M13 = M12 M23 \- (1 \- M12 M21) m23 / m12, \& M31 = M32 M21 \- (1 \- M23 M32) m12 / m23. .Ve .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 geodesic 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 \fIprec\fR + 5. For \s-1DMS\s0 (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is \fIprec\fR + 1. 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 \fBGeodSolve\fR to return an exit code of 1. However, an error does not cause \fBGeodSolve\fR to terminate; following lines will be converted. .SH "ACCURACY" .IX Header "ACCURACY" Using the (default) series solution, GeodSolve is accurate to about 15 nm (15 nanometers) for the \s-1WGS84\s0 ellipsoid. The approximate maximum error (expressed as a distance) for an ellipsoid with the same equatorial radius as the \s-1WGS84\s0 ellipsoid and different values of the flattening is .PP .Vb 6 \& |f| error \& 0.01 25 nm \& 0.02 30 nm \& 0.05 10 um \& 0.1 1.5 mm \& 0.2 300 mm .Ve .PP If \fB\-E\fR is specified, GeodSolve is accurate to about 40 nm (40 nanometers) for the \s-1WGS84\s0 ellipsoid. The approximate maximum error (expressed as a distance) for an ellipsoid with a quarter meridian of 10000 km and different values of the \fIa/b\fR = 1 \- \fIf\fR is .PP .Vb 10 \& 1\-f error (nm) \& 1/128 387 \& 1/64 345 \& 1/32 269 \& 1/16 210 \& 1/8 115 \& 1/4 69 \& 1/2 36 \& 1 15 \& 2 25 \& 4 96 \& 8 318 \& 16 985 \& 32 2352 \& 64 6008 \& 128 19024 .Ve .SH "MULTIPLE SOLUTIONS" .IX Header "MULTIPLE SOLUTIONS" The shortest distance returned for the inverse problem is (obviously) uniquely defined. However, in a few special cases there are multiple azimuths which yield the same shortest distance. Here is a catalog of those cases: .IP "\fIlat1\fR = \-\fIlat2\fR (with neither point at a pole)" 4 .IX Item "lat1 = -lat2 (with neither point at a pole)" If \fIazi1\fR = \fIazi2\fR, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [\fIazi1\fR,\fIazi2\fR] = [\fIazi2\fR,\fIazi1\fR], [\fIM12\fR,\fIM21\fR] = [\fIM21\fR,\fIM12\fR], \fIS12\fR = \-\fIS12\fR. (This occurs when the longitude difference is near +/\-180 for oblate ellipsoids.) .IP "\fIlon2\fR = \fIlon1\fR +/\- 180 (with neither point at a pole)" 4 .IX Item "lon2 = lon1 +/- 180 (with neither point at a pole)" If \fIazi1\fR = 0 or +/\-180, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [\fIazi1\fR,\fIazi2\fR] = [\-\fIazi1\fR,\-\fIazi2\fR], \fIS12\fR = \-\fIS12\fR. (This occurs when \fIlat2\fR is near \-\fIlat1\fR for prolate ellipsoids.) .IP "Points 1 and 2 at opposite poles" 4 .IX Item "Points 1 and 2 at opposite poles" There are infinitely many geodesics which can be generated by setting [\fIazi1\fR,\fIazi2\fR] = [\fIazi1\fR,\fIazi2\fR] + [\fId\fR,\-\fId\fR], for arbitrary \&\fId\fR. (For spheres, this prescription applies when points 1 and 2 are antipodal.) .IP "\fIs12\fR = 0 (coincident points)" 4 .IX Item "s12 = 0 (coincident points)" There are infinitely many geodesics which can be generated by setting [\fIazi1\fR,\fIazi2\fR] = [\fIazi1\fR,\fIazi2\fR] + [\fId\fR,\fId\fR], for arbitrary \fId\fR. .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 | \& GeodSolve \-i \-: \-p 0 \& \& 003:18:29.9 177:29:09.2 15347628 .Ve .PP Equally spaced waypoints on the route: .PP .Vb 2 \& for ((i = 0; i <= 10; ++i)); do echo $i/10; done | \& GeodSolve \-I 40:38:23N 073:46:44W 01:21:33N 103:59:22E \-F \-: \-p 0 \& \& 40:38:23.0N 073:46:44.0W 003:18:29.9 \& 54:24:51.3N 072:25:39.6W 004:18:44.1 \& 68:07:37.7N 069:40:42.9W 006:44:25.4 \& 81:38:00.4N 058:37:53.9W 017:28:52.7 \& 83:43:26.0N 080:37:16.9E 156:26:00.4 \& 70:20:29.2N 097:01:29.4E 172:31:56.4 \& 56:38:36.0N 100:14:47.6E 175:26:10.5 \& 42:52:37.1N 101:43:37.2E 176:34:28.6 \& 29:03:57.0N 102:39:34.8E 177:07:35.2 \& 15:13:18.6N 103:22:08.0E 177:23:44.7 \& 01:21:33.0N 103:59:22.0E 177:29:09.2 .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBGeoConvert\fR\|(1). .PP An online version of this utility is availbable at . .PP The algorithms are described in C. F. F. Karney, \&\fIAlgorithms for geodesics\fR, J. Geodesy 87, 43\-55 (2013); \s-1DOI:\s0 ; addenda: . .PP The Wikipedia page, Geodesics on an ellipsoid, . .SH "AUTHOR" .IX Header "AUTHOR" \&\fBGeodSolve\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBGeodSolve\fR was added to GeographicLib, , in 2009\-03. Prior to version 1.30, it was called \fBGeod\fR. (The name was changed to avoid a conflict with the \fBgeod\fR utility in \fIproj.4\fR.) GeographicLib-1.52/man/GeoidEval.10000644000771000077100000004042114064202407016512 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2021-06-21" "GeographicLib 1.52" "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\-w\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 heights of the geoid above the \s-1WGS84\s0 ellipsoid on standard output. .PP Positions are given as latitude and longitude, \s-1UTM/UPS,\s0 or \s-1MGRS,\s0 in any of the formats accepted by \fBGeoConvert\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 \fBGravity\fR\|(1). This utility can also compute the direction of gravity accurately. .PP The height of the geoid above the ellipsoid, \fIN\fR, is sometimes called the geoid undulation. It can be used to convert a height above the ellipsoid, \fIh\fR, to the corresponding height above the geoid (the orthometric height, roughly the height above mean sea level), \fIH\fR, using the relations .Sp .RS 4 \&\fIh\fR = \fIN\fR + \fIH\fR, \ \ \fIH\fR = \-\fIN\fR + \fIh\fR. .RE .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-n\fR \fIname\fR" 4 .IX Item "-n name" use geoid \fIname\fR instead of the default \f(CW\*(C`egm96\-5\*(C'\fR. See \&\*(L"\s-1GEOIDS\*(R"\s0. .IP "\fB\-d\fR \fIdir\fR" 4 .IX Item "-d dir" read geoid data from \fIdir\fR instead of the default. See \&\*(L"\s-1GEOIDS\*(R"\s0. .IP "\fB\-l\fR" 4 .IX Item "-l" use bilinear interpolation instead of cubic. See \&\*(L"\s-1INTERPOLATION\*(R"\s0. .IP "\fB\-a\fR" 4 .IX Item "-a" cache the entire data set in memory. See \*(L"\s-1CACHE\*(R"\s0. .IP "\fB\-c\fR \fIsouth\fR \fIwest\fR \fInorth\fR \fIeast\fR" 4 .IX Item "-c south west north east" cache the data bounded by \fIsouth\fR \fIwest\fR \fInorth\fR \fIeast\fR in memory. The first two arguments specify the \s-1SW\s0 corner of the cache and the last two arguments specify the \s-1NE\s0 corner. The \fB\-w\fR flag specifies that longitude precedes latitude for these corners, provided that it appears before \fB\-c\fR. See \*(L"\s-1CACHE\*(R"\s0. .IP "\fB\-w\fR" 4 .IX Item "-w" toggle the longitude first flag (it starts off); if the flag is on, then when reading geographic coordinates, longitude precedes latitude (this can be overridden by a hemisphere designator, \fIN\fR, \fIS\fR, \fIE\fR, \fIW\fR). .IP "\fB\-z\fR \fIzone\fR" 4 .IX Item "-z zone" 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 \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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 \*(L"\s-1INTERPOLATION\*(R"\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`GEOGRAPHICLIB_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`GEOGRAPHICLIB_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. .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-1GEOGRAPHICLIB_GEOID_NAME\s0\fR" 4 .IX Item "GEOGRAPHICLIB_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-1GEOGRAPHICLIB_GEOID_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-1GEOGRAPHICLIB_GEOID_PATH\s0\fR" 4 .IX Item "GEOGRAPHICLIB_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:/ProgramData/GeographicLib/geoids\*(C'\fR on Windows systems. The \fB\-h\fR option reports the value of \fB\s-1GEOGRAPHICLIB_GEOID_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 geoid path. If it is set (and if \fB\s-1GEOGRAPHICLIB_GEOID_PATH\s0\fR is not set), then $\fB\s-1GEOGRAPHICLIB_DATA\s0\fR/geoids 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, . .IP "\fB\s-1EGM96\s0\fR" 4 .IX Item "EGM96" An earth gravity model published by the \s-1NGA\s0 in 1996, . .IP "\fB\s-1EGM2008\s0\fR" 4 .IX Item "EGM2008" An earth gravity model published by the \s-1NGA\s0 in 2008, . .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" \&\fBGeoConvert\fR\|(1), \fBGravity\fR\|(1), \fBgeographiclib\-get\-geoids\fR\|(8). .PP An online version of this utility is availbable at . .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.52/man/Gravity.10000644000771000077100000003407014064202407016303 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2021-06-21" "GeographicLib 1.52" "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\-N\fR \fINmax\fR ] [ \fB\-M\fR \fIMmax\fR ] [ \fB\-G\fR | \fB\-D\fR | \fB\-A\fR | \fB\-H\fR ] [ \fB\-c\fR \fIlat\fR \fIh\fR ] [ \fB\-w\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; for details on the allowed formats for latitude and longitude, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \&\fBGeoConvert\fR\|(1). \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, except for grs80, 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 \fIname\fR" 4 .IX Item "-n name" use gravity field model \fIname\fR instead of the default \f(CW\*(C`egm96\*(C'\fR. See \&\*(L"\s-1MODELS\*(R"\s0. .IP "\fB\-d\fR \fIdir\fR" 4 .IX Item "-d dir" read gravity models from \fIdir\fR instead of the default. See \&\*(L"\s-1MODELS\*(R"\s0. .IP "\fB\-N\fR \fINmax\fR" 4 .IX Item "-N Nmax" limit the degree of the model to \fINmax\fR. .IP "\fB\-M\fR \fIMmax\fR" 4 .IX Item "-M Mmax" limit the order of the model to \fIMmax\fR. .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. \fBGeoidEval\fR\|(1) can compute geoid heights much more quickly by interpolating on a grid of precomputed results; however the results from \fBGeoidEval\fR\|(1) are only accurate to a few millimeters. .IP "\fB\-c\fR \fIlat\fR \fIh\fR" 4 .IX Item "-c lat h" 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\-w\fR" 4 .IX Item "-w" toggle the longitude first flag (it starts off); if the flag is on, then 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\-p\fR \fIprec\fR" 4 .IX Item "-p prec" 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 \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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 10 \& egm84, earth gravity model 1984. See \& https://earth\-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm84 \& egm96, earth gravity model 1996. See \& https://earth\-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm96 \& egm2008, earth gravity model 2008. See \& https://earth\-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm2008 \& wgs84, world geodetic system 1984. This returns the normal \& gravity for the WGS84 ellipsoid. \& grs80, geodetic reference system 1980. This returns the normal \& gravity for the GRS80 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`GEOGRAPHICLIB_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`GEOGRAPHICLIB_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-1GEOGRAPHICLIB_GRAVITY_NAME\s0\fR" 4 .IX Item "GEOGRAPHICLIB_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-1GEOGRAPHICLIB_GRAVITY_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-1GEOGRAPHICLIB_GRAVITY_PATH\s0\fR" 4 .IX Item "GEOGRAPHICLIB_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:/ProgramData/GeographicLib/gravity\*(C'\fR on Windows systems. The \fB\-h\fR option reports the value of \fB\s-1GEOGRAPHICLIB_GRAVITY_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-1GEOGRAPHICLIB_GRAVITY_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" \&\fBGeoConvert\fR\|(1), \fBGeoidEval\fR\|(1), \fBgeographiclib\-get\-gravity\fR\|(8). .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.52/man/MagneticField.10000644000771000077100000003630714064202407017356 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2021-06-21" "GeographicLib 1.52" "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\-N\fR \fINmax\fR ] [ \fB\-M\fR \fIMmax\fR ] [ \fB\-t\fR \fItime\fR | \fB\-c\fR \fItime\fR \fIlat\fR \fIh\fR ] [ \fB\-r\fR ] [ \fB\-w\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, a fractional year such as 2012.5, or the string \*(L"now\*(R". \fIlat\fR and \fIlon\fR are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; for details on the allowed formats for latitude and longitude, see the \&\f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fBGeoConvert\fR\|(1). \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 \fIname\fR" 4 .IX Item "-n name" use magnetic field model \fIname\fR instead of the default \f(CW\*(C`wmm2020\*(C'\fR. See \&\*(L"\s-1MODELS\*(R"\s0. .IP "\fB\-d\fR \fIdir\fR" 4 .IX Item "-d dir" read magnetic models from \fIdir\fR instead of the default. See \&\*(L"\s-1MODELS\*(R"\s0. .IP "\fB\-N\fR \fINmax\fR" 4 .IX Item "-N Nmax" limit the degree of the model to \fINmax\fR. .IP "\fB\-M\fR \fIMmax\fR" 4 .IX Item "-M Mmax" limit the order of the model to \fIMmax\fR. .IP "\fB\-t\fR \fItime\fR" 4 .IX Item "-t time" evaluate the field at \fItime\fR instead of reading the time from the input lines. .IP "\fB\-c\fR \fItime\fR \fIlat\fR \fIh\fR" 4 .IX Item "-c time lat h" 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\-w\fR" 4 .IX Item "-w" toggle the longitude first flag (it starts off); if the flag is on, then 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\-T\fR \fItguard\fR" 4 .IX Item "-T tguard" signal an error if \fItime\fR lies \fItguard\fR years (default 50 yr) beyond the range for the model. .IP "\fB\-H\fR \fIhguard\fR" 4 .IX Item "-H hguard" signal an error if \fIh\fR lies \fIhguard\fR meters (default 500000 m) beyond the range for the model. .IP "\fB\-p\fR \fIprec\fR" 4 .IX Item "-p prec" 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 \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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 2010\-2015. See \& https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml \& wmm2015v2, the World Magnetic Model 2015, which approximates the \& main magnetic field for the period 2015\-2020. See \& https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml \& wmm2015, a deprecated version of wmm2015v2 \& wmm2020, the World Magnetic Model 2020, which approximates the \& main magnetic field for the period 2020\-2025. See \& https://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 \& https://ngdc.noaa.gov/IAGA/vmod/igrf.html \& igrf12, the International Geomagnetic Reference Field (12th \& generation), which approximates the main magnetic field for \& the period 1900\-2020. See \& https://ngdc.noaa.gov/IAGA/vmod/igrf.html \& igrf13, the International Geomagnetic Reference Field (13th \& generation), which approximates the main magnetic field for \& the period 1900\-2025. See \& https://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 https://ngdc.noaa.gov/geomag/EMM/index.html \& emm2015, the Enhanced Magnetic Model 2015, which approximates \& the main and crustal magnetic fields for the period 2000\-2020. \& See https://ngdc.noaa.gov/geomag/EMM/index.html \& emm2017, the Enhanced Magnetic Model 2017, which approximates \& the main and crustal magnetic fields for the period 2000\-2022. \& See https://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 emm20xx) 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`wmm2020\*(C'\fR magnetic model is used. This may changed by setting the environment variable \f(CW\*(C`GEOGRAPHICLIB_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`GEOGRAPHICLIB_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-1GEOGRAPHICLIB_MAGNETIC_NAME\s0\fR" 4 .IX Item "GEOGRAPHICLIB_MAGNETIC_NAME" Override the compile-time default magnetic name of \f(CW\*(C`wmm2020\*(C'\fR. The \&\fB\-h\fR option reports the value of \fB\s-1GEOGRAPHICLIB_MAGNETIC_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-1GEOGRAPHICLIB_MAGNETIC_PATH\s0\fR" 4 .IX Item "GEOGRAPHICLIB_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:/ProgramData/GeographicLib/magnetic\*(C'\fR on Windows systems. The \fB\-h\fR option reports the value of \fB\s-1GEOGRAPHICLIB_MAGNETIC_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-1GEOGRAPHICLIB_MAGNETIC_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-1WMM2020\s0 in Timbuktu on 2020\-01\-01 .PP .Vb 3 \& echo 2020\-01\-01 16:46:33N 3:00:34W 300 | MagneticField \-r \& => \-1.60 12.00 33973.5 33960.3 \-948.1 7223.0 34732.8 \& 0.13 \-0.02 21.8 23.9 77.9 \-8.4 19.5 .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" \&\fBGeoConvert\fR\|(1), \fBgeographiclib\-get\-magnetic\fR\|(8). .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.52/man/Planimeter.10000644000771000077100000003207214064202407016756 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2021-06-21" "GeographicLib 1.52" "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\-w\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-G\fR | \fB\-E\fR | \fB\-Q\fR | \fB\-R\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 \&\fBGeoConvert\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 The edges of the polygon are given by the \fIshortest\fR geodesic between consecutive vertices. In certain cases, there may be two or many such shortest geodesics, and in that case, the polygon is not uniquely specified by its vertices. This only happens with very long edges (for the \s-1WGS84\s0 ellipsoid, any edge shorter than 19970 km is uniquely specified by its end points). In such cases, insert an additional vertex near the middle of the long edge to define the boundary of the polygon. .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 Arbitrarily complex polygons are allowed. In the case of self-intersecting polygons the area is accumulated \*(L"algebraically\*(R", e.g., the areas of the 2 loops in a figure\-8 polygon will partially cancel. 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 \fIa\fR \fIf\fR" 4 .IX Item "-e a f" specify the ellipsoid via the equatorial radius, \fIa\fR and the flattening, \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. 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 always uses the \s-1WGS84\s0 parameters. .IP "\fB\-w\fR" 4 .IX Item "-w" toggle the longitude first flag (it starts off); if the flag is on, then when reading geographic coordinates, longitude precedes latitude (this can be overridden by a hemisphere designator, \fIN\fR, \fIS\fR, \fIE\fR, \fIW\fR). .IP "\fB\-p\fR \fIprec\fR" 4 .IX Item "-p prec" set the output precision to \fIprec\fR (default 6); the perimeter is given (in meters) with \fIprec\fR digits after the decimal point; the area is given (in meters^2) with (\fIprec\fR \- 5) digits after the decimal point. .IP "\fB\-G\fR" 4 .IX Item "-G" use the series formulation for the geodesics. This is the default option and is recommended for terrestrial applications. This option, \&\fB\-G\fR, and the following three options, \fB\-E\fR, \fB\-Q\fR, and \fB\-R\fR, are mutually exclusive. .IP "\fB\-E\fR" 4 .IX Item "-E" use \*(L"exact\*(R" algorithms (based on elliptic integrals) for the geodesic calculations. These are more accurate than the (default) series expansions for |\fIf\fR| > 0.02. (But note that the implementation of areas in GeodesicExact uses a high order series and this is only accurate for modest flattenings.) .IP "\fB\-Q\fR" 4 .IX Item "-Q" perform the calculation on the authalic sphere. The area calculation is accurate even if the flattening is large, \fIprovided\fR the edges are sufficiently short. The perimeter calculation is not accurate. .IP "\fB\-R\fR" 4 .IX Item "-R" The lines joining the vertices are rhumb lines instead of geodesics. .IP "\fB\-\-comment\-delimiter\fR \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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 "ACCURACY" .IX Header "ACCURACY" Using the \fB\-G\fR option (the default), the accuracy was estimated by computing the error in the area for 10^7 approximately regular polygons on the \s-1WGS84\s0 ellipsoid. The centers and the orientations of the polygons were uniformly distributed, the number of vertices was log-uniformly distributed in [3, 300], and the center to vertex distance log-uniformly distributed in [0.1 m, 9000 km]. .PP The maximum error in the perimeter was 200 nm, and the maximum error in the area was .PP .Vb 4 \& 0.0013 m^2 for perimeter < 10 km \& 0.0070 m^2 for perimeter < 100 km \& 0.070 m^2 for perimeter < 1000 km \& 0.11 m^2 for all perimeters .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBGeoConvert\fR\|(1), \fBGeodSolve\fR\|(1). .PP An online version of this utility is availbable at . .PP The algorithm for the area of geodesic polygon is given in Section 6 of C. F. F. Karney, \fIAlgorithms for geodesics\fR, J. Geodesy 87, 43\-55 (2013); \&\s-1DOI\s0 ; addenda: . .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.52/man/RhumbSolve.10000644000771000077100000003364314064202407016751 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "RHUMBSOLVE 1" .TH RHUMBSOLVE 1 "2021-06-21" "GeographicLib 1.52" "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" RhumbSolve \-\- perform rhumb line calculations .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBRhumbSolve\fR [ \fB\-i\fR | \fB\-L\fR \fIlat1\fR \fIlon1\fR \fIazi12\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-d\fR | \fB\-:\fR ] [ \fB\-w\fR ] [ \fB\-p\fR \fIprec\fR ] [ \fB\-s\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 path with constant heading between two points on the ellipsoid at (\fIlat1\fR, \fIlon1\fR) and (\fIlat2\fR, \fIlon2\fR) is called the rhumb line or loxodrome. Its length is \fIs12\fR and the rhumb line has a forward azimuth \fIazi12\fR along its length. Also computed is \fIS12\fR is the area between the rhumb line from point 1 to point 2 and the equator; i.e., it is the area, measured counter-clockwise, of the geodesic quadrilateral with corners (\fIlat1\fR,\fIlon1\fR), (0,\fIlon1\fR), (0,\fIlon2\fR), and (\fIlat2\fR,\fIlon2\fR). A point at a pole is treated as a point a tiny distance away from the pole on the given line of longitude. The longitude becomes indeterminate when a rhumb line passes through a pole, and \fBRhumbSolve\fR reports NaNs for the longitude and the area in this case. .PP \&\fB\s-1NOTE:\s0\fR the rhumb line is \fBnot\fR the shortest path between two points; that is the geodesic and it is calculated by \fBGeodSolve\fR\|(1). .PP \&\fBRhumbSolve\fR operates in one of three modes: .IP "1." 4 By default, \fBRhumbSolve\fR accepts lines on the standard input containing \&\fIlat1\fR \fIlon1\fR \fIazi12\fR \fIs12\fR and prints \fIlat2\fR \fIlon2\fR \fIS12\fR on standard output. This is the direct calculation. .IP "2." 4 With the \fB\-i\fR command line argument, \fBRhumbSolve\fR performs the inverse calculation. It reads lines containing \fIlat1\fR \fIlon1\fR \fIlat2\fR \fIlon2\fR and prints the values of \fIazi12\fR \fIs12\fR \fIS12\fR for the corresponding shortest rhumb lines. If the end points are on opposite meridians, there are two shortest rhumb lines and the east-going one is chosen. .IP "3." 4 Command line arguments \fB\-L\fR \fIlat1\fR \fIlon1\fR \fIazi12\fR specify a rhumb line. \fBRhumbSolve\fR then accepts a sequence of \fIs12\fR values (one per line) on standard input and prints \fIlat2\fR \fIlon2\fR \fIS12\fR for each. This generates a sequence of points on a rhumb line. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-i\fR" 4 .IX Item "-i" perform an inverse calculation (see 2 above). .IP "\fB\-L\fR \fIlat1\fR \fIlon1\fR \fIazi12\fR" 4 .IX Item "-L lat1 lon1 azi12" line mode (see 3 above); generate a sequence of points along the rhumb line specified by \fIlat1\fR \fIlon1\fR \fIazi12\fR. The \fB\-w\fR flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before \fB\-L\fR. (\fB\-l\fR is an alternative, deprecated, spelling of this flag.) .IP "\fB\-e\fR \fIa\fR \fIf\fR" 4 .IX Item "-e a f" specify the ellipsoid via the equatorial radius, \fIa\fR and the flattening, \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. 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\-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\-p\fR \fIprec\fR" 4 .IX Item "-p prec" set the output precision to \fIprec\fR (default 3); \fIprec\fR is the precision relative to 1 m. See \*(L"\s-1PRECISION\*(R"\s0. .IP "\fB\-s\fR" 4 .IX Item "-s" By default, the rhumb line calculations are carried out exactly in terms of elliptic integrals. This includes the use of the addition theorem for elliptic integrals to compute the divided difference of the isometric and rectifying latitudes. If \fB\-s\fR is supplied this divided difference is computed using Krueger series for the transverse Mercator projection which is only accurate for |\fIf\fR| < 0.01. See \&\*(L"\s-1ACCURACY\*(R"\s0. .IP "\fB\-\-comment\-delimiter\fR \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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" \&\fBRhumbSolve\fR measures all angles in degrees, all lengths (\fIs12\fR) in meters, and all areas (\fIS12\fR) in meters^2. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees, minutes, seconds. For example, \f(CW\*(C`40d30\*(C'\fR, \f(CW\*(C`40d30\*(Aq\*(C'\fR, \f(CW\*(C`40:30\*(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 (the \fB\-w\fR flag switches this convention); 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. .PP For details on the allowed formats for angles, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fBGeoConvert\fR\|(1). .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 \fIprec\fR + 5. For \s-1DMS\s0 (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is \fIprec\fR + 1. 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 \fBRhumbSolve\fR to return an exit code of 1. However, an error does not cause \fBRhumbSolve\fR to terminate; following lines will be converted. .SH "ACCURACY" .IX Header "ACCURACY" The algorithm used by \fBRhumbSolve\fR uses exact formulas for converting between the latitude, rectifying latitude (\fImu\fR), and isometric latitude (\fIpsi\fR). These formulas are accurate for any value of the flattening. The computation of rhumb lines involves the ratio (\fIpsi1\fR \&\- \fIpsi2\fR) / (\fImu1\fR \- \fImu2\fR) and this is subject to large round-off errors if \fIlat1\fR is close to \fIlat2\fR. So this ratio is computed using divided differences using one of two methods: by default, this uses the addition theorem for elliptic integrals (accurate for all values of \&\fIf\fR); however, with the \fB\-s\fR options, it is computed using the series expansions used by \fBTransverseMercatorProj\fR\|(1) for the conversions between rectifying and conformal latitudes (accurate for |\fIf\fR| < 0.01). For the \s-1WGS84\s0 ellipsoid, the error is about 10 nanometers using either method. .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 | \& RhumbSolve \-i \-: \-p 0 \& \& 103:34:58.2 18523563 .Ve .PP N.B. This is \fBnot\fR the route typically taken by aircraft because it's considerably longer than the geodesic given by \fBGeodSolve\fR\|(1). .PP Waypoints on the route at intervals of 2000km: .PP .Vb 2 \& for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done | \& RhumbSolve \-L 40:38:23N 073:46:44W 103:34:58.2 \-: \-p 0 \& \& 40:38:23.0N 073:46:44.0W 0 \& 36:24:30.3N 051:28:26.4W 9817078307821 \& 32:10:26.8N 030:20:57.3W 18224745682005 \& 27:56:13.2N 010:10:54.2W 25358020327741 \& 23:41:50.1N 009:12:45.5E 31321269267102 \& 19:27:18.7N 027:59:22.1E 36195163180159 \& 15:12:40.2N 046:17:01.1E 40041499143669 \& 10:57:55.9N 064:12:52.8E 42906570007050 \& 06:43:07.3N 081:53:28.8E 44823504180200 \& 02:28:16.2N 099:24:54.5E 45813843358737 \& 01:46:36.0S 116:52:59.7E 45888525219677 .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBGeoConvert\fR\|(1), \fBGeodSolve\fR\|(1), \fBTransverseMercatorProj\fR\|(1). .PP An online version of this utility is availbable at . .PP The Wikipedia page, Rhumb line, . .SH "AUTHOR" .IX Header "AUTHOR" \&\fBRhumbSolve\fR was written by Charles Karney. .SH "HISTORY" .IX Header "HISTORY" \&\fBRhumbSolve\fR was added to GeographicLib, , in version 1.37. GeographicLib-1.52/man/TransverseMercatorProj.10000644000771000077100000002520214064202407021337 0ustar ckarneyckarney.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "2021-06-21" "GeographicLib 1.52" "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 \fIk0\fR ] [ \fB\-r\fR ] [ \fB\-e\fR \fIa\fR \fIf\fR ] [ \fB\-w\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" 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 detils on the allowed formats for latitude and longitude, see the \f(CW\*(C`GEOGRAPHIC COORDINATES\*(C'\fR section of \fBGeoConvert\fR\|(1). 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 grid north (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 the exact algorithm with the \*(L"\s-1EXTENDED DOMAIN\*(R"\s0; this is the default. .IP "\fB\-l\fR \fIlon0\fR" 4 .IX Item "-l lon0" specify the longitude of origin \fIlon0\fR (degrees, default 0). .IP "\fB\-k\fR \fIk0\fR" 4 .IX Item "-k k0" 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 \fIa\fR \fIf\fR" 4 .IX Item "-e a f" specify the ellipsoid via the equatorial radius, \fIa\fR and the flattening, \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. 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\-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\-p\fR \fIprec\fR" 4 .IX Item "-p prec" set the output precision to \fIprec\fR (default 6). \fIprec\fR is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is \fIprec\fR + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is \fIprec\fR + 6. .IP "\fB\-\-comment\-delimiter\fR \fIcommentdelim\fR" 4 .IX Item "--comment-delimiter commentdelim" 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 \fIinfile\fR" 4 .IX Item "--input-file infile" 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 \fIinstring\fR" 4 .IX Item "--input-string instring" 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 \fIlinesep\fR" 4 .IX Item "--line-separator linesep" set the line separator character to \fIlinesep\fR. By default this is a semicolon. .IP "\fB\-\-output\-file\fR \fIoutfile\fR" 4 .IX Item "--output-file outfile" 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 = 82.636..., 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. Geodesy \fB85\fR(8), 475\-485 (Aug. 2011); \s-1DOI\s0 ; 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.52/man/CartConvert.usage0000644000771000077100000001456214064202407020060 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ -w ] [ -p prec ] [\n" " --comment-delimiter commentdelim ] [ --version | -h | --help ] [\n" " --input-file infile | --input-string instring ] [ --line-separator\n" " linesep ] [ --output-file outfile ]\n" "\n" "For full documentation type:\n" " CartConvert --help\n" "or visit:\n" " https://geographiclib.sourceforge.io/1.52/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 ] [ -w ] [ -p prec ] [\n" " --comment-delimiter commentdelim ] [ --version | -h | --help ] [\n" " --input-file infile | --input-string instring ] [ --line-separator\n" " linesep ] [ --output-file outfile ]\n" "\n" "DESCRIPTION\n" " 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 details on the allowed formats for latitude and longitude, see the\n" " \"GEOGRAPHIC COORDINATES\" section of GeoConvert(1). For each set of\n" " geodetic coordinates, the corresponding cartesian coordinates x, y, z\n" " (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. In general there are multiple solutions and the result\n" " which minimizes the absolute value of height is returned, i.e.,\n" " (latitude, longitude) corresponds to the closest point on the\n" " ellipsoid.\n" "\n" " -l lat0 lon0 h0\n" " specifies conversions to and from a local cartesion coordinate\n" " systems with origin lat0 lon0 h0, instead of a geocentric\n" " coordinate system. The -w flag can be used to swap the default\n" " order of the 2 geographic coordinates, provided that it appears\n" " before -l.\n" "\n" " -e a f\n" " specify the ellipsoid via the equatorial radius, a and the\n" " flattening, 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. By default, the WGS84 ellipsoid is used, a =\n" " 6378137 m, f = 1/298.257223563.\n" "\n" " -w toggle the longitude first flag (it starts off); if the flag is on,\n" " then on input and output, longitude precedes latitude (except that,\n" " on input, this can be overridden by a hemisphere designator, N, S,\n" " E, W).\n" "\n" " -p prec\n" " set the output precision to prec (default 6). prec is the number\n" " of digits after the decimal point for geocentric and local\n" " cartesion coordinates and for the height (in meters). For\n" " latitudes and longitudes (in degrees), the number of digits after\n" " the decimal point is prec + 5.\n" "\n" " --comment-delimiter commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "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\n" " it was called ECEFConvert.\n" ; return retval; } GeographicLib-1.52/man/ConicProj.usage0000644000771000077100000001574314064202407017516 0ustar ckarneyckarneyint 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" " [ -w ] [ -p prec ] [ --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" " ConicProj --help\n" "or visit:\n" " https://geographiclib.sourceforge.io/1.52/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" " [ -w ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version |\n" " -h | --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator 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 details on the allowed formats for\n" " latitude and longitude, see the \"GEOGRAPHIC COORDINATES\" section of\n" " GeoConvert(1). For each set of geodetic coordinates, the corresponding\n" " projected easting, x, and northing, y, (meters) are printed on standard\n" " output together with the meridian convergence gamma (degrees) and\n" " (azimuthal) scale k. For Albers equal area, the radial scale is 1/k.\n" " The meridian convergence is the bearing of the y axis measured\n" " 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 lat1 lat2\n" " use the Lambert conformal conic projection with standard parallels\n" " lat1 and lat2.\n" "\n" " -a lat1 lat2\n" " use the Albers equal area projection with standard parallels lat1\n" " and lat2.\n" "\n" " -l lon0\n" " specify the longitude of origin lon0 (degrees, default 0).\n" "\n" " -k k1\n" " 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 a f\n" " specify the ellipsoid via the equatorial radius, a and the\n" " flattening, 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. By default, the WGS84 ellipsoid is used, a =\n" " 6378137 m, f = 1/298.257223563.\n" "\n" " -w toggle the longitude first flag (it starts off); if the flag is on,\n" " then on input and output, longitude precedes latitude (except that,\n" " on input, this can be overridden by a hemisphere designator, N, S,\n" " E, W).\n" "\n" " -p prec\n" " set the output precision to prec (default 6). prec is the number\n" " of digits after the decimal point for lengths (in meters). For\n" " latitudes and longitudes (in degrees), the number of digits after\n" " the decimal point is prec + 5. For the convergence (in degrees)\n" " and scale, the number of digits after the decimal point is prec +\n" " 6.\n" "\n" " --comment-delimiter commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "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,\n" " , in version 1.9.\n" ; return retval; } GeographicLib-1.52/man/GeodesicProj.usage0000644000771000077100000001575314064202407020206 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " GeodesicProj ( -z | -c | -g ) lat0 lon0 [ -r ] [ -e a f ] [ -w ] [ -p\n" " prec ] [ --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" " https://geographiclib.sourceforge.io/1.52/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 ] [ -w ] [ -p\n" " prec ] [ --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 details on the allowed formats for\n" " latitude and longitude, see the \"GEOGRAPHIC COORDINATES\" section of\n" " GeoConvert(1). For each set of geodetic coordinates, the corresponding\n" " projected coordinates x, y (meters) are printed on standard output\n" " together with the azimuth azi (degrees) and reciprocal scale rk. For\n" " Cassini-Soldner, azi is the bearing of the easting direction and the\n" " scale in the easting direction is 1 and the scale in the northing\n" " direction is 1/rk. For azimuthal equidistant and gnomonic, azi is the\n" " bearing of the radial direction and the scale in the azimuthal\n" " direction is 1/rk. For azimuthal equidistant and gnomonic, the scales\n" " in the radial direction are 1 and 1/rk^2, respectively.\n" "\n" "OPTIONS\n" " -z lat0 lon0\n" " use the azimuthal equidistant projection centered at latitude =\n" " lat0, longitude = lon0. The -w flag can be used to swap the\n" " default order of the 2 coordinates, provided that it appears before\n" " -z.\n" "\n" " -c lat0 lon0\n" " use the Cassini-Soldner projection centered at latitude = lat0,\n" " longitude = lon0. The -w flag can be used to swap the default\n" " order of the 2 coordinates, provided that it appears before -c.\n" "\n" " -g lat0 lon0\n" " use the ellipsoidal gnomonic projection centered at latitude =\n" " lat0, longitude = lon0. The -w flag can be used to swap the\n" " default order of the 2 coordinates, provided that it appears before\n" " -g.\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 a f\n" " specify the ellipsoid via the equatorial radius, a and the\n" " flattening, 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. By default, the WGS84 ellipsoid is used, a =\n" " 6378137 m, f = 1/298.257223563.\n" "\n" " -w toggle the longitude first flag (it starts off); if the flag is on,\n" " then on input and output, longitude precedes latitude (except that,\n" " on input, this can be overridden by a hemisphere designator, N, S,\n" " E, W).\n" "\n" " -p prec\n" " set the output precision to prec (default 6). prec is the number\n" " of digits after the decimal point for lengths (in meters). For\n" " latitudes, longitudes, and azimuths (in degrees), the number of\n" " digits after the decimal point is prec + 5. For the scale, the\n" " number of digits after the decimal point is prec + 6.\n" "\n" " --comment-delimiter commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "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 8 of C. F. F.\n" " Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); DOI\n" " ; addenda:\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\n" " 1.9 it was called EquidistantTest.\n" ; return retval; } GeographicLib-1.52/man/GeoConvert.usage0000644000771000077100000004144114064202407017675 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -z zone | -s | -t | -S |\n" " -T ] [ -n ] [ -w ] [ -p prec ] [ -l | -a ] [ --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" " GeoConvert --help\n" "or visit:\n" " https://geographiclib.sourceforge.io/1.52/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 ] [ -z zone | -s | -t | -S |\n" " -T ] [ -n ] [ -w ] [ -p prec ] [ -l | -a ] [ --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" " 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, and seconds. Latitude\n" " is given first (unless the -w option is given). See \"GEOGRAPHIC\n" " COORDINATES\" for a description of the format. For example, the\n" " 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 north) or s (or south). The zone is absent for a UPS\n" " specification. For 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. The meridian convergence is the bearing of grid\n" " north given as degrees clockwise from true north.\n" "\n" " -z zone\n" " 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, 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" " -S or -T\n" " behave the same as -s and -t, respectively, until the first legal\n" " conversion is performed. For subsequent points, the zone and\n" " hemisphere of that conversion are used. This enables a sequence of\n" " points to be converted into UTM or UPS using a consistent\n" " coordinate system.\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 toggle the longitude first flag (it starts off); if the flag is on,\n" " then on input and output, longitude precedes latitude (except that,\n" " on input, this can be overridden by a hemisphere designator, N, S,\n" " E, W).\n" "\n" " -p prec\n" " set the output precision to prec (default 0); prec is the precision\n" " relative to 1 m. See \"PRECISION\".\n" "\n" " -l on output, UTM/UPS uses the long forms north and south to designate\n" " the hemisphere instead of n or s.\n" "\n" " -a on output, UTM/UPS uses the abbreviations n and s to designate the\n" " hemisphere instead of north or south; this is the default\n" " representation.\n" "\n" " --comment-delimiter commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "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. For MGRS, The number of digits\n" " per coordinate is 5 + prec; prec = -6 results in just the grid zone.\n" " For decimal degrees, the number of digits after the decimal point is 5\n" " + prec. For DMS (degree, minute, seconds) output, the number of digits\n" " after the decimal point in the seconds components is 1 + prec; if this\n" " is negative then use minutes (prec = -2 or -3) or degrees (prec <= -4)\n" " as the least significant component. Print convergence, resp. scale,\n" " with 5 + prec, resp. 7 + prec, digits after the decimal point. The\n" " minimum value of prec is -5 (-6 for MGRS) and the maximum is 9 for\n" " UTM/UPS, 9 for decimal degrees, 10 for DMS, 6 for MGRS, and 8 for\n" " convergence and scale.\n" "\n" "GEOGRAPHIC COORDINATES\n" " The utility accepts geographic coordinates, latitude and longitude, in\n" " a number of common formats. Latitude precedes longitude, unless the -w\n" " option is given which switches this convention. On input, either\n" " coordinate may be given first by appending or prepending N or S to the\n" " latitude and E or W to the longitude. These hemisphere designators\n" " carry an implied sign, positive for N and E and negative for S and W.\n" " This sign multiplies any +/- sign prefixing the coordinate. The\n" " coordinates may be given as decimal degree or as degrees, minutes, and\n" " seconds. d, ', and \" are used to denote degrees, minutes, and seconds,\n" " with the least significant designator optional. (See \"QUOTING\" for how\n" " to quote the characters ' and \" when entering coordinates on the\n" " command line.) Alternatively, : (colon) may be used to separate the\n" " various components. Only the final component of coordinate can include\n" " a decimal point, and the minutes and seconds components must be less\n" " than 60.\n" "\n" " It is also possible to carry out addition or subtraction operations in\n" " geographic coordinates. If the coordinate includes interior signs\n" " (i.e., not at the beginning or immediately after an initial hemisphere\n" " designator), then the coordinate is split before such signs; the pieces\n" " are parsed separately and the results summed. For example the point\n" " 15\" east of 39N 70W is\n" "\n" " 39N 70W+0:0:15E\n" "\n" " WARNING: \"Exponential\" notation is not recognized for geographic\n" " coordinates. Thus 7.0E1 is illegal, while 7.0E+1 is parsed as (7.0E) +\n" " (+1), yielding the same result as 8.0E.\n" "\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; in addition two single quotes can be used to\n" " represent \".\n" "\n" " The other GeographicLib utilities use the same rules for interpreting\n" " geographic coordinates; in addition, azimuths and arc lengths are\n" " interpreted the same way.\n" "\n" "QUOTING\n" " Unfortunately the characters ' and \" have special meanings in many\n" " shells and have to be entered with care. However note (1) that the\n" " trailing designator is optional and that (2) you can use colons as a\n" " separator character. Thus 10d20' can be entered as 10d20 or 10:20 and\n" " 10d20'30\" can be entered as 10:20:30.\n" "\n" " Unix shells (sh, bash, tsch)\n" " The characters ' and \" can be quoted by preceding them with a \\\n" " (backslash); or you can quote a string containing ' with a pair of\n" " \"s. The two alternatives are illustrated by\n" "\n" " echo 10d20\\'30\\\" \"20d30'40\" | GeoConvert -d -p -1\n" " => 10d20'30\"N 020d30'40\"E\n" "\n" " Quoting of command line arguments is similar\n" "\n" " GeoConvert -d -p -1 --input-string \"10d20'30\\\" 20d30'40\"\n" " => 10d20'30\"N 020d30'40\"E\n" "\n" " Windows command shell (cmd)\n" " The ' character needs no quoting; the \" character can either be\n" " quoted by a ^ or can be represented by typing ' twice. (This\n" " quoting is usually unnecessary because the trailing designator can\n" " be omitted.) Thus\n" "\n" " echo 10d20'30'' 20d30'40 | GeoConvert -d -p -1\n" " => 10d20'30\"N 020d30'40\"E\n" "\n" " Use \\ to quote the \" character in a command line argument\n" "\n" " GeoConvert -d -p -1 --input-string \"10d20'30\\\" 20d30'40\"\n" " => 10d20'30\"N 020d30'40\"E\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" "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. When an\n" " MGRS coordinate is provided as input, GeoConvert treats this as a\n" " representative point within the square. By default, this\n" " representative point is the center of the square (\"38n 444500 3688500\"\n" " in the example above). (This leads to a stable conversion between MGRS\n" " and geographic coordinates.) However, if the -n option is given then\n" " the south-west corner of the square is returned instead (\"38n 444000\n" " 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, and -t options allow these rules to be overridden with zone =\n" " 0 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" " Is zone is specified with a hemisphere, then this is honored when\n" " printing UTM coordinates:\n" "\n" " echo -1 3 | GeoConvert -u => 31s 500000 9889470\n" " echo -1 3 | GeoConvert -u -z 31 => 31s 500000 9889470\n" " echo -1 3 | GeoConvert -u -z 31s => 31s 500000 9889470\n" " echo -1 3 | GeoConvert -u -z 31n => 31n 500000 -110530\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 (or south); replace N thru X by n (or north).\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" " GeoConvert can be used to do simple arithmetic using degree, minutes,\n" " and seconds. For example, sometimes data is tiled in 15 second squares\n" " tagged by the DMS representation of the SW corner. The tags of the\n" " tile at 38:59:45N 077:02:00W and its 8 neighbors are then given by\n" "\n" " t=0:0:15\n" " for y in -$t +0 +$t; do\n" " for x in -$t +0 +$t; do\n" " echo 38:59:45N$y 077:02:00W$x\n" " done\n" " done | GeoConvert -: -p -1 | tr -d ': '\n" " =>\n" " 385930N0770215W\n" " 385930N0770200W\n" " 385930N0770145W\n" " 385945N0770215W\n" " 385945N0770200W\n" " 385945N0770145W\n" " 390000N0770215W\n" " 390000N0770200W\n" " 390000N0770145W\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" " An online version of this utility is availbable at\n" " .\n" "\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. Geodesy 85(8), 475-485 (Aug. 2011); DOI\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.52/man/GeodSolve.usage0000644000771000077100000004034614064202407017514 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " GeodSolve [ -i | -L lat1 lon1 azi1 | -D lat1 lon1 azi1 s13 | -I lat1\n" " lon1 lat3 lon3 ] [ -a ] [ -e a f ] [ -u ] [ -F ] [ -d | -: ] [ -w ] [\n" " -b ] [ -f ] [ -p prec ] [ -E ] [ --comment-delimiter commentdelim ] [\n" " --version | -h | --help ] [ --input-file infile | --input-string\n" " instring ] [ --line-separator linesep ] [ --output-file outfile ]\n" "\n" "For full documentation type:\n" " GeodSolve --help\n" "or visit:\n" " https://geographiclib.sourceforge.io/1.52/GeodSolve.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " GeodSolve -- perform geodesic calculations\n" "\n" "SYNOPSIS\n" " GeodSolve [ -i | -L lat1 lon1 azi1 | -D lat1 lon1 azi1 s13 | -I lat1\n" " lon1 lat3 lon3 ] [ -a ] [ -e a f ] [ -u ] [ -F ] [ -d | -: ] [ -w ] [\n" " -b ] [ -f ] [ -p prec ] [ -E ] [ --comment-delimiter commentdelim ] [\n" " --version | -h | --help ] [ --input-file infile | --input-string\n" " instring ] [ --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 forward azimuths azi1 and azi2 at\n" " the two end points.\n" "\n" " GeodSolve operates in one of three modes:\n" "\n" " 1. By default, GeodSolve accepts lines on the standard input\n" " containing lat1 lon1 azi1 s12 and prints lat2 lon2 azi2 on standard\n" " output. This is the direct geodesic calculation.\n" "\n" " 2. With the -i command line argument, GeodSolve 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" " 3. Command line arguments -L lat1 lon1 azi1 specify a geodesic line.\n" " GeodSolve 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. Command line arguments\n" " -D and -I work similarly with the geodesic line defined in terms of\n" " a direct or inverse geodesic calculation, respectively.\n" "\n" "OPTIONS\n" " -i perform an inverse geodesic calculation (see 2 above).\n" "\n" " -L lat1 lon1 azi1\n" " line mode (see 3 above); generate a sequence of points along the\n" " geodesic specified by lat1 lon1 azi1. The -w flag can be used to\n" " swap the default order of the 2 geographic coordinates, provided\n" " that it appears before -L. (-l is an alternative, deprecated,\n" " spelling of this flag.)\n" "\n" " -D lat1 lon1 azi1 s13\n" " line mode (see 3 above); generate a sequence of points along the\n" " geodesic specified by lat1 lon1 azi1 s13. The -w flag can be used\n" " to swap the default order of the 2 geographic coordinates, provided\n" " that it appears before -D. Similarly, the -a flag can be used to\n" " change the interpretation of s13 to a13, provided that it appears\n" " before -D.\n" "\n" " -I lat1 lon1 lat3 lon3\n" " line mode (see 3 above); generate a sequence of points along the\n" " geodesic specified by lat1 lon1 lat3 lon3. The -w flag can be used\n" " to swap the default order of the 2 geographic coordinates, provided\n" " that it appears before -I.\n" "\n" " -a toggle the arc mode flag (it starts off); if this flag is on, then\n" " on input and output s12 is replaced by a12 the arc length (in\n" " degrees) on the auxiliary sphere. See \"AUXILIARY SPHERE\".\n" "\n" " -e a f\n" " specify the ellipsoid via the equatorial radius, a and the\n" " flattening, 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. By default, the WGS84 ellipsoid is used, a =\n" " 6378137 m, f = 1/298.257223563.\n" "\n" " -u unroll the longitude. Normally, on output longitudes are reduced\n" " to lie in [-180deg,180deg). However with this option, the returned\n" " longitude lon2 is \"unrolled\" so that lon2 - lon1 indicates how\n" " often and in what sense the geodesic has encircled the earth. Use\n" " the -f option, to get both longitudes printed.\n" "\n" " -F fractional mode. This only has any effect with the -D and -I\n" " options (and is otherwise ignored). The values read on standard\n" " input are interpreted as fractional distances to point 3, i.e., as\n" " s12/s13 instead of s12. If arc mode is in effect, then the values\n" " denote fractional arc length, i.e., a12/a13. The fractional\n" " distances can be entered as a simple fraction, e.g., 3/4.\n" "\n" " -d output angles as degrees, minutes, seconds instead of decimal\n" " degrees.\n" "\n" " -: like -d, except use : as a separator instead of the d, ', and \"\n" " delimiters.\n" "\n" " -w toggle the longitude first flag (it starts off); if the flag is on,\n" " then on input and output, longitude precedes latitude (except that,\n" " on input, this can be overridden by a hemisphere designator, N, S,\n" " E, W).\n" "\n" " -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 prec\n" " set the output precision to prec (default 3); prec is the precision\n" " relative to 1 m. See \"PRECISION\".\n" "\n" " -E use \"exact\" algorithms (based on elliptic integrals) for the\n" " geodesic calculations. These are more accurate than the (default)\n" " series expansions for |f| > 0.02.\n" "\n" " --comment-delimiter commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "INPUT\n" " GeodSolve measures all angles in degrees and all lengths (s12) in\n" " meters, and all areas (S12) in meters^2. On input angles (latitude,\n" " longitude, azimuth, arc length) can be as decimal degrees or degrees,\n" " minutes, seconds. For example, \"40d30\", \"40d30'\", \"40:30\", \"40.5d\",\n" " and 40.5 are all equivalent. By default, latitude precedes longitude\n" " for each point (the -w flag switches this convention); however on input\n" " either may be given first by appending (or prepending) N or S to the\n" " latitude and E or W to the longitude. Azimuths are measured clockwise\n" " from north; however this may be overridden with E or W.\n" "\n" " For details on the allowed formats for angles, see the \"GEOGRAPHIC\n" " COORDINATES\" section of GeoConvert(1).\n" "\n" "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:\n" "\n" " s13 = s12 + s23,\n" " a13 = a12 + a23,\n" " S13 = S12 + S23,\n" " m13 = m12 M23 + m23 M21,\n" " M13 = M12 M23 - (1 - M12 M21) m23 / m12,\n" " 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 geodesic quadrilateral with corners (lat1,lon1), (0,lon1),\n" " (0,lon2), and (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 prec + 5. For DMS (degree,\n" " minute, seconds) output, the number of digits after the decimal point\n" " in the seconds component is prec + 1. 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 GeodSolve to return an exit code of\n" " 1. However, an error does not cause GeodSolve to terminate; following\n" " lines will be converted.\n" "\n" "ACCURACY\n" " Using the (default) series solution, GeodSolve is accurate to about 15\n" " nm (15 nanometers) for the WGS84 ellipsoid. The approximate maximum\n" " error (expressed as a distance) for an ellipsoid with the same\n" " equatorial radius as the WGS84 ellipsoid and different values of the\n" " flattening is\n" "\n" " |f| error\n" " 0.01 25 nm\n" " 0.02 30 nm\n" " 0.05 10 um\n" " 0.1 1.5 mm\n" " 0.2 300 mm\n" "\n" " If -E is specified, GeodSolve is accurate to about 40 nm (40\n" " nanometers) for the WGS84 ellipsoid. The approximate maximum error\n" " (expressed as a distance) for an ellipsoid with a quarter meridian of\n" " 10000 km and different values of the a/b = 1 - f is\n" "\n" " 1-f error (nm)\n" " 1/128 387\n" " 1/64 345\n" " 1/32 269\n" " 1/16 210\n" " 1/8 115\n" " 1/4 69\n" " 1/2 36\n" " 1 15\n" " 2 25\n" " 4 96\n" " 8 318\n" " 16 985\n" " 32 2352\n" " 64 6008\n" " 128 19024\n" "\n" "MULTIPLE SOLUTIONS\n" " The shortest distance returned for the inverse problem is (obviously)\n" " uniquely defined. However, in a few special cases there are multiple\n" " azimuths which yield the same shortest distance. Here is a catalog of\n" " those cases:\n" "\n" " lat1 = -lat2 (with neither point at a pole)\n" " If azi1 = azi2, the geodesic is unique. Otherwise there are two\n" " geodesics and the second one is obtained by setting [azi1,azi2] =\n" " [azi2,azi1], [M12,M21] = [M21,M12], S12 = -S12. (This occurs when\n" " the longitude difference is near +/-180 for oblate ellipsoids.)\n" "\n" " lon2 = lon1 +/- 180 (with neither point at a pole)\n" " If azi1 = 0 or +/-180, the geodesic is unique. Otherwise there are\n" " two geodesics and the second one is obtained by setting [azi1,azi2]\n" " = [-azi1,-azi2], S12 = -S12. (This occurs when lat2 is near -lat1\n" " for prolate ellipsoids.)\n" "\n" " Points 1 and 2 at opposite poles\n" " There are infinitely many geodesics which can be generated by\n" " setting [azi1,azi2] = [azi1,azi2] + [d,-d], for arbitrary d. (For\n" " spheres, this prescription applies when points 1 and 2 are\n" " antipodal.)\n" "\n" " s12 = 0 (coincident points)\n" " There are infinitely many geodesics which can be generated by\n" " setting [azi1,azi2] = [azi1,azi2] + [d,d], for arbitrary d.\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" " GeodSolve -i -: -p 0\n" "\n" " 003:18:29.9 177:29:09.2 15347628\n" "\n" " Equally spaced waypoints on the route:\n" "\n" " for ((i = 0; i <= 10; ++i)); do echo $i/10; done |\n" " GeodSolve -I 40:38:23N 073:46:44W 01:21:33N 103:59:22E -F -: -p 0\n" "\n" " 40:38:23.0N 073:46:44.0W 003:18:29.9\n" " 54:24:51.3N 072:25:39.6W 004:18:44.1\n" " 68:07:37.7N 069:40:42.9W 006:44:25.4\n" " 81:38:00.4N 058:37:53.9W 017:28:52.7\n" " 83:43:26.0N 080:37:16.9E 156:26:00.4\n" " 70:20:29.2N 097:01:29.4E 172:31:56.4\n" " 56:38:36.0N 100:14:47.6E 175:26:10.5\n" " 42:52:37.1N 101:43:37.2E 176:34:28.6\n" " 29:03:57.0N 102:39:34.8E 177:07:35.2\n" " 15:13:18.6N 103:22:08.0E 177:23:44.7\n" " 01:21:33.0N 103:59:22.0E 177:29:09.2\n" "\n" "SEE ALSO\n" " GeoConvert(1).\n" "\n" " An online version of this utility is availbable at\n" " .\n" "\n" " The algorithms are described in C. F. F. Karney, Algorithms for\n" " geodesics, J. Geodesy 87, 43-55 (2013); DOI:\n" " ; addenda:\n" " .\n" "\n" " The Wikipedia page, Geodesics on an ellipsoid,\n" " .\n" "\n" "AUTHOR\n" " GeodSolve was written by Charles Karney.\n" "\n" "HISTORY\n" " GeodSolve was added to GeographicLib,\n" " , in 2009-03. Prior to version\n" " 1.30, it was called Geod. (The name was changed to avoid a conflict\n" " with the geod utility in proj.4.)\n" ; return retval; } GeographicLib-1.52/man/GeoidEval.usage0000644000771000077100000003125514064202407017463 0ustar ckarneyckarneyint 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" " ] [ -w ] [ -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" " https://geographiclib.sourceforge.io/1.52/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" " ] [ -w ] [ -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 heights of the geoid above the WGS84 ellipsoid on\n" " standard output.\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" " The height of the geoid above the ellipsoid, N, is sometimes called the\n" " geoid undulation. It can be used to convert a height above the\n" " ellipsoid, h, to the corresponding height above the geoid (the\n" " orthometric height, roughly the height above mean sea level), H, using\n" " the relations\n" "\n" " h = N + H, H = -N + h.\n" "\n" "OPTIONS\n" " -n name\n" " use geoid name instead of the default \"egm96-5\". See \"GEOIDS\".\n" "\n" " -d dir\n" " 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 south west north east\n" " cache the data bounded by south west north east in memory. The\n" " first two arguments specify the SW corner of the cache and the last\n" " two arguments specify the NE corner. The -w flag specifies that\n" " longitude precedes latitude for these corners, provided that it\n" " appears before -c. See \"CACHE\".\n" "\n" " -w toggle the longitude first flag (it starts off); if the flag is on,\n" " then when reading geographic coordinates, longitude precedes\n" " latitude (this can be overridden by a hemisphere designator, N, S,\n" " E, W).\n" "\n" " -z zone\n" " 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 commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage, the default geoid path and name, and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "GEOIDS\n" " GeoidEval computes geoid heights by interpolating on the data in a\n" " regularly spaced table (see \"INTERPOLATION\"). The following geoid\n" " tables 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 \"GEOGRAPHICLIB_GEOID_NAME\" or with the -n\n" " option. The errors listed here are estimates of the quantization and\n" " interpolation errors in the reported heights compared to the specified\n" " 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" " \"GEOGRAPHICLIB_GEOID_PATH\" or \"GEOGRAPHICLIB_DATA\", or with the -d\n" " option. The -h option prints the default geoid path and name. Use the\n" " -v option to 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.\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" " GEOGRAPHICLIB_GEOID_NAME\n" " Override the compile-time default geoid name of \"egm96-5\". The -h\n" " option reports the value of GEOGRAPHICLIB_GEOID_NAME, if defined,\n" " otherwise it reports the compile-time value. If the -n name option\n" " is used, then name takes precedence.\n" "\n" " GEOGRAPHICLIB_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:/ProgramData/GeographicLib/geoids\" on Windows systems. The -h\n" " option reports the value of GEOGRAPHICLIB_GEOID_PATH, if defined,\n" " otherwise it reports the compile-time value. If the -d dir option\n" " is used, then dir takes precedence.\n" "\n" " GEOGRAPHICLIB_DATA\n" " Another way of overriding the compile-time default geoid path. If\n" " it is set (and if GEOGRAPHICLIB_GEOID_PATH is not set), then\n" " $GEOGRAPHICLIB_DATA/geoids 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" " .\n" "\n" " EGM96\n" " An earth gravity model published by the NGA in 1996,\n" " .\n" "\n" " EGM2008\n" " An earth gravity model published by the NGA in 2008,\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), geographiclib-get-geoids(8).\n" "\n" " An online version of this utility is availbable at\n" " .\n" "\n" "AUTHOR\n" " GeoidEval was written by Charles Karney.\n" "\n" "HISTORY\n" " GeoidEval was added to GeographicLib,\n" " , in 2009-09.\n" ; return retval; } GeographicLib-1.52/man/Gravity.usage0000644000771000077100000002463714064202407017257 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " Gravity [ -n name ] [ -d dir ] [ -N Nmax ] [ -M Mmax ] [ -G | -D | -A |\n" " -H ] [ -c lat h ] [ -w ] [ -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" " Gravity --help\n" "or visit:\n" " https://geographiclib.sourceforge.io/1.52/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 ] [ -N Nmax ] [ -M Mmax ] [ -G | -D | -A |\n" " -H ] [ -c lat h ] [ -w ] [ -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" " 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; for details on the allowed formats for latitude and longitude,\n" " see the \"GEOGRAPHIC COORDINATES\" section of GeoConvert(1). h is the\n" " height above the ellipsoid in meters; this quantity is optional and\n" " defaults to 0. Alternatively, the gravity field can be computed at\n" " various points on a circle of latitude (constant lat and h) via the -c\n" " option; in this case only the longitude should be given on the input\n" " lines. The quantities printed out are governed by the -G (default),\n" " -D, -A, or -H options.\n" "\n" " All the supported gravity models, except for grs80, use WGS84 as the\n" " reference ellipsoid a = 6378137 m, f = 1/298.257223563, omega =\n" " 7292115e-11 rad/s, and GM = 3986004.418e8 m^3/s^2.\n" "\n" "OPTIONS\n" " -n name\n" " use gravity field model name instead of the default \"egm96\". See\n" " \"MODELS\".\n" "\n" " -d dir\n" " read gravity models from dir instead of the default. See \"MODELS\".\n" "\n" " -N Nmax\n" " limit the degree of the model to Nmax.\n" "\n" " -M Mmax\n" " limit the order of the model to Mmax.\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 lat h\n" " 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" " -w toggle the longitude first flag (it starts off); if the flag is on,\n" " then on input and output, longitude precedes latitude (except that,\n" " on input, this can be overridden by a hemisphere designator, N, S,\n" " E, W).\n" "\n" " -p prec\n" " 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 commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage, the default gravity path and name, and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "MODELS\n" " Gravity computes the gravity field using one of the following models\n" "\n" " egm84, earth gravity model 1984. See\n" " https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm84\n" " egm96, earth gravity model 1996. See\n" " https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm96\n" " egm2008, earth gravity model 2008. See\n" " https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm2008\n" " wgs84, world geodetic system 1984. This returns the normal\n" " gravity for the WGS84 ellipsoid.\n" " grs80, geodetic reference system 1980. This returns the normal\n" " gravity for the GRS80 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\n" " \"GEOGRAPHICLIB_GRAVITY_NAME\" or with the -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" " \"GEOGRAPHICLIB_GRAVITY_PATH\" or \"GEOGRAPHICLIB_DATA\", or with the -d\n" " option. The -h option prints the default gravity path and name. Use\n" " the -v option to 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" " GEOGRAPHICLIB_GRAVITY_NAME\n" " Override the compile-time default gravity name of \"egm96\". The -h\n" " option reports the value of GEOGRAPHICLIB_GRAVITY_NAME, if defined,\n" " otherwise it reports the compile-time value. If the -n name option\n" " is used, then name takes precedence.\n" "\n" " GEOGRAPHICLIB_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:/ProgramData/GeographicLib/gravity\" on Windows systems. The -h\n" " option reports the value of GEOGRAPHICLIB_GRAVITY_PATH, if defined,\n" " otherwise it reports the compile-time value. If the -d dir option\n" " is used, then dir takes precedence.\n" "\n" " GEOGRAPHICLIB_DATA\n" " Another way of overriding the compile-time default gravity path.\n" " If it is set (and if GEOGRAPHICLIB_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), geographiclib-get-gravity(8).\n" "\n" "AUTHOR\n" " Gravity was written by Charles Karney.\n" "\n" "HISTORY\n" " Gravity was added to GeographicLib,\n" " , in version 1.16.\n" ; return retval; } GeographicLib-1.52/man/MagneticField.usage0000644000771000077100000002761214064202407020321 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " MagneticField [ -n name ] [ -d dir ] [ -N Nmax ] [ -M Mmax ] [ -t time\n" " | -c time lat h ] [ -r ] [ -w ] [ -T tguard ] [ -H hguard ] [ -p prec ]\n" " [ -v ] [ --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" " MagneticField --help\n" "or visit:\n" " https://geographiclib.sourceforge.io/1.52/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 ] [ -N Nmax ] [ -M Mmax ] [ -t time\n" " | -c time lat h ] [ -r ] [ -w ] [ -T tguard ] [ -H hguard ] [ -p prec ]\n" " [ -v ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ]\n" " [ --input-file infile | --input-string instring ] [ --line-separator\n" " linesep ] [ --output-file 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, a fractional year such as 2012.5, or the string \"now\".\n" " lat and lon are the latitude and longitude expressed as decimal degrees\n" " or degrees, minutes, and seconds; for details on the allowed formats\n" " for latitude and longitude, see the \"GEOGRAPHIC COORDINATES\" section of\n" " GeoConvert(1). h is the height above the ellipsoid in meters; this is\n" " optional and defaults to zero. Alternatively, time can be given on the\n" " command line as the argument to the -t option, in which case it should\n" " not be included on the input lines. Finally, the magnetic field can be\n" " computed at various points on a circle of latitude (constant time, lat,\n" " and h) via the -c option; in this case only the longitude should be\n" " 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 name\n" " use magnetic field model name instead of the default \"wmm2020\".\n" " See \"MODELS\".\n" "\n" " -d dir\n" " read magnetic models from dir instead of the default. See\n" " \"MODELS\".\n" "\n" " -N Nmax\n" " limit the degree of the model to Nmax.\n" "\n" " -M Mmax\n" " limit the order of the model to Mmax.\n" "\n" " -t time\n" " evaluate the field at time instead of reading the time from the\n" " input lines.\n" "\n" " -c time lat h\n" " 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" " -w toggle the longitude first flag (it starts off); if the flag is on,\n" " then on input and output, longitude precedes latitude (except that,\n" " on input, this can be overridden by a hemisphere designator, N, S,\n" " E, W).\n" "\n" " -T tguard\n" " signal an error if time lies tguard years (default 50 yr) beyond\n" " the range for the model.\n" "\n" " -H hguard\n" " signal an error if h lies hguard meters (default 500000 m) beyond\n" " the range for the model.\n" "\n" " -p prec\n" " 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 commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage, the default magnetic path and name, and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "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 2010-2015. See\n" " https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml\n" " wmm2015v2, the World Magnetic Model 2015, which approximates the\n" " main magnetic field for the period 2015-2020. See\n" " https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml\n" " wmm2015, a deprecated version of wmm2015v2\n" " wmm2020, the World Magnetic Model 2020, which approximates the\n" " main magnetic field for the period 2020-2025. See\n" " https://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 1900-2015. See\n" " https://ngdc.noaa.gov/IAGA/vmod/igrf.html\n" " igrf12, the International Geomagnetic Reference Field (12th\n" " generation), which approximates the main magnetic field for\n" " the period 1900-2020. See\n" " https://ngdc.noaa.gov/IAGA/vmod/igrf.html\n" " igrf13, the International Geomagnetic Reference Field (13th\n" " generation), which approximates the main magnetic field for\n" " the period 1900-2025. See\n" " https://ngdc.noaa.gov/IAGA/vmod/igrf.html\n" " emm2010, the Enhanced Magnetic Model 2010, which approximates\n" " the main and crustal magnetic fields for the period 2010-2015.\n" " See https://ngdc.noaa.gov/geomag/EMM/index.html\n" " emm2015, the Enhanced Magnetic Model 2015, which approximates\n" " the main and crustal magnetic fields for the period 2000-2020.\n" " See https://ngdc.noaa.gov/geomag/EMM/index.html\n" " emm2017, the Enhanced Magnetic Model 2017, which approximates\n" " the main and crustal magnetic fields for the period 2000-2022.\n" " See https://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 emm20xx) 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 \"wmm2020\" magnetic model is used. This may changed by\n" " setting the environment variable \"GEOGRAPHICLIB_MAGNETIC_NAME\" or with\n" " 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" " \"GEOGRAPHICLIB_MAGNETIC_PATH\" or \"GEOGRAPHICLIB_DATA\", or with the -d\n" " option. The -h option prints the default magnetic path and name. Use\n" " the -v option to 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" " GEOGRAPHICLIB_MAGNETIC_NAME\n" " Override the compile-time default magnetic name of \"wmm2020\". The\n" " -h option reports the value of GEOGRAPHICLIB_MAGNETIC_NAME, if\n" " defined, otherwise it reports the compile-time value. If the -n\n" " name option is used, then name takes precedence.\n" "\n" " GEOGRAPHICLIB_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:/ProgramData/GeographicLib/magnetic\" on Windows systems. The -h\n" " option reports the value of GEOGRAPHICLIB_MAGNETIC_PATH, if\n" " defined, otherwise it reports the compile-time value. If the -d\n" " dir option is used, then 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 GEOGRAPHICLIB_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 WMM2020 in Timbuktu on 2020-01-01\n" "\n" " echo 2020-01-01 16:46:33N 3:00:34W 300 | MagneticField -r\n" " => -1.60 12.00 33973.5 33960.3 -948.1 7223.0 34732.8\n" " 0.13 -0.02 21.8 23.9 77.9 -8.4 19.5\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), geographiclib-get-magnetic(8).\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.52/man/Planimeter.usage0000644000771000077100000002424414064202407017724 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " Planimeter [ -r ] [ -s ] [ -l ] [ -e a f ] [ -w ] [ -p prec ] [ -G | -E\n" " | -Q | -R ] [ --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" " Planimeter --help\n" "or visit:\n" " https://geographiclib.sourceforge.io/1.52/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 ] [ -w ] [ -p prec ] [ -G | -E\n" " | -Q | -R ] [ --comment-delimiter commentdelim ] [ --version | -h |\n" " --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator linesep ] [ --output-file 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" " The edges of the polygon are given by the shortest geodesic between\n" " consecutive vertices. In certain cases, there may be two or many such\n" " shortest geodesics, and in that case, the polygon is not uniquely\n" " specified by its vertices. This only happens with very long edges (for\n" " the WGS84 ellipsoid, any edge shorter than 19970 km is uniquely\n" " specified by its end points). In such cases, insert an additional\n" " vertex near the middle of the long edge to define the boundary of the\n" " polygon.\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" " Arbitrarily complex polygons are allowed. In the case of self-\n" " intersecting polygons the area is accumulated \"algebraically\", e.g.,\n" " the areas of the 2 loops in a figure-8 polygon will partially cancel.\n" " Polygons may include one or both poles. There is no need to close the\n" " 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 a f\n" " specify the ellipsoid via the equatorial radius, a and the\n" " flattening, 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. By default, the WGS84 ellipsoid is used, a =\n" " 6378137 m, f = 1/298.257223563. If entering vertices as UTM/UPS or\n" " MGRS coordinates, use the default ellipsoid, since the conversion\n" " of these coordinates to latitude and longitude always uses the\n" " WGS84 parameters.\n" "\n" " -w toggle the longitude first flag (it starts off); if the flag is on,\n" " then when reading geographic coordinates, longitude precedes\n" " latitude (this can be overridden by a hemisphere designator, N, S,\n" " E, W).\n" "\n" " -p prec\n" " set the output precision to prec (default 6); the perimeter is\n" " given (in meters) with prec digits after the decimal point; the\n" " area is given (in meters^2) with (prec - 5) digits after the\n" " decimal point.\n" "\n" " -G use the series formulation for the geodesics. This is the default\n" " option and is recommended for terrestrial applications. This\n" " option, -G, and the following three options, -E, -Q, and -R, are\n" " mutually exclusive.\n" "\n" " -E use \"exact\" algorithms (based on elliptic integrals) for the\n" " geodesic calculations. These are more accurate than the (default)\n" " series expansions for |f| > 0.02. (But note that the\n" " implementation of areas in GeodesicExact uses a high order series\n" " and this is only accurate for modest flattenings.)\n" "\n" " -Q perform the calculation on the authalic sphere. The area\n" " calculation is accurate even if the flattening is large, provided\n" " the edges are sufficiently short. The perimeter calculation is not\n" " accurate.\n" "\n" " -R The lines joining the vertices are rhumb lines instead of\n" " geodesics.\n" "\n" " --comment-delimiter commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing. 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 infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "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" "ACCURACY\n" " Using the -G option (the default), the accuracy was estimated by\n" " computing the error in the area for 10^7 approximately regular polygons\n" " on the WGS84 ellipsoid. The centers and the orientations of the\n" " polygons were uniformly distributed, the number of vertices was log-\n" " uniformly distributed in [3, 300], and the center to vertex distance\n" " log-uniformly distributed in [0.1 m, 9000 km].\n" "\n" " The maximum error in the perimeter was 200 nm, and the maximum error in\n" " the area was\n" "\n" " 0.0013 m^2 for perimeter < 10 km\n" " 0.0070 m^2 for perimeter < 100 km\n" " 0.070 m^2 for perimeter < 1000 km\n" " 0.11 m^2 for all perimeters\n" "\n" "SEE ALSO\n" " GeoConvert(1), GeodSolve(1).\n" "\n" " An online version of this utility is availbable at\n" " .\n" "\n" " The algorithm for the area of geodesic polygon is given in Section 6 of\n" " C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);\n" " DOI ; addenda:\n" " .\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.52/man/RhumbSolve.usage0000644000771000077100000002473614064202407017720 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " RhumbSolve [ -i | -L lat1 lon1 azi12 ] [ -e a f ] [ -d | -: ] [ -w ] [\n" " -p prec ] [ -s ] [ --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" " RhumbSolve --help\n" "or visit:\n" " https://geographiclib.sourceforge.io/1.52/RhumbSolve.1.html\n"; else ( retval ? std::cerr : std::cout ) << "Man page:\n" "NAME\n" " RhumbSolve -- perform rhumb line calculations\n" "\n" "SYNOPSIS\n" " RhumbSolve [ -i | -L lat1 lon1 azi12 ] [ -e a f ] [ -d | -: ] [ -w ] [\n" " -p prec ] [ -s ] [ --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 path with constant heading between two points on the ellipsoid at\n" " (lat1, lon1) and (lat2, lon2) is called the rhumb line or loxodrome.\n" " Its length is s12 and the rhumb line has a forward azimuth azi12 along\n" " its length. Also computed is S12 is the area between the rhumb line\n" " from point 1 to point 2 and the equator; i.e., it is the area, measured\n" " counter-clockwise, of the geodesic quadrilateral with corners\n" " (lat1,lon1), (0,lon1), (0,lon2), and (lat2,lon2). A point at a pole is\n" " treated as a point a tiny distance away from the pole on the given line\n" " of longitude. The longitude becomes indeterminate when a rhumb line\n" " passes through a pole, and RhumbSolve reports NaNs for the longitude\n" " and the area in this case.\n" "\n" " NOTE: the rhumb line is not the shortest path between two points; that\n" " is the geodesic and it is calculated by GeodSolve(1).\n" "\n" " RhumbSolve operates in one of three modes:\n" "\n" " 1. By default, RhumbSolve accepts lines on the standard input\n" " containing lat1 lon1 azi12 s12 and prints lat2 lon2 S12 on standard\n" " output. This is the direct calculation.\n" "\n" " 2. With the -i command line argument, RhumbSolve performs the inverse\n" " calculation. It reads lines containing lat1 lon1 lat2 lon2 and\n" " prints the values of azi12 s12 S12 for the corresponding shortest\n" " rhumb lines. If the end points are on opposite meridians, there\n" " are two shortest rhumb lines and the east-going one is chosen.\n" "\n" " 3. Command line arguments -L lat1 lon1 azi12 specify a rhumb line.\n" " RhumbSolve then accepts a sequence of s12 values (one per line) on\n" " standard input and prints lat2 lon2 S12 for each. This generates a\n" " sequence of points on a rhumb line.\n" "\n" "OPTIONS\n" " -i perform an inverse calculation (see 2 above).\n" "\n" " -L lat1 lon1 azi12\n" " line mode (see 3 above); generate a sequence of points along the\n" " rhumb line specified by lat1 lon1 azi12. The -w flag can be used\n" " to swap the default order of the 2 geographic coordinates, provided\n" " that it appears before -L. (-l is an alternative, deprecated,\n" " spelling of this flag.)\n" "\n" " -e a f\n" " specify the ellipsoid via the equatorial radius, a and the\n" " flattening, 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. By default, the WGS84 ellipsoid is used, a =\n" " 6378137 m, f = 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" " -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" " -p prec\n" " set the output precision to prec (default 3); prec is the precision\n" " relative to 1 m. See \"PRECISION\".\n" "\n" " -s By default, the rhumb line calculations are carried out exactly in\n" " terms of elliptic integrals. This includes the use of the addition\n" " theorem for elliptic integrals to compute the divided difference of\n" " the isometric and rectifying latitudes. If -s is supplied this\n" " divided difference is computed using Krueger series for the\n" " transverse Mercator projection which is only accurate for |f| <\n" " 0.01. See \"ACCURACY\".\n" "\n" " --comment-delimiter commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "INPUT\n" " RhumbSolve measures all angles in degrees, all lengths (s12) in meters,\n" " and all areas (S12) in meters^2. On input angles (latitude, longitude,\n" " azimuth, arc length) can be as decimal degrees or degrees, minutes,\n" " seconds. For example, \"40d30\", \"40d30'\", \"40:30\", \"40.5d\", and 40.5\n" " are all equivalent. By default, latitude precedes longitude for each\n" " point (the -w flag switches this convention); however on input either\n" " may be given first by appending (or prepending) N or S to the latitude\n" " and E or W to the longitude. Azimuths are measured clockwise from\n" " north; however this may be overridden with E or W.\n" "\n" " For details on the allowed formats for angles, see the \"GEOGRAPHIC\n" " COORDINATES\" section of GeoConvert(1).\n" "\n" "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 prec + 5. For DMS (degree,\n" " minute, seconds) output, the number of digits after the decimal point\n" " in the seconds component is prec + 1. 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 RhumbSolve to return an exit code of\n" " 1. However, an error does not cause RhumbSolve to terminate; following\n" " lines will be converted.\n" "\n" "ACCURACY\n" " The algorithm used by RhumbSolve uses exact formulas for converting\n" " between the latitude, rectifying latitude (mu), and isometric latitude\n" " (psi). These formulas are accurate for any value of the flattening.\n" " The computation of rhumb lines involves the ratio (psi1 - psi2) / (mu1\n" " - mu2) and this is subject to large round-off errors if lat1 is close\n" " to lat2. So this ratio is computed using divided differences using one\n" " of two methods: by default, this uses the addition theorem for elliptic\n" " integrals (accurate for all values of f); however, with the -s options,\n" " it is computed using the series expansions used by\n" " TransverseMercatorProj(1) for the conversions between rectifying and\n" " conformal latitudes (accurate for |f| < 0.01). For the WGS84\n" " ellipsoid, the error is about 10 nanometers using either method.\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" " RhumbSolve -i -: -p 0\n" "\n" " 103:34:58.2 18523563\n" "\n" " N.B. This is not the route typically taken by aircraft because it's\n" " considerably longer than the geodesic given by GeodSolve(1).\n" "\n" " Waypoints on the route at intervals of 2000km:\n" "\n" " for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done |\n" " RhumbSolve -L 40:38:23N 073:46:44W 103:34:58.2 -: -p 0\n" "\n" " 40:38:23.0N 073:46:44.0W 0\n" " 36:24:30.3N 051:28:26.4W 9817078307821\n" " 32:10:26.8N 030:20:57.3W 18224745682005\n" " 27:56:13.2N 010:10:54.2W 25358020327741\n" " 23:41:50.1N 009:12:45.5E 31321269267102\n" " 19:27:18.7N 027:59:22.1E 36195163180159\n" " 15:12:40.2N 046:17:01.1E 40041499143669\n" " 10:57:55.9N 064:12:52.8E 42906570007050\n" " 06:43:07.3N 081:53:28.8E 44823504180200\n" " 02:28:16.2N 099:24:54.5E 45813843358737\n" " 01:46:36.0S 116:52:59.7E 45888525219677\n" "\n" "SEE ALSO\n" " GeoConvert(1), GeodSolve(1), TransverseMercatorProj(1).\n" "\n" " An online version of this utility is availbable at\n" " .\n" "\n" " The Wikipedia page, Rhumb line,\n" " .\n" "\n" "AUTHOR\n" " RhumbSolve was written by Charles Karney.\n" "\n" "HISTORY\n" " RhumbSolve was added to GeographicLib,\n" " , in version 1.37.\n" ; return retval; } GeographicLib-1.52/man/TransverseMercatorProj.usage0000644000771000077100000001627714064202407022317 0ustar ckarneyckarneyint usage(int retval, bool brief) { if (brief) ( retval ? std::cerr : std::cout ) << "Usage:\n" " TransverseMercatorProj [ -s | -t ] [ -l lon0 ] [ -k k0 ] [ -r ] [ -e a\n" " f ] [ -w ] [ -p prec ] [ --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" " TransverseMercatorProj --help\n" "or visit:\n" " https://geographiclib.sourceforge.io/1.52/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 k0 ] [ -r ] [ -e a\n" " f ] [ -w ] [ -p prec ] [ --comment-delimiter commentdelim ] [ --version\n" " | -h | --help ] [ --input-file infile | --input-string instring ] [\n" " --line-separator 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 detils on the allowed formats for\n" " latitude and longitude, see the \"GEOGRAPHIC COORDINATES\" section of\n" " GeoConvert(1). For each set of geodetic coordinates, the corresponding\n" " projected easting, x, and northing, y, (meters) are printed on standard\n" " output together with the meridian convergence gamma (degrees) and scale\n" " k. The meridian convergence is the bearing of grid north (the y axis)\n" " 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 the exact algorithm with the \"EXTENDED DOMAIN\"; this is the\n" " default.\n" "\n" " -l lon0\n" " specify the longitude of origin lon0 (degrees, default 0).\n" "\n" " -k k0\n" " 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 a f\n" " specify the ellipsoid via the equatorial radius, a and the\n" " flattening, 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. By default, the WGS84 ellipsoid is used, a =\n" " 6378137 m, f = 1/298.257223563. If the exact algorithm is used, f\n" " must be positive.\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" " -p prec\n" " set the output precision to prec (default 6). prec is the number\n" " of digits after the decimal point for lengths (in meters). For\n" " latitudes and longitudes (in degrees), the number of digits after\n" " the decimal point is prec + 5. For the convergence (in degrees)\n" " and scale, the number of digits after the decimal point is prec +\n" " 6.\n" "\n" " --comment-delimiter commentdelim\n" " set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n" " set, the input lines will be scanned for this delimiter and, if\n" " found, the delimiter and the rest of the line will be removed prior\n" " to processing and subsequently appended to the output line\n" " (separated by a space).\n" "\n" " --version\n" " print version and exit.\n" "\n" " -h print usage and exit.\n" "\n" " --help\n" " print full documentation and exit.\n" "\n" " --input-file infile\n" " read input from the file infile instead of from standard input; a\n" " file name of \"-\" stands for standard input.\n" "\n" " --input-string instring\n" " read input from the string instring instead of from standard input.\n" " All occurrences of the line separator character (default is a\n" " semicolon) in instring are converted to newlines before the reading\n" " begins.\n" "\n" " --line-separator linesep\n" " set the line separator character to linesep. By default this is a\n" " semicolon.\n" "\n" " --output-file outfile\n" " write output to the file outfile instead of to standard output; a\n" " file name of \"-\" stands for standard output.\n" "\n" "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 = 82.636...,\n" " where e is the eccentricity of the ellipsoid. The standard convention\n" " for handling this branch point is to map positive (negative) latitudes\n" " into positive (negative) northings y; i.e., a branch cut is placed on\n" " the 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. Geodesy 85(8), 475-485 (Aug. 2011); DOI\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\n" " 1.9 it was called TransverseMercatorTest (and its interface was\n" " slightly different).\n" ; return retval; } GeographicLib-1.52/man/CartConvert.1.html0000644000771000077100000001533614064202407020057 0ustar ckarneyckarney CartConvert(1)

NAME

CartConvert -- convert geodetic coordinates to geocentric or local cartesian

SYNOPSIS

CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ -w ] [ -p prec ] [ --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 details on the allowed formats for latitude and longitude, see the GEOGRAPHIC COORDINATES section of GeoConvert(1). 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. In general there are multiple solutions and the result which minimizes the absolute value of height is returned, i.e., (latitude, longitude) corresponds to the closest point on the ellipsoid.

-l lat0 lon0 h0

specifies conversions to and from a local cartesion coordinate systems with origin lat0 lon0 h0, instead of a geocentric coordinate system. The -w flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before -l.

-e a f

specify the ellipsoid via the equatorial radius, a and the flattening, 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. By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

-w

toggle the longitude first flag (it starts off); if the flag is on, then on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-p prec

set the output precision to prec (default 6). prec is the number of digits after the decimal point for geocentric and local cartesion coordinates and for the height (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is prec + 5.

--comment-delimiter commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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 https://arxiv.org/abs/1102.1215.

AUTHOR

CartConvert was written by Charles Karney.

HISTORY

CartConvert was added to GeographicLib, https://geographiclib.sourceforge.io, in 2009-02. Prior to 2009-03 it was called ECEFConvert.

GeographicLib-1.52/man/ConicProj.1.html0000644000771000077100000001641314064202407017510 0ustar ckarneyckarney ConicProj(1)

NAME

ConicProj -- perform conic projections

SYNOPSIS

ConicProj ( -c | -a ) lat1 lat2 [ -l lon0 ] [ -k k1 ] [ -r ] [ -e a f ] [ -w ] [ -p prec ] [ --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 details on the allowed formats for latitude and longitude, see the GEOGRAPHIC COORDINATES section of GeoConvert(1). 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 lat1 lat2

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

-a lat1 lat2

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

-l lon0

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

-k k1

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 a f

specify the ellipsoid via the equatorial radius, a and the flattening, 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. By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

-w

toggle the longitude first flag (it starts off); if the flag is on, then on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-p prec

set the output precision to prec (default 6). prec is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is prec + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is prec + 6.

--comment-delimiter commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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, https://geographiclib.sourceforge.io, in version 1.9.

GeographicLib-1.52/man/GeodesicProj.1.html0000644000771000077100000001665414064202407020206 0ustar ckarneyckarney GeodesicProj(1)

NAME

GeodesicProj -- perform projections based on geodesics

SYNOPSIS

GeodesicProj ( -z | -c | -g ) lat0 lon0 [ -r ] [ -e a f ] [ -w ] [ -p prec ] [ --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 details on the allowed formats for latitude and longitude, see the GEOGRAPHIC COORDINATES section of GeoConvert(1). 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 lat0 lon0

use the azimuthal equidistant projection centered at latitude = lat0, longitude = lon0. The -w flag can be used to swap the default order of the 2 coordinates, provided that it appears before -z.

-c lat0 lon0

use the Cassini-Soldner projection centered at latitude = lat0, longitude = lon0. The -w flag can be used to swap the default order of the 2 coordinates, provided that it appears before -c.

-g lat0 lon0

use the ellipsoidal gnomonic projection centered at latitude = lat0, longitude = lon0. The -w flag can be used to swap the default order of the 2 coordinates, provided that it appears before -g.

-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 a f

specify the ellipsoid via the equatorial radius, a and the flattening, 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. By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

-w

toggle the longitude first flag (it starts off); if the flag is on, then on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-p prec

set the output precision to prec (default 6). prec is the number of digits after the decimal point for lengths (in meters). For latitudes, longitudes, and azimuths (in degrees), the number of digits after the decimal point is prec + 5. For the scale, the number of digits after the decimal point is prec + 6.

--comment-delimiter commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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 8 of C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); DOI https://doi.org/10.1007/s00190-012-0578-z; addenda: https://geographiclib.sourceforge.io/geod-addenda.html.

AUTHOR

GeodesicProj was written by Charles Karney.

HISTORY

GeodesicProj was added to GeographicLib, https://geographiclib.sourceforge.io, in 2009-08. Prior to version 1.9 it was called EquidistantTest.

GeographicLib-1.52/man/GeoConvert.1.html0000644000771000077100000004325514064202407017701 0ustar ckarneyckarney GeoConvert(1)

NAME

GeoConvert -- convert geographic coordinates

SYNOPSIS

GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -z zone | -s | -t | -S | -T ] [ -n ] [ -w ] [ -p prec ] [ -l | -a ] [ --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, and seconds. Latitude is given first (unless the -w option is given). See "GEOGRAPHIC COORDINATES" for a description of the format. 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 north) or s (or south). 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. The meridian convergence is the bearing of grid north given as degrees clockwise from true north.

-z zone

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, 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.

-S or -T

behave the same as -s and -t, respectively, until the first legal conversion is performed. For subsequent points, the zone and hemisphere of that conversion are used. This enables a sequence of points to be converted into UTM or UPS using a consistent coordinate system.

-n

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

-w

toggle the longitude first flag (it starts off); if the flag is on, then on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-p prec

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

-l

on output, UTM/UPS uses the long forms north and south to designate the hemisphere instead of n or s.

-a

on output, UTM/UPS uses the abbreviations n and s to designate the hemisphere instead of north or south; this is the default representation.

--comment-delimiter commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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. For MGRS, The number of digits per coordinate is 5 + prec; prec = -6 results in just the grid zone. 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 (-6 for MGRS) and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS, 6 for MGRS, and 8 for convergence and scale.

GEOGRAPHIC COORDINATES

The utility accepts geographic coordinates, latitude and longitude, in a number of common formats. Latitude precedes longitude, unless the -w option is given which switches this convention. On input, either coordinate may be given first by appending or prepending N or S to the latitude and E or W to the longitude. These hemisphere designators carry an implied sign, positive for N and E and negative for S and W. This sign multiplies any +/- sign prefixing the coordinate. The coordinates may be given as decimal degree or as degrees, minutes, and 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.) Alternatively, : (colon) may be used to separate the various components. Only the final component of coordinate can include a decimal point, and the minutes and seconds components must be less than 60.

It is also possible to carry out addition or subtraction operations in geographic coordinates. If the coordinate includes interior signs (i.e., not at the beginning or immediately after an initial hemisphere designator), then the coordinate is split before such signs; the pieces are parsed separately and the results summed. For example the point 15" east of 39N 70W is

    39N 70W+0:0:15E

WARNING: "Exponential" notation is not recognized for geographic coordinates. Thus 7.0E1 is illegal, while 7.0E+1 is parsed as (7.0E) + (+1), yielding the same result as 8.0E.

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; in addition two single quotes can be used to represent ".

The other GeographicLib utilities use the same rules for interpreting geographic coordinates; in addition, azimuths and arc lengths are interpreted the same way.

QUOTING

Unfortunately the characters ' and " have special meanings in many shells and have to be entered with care. However note (1) that the trailing designator is optional and that (2) you can use colons as a separator character. Thus 10d20' can be entered as 10d20 or 10:20 and 10d20'30" can be entered as 10:20:30.

Unix shells (sh, bash, tsch)

The characters ' and " can be quoted by preceding them with a \ (backslash); or you can quote a string containing ' with a pair of "s. The two alternatives are illustrated by

   echo 10d20\'30\" "20d30'40" | GeoConvert -d -p -1
   => 10d20'30"N 020d30'40"E

Quoting of command line arguments is similar

   GeoConvert -d -p -1 --input-string "10d20'30\" 20d30'40"
   => 10d20'30"N 020d30'40"E
Windows command shell (cmd)

The ' character needs no quoting; the " character can either be quoted by a ^ or can be represented by typing ' twice. (This quoting is usually unnecessary because the trailing designator can be omitted.) Thus

   echo 10d20'30'' 20d30'40 | GeoConvert -d -p -1
   => 10d20'30"N 020d30'40"E

Use \ to quote the " character in a command line argument

   GeoConvert -d -p -1 --input-string "10d20'30\" 20d30'40"
   => 10d20'30"N 020d30'40"E
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

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. When an MGRS coordinate is provided as input, GeoConvert treats this as a representative point within the square. By default, this representative point is the center of the square (38n 444500 3688500 in the example above). (This leads to a stable conversion between MGRS and geographic coordinates.) 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, and -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

Is zone is specified with a hemisphere, then this is honored when printing UTM coordinates:

   echo -1 3 | GeoConvert -u         => 31s 500000 9889470
   echo -1 3 | GeoConvert -u -z 31   => 31s 500000 9889470
   echo -1 3 | GeoConvert -u -z 31s  => 31s 500000 9889470
   echo -1 3 | GeoConvert -u -z 31n  => 31n 500000 -110530

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 (or south); replace N thru X by n (or north).

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

GeoConvert can be used to do simple arithmetic using degree, minutes, and seconds. For example, sometimes data is tiled in 15 second squares tagged by the DMS representation of the SW corner. The tags of the tile at 38:59:45N 077:02:00W and its 8 neighbors are then given by

    t=0:0:15
    for y in -$t +0 +$t; do
        for x in -$t +0 +$t; do
            echo 38:59:45N$y 077:02:00W$x
        done
    done | GeoConvert -: -p -1 | tr -d ': '
    =>
    385930N0770215W
    385930N0770200W
    385930N0770145W
    385945N0770215W
    385945N0770200W
    385945N0770145W
    390000N0770215W
    390000N0770200W
    390000N0770145W

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, https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system.

UPS

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

MGRS

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

WGS84

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

SEE ALSO

An online version of this utility is availbable at https://geographiclib.sourceforge.io/cgi-bin/GeoConvert.

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

AUTHOR

GeoConvert was written by Charles Karney.

HISTORY

GeoConvert was added to GeographicLib, https://geographiclib.sourceforge.io, in 2009-01.

GeographicLib-1.52/man/GeodSolve.1.html0000644000771000077100000004243714064202407017516 0ustar ckarneyckarney GeodSolve(1)

NAME

GeodSolve -- perform geodesic calculations

SYNOPSIS

GeodSolve [ -i | -L lat1 lon1 azi1 | -D lat1 lon1 azi1 s13 | -I lat1 lon1 lat3 lon3 ] [ -a ] [ -e a f ] [ -u ] [ -F ] [ -d | -: ] [ -w ] [ -b ] [ -f ] [ -p prec ] [ -E ] [ --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 forward azimuths azi1 and azi2 at the two end points.

GeodSolve operates in one of three modes:

  1. By default, GeodSolve 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. With the -i command line argument, GeodSolve performs the inverse geodesic calculation. It reads lines containing lat1 lon1 lat2 lon2 and prints the corresponding values of azi1 azi2 s12.

  3. Command line arguments -L lat1 lon1 azi1 specify a geodesic line. GeodSolve 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. Command line arguments -D and -I work similarly with the geodesic line defined in terms of a direct or inverse geodesic calculation, respectively.

OPTIONS

-i

perform an inverse geodesic calculation (see 2 above).

-L lat1 lon1 azi1

line mode (see 3 above); generate a sequence of points along the geodesic specified by lat1 lon1 azi1. The -w flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before -L. (-l is an alternative, deprecated, spelling of this flag.)

-D lat1 lon1 azi1 s13

line mode (see 3 above); generate a sequence of points along the geodesic specified by lat1 lon1 azi1 s13. The -w flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before -D. Similarly, the -a flag can be used to change the interpretation of s13 to a13, provided that it appears before -D.

-I lat1 lon1 lat3 lon3

line mode (see 3 above); generate a sequence of points along the geodesic specified by lat1 lon1 lat3 lon3. The -w flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before -I.

-a

toggle the arc mode flag (it starts off); if this flag is on, then on input and output s12 is replaced by a12 the arc length (in degrees) on the auxiliary sphere. See "AUXILIARY SPHERE".

-e a f

specify the ellipsoid via the equatorial radius, a and the flattening, 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. By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563.

-u

unroll the longitude. Normally, on output longitudes are reduced to lie in [-180deg,180deg). However with this option, the returned longitude lon2 is "unrolled" so that lon2 - lon1 indicates how often and in what sense the geodesic has encircled the earth. Use the -f option, to get both longitudes printed.

-F

fractional mode. This only has any effect with the -D and -I options (and is otherwise ignored). The values read on standard input are interpreted as fractional distances to point 3, i.e., as s12/s13 instead of s12. If arc mode is in effect, then the values denote fractional arc length, i.e., a12/a13. The fractional distances can be entered as a simple fraction, e.g., 3/4.

-d

output angles as degrees, minutes, seconds instead of decimal degrees.

-:

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

-w

toggle the longitude first flag (it starts off); if the flag is on, then on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-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 prec

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

-E

use "exact" algorithms (based on elliptic integrals) for the geodesic calculations. These are more accurate than the (default) series expansions for |f| > 0.02.

--comment-delimiter commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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

INPUT

GeodSolve measures all angles in degrees and all lengths (s12) in meters, and all areas (S12) in meters^2. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees, minutes, seconds. For example, 40d30, 40d30', 40:30, 40.5d, and 40.5 are all equivalent. By default, latitude precedes longitude for each point (the -w flag switches this convention); 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.

For details on the allowed formats for angles, see the GEOGRAPHIC COORDINATES section of GeoConvert(1).

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:

   s13 = s12 + s23,
   a13 = a12 + a23,
   S13 = S12 + S23,
   m13 = m12 M23 + m23 M21,
   M13 = M12 M23 - (1 - M12 M21) m23 / m12,
   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 geodesic 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 prec + 5. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is prec + 1. 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 GeodSolve to return an exit code of 1. However, an error does not cause GeodSolve to terminate; following lines will be converted.

ACCURACY

Using the (default) series solution, GeodSolve is accurate to about 15 nm (15 nanometers) for the WGS84 ellipsoid. The approximate maximum error (expressed as a distance) for an ellipsoid with the same equatorial radius as the WGS84 ellipsoid and different values of the flattening is

   |f|     error
   0.01    25 nm
   0.02    30 nm
   0.05    10 um
   0.1    1.5 mm
   0.2    300 mm

If -E is specified, GeodSolve is accurate to about 40 nm (40 nanometers) for the WGS84 ellipsoid. The approximate maximum error (expressed as a distance) for an ellipsoid with a quarter meridian of 10000 km and different values of the a/b = 1 - f is

   1-f    error (nm)
   1/128   387
   1/64    345
   1/32    269
   1/16    210
   1/8     115
   1/4      69
   1/2      36
     1      15
     2      25
     4      96
     8     318
    16     985
    32    2352
    64    6008
   128   19024

MULTIPLE SOLUTIONS

The shortest distance returned for the inverse problem is (obviously) uniquely defined. However, in a few special cases there are multiple azimuths which yield the same shortest distance. Here is a catalog of those cases:

lat1 = -lat2 (with neither point at a pole)

If azi1 = azi2, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [azi1,azi2] = [azi2,azi1], [M12,M21] = [M21,M12], S12 = -S12. (This occurs when the longitude difference is near +/-180 for oblate ellipsoids.)

lon2 = lon1 +/- 180 (with neither point at a pole)

If azi1 = 0 or +/-180, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [azi1,azi2] = [-azi1,-azi2], S12 = -S12. (This occurs when lat2 is near -lat1 for prolate ellipsoids.)

Points 1 and 2 at opposite poles

There are infinitely many geodesics which can be generated by setting [azi1,azi2] = [azi1,azi2] + [d,-d], for arbitrary d. (For spheres, this prescription applies when points 1 and 2 are antipodal.)

s12 = 0 (coincident points)

There are infinitely many geodesics which can be generated by setting [azi1,azi2] = [azi1,azi2] + [d,d], for arbitrary d.

EXAMPLES

Route from JFK Airport to Singapore Changi Airport:

   echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |
   GeodSolve -i -: -p 0

   003:18:29.9 177:29:09.2 15347628

Equally spaced waypoints on the route:

   for ((i = 0; i <= 10; ++i)); do echo $i/10; done |
   GeodSolve -I 40:38:23N 073:46:44W 01:21:33N 103:59:22E -F -: -p 0

   40:38:23.0N 073:46:44.0W 003:18:29.9
   54:24:51.3N 072:25:39.6W 004:18:44.1
   68:07:37.7N 069:40:42.9W 006:44:25.4
   81:38:00.4N 058:37:53.9W 017:28:52.7
   83:43:26.0N 080:37:16.9E 156:26:00.4
   70:20:29.2N 097:01:29.4E 172:31:56.4
   56:38:36.0N 100:14:47.6E 175:26:10.5
   42:52:37.1N 101:43:37.2E 176:34:28.6
   29:03:57.0N 102:39:34.8E 177:07:35.2
   15:13:18.6N 103:22:08.0E 177:23:44.7
   01:21:33.0N 103:59:22.0E 177:29:09.2

SEE ALSO

GeoConvert(1).

An online version of this utility is availbable at https://geographiclib.sourceforge.io/cgi-bin/GeodSolve.

The algorithms are described in C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); DOI: https://doi.org/10.1007/s00190-012-0578-z; addenda: https://geographiclib.sourceforge.io/geod-addenda.html.

The Wikipedia page, Geodesics on an ellipsoid, https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid.

AUTHOR

GeodSolve was written by Charles Karney.

HISTORY

GeodSolve was added to GeographicLib, https://geographiclib.sourceforge.io, in 2009-03. Prior to version 1.30, it was called Geod. (The name was changed to avoid a conflict with the geod utility in proj.4.)

GeographicLib-1.52/man/GeoidEval.1.html0000644000771000077100000003310414064202407017455 0ustar ckarneyckarney GeoidEval(1)

NAME

GeoidEval -- look up geoid heights

SYNOPSIS

GeoidEval [ -n name ] [ -d dir ] [ -l ] [ -a | -c south west north east ] [ -w ] [ -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 heights of the geoid above the WGS84 ellipsoid on standard output.

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.

The height of the geoid above the ellipsoid, N, is sometimes called the geoid undulation. It can be used to convert a height above the ellipsoid, h, to the corresponding height above the geoid (the orthometric height, roughly the height above mean sea level), H, using the relations

    h = N + H,   H = -N + h.

OPTIONS

-n name

use geoid name instead of the default egm96-5. See "GEOIDS".

-d dir

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 south west north east

cache the data bounded by south west north east in memory. The first two arguments specify the SW corner of the cache and the last two arguments specify the NE corner. The -w flag specifies that longitude precedes latitude for these corners, provided that it appears before -c. See "CACHE".

-w

toggle the longitude first flag (it starts off); if the flag is on, then when reading geographic coordinates, longitude precedes latitude (this can be overridden by a hemisphere designator, N, S, E, W).

-z zone

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 commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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 GEOGRAPHICLIB_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 GEOGRAPHICLIB_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 https://geographiclib.sourceforge.io/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.

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

GEOGRAPHICLIB_GEOID_NAME

Override the compile-time default geoid name of egm96-5. The -h option reports the value of GEOGRAPHICLIB_GEOID_NAME, if defined, otherwise it reports the compile-time value. If the -n name option is used, then name takes precedence.

GEOGRAPHICLIB_GEOID_PATH

Override the compile-time default geoid path. This is typically /usr/local/share/GeographicLib/geoids on Unix-like systems and C:/ProgramData/GeographicLib/geoids on Windows systems. The -h option reports the value of GEOGRAPHICLIB_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 geoid path. If it is set (and if GEOGRAPHICLIB_GEOID_PATH is not set), then $GEOGRAPHICLIB_DATA/geoids 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, https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm84.

EGM96

An earth gravity model published by the NGA in 1996, https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm96.

EGM2008

An earth gravity model published by the NGA in 2008, https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm2008.

WGS84

World Geodetic System 1984, https://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), geographiclib-get-geoids(8).

An online version of this utility is availbable at https://geographiclib.sourceforge.io/cgi-bin/GeoidEval.

AUTHOR

GeoidEval was written by Charles Karney.

HISTORY

GeoidEval was added to GeographicLib, https://geographiclib.sourceforge.io, in 2009-09.

GeographicLib-1.52/man/Gravity.1.html0000644000771000077100000002601114064202407017242 0ustar ckarneyckarney Gravity(1)

NAME

Gravity -- compute the earth's gravity field

SYNOPSIS

Gravity [ -n name ] [ -d dir ] [ -N Nmax ] [ -M Mmax ] [ -G | -D | -A | -H ] [ -c lat h ] [ -w ] [ -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; for details on the allowed formats for latitude and longitude, see the GEOGRAPHIC COORDINATES section of GeoConvert(1). 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, except for grs80, 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 name

use gravity field model name instead of the default egm96. See "MODELS".

-d dir

read gravity models from dir instead of the default. See "MODELS".

-N Nmax

limit the degree of the model to Nmax.

-M Mmax

limit the order of the model to Mmax.

-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 lat h

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.

-w

toggle the longitude first flag (it starts off); if the flag is on, then on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-p prec

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 commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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
      https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm84
    egm96, earth gravity model 1996.  See
      https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm96
    egm2008, earth gravity model 2008.  See
      https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84#tab_egm2008
    wgs84, world geodetic system 1984.  This returns the normal
      gravity for the WGS84 ellipsoid.
    grs80, geodetic reference system 1980.  This returns the normal
      gravity for the GRS80 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 GEOGRAPHICLIB_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 GEOGRAPHICLIB_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 https://geographiclib.sourceforge.io/html/gravity.html#gravityinst.

ENVIRONMENT

GEOGRAPHICLIB_GRAVITY_NAME

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

GEOGRAPHICLIB_GRAVITY_PATH

Override the compile-time default gravity path. This is typically /usr/local/share/GeographicLib/gravity on Unix-like systems and C:/ProgramData/GeographicLib/gravity on Windows systems. The -h option reports the value of GEOGRAPHICLIB_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 GEOGRAPHICLIB_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), geographiclib-get-gravity(8).

AUTHOR

Gravity was written by Charles Karney.

HISTORY

Gravity was added to GeographicLib, https://geographiclib.sourceforge.io, in version 1.16.

GeographicLib-1.52/man/MagneticField.1.html0000644000771000077100000003020214064202407020305 0ustar ckarneyckarney MagneticField(1)

NAME

MagneticField -- compute the earth's magnetic field

SYNOPSIS

MagneticField [ -n name ] [ -d dir ] [ -N Nmax ] [ -M Mmax ] [ -t time | -c time lat h ] [ -r ] [ -w ] [ -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, a fractional year such as 2012.5, or the string "now". lat and lon are the latitude and longitude expressed as decimal degrees or degrees, minutes, and seconds; for details on the allowed formats for latitude and longitude, see the GEOGRAPHIC COORDINATES section of GeoConvert(1). 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 name

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

-d dir

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

-N Nmax

limit the degree of the model to Nmax.

-M Mmax

limit the order of the model to Mmax.

-t time

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

-c time lat h

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.

-w

toggle the longitude first flag (it starts off); if the flag is on, then on input and output, longitude precedes latitude (except that, on input, this can be overridden by a hemisphere designator, N, S, E, W).

-T tguard

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

-H hguard

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

-p prec

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 commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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
      https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml
    wmm2015v2, the World Magnetic Model 2015, which approximates the
      main magnetic field for the period 2015-2020.  See
      https://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml
    wmm2015, a deprecated version of wmm2015v2
    wmm2020, the World Magnetic Model 2020, which approximates the
      main magnetic field for the period 2020-2025.  See
      https://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
      https://ngdc.noaa.gov/IAGA/vmod/igrf.html
    igrf12, the International Geomagnetic Reference Field (12th
      generation), which approximates the main magnetic field for
      the period 1900-2020.  See
      https://ngdc.noaa.gov/IAGA/vmod/igrf.html
    igrf13, the International Geomagnetic Reference Field (13th
      generation), which approximates the main magnetic field for
      the period 1900-2025.  See
      https://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 https://ngdc.noaa.gov/geomag/EMM/index.html
    emm2015, the Enhanced Magnetic Model 2015, which approximates
      the main and crustal magnetic fields for the period 2000-2020.
      See https://ngdc.noaa.gov/geomag/EMM/index.html
    emm2017, the Enhanced Magnetic Model 2017, which approximates
      the main and crustal magnetic fields for the period 2000-2022.
      See https://ngdc.noaa.gov/geomag/EMM/index.html

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

By default, the wmm2020 magnetic model is used. This may changed by setting the environment variable GEOGRAPHICLIB_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 GEOGRAPHICLIB_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 https://geographiclib.sourceforge.io/html/magnetic.html#magneticinst.

ENVIRONMENT

GEOGRAPHICLIB_MAGNETIC_NAME

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

GEOGRAPHICLIB_MAGNETIC_PATH

Override the compile-time default magnetic path. This is typically /usr/local/share/GeographicLib/magnetic on Unix-like systems and C:/ProgramData/GeographicLib/magnetic on Windows systems. The -h option reports the value of GEOGRAPHICLIB_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 GEOGRAPHICLIB_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 WMM2020 in Timbuktu on 2020-01-01

    echo 2020-01-01 16:46:33N 3:00:34W 300 | MagneticField -r
    => -1.60 12.00 33973.5 33960.3 -948.1 7223.0 34732.8
       0.13 -0.02 21.8 23.9 77.9 -8.4 19.5

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

SEE ALSO

GeoConvert(1), geographiclib-get-magnetic(8).

AUTHOR

MagneticField was written by Charles Karney.

HISTORY

MagneticField was added to GeographicLib, https://geographiclib.sourceforge.io, in version 1.15.

GeographicLib-1.52/man/Planimeter.1.html0000644000771000077100000002421014064202407017714 0ustar ckarneyckarney Planimeter(1)

NAME

Planimeter -- compute the area of geodesic polygons

SYNOPSIS

Planimeter [ -r ] [ -s ] [ -l ] [ -e a f ] [ -w ] [ -p prec ] [ -G | -E | -Q | -R ] [ --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).

The edges of the polygon are given by the shortest geodesic between consecutive vertices. In certain cases, there may be two or many such shortest geodesics, and in that case, the polygon is not uniquely specified by its vertices. This only happens with very long edges (for the WGS84 ellipsoid, any edge shorter than 19970 km is uniquely specified by its end points). In such cases, insert an additional vertex near the middle of the long edge to define the boundary of the polygon.

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.

Arbitrarily complex polygons are allowed. In the case of self-intersecting polygons the area is accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. 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 a f

specify the ellipsoid via the equatorial radius, a and the flattening, 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. 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 always uses the WGS84 parameters.

-w

toggle the longitude first flag (it starts off); if the flag is on, then when reading geographic coordinates, longitude precedes latitude (this can be overridden by a hemisphere designator, N, S, E, W).

-p prec

set the output precision to prec (default 6); the perimeter is given (in meters) with prec digits after the decimal point; the area is given (in meters^2) with (prec - 5) digits after the decimal point.

-G

use the series formulation for the geodesics. This is the default option and is recommended for terrestrial applications. This option, -G, and the following three options, -E, -Q, and -R, are mutually exclusive.

-E

use "exact" algorithms (based on elliptic integrals) for the geodesic calculations. These are more accurate than the (default) series expansions for |f| > 0.02. (But note that the implementation of areas in GeodesicExact uses a high order series and this is only accurate for modest flattenings.)

-Q

perform the calculation on the authalic sphere. The area calculation is accurate even if the flattening is large, provided the edges are sufficiently short. The perimeter calculation is not accurate.

-R

The lines joining the vertices are rhumb lines instead of geodesics.

--comment-delimiter commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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' '

ACCURACY

Using the -G option (the default), the accuracy was estimated by computing the error in the area for 10^7 approximately regular polygons on the WGS84 ellipsoid. The centers and the orientations of the polygons were uniformly distributed, the number of vertices was log-uniformly distributed in [3, 300], and the center to vertex distance log-uniformly distributed in [0.1 m, 9000 km].

The maximum error in the perimeter was 200 nm, and the maximum error in the area was

   0.0013 m^2 for perimeter < 10 km
   0.0070 m^2 for perimeter < 100 km
   0.070 m^2 for perimeter < 1000 km
   0.11 m^2 for all perimeters

SEE ALSO

GeoConvert(1), GeodSolve(1).

An online version of this utility is availbable at https://geographiclib.sourceforge.io/cgi-bin/Planimeter.

The algorithm for the area of geodesic polygon is given in Section 6 of C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); DOI https://doi.org/10.1007/s00190-012-0578-z; addenda: https://geographiclib.sourceforge.io/geod-addenda.html.

AUTHOR

Planimeter was written by Charles Karney.

HISTORY

Planimeter was added to GeographicLib, https://geographiclib.sourceforge.io, in version 1.4.

GeographicLib-1.52/man/RhumbSolve.1.html0000644000771000077100000002565714064202407017722 0ustar ckarneyckarney RhumbSolve(1)

NAME

RhumbSolve -- perform rhumb line calculations

SYNOPSIS

RhumbSolve [ -i | -L lat1 lon1 azi12 ] [ -e a f ] [ -d | -: ] [ -w ] [ -p prec ] [ -s ] [ --comment-delimiter commentdelim ] [ --version | -h | --help ] [ --input-file infile | --input-string instring ] [ --line-separator linesep ] [ --output-file outfile ]

DESCRIPTION

The path with constant heading between two points on the ellipsoid at (lat1, lon1) and (lat2, lon2) is called the rhumb line or loxodrome. Its length is s12 and the rhumb line has a forward azimuth azi12 along its length. Also computed is S12 is the area between the rhumb line from point 1 to point 2 and the equator; i.e., it is the area, measured counter-clockwise, of the geodesic quadrilateral with corners (lat1,lon1), (0,lon1), (0,lon2), and (lat2,lon2). A point at a pole is treated as a point a tiny distance away from the pole on the given line of longitude. The longitude becomes indeterminate when a rhumb line passes through a pole, and RhumbSolve reports NaNs for the longitude and the area in this case.

NOTE: the rhumb line is not the shortest path between two points; that is the geodesic and it is calculated by GeodSolve(1).

RhumbSolve operates in one of three modes:

  1. By default, RhumbSolve accepts lines on the standard input containing lat1 lon1 azi12 s12 and prints lat2 lon2 S12 on standard output. This is the direct calculation.

  2. With the -i command line argument, RhumbSolve performs the inverse calculation. It reads lines containing lat1 lon1 lat2 lon2 and prints the values of azi12 s12 S12 for the corresponding shortest rhumb lines. If the end points are on opposite meridians, there are two shortest rhumb lines and the east-going one is chosen.

  3. Command line arguments -L lat1 lon1 azi12 specify a rhumb line. RhumbSolve then accepts a sequence of s12 values (one per line) on standard input and prints lat2 lon2 S12 for each. This generates a sequence of points on a rhumb line.

OPTIONS

-i

perform an inverse calculation (see 2 above).

-L lat1 lon1 azi12

line mode (see 3 above); generate a sequence of points along the rhumb line specified by lat1 lon1 azi12. The -w flag can be used to swap the default order of the 2 geographic coordinates, provided that it appears before -L. (-l is an alternative, deprecated, spelling of this flag.)

-e a f

specify the ellipsoid via the equatorial radius, a and the flattening, 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. 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.

-w

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

-p prec

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

-s

By default, the rhumb line calculations are carried out exactly in terms of elliptic integrals. This includes the use of the addition theorem for elliptic integrals to compute the divided difference of the isometric and rectifying latitudes. If -s is supplied this divided difference is computed using Krueger series for the transverse Mercator projection which is only accurate for |f| < 0.01. See "ACCURACY".

--comment-delimiter commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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

INPUT

RhumbSolve measures all angles in degrees, all lengths (s12) in meters, and all areas (S12) in meters^2. On input angles (latitude, longitude, azimuth, arc length) can be as decimal degrees or degrees, minutes, seconds. For example, 40d30, 40d30', 40:30, 40.5d, and 40.5 are all equivalent. By default, latitude precedes longitude for each point (the -w flag switches this convention); 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.

For details on the allowed formats for angles, see the GEOGRAPHIC COORDINATES section of GeoConvert(1).

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 prec + 5. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds component is prec + 1. 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 RhumbSolve to return an exit code of 1. However, an error does not cause RhumbSolve to terminate; following lines will be converted.

ACCURACY

The algorithm used by RhumbSolve uses exact formulas for converting between the latitude, rectifying latitude (mu), and isometric latitude (psi). These formulas are accurate for any value of the flattening. The computation of rhumb lines involves the ratio (psi1 - psi2) / (mu1 - mu2) and this is subject to large round-off errors if lat1 is close to lat2. So this ratio is computed using divided differences using one of two methods: by default, this uses the addition theorem for elliptic integrals (accurate for all values of f); however, with the -s options, it is computed using the series expansions used by TransverseMercatorProj(1) for the conversions between rectifying and conformal latitudes (accurate for |f| < 0.01). For the WGS84 ellipsoid, the error is about 10 nanometers using either method.

EXAMPLES

Route from JFK Airport to Singapore Changi Airport:

   echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |
   RhumbSolve -i -: -p 0

   103:34:58.2 18523563

N.B. This is not the route typically taken by aircraft because it's considerably longer than the geodesic given by GeodSolve(1).

Waypoints on the route at intervals of 2000km:

   for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done |
   RhumbSolve -L 40:38:23N 073:46:44W 103:34:58.2 -: -p 0

   40:38:23.0N 073:46:44.0W 0
   36:24:30.3N 051:28:26.4W 9817078307821
   32:10:26.8N 030:20:57.3W 18224745682005
   27:56:13.2N 010:10:54.2W 25358020327741
   23:41:50.1N 009:12:45.5E 31321269267102
   19:27:18.7N 027:59:22.1E 36195163180159
   15:12:40.2N 046:17:01.1E 40041499143669
   10:57:55.9N 064:12:52.8E 42906570007050
   06:43:07.3N 081:53:28.8E 44823504180200
   02:28:16.2N 099:24:54.5E 45813843358737
   01:46:36.0S 116:52:59.7E 45888525219677

SEE ALSO

GeoConvert(1), GeodSolve(1), TransverseMercatorProj(1).

An online version of this utility is availbable at https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve.

The Wikipedia page, Rhumb line, https://en.wikipedia.org/wiki/Rhumb_line.

AUTHOR

RhumbSolve was written by Charles Karney.

HISTORY

RhumbSolve was added to GeographicLib, https://geographiclib.sourceforge.io, in version 1.37.

GeographicLib-1.52/man/TransverseMercatorProj.1.html0000644000771000077100000001712414064202407022306 0ustar ckarneyckarney TransverseMercatorProj(1)

NAME

TransverseMercatorProj -- perform transverse Mercator projection

SYNOPSIS

TransverseMercatorProj [ -s | -t ] [ -l lon0 ] [ -k k0 ] [ -r ] [ -e a f ] [ -w ] [ -p prec ] [ --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 detils on the allowed formats for latitude and longitude, see the GEOGRAPHIC COORDINATES section of GeoConvert(1). 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 grid north (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 the exact algorithm with the "EXTENDED DOMAIN"; this is the default.

-l lon0

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

-k k0

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 a f

specify the ellipsoid via the equatorial radius, a and the flattening, 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. By default, the WGS84 ellipsoid is used, a = 6378137 m, f = 1/298.257223563. If the exact algorithm is used, f must be positive.

-w

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

-p prec

set the output precision to prec (default 6). prec is the number of digits after the decimal point for lengths (in meters). For latitudes and longitudes (in degrees), the number of digits after the decimal point is prec + 5. For the convergence (in degrees) and scale, the number of digits after the decimal point is prec + 6.

--comment-delimiter commentdelim

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 infile

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

--input-string instring

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 linesep

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

--output-file outfile

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 = 82.636..., 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. Geodesy 85(8), 475-485 (Aug. 2011); DOI https://doi.org/10.1007/s00190-011-0445-3; preprint https://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, https://geographiclib.sourceforge.io, in 2009-01. Prior to version 1.9 it was called TransverseMercatorTest (and its interface was slightly different).

GeographicLib-1.52/matlab/CMakeLists.txt0000644000771000077100000000127614064202371020023 0ustar ckarneyckarney# Install matlab files. if (COMMON_INSTALL_PATH) # More Octave friendly would be "share/octave/site/m" set (INSTALL_MATLAB_DIR "share/matlab") else () set (INSTALL_MATLAB_DIR "matlab") endif () file (GLOB MATLAB_FILES geographiclib/[A-Za-z]*.m) install (FILES ${MATLAB_FILES} DESTINATION ${INSTALL_MATLAB_DIR}/geographiclib) # Install "private" functions file (GLOB PRIVATE_MATLAB_FILES geographiclib/private/[A-Za-z]*.m) install (FILES ${PRIVATE_MATLAB_FILES} DESTINATION ${INSTALL_MATLAB_DIR}/geographiclib/private) # Install "legacy" functions file (GLOB LEGACY_FILES geographiclib-legacy/[A-Za-z]*.m) install (FILES ${LEGACY_FILES} DESTINATION ${INSTALL_MATLAB_DIR}/geographiclib-legacy) GeographicLib-1.52/matlab/Makefile.am0000644000771000077100000001001114064202371017302 0ustar ckarneyckarney# # Makefile.am # # Copyright (c) Charles Karney (2011-2016) MATLAB_FILES = \ $(srcdir)/geographiclib/Contents.m \ $(srcdir)/geographiclib/geographiclib_test.m \ $(srcdir)/geographiclib/cassini_fwd.m \ $(srcdir)/geographiclib/cassini_inv.m \ $(srcdir)/geographiclib/defaultellipsoid.m \ $(srcdir)/geographiclib/ecc2flat.m \ $(srcdir)/geographiclib/eqdazim_fwd.m \ $(srcdir)/geographiclib/eqdazim_inv.m \ $(srcdir)/geographiclib/flat2ecc.m \ $(srcdir)/geographiclib/gedistance.m \ $(srcdir)/geographiclib/gedoc.m \ $(srcdir)/geographiclib/geocent_fwd.m \ $(srcdir)/geographiclib/geocent_inv.m \ $(srcdir)/geographiclib/geodarea.m \ $(srcdir)/geographiclib/geoddistance.m \ $(srcdir)/geographiclib/geoddoc.m \ $(srcdir)/geographiclib/geodreckon.m \ $(srcdir)/geographiclib/geoid_height.m \ $(srcdir)/geographiclib/geoid_load.m \ $(srcdir)/geographiclib/gereckon.m \ $(srcdir)/geographiclib/gnomonic_fwd.m \ $(srcdir)/geographiclib/gnomonic_inv.m \ $(srcdir)/geographiclib/loccart_fwd.m \ $(srcdir)/geographiclib/loccart_inv.m \ $(srcdir)/geographiclib/mgrs_fwd.m \ $(srcdir)/geographiclib/mgrs_inv.m \ $(srcdir)/geographiclib/polarst_fwd.m \ $(srcdir)/geographiclib/polarst_inv.m \ $(srcdir)/geographiclib/projdoc.m \ $(srcdir)/geographiclib/tranmerc_fwd.m \ $(srcdir)/geographiclib/tranmerc_inv.m \ $(srcdir)/geographiclib/utmups_fwd.m \ $(srcdir)/geographiclib/utmups_inv.m MATLAB_PRIVATE = \ $(srcdir)/geographiclib/private/A1m1f.m \ $(srcdir)/geographiclib/private/A2m1f.m \ $(srcdir)/geographiclib/private/A3coeff.m \ $(srcdir)/geographiclib/private/A3f.m \ $(srcdir)/geographiclib/private/AngDiff.m \ $(srcdir)/geographiclib/private/AngNormalize.m \ $(srcdir)/geographiclib/private/AngRound.m \ $(srcdir)/geographiclib/private/C1f.m \ $(srcdir)/geographiclib/private/C1pf.m \ $(srcdir)/geographiclib/private/C2f.m \ $(srcdir)/geographiclib/private/C3coeff.m \ $(srcdir)/geographiclib/private/C3f.m \ $(srcdir)/geographiclib/private/C4coeff.m \ $(srcdir)/geographiclib/private/C4f.m \ $(srcdir)/geographiclib/private/G4coeff.m \ $(srcdir)/geographiclib/private/GeoRotation.m \ $(srcdir)/geographiclib/private/LatFix.m \ $(srcdir)/geographiclib/private/SinCosSeries.m \ $(srcdir)/geographiclib/private/atan2dx.m \ $(srcdir)/geographiclib/private/cbrtx.m \ $(srcdir)/geographiclib/private/copysignx.m \ $(srcdir)/geographiclib/private/cvmgt.m \ $(srcdir)/geographiclib/private/eatanhe.m \ $(srcdir)/geographiclib/private/geoid_file.m \ $(srcdir)/geographiclib/private/geoid_load_file.m \ $(srcdir)/geographiclib/private/norm2.m \ $(srcdir)/geographiclib/private/remx.m \ $(srcdir)/geographiclib/private/sincosdx.m \ $(srcdir)/geographiclib/private/sumx.m \ $(srcdir)/geographiclib/private/swap.m \ $(srcdir)/geographiclib/private/tauf.m \ $(srcdir)/geographiclib/private/taupf.m MATLAB_LEGACY = \ $(srcdir)/geographiclib-legacy/Contents.m \ $(srcdir)/geographiclib-legacy/geocentricforward.m \ $(srcdir)/geographiclib-legacy/geocentricreverse.m \ $(srcdir)/geographiclib-legacy/geodesicdirect.m \ $(srcdir)/geographiclib-legacy/geodesicinverse.m \ $(srcdir)/geographiclib-legacy/geodesicline.m \ $(srcdir)/geographiclib-legacy/geoidheight.m \ $(srcdir)/geographiclib-legacy/localcartesianforward.m \ $(srcdir)/geographiclib-legacy/localcartesianreverse.m \ $(srcdir)/geographiclib-legacy/mgrsforward.m \ $(srcdir)/geographiclib-legacy/mgrsreverse.m \ $(srcdir)/geographiclib-legacy/polygonarea.m \ $(srcdir)/geographiclib-legacy/utmupsforward.m \ $(srcdir)/geographiclib-legacy/utmupsreverse.m MATLAB_ALL = $(MATLAB_FILES) $(MATLAB_PRIVATE) matlabdir=$(DESTDIR)$(datadir)/matlab install: $(INSTALL) -d $(matlabdir)/geographiclib/private $(INSTALL) -d $(matlabdir)/geographiclib-legacy $(INSTALL) -m 644 $(MATLAB_FILES) $(matlabdir)/geographiclib $(INSTALL) -m 644 $(MATLAB_PRIVATE) $(matlabdir)/geographiclib/private $(INSTALL) -m 644 $(MATLAB_LEGACY) $(matlabdir)/geographiclib-legacy clean-local: rm -rf *.mex* *.oct EXTRA_DIST = Makefile.mk CMakeLists.txt $(MATLAB_ALL) $(MATLAB_LEGACY) GeographicLib-1.52/matlab/Makefile.mk0000644000771000077100000000117614064202371017330 0ustar ckarneyckarneyMATLAB_FILES = $(wildcard geographiclib/*.m) MATLAB_PRIVATE = $(wildcard geographiclib/private/*.m) MATLAB_LEGACY = $(wildcard geographiclib-legacy/*.m) DEST = $(PREFIX)/share/matlab INSTALL = install -b all: @: install: test -d $(DEST)/geographiclib/private || \ mkdir -p $(DEST)/geographiclib/private test -d $(DEST)/geographiclib-legacy || \ mkdir -p $(DEST)/geographiclib-legacy $(INSTALL) -m 644 $(MATLAB_FILES) $(DEST)/geographiclib $(INSTALL) -m 644 $(MATLAB_PRIVATE) $(DEST)/geographiclib/private/ $(INSTALL) -m 644 $(MATLAB_LEGACY) $(DEST)/geographiclib-legacy clean: rm -f *.mex* *.oct .PHONY: all install clean GeographicLib-1.52/matlab/geographiclib-legacy/Contents.m0000644000771000077100000000226014064202371023271 0ustar ckarneyckarney% GeographicLib legacy functions % Version 1.42 2015-04-27 % % The functions in this directory are DEPRECATED. They are wrapper % routines for the GeographicLib toolbox, which is available at % % href="https://www.mathworks.com/matlabcentral/fileexchange/50605 % % Directly using the GeographicLib toolbox provides greater functionality % and flexiblility. % % Geodesics % geodesicdirect - Wrapper for geodreckon % geodesicinverse - Wrapper for geoddistance % geodesicline - Another wrapper for geodreckon % polygonarea - Wrapper for geodarea % % Grid systems % utmupsforward - Wrapper for utmups_fwd % utmupsreverse - Wrapper for utmups_inv % mgrsforward - Wrapper for mgrs_fwd % mgrsreverse - Wrapper for mgrs_inv % % Geoid lookup % geoidheight - Wrapper for geoid_height % % Geometric transformations % geocentricforward - Wrapper for geocent_fwd % geocentricreverse - Wrapper for geocent_inv % localcartesianforward - Wrapper for loccart_fwd % localcartesianreverse - Wrapper for loccart_inv % Copyright (c) Charles Karney (2015-2019) . GeographicLib-1.52/matlab/geographiclib-legacy/geocentricforward.m0000644000771000077100000000307714064202371025212 0ustar ckarneyckarneyfunction [geocentric, rot] = geocentricforward(geodetic, a, f) %GEOCENTRICFORWARD Wrapper for geocent_fwd % % [geocentric, rot] = GEOCENTRICFORWARD(geodetic) % [geocentric, rot] = GEOCENTRICFORWARD(geodetic, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geocent_fwd which is implemented as % native Matlab code. % % 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 = equatorial radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also GEOCENT_FWD. % Copyright (c) Charles Karney (2015-2017) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end if size(geodetic,2) < 3 h = 0; else h = geodetic(:,3); end [X, Y, Z, M] = geocent_fwd(geodetic(:,1), geodetic(:,2), h, ellipsoid); geocentric = [X, Y, Z]; rot = reshape(permute(M, [3, 2, 1]), [], 9); end GeographicLib-1.52/matlab/geographiclib-legacy/geocentricreverse.m0000644000771000077100000000307214064202371025214 0ustar ckarneyckarneyfunction [geodetic, rot] = geocentricreverse(geocentric, a, f) %GEOCENTRICREVERSE Wrapper for geocent_inv % % [geodetic, rot] = GEOCENTRICREVERSE(geocentric) % [geodetic, rot] = GEOCENTRICREVERSE(geocentric, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geocent_inv which is implemented as % native Matlab code. % % 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 = equatorial radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also GEOCENT_INV. % Copyright (c) Charles Karney (2015-2017) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [lat, lon, h, M] = geocent_inv(geocentric(:,1), geocentric(:,2), ... geocentric(:,3), ellipsoid); geodetic = [lat, lon, h]; rot = reshape(permute(M, [3, 2, 1]), [], 9); end GeographicLib-1.52/matlab/geographiclib-legacy/geodesicdirect.m0000644000771000077100000000317614064202371024460 0ustar ckarneyckarneyfunction [latlong, aux] = geodesicdirect(geodesic, a, f) %GEODESICDIRECT Wrapper for geodreckon % % [latlong, aux] = GEODESICDIRECT(geodesic) % [latlong, aux] = GEODESICDIRECT(geodesic, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geodreckon which is implemented as % native Matlab code. % % 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 = equatorial radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also GEODRECKON. % Copyright (c) Charles Karney (2015-2017) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [lat2, lon2, azi2, S12, m12, M12, M21, a12] = geodreckon ... (geodesic(:,1), geodesic(:,2), geodesic(:,4), geodesic(:,3), ... ellipsoid); latlong = [lat2, lon2, azi2]; aux = [a12, m12, M12, M21, S12]; end GeographicLib-1.52/matlab/geographiclib-legacy/geodesicinverse.m0000644000771000077100000000320614064202371024653 0ustar ckarneyckarneyfunction [geodesic, aux] = geodesicinverse(latlong, a, f) %GEODESICINVERSE Wrapper for geoddistance % % [geodesic, aux] = GEODESICINVERSE(latlong) % [geodesic, aux] = GEODESICINVERSE(latlong, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geoddistance which is implemented as % native Matlab code. % % 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 = equatorial radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also GEODDISTANCE. % Copyright (c) Charles Karney (2015-2017) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ... (latlong(:,1), latlong(:,2), latlong(:,3), latlong(:,4), ellipsoid); geodesic = [azi1, azi2, s12]; aux = [a12, m12, M12, M21, S12]; end GeographicLib-1.52/matlab/geographiclib-legacy/geodesicline.m0000644000771000077100000000343614064202371024134 0ustar ckarneyckarneyfunction [latlong, aux] = geodesicline(lat1, lon1, azi1, distances, a, f) %GEODESICLINE Another wrapper for geodreckon % % [latlong, aux] = GEODESICLINE(lat1, lon1, azi1, distances) % [latlong, aux] = GEODESICLINE(lat1, lon1, azi1, distances, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geodreckon which is implemented as % native Matlab code. % % 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 = equatorial 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) % % See also GEODRECKON. % Copyright (c) Charles Karney (2015-2017) . if (nargin < 5) ellipsoid = defaultellipsoid; elseif (nargin < 6) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [lat2, lon2, azi2, S12, m12, M12, M21, a12] = ... geodreckon(lat1, lon1, distances, azi1, ellipsoid); latlong = [lat2, lon2, azi2]; aux = [a12, m12, M12, M21, S12]; end GeographicLib-1.52/matlab/geographiclib-legacy/geoidheight.m0000644000771000077100000000212214064202371023751 0ustar ckarneyckarneyfunction height = geoidheight(latlong, geoidname, geoiddir) %GEOIDHEIGHT Wrapper for geoid_height % % height = GEOIDHEIGHT(latlong) % height = GEOIDHEIGHT(latlong, geoidname, geoiddir) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geoid_height which is implemented as % native Matlab code. % % 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 % % See also GEOID_HEIGHT. % Copyright (c) Charles Karney (2015-2016) . if nargin < 2 geoidname = ''; end if nargin < 3 geoiddir = ''; end height = geoid_height(latlong(:,1), latlong(:,2), geoidname, geoiddir); end GeographicLib-1.52/matlab/geographiclib-legacy/localcartesianforward.m0000644000771000077100000000400114064202371026040 0ustar ckarneyckarneyfunction [cartesian, rot] = localcartesianforward(origin, geodetic, a, f) %LOCALCARTESIANFORWARD Wrapper for loccart_fwd % % [cartesian, rot] = LOCALCARTESIANFORWARD(origin, geodetic) % [cartesian, rot] = LOCALCARTESIANFORWARD(origin, geodetic, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls loccart_fwd which is implemented as % native Matlab code. % % 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 = equatorial radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also LOCCART_FWD. % Copyright (c) Charles Karney (2015-2017) . if (nargin < 3) ellipsoid = defaultellipsoid; elseif (nargin < 4) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end if size(geodetic,2) < 3 h = 0; else h = geodetic(:,3); end if length(origin(:)) == 2 h0 = 0; elseif length(origin(:)) == 3 h0 = origin(3); else error('origin is not vector of length 2 or 3') end [x, y, z, M] = loccart_fwd(origin(1), origin(2), h0, ... geodetic(:,1), geodetic(:,2), h, ellipsoid); cartesian = [x, y, z]; rot = reshape(permute(M, [3, 2, 1]), [], 9); end GeographicLib-1.52/matlab/geographiclib-legacy/localcartesianreverse.m0000644000771000077100000000371014064202371026055 0ustar ckarneyckarneyfunction [geodetic, rot] = localcartesianreverse(origin, cartesian, a, f) %LOCALCARTESIANREVERSE Wrapper for loccart_inv % % [geodetic, rot] = LOCALCARTESIANREVERSE(origin, cartesian) % [geodetic, rot] = LOCALCARTESIANREVERSE(origin, cartesian, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls loccart_inv which is implemented as % native Matlab code. % % 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 = equatorial radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % See also LOCCART_INV. % Copyright (c) Charles Karney (2015-2017) . if (nargin < 3) ellipsoid = defaultellipsoid; elseif (nargin < 4) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end if length(origin(:)) == 2 h0 = 0; elseif length(origin(:)) == 3 h0 = origin(3); else error('origin is not vector of length 2 or 3') end [lat, lon, h, M] = ... loccart_inv(origin(1), origin(2), h0, ... cartesian(:,1), cartesian(:,2), cartesian(:,3), ellipsoid); geodetic = [lat, lon, h]; rot = reshape(permute(M, [3, 2, 1]), [], 9); end GeographicLib-1.52/matlab/geographiclib-legacy/mgrsforward.m0000644000771000077100000000165514064202371024040 0ustar ckarneyckarneyfunction mgrs = mgrsforward(utmups, prec) %MGRSFORWARD Wrapper for mgrs_fwd % % mgrs = MGRSFORWARD(utmups) % mgrs = MGRSFORWARD(utmups, prec) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls mgrs_fwd which is implemented as native % Matlab code. % % 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. % % See also MGRS_FWD. % Copyright (c) Charles Karney (2015) . if nargin < 2 prec = 5; end mgrs = mgrs_fwd(utmups(:,1), utmups(:,2), utmups(:,3), utmups(:,4), prec); end GeographicLib-1.52/matlab/geographiclib-legacy/mgrsreverse.m0000644000771000077100000000221314064202371024036 0ustar ckarneyckarneyfunction [utmups, prec] = mgrsreverse(mgrs) %MGRSREVERSE Wrapper for mgrs_inv % % [utmups, prec] = MGRSREVERSE(mgrs) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls mgrs_inv which is implemented as native % Matlab code. % % 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. % % See also MGRS_INV. % Copyright (c) Charles Karney (2015) . [x, y, z, h, prec] = mgrs_inv(mgrs); utmups = [x, y, z, h]; end GeographicLib-1.52/matlab/geographiclib-legacy/polygonarea.m0000644000771000077100000000271114064202371024015 0ustar ckarneyckarneyfunction [area, perimeter] = polygonarea(latlong, a, f) %POLYGONAREA Wrapper for geodarea % % [area, perimeter] = POLYGONAREA(latlong) % [area, perimeter] = POLYGONAREA(latlong, a, f) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls geodarea which is implemented as native % Matlab code. % % 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 = equatorial radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % Arbitrarily complex polygons are allowed. In the case of % self-intersecting polygons the area is accumulated "algebraically", % e.g., the areas of the 2 loops in a figure-8 polygon will partially % cancel. 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 ]) % % See also GEODAREA. % Copyright (c) Charles Karney (2015-2019) . if (nargin < 2) ellipsoid = defaultellipsoid; elseif (nargin < 3) ellipsoid = [a, 0]; else ellipsoid = [a, flat2ecc(f)]; end [area, perimeter] = geodarea(latlong(:,1), latlong(:,2), ellipsoid); end GeographicLib-1.52/matlab/geographiclib-legacy/utmupsforward.m0000644000771000077100000000254314064202371024422 0ustar ckarneyckarneyfunction [utmups, scale] = utmupsforward(latlong, setzone) %UTMUPSFORWARD Wrapper for utmups_fwd % % [utmups, scale] = UTMUPSFORWARD(latlong) % [utmups, scale] = UTMUPSFORWARD(latlong, setzone) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls utmups_fwd which is implemented as % native Matlab code. % % 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 % % See also UTMUPS_FWD. % Copyright (c) Charles Karney (2015) . if nargin < 2 setzone = -1; end [x, y, zone, northp, gam, k] = ... utmups_fwd(latlong(:,1), latlong(:,2), setzone); utmups = [x, y, zone, northp]; scale = [gam, k]; end GeographicLib-1.52/matlab/geographiclib-legacy/utmupsreverse.m0000644000771000077100000000204614064202371024427 0ustar ckarneyckarneyfunction [latlong, scale] = utmupsreverse(utmups) %UTMUPSREVERSE Wrapper for utmups_inv % % [latlong, scale] = UTMUPSREVERSE(utmups) % % This is a legacy function to replace a compiled interface function of % the same name. This now calls utmups_inv which is implemented as % native Matlab code. % % 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 % % See also UTMUPS_INV. % Copyright (c) Charles Karney (2015) . [lat, lon, gam, k] = ... utmups_inv(utmups(:,1), utmups(:,2), utmups(:,3), utmups(:,4)); latlong = [lat, lon]; scale = [gam, k]; end GeographicLib-1.52/matlab/geographiclib/Contents.m0000644000771000077100000001010314064202371022022 0ustar ckarneyckarney% GeographicLib toolbox % Version 1.52 2021-06-20 % % This toolbox provides native MATLAB implementations of a subset of the % C++ library, GeographicLib. Key components of this toolbox are % % * Geodesics, direct, inverse, area calculations. % * Projections, transverse Mercator, polar stereographic, etc. % * Grid systems, UTM, UPS, MGRS. % * Geoid lookup, egm84, egm96, egm2008 geoids supported. % * Geometric transformations, geocentric, local cartesian. % * Great ellipse, direct, inverse, area calculations. % % All the functions are vectorized and so offer speeds comparable to % compiled C++ code when operating on arrays. Additional information is % available in the documentation for the GeographicLib, which is % available at % % https://geographiclib.sourceforge.io/1.52 % % Some common features of these functions: % * Angles (latitude, longitude, azimuth, meridian convergence) are % measured in degrees. % * Distances are measured in meters, areas in meters^2. % * Latitudes must lie in [-90,90]. However most routines don't check % that this condition holds. (Exceptions are the grid system and % geoid functions. These return NaNs for invalid inputs.) % * The ellipsoid is specified as [a, e], where a = equatorial radius % and e = eccentricity. The eccentricity can be pure imaginary to % denote a prolate ellipsoid. % * Keep abs(e) < 0.2 (i.e., abs(f) <= 1/50) for full double precision % accuracy. % % There is some overlap between this toolbox and MATLAB's Mapping % Toolbox. However, this toolbox offers: % * better accuracy; % * treatment of oblate and prolate ellipsoid; % * guaranteed convergence for geoddistance; % * calculation of area and differential properties of geodesics; % * ellipsoidal versions of the equidistant azimuthal and gnomonic % projections. % % Function summary: % % Geodesics % geoddistance - Distance between points on an ellipsoid % geodreckon - Point at specified azimuth, range on an ellipsoid % geodarea - Surface area of polygon on an ellipsoid % % Projections % tranmerc_fwd - Forward transverse Mercator projection % tranmerc_inv - Inverse transverse Mercator projection % polarst_fwd - Forward polar stereographic projection % polarst_inv - Inverse polar stereographic projection % eqdazim_fwd - Forward azimuthal equidistant projection % eqdazim_inv - Inverse azimuthal equidistant projection % cassini_fwd - Forward Cassini-Soldner projection % cassini_inv - Inverse Cassini-Soldner projection % gnomonic_fwd - Forward ellipsoidal gnomonic projection % gnomonic_inv - Inverse ellipsoidal gnomonic projection % % Grid systems % utmups_fwd - Convert to UTM/UPS system % utmups_inv - Convert from UTM/UPS system % mgrs_fwd - Convert UTM/UPS coordinates to MGRS % mgrs_inv - Convert MGRS to UTM/UPS coordinates % % Geoid lookup % geoid_height - Compute the height of the geoid above the ellipsoid % geoid_load - Load a geoid model % % Geometric transformations % geocent_fwd - Conversion from geographic to geocentric coordinates % geocent_inv - Conversion from geocentric to geographic coordinates % loccart_fwd - Convert geographic to local cartesian coordinates % loccart_inv - Convert local cartesian to geographic coordinates % % Great ellipses % gedistance - Great ellipse distance on an ellipsoid % gereckon - Point along great ellipse at given azimuth and range % % Utility % defaultellipsoid - Return the WGS84 ellipsoid % ecc2flat - Convert eccentricity to flattening % flat2ecc - Convert flattening to eccentricity % geographiclib_test - The test suite for the geographiclib package % % Documentation % geoddoc - Geodesics on an ellipsoid of revolution % projdoc - Projections for an ellipsoid % gedoc - Great ellipses on an ellipsoid of revolution % Copyright (c) Charles Karney (2015-2021) . GeographicLib-1.52/matlab/geographiclib/cassini_fwd.m0000644000771000077100000000553714064202371022535 0ustar ckarneyckarneyfunction [x, y, azi, rk] = cassini_fwd(lat0, lon0, lat, lon, ellipsoid) %CASSINI_FWD Forward Cassini-Soldner projection % % [x, y] = CASSINI_FWD(lat0, lon0, lat, lon) % [x, y, azi, rk] = CASSINI_FWD(lat0, lon0, lat, lon, ellipsoid) % % performs the forward Cassini-Soldner projection of points (lat,lon) to % (x,y) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. projdoc % defines the projection and gives the restrictions on the allowed ranges % of the arguments. The inverse projection is given by cassini_inv. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the easting (x) direction and rk is the reciprocal of % the northing (y) scale. The scale in the easting direction is 1. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % See also PROJDOC, CASSINI_INV, GEODDISTANCE, DEFAULTELLIPSOID, % FLAT2ECC. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try Z = zeros(size(lat0 + lon0 + lat + lon)); catch error('lat0, lon0, lat, lon have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end degree = pi/180; f = ecc2flat(ellipsoid(2)); dlon = AngDiff(lon0, lon) + Z; [s12, azi1, azi2, ~, ~, ~, ~, sig12] = ... geoddistance(lat, -abs(dlon), lat, abs(dlon), ellipsoid); sig12 = 0.5 * sig12; s12 = 0.5 * s12; c = s12 == 0; da = AngDiff(azi1, azi2)/2; s = abs(dlon) <= 90; azi1(c & s) = 90 - da(c & s); azi2(c & s) = 90 + da(c & s); s = ~s; azi1(c & s) = -90 - da(c & s); azi2(c & s) = -90 + da(c & s); c = dlon < 0; azi2(c) = azi1(c); s12(c) = -s12(c); sig12(c) = -sig12(c); x = s12; azi = AngNormalize(azi2); [~, ~, ~, ~, ~, ~, rk] = ... geodreckon(lat, dlon, -sig12, azi, ellipsoid, 1); [sbet, cbet] = sincosdx(lat); [sbet, cbet] = norm2((1-f) * sbet, cbet); [sbet0, cbet0] = sincosdx(lat0); [sbet0, cbet0] = norm2((1-f) * sbet0, cbet0); [salp, calp] = sincosdx(azi); salp0 = salp .* cbet; calp0 = hypot(calp, salp .* sbet); sbet1 = calp0; c = lat + Z >= 0; sbet1(~c) = -sbet1(~c); cbet1 = abs(salp0); c = abs(dlon) <= 90; cbet1(~c) = -cbet1(~c); sbet01 = sbet1 .* cbet0 - cbet1 .* sbet0; cbet01 = cbet1 .* cbet0 + sbet1 .* sbet0; sig01 = atan2(sbet01, cbet01) / degree; [~, ~, ~, ~, ~, ~, ~, y] = geodreckon(lat0, 0, sig01, 0, ellipsoid, 1); end GeographicLib-1.52/matlab/geographiclib/cassini_inv.m0000644000771000077100000000325714064202371022546 0ustar ckarneyckarneyfunction [lat, lon, azi, rk] = cassini_inv(lat0, lon0, x, y, ellipsoid) %CASSINI_INV Inverse Cassini-Soldner projection % % [lat, lon] = CASSINI_INV(lat0, lon0, x, y) % [lat, lon, azi, rk] = CASSINI_INV(lat0, lon0, x, y, ellipsoid) % % performs the inverse Cassini-Soldner projection of points (x,y) to % (lat,lon) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. projdoc % defines the projection and gives the restrictions on the allowed ranges % of the arguments. The forward projection is given by cassini_fwd. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the easting (x) direction and rk is the reciprocal of % the northing (y) scale. The scale in the easting direction is 1. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % See also PROJDOC, CASSINI_FWD, GEODRECKON, DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try [~] = lat0 + lon0 + x + y; catch error('lat0, lon0, x, y have incompatible sizes') end [lat1, lon1, azi0] = geodreckon(lat0, lon0, y, 0, ellipsoid); [lat, lon, azi, ~, ~, rk] = ... geodreckon(lat1, lon1, x, azi0 + 90, ellipsoid); end GeographicLib-1.52/matlab/geographiclib/defaultellipsoid.m0000644000771000077100000000076314064202371023571 0ustar ckarneyckarneyfunction ellipsoid = defaultellipsoid %DEFAULTELLIPSOID Return the WGS84 ellipsoid % % ellipsoid = DEFAULTELLIPSOID % % returns a vector of the equatorial radius and eccentricity for the % WGS84 ellipsoid. use ecc2flat and flat2ecc to convert between % the eccentricity and the flattening. % % See also ECC2FLAT, FLAT2ECC. persistent ell if isempty(ell) a = 6378137; f = 1/298.257223563; e = flat2ecc(f); ell = [a, e]; end narginchk(0, 0) ellipsoid = ell; end GeographicLib-1.52/matlab/geographiclib/ecc2flat.m0000644000771000077100000000040614064202371021715 0ustar ckarneyckarneyfunction f = ecc2flat(e) %ECC2FLAT Convert eccentricity to flattening % % f = ECC2FLAT(e) % % returns the flattening of an ellipsoid given the eccentricity. % % See also FLAT2ECC. narginchk(1, 1) e2 = real(e.^2); f = e2 ./ (1 + sqrt(1 - e2)); end GeographicLib-1.52/matlab/geographiclib/eqdazim_fwd.m0000644000771000077100000000412714064202371022530 0ustar ckarneyckarneyfunction [x, y, azi, rk] = eqdazim_fwd(lat0, lon0, lat, lon, ellipsoid) %EQDAZIM_FWD Forward azimuthal equidistant projection % % [x, y] = EQDAZIM_FWD(lat0, lon0, lat, lon) % [x, y, azi, rk] = EQDAZIM_FWD(lat0, lon0, lat, lon, ellipsoid) % % performs the forward azimuthal equidistant projection of points % (lat,lon) to (x,y) using (lat0,lon0) as the center of projection. % These input arguments can be scalars or arrays of equal size. The % ellipsoid vector is of the form [a, e], where a is the equatorial % radius in meters, e is the eccentricity. If ellipsoid is omitted, the % WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. projdoc defines the projection and gives % the restrictions on the allowed ranges of the arguments. The inverse % projection is given by eqdazim_inv. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the geodesic from the center of projection and rk is % the reciprocal of the azimuthal scale. The scale in the radial % direction is 1. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % Section 14 of % % C. F. F. Karney, Geodesics on an ellipsoid of revolution (2011), % https://arxiv.org/abs/1102.1215 % Errata: https://geographiclib.sourceforge.io/geod-addenda.html#geod-errata % % describes how to use this projection in the determination of maritime % boundaries (finding the median line). % % See also PROJDOC, EQDAZIM_INV, GEODDISTANCE, DEFAULTELLIPSOID, % FLAT2ECC. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try [~] = lat0 + lon0 + lat + lon; catch error('lat0, lon0, lat, lon have incompatible sizes') end [s, azi0, azi, ~, m, ~, ~, sig] = ... geoddistance(lat0, lon0, lat, lon, ellipsoid); [x, y] = sincosdx(azi0); x = s .* x; y = s .* y; rk = m ./ s; rk(sig <= 0.01 * sqrt(realmin)) = 1; end GeographicLib-1.52/matlab/geographiclib/eqdazim_inv.m0000644000771000077100000000407214064202371022543 0ustar ckarneyckarneyfunction [lat, lon, azi, rk] = eqdazim_inv(lat0, lon0, x, y, ellipsoid) %EQDAZIM_INV Inverse azimuthal equidistant projection % % [lat, lon] = EQDAZIM_INV(lat0, lon0, x, y) % [lat, lon, azi, rk] = EQDAZIM_INV(lat0, lon0, x, y, ellipsoid) % % performs the inverse azimuthal equidistant projection of points (x,y) % to (lat,lon) using (lat0,lon0) as the center of projection. These % input arguments can be scalars or arrays of equal size. The ellipsoid % vector is of the form [a, e], where a is the equatorial radius in % meters, e is the eccentricity. If ellipsoid is omitted, the WGS84 % ellipsoid (more precisely, the value returned by defaultellipsoid) is % used. projdoc defines the projection and gives the restrictions on % the allowed ranges of the arguments. The forward projection is given % by eqdazim_fwd. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the geodesic from the center of projection and rk is % the reciprocal of the azimuthal scale. The scale in the radial % direction is 1. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % Section 14 of % % C. F. F. Karney, Geodesics on an ellipsoid of revolution (2011), % https://arxiv.org/abs/1102.1215 % Errata: https://geographiclib.sourceforge.io/geod-addenda.html#geod-errata % % describes how to use this projection in the determination of maritime % boundaries (finding the median line). % % See also PROJDOC, EQDAZIM_FWD, GEODRECKON, DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try [~] = lat0 + lon0 + x + y; catch error('lat0, lon0, x, y have incompatible sizes') end azi0 = atan2dx(x, y); s = hypot(x, y); [lat, lon, azi, ~, m, ~, ~, sig] = ... geodreckon(lat0, lon0, s, azi0, ellipsoid); rk = m ./ s; rk(sig <= 0.01 * sqrt(realmin)) = 1; end GeographicLib-1.52/matlab/geographiclib/flat2ecc.m0000644000771000077100000000035514064202371021720 0ustar ckarneyckarneyfunction e = flat2ecc(f) %FLAT2ECC Convert flattening to eccentricity % % e = FLAT2ECC(f) % % returns the eccentricity of an ellipsoid given the flattening. % % See also ECC2FLAT. narginchk(1, 1) e = sqrt(f .* (2 - f)); end GeographicLib-1.52/matlab/geographiclib/gedistance.m0000644000771000077100000001115614064202371022344 0ustar ckarneyckarneyfunction [s12, azi1, azi2, S12] = gedistance(lat1, lon1, lat2, lon2, ellipsoid) %GEDISTANCE Great ellipse distance on an ellipsoid % % [s12, azi1, azi2] = GEDISTANCE(lat1, lon1, lat2, lon2) % [s12, azi1, azi2, S12] = GEDISTANCE(lat1, lon1, lat2, lon2, ellipsoid) % % solves the inverse great ellipse problem of finding of length and % azimuths of the great ellipse between points specified by lat1, lon1, % lat2, lon2. The input latitudes and longitudes, lat1, lon1, lat2, % lon2, can be scalars or arrays of equal size and must be expressed in % degrees. The ellipsoid vector is of the form [a, e], where a is the % equatorial radius in meters, e is the eccentricity. If ellipsoid is % omitted, the WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. The output s12 is the distance in meters % and azi1 and azi2 are the forward azimuths at the end points in % degrees. The optional output S12 is the area between the great ellipse % and the equator (in meters^2). gedoc gives an example and provides % additional background information. gedoc also gives the restrictions % on the allowed ranges of the arguments. % % When given a combination of scalar and array inputs, the scalar inputs % are automatically expanded to match the size of the arrays. % % geoddistance solves the equivalent geodesic problem and usually this is % preferable to using GEDISTANCE. % % For more information, see % % https://geographiclib.sourceforge.io/html/greatellipse.html % % See also GEDOC, GERECKON, DEFAULTELLIPSOID, FLAT2ECC, GEODDISTANCE, % GEODRECKON. % Copyright (c) Charles Karney (2014-2019) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat1 + lon1 + lat2 + lon2); catch error('lat1, lon1, s12, azi1 have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end Z = zeros(S); lat1 = lat1 + Z; lon1 = lon1 + Z; lat2 = lat2 + Z; lon2 = lon2 + Z; tiny = sqrt(realmin); a = ellipsoid(1); e2 = real(ellipsoid(2)^2); f = e2 / (1 + sqrt(1 - e2)); f1 = 1 - f; areap = nargout >= 4; lat1 = AngRound(LatFix(lat1(:))); lat2 = AngRound(LatFix(lat2(:))); lon12 = AngRound(AngDiff(lon1(:), lon2(:))); [sbet1, cbet1] = sincosdx(lat1); sbet1 = f1 * sbet1; cbet1 = max(tiny, cbet1); [sbet1, cbet1] = norm2(sbet1, cbet1); [sbet2, cbet2] = sincosdx(lat2); sbet2 = f1 * sbet2; cbet2 = max(tiny, cbet2); [sbet2, cbet2] = norm2(sbet2, cbet2); [slam12, clam12] = sincosdx(lon12); % Solve great circle sgam1 = cbet2 .* slam12; cgam1 = +cbet1 .* sbet2 - sbet1 .* cbet2 .* clam12; sgam2 = cbet1 .* slam12; cgam2 = -sbet1 .* cbet2 + cbet1 .* sbet2 .* clam12; ssig12 = hypot(sgam1, cgam1); csig12 = sbet1 .* sbet2 + cbet1 .* cbet2 .* clam12; [sgam1, cgam1] = norm2(sgam1, cgam1); [sgam2, cgam2] = norm2(sgam2, cgam2); % no need to normalize [ssig12, csig12] cgam0 = hypot(cgam1, sgam1 .* sbet1); ssig1 = sbet1; csig1 = cbet1 .* cgam1; csig1(ssig1 == 0 & csig1 == 0) = 1; [ssig1, csig1] = norm2(ssig1, csig1); ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; k2 = e2 * cgam0.^2; epsi = k2 ./ (2 * (1 + sqrt(1 - k2)) - k2); C1a = C1f(epsi); A1 = a * (1 + A1m1f(epsi)) .* (1 - epsi)./(1 + epsi); s12 = A1 .* (atan2(ssig12, csig12) + ... (SinCosSeries(true, ssig2, csig2, C1a) - ... SinCosSeries(true, ssig1, csig1, C1a))); azi1 = atan2dx(sgam1, cgam1 .* sqrt(1 - e2 * cbet1.^2)); azi2 = atan2dx(sgam2, cgam2 .* sqrt(1 - e2 * cbet2.^2)); s12 = reshape(s12, S); azi1 = reshape(azi1, S); azi2 = reshape(azi2, S); if areap sgam0 = sgam1 .* cbet1; A4 = (a^2 * e2) * cgam0 .* sgam0; n = f / (2 - f); G4x = G4coeff(n); G4a = C4f(epsi, G4x); B41 = SinCosSeries(false, ssig1, csig1, G4a); B42 = SinCosSeries(false, ssig2, csig2, G4a); S12 = A4 .* (B42 - B41); S12(cgam0 == 0 | sgam0 == 0) = 0; sgam12 = sgam2 .* cgam1 - cgam2 .* sgam1; cgam12 = cgam2 .* cgam1 + sgam2 .* sgam1; s = sgam12 == 0 & cgam12 < 0; sgam12(s) = tiny * cgam1(s); cgam12(s) = -1; gam12 = atan2(sgam12, cgam12); l = abs(gam12) < 1; dlam12 = 1 + clam12(l); dbet1 = 1 + cbet1(l); dbet2 = 1 + cbet2(l); gam12(l) = ... 2 * atan2(slam12(l) .* (sbet1(l) .* dbet2 + sbet2(l) .* dbet1), ... dlam12 .* (sbet1(l) .* sbet2(l) + dbet1 .* dbet2)); if e2 ~= 0 c2 = a^2 * (1 + (1 - e2) * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end S12 = S12 + c2 * gam12; S12 = reshape(S12, S); end end GeographicLib-1.52/matlab/geographiclib/gedoc.m0000644000771000077100000001320214064202371021311 0ustar ckarneyckarneyfunction gedoc %GEDOC Great ellipses on an ellipsoid of revolution % % The two routines GEDISTANCE and GERECKON solve the inverse and direct % problems for great ellipses on the surface of an ellipsoid of % revolution. For more information, see % % https://geographiclib.sourceforge.io/html/greatellipse.html % % Great ellipses are sometimes proposed as alternatives to computing % ellipsoidal geodesics. However geodesic calculations are easy to % perform using geoddistance and geodreckon, and these should normally be % used instead of gedistance and gereckon. For a discussion, see % % https://geographiclib.sourceforge.io/html/greatellipse.html#gevsgeodesic % % The method involves stretching the ellipse along the axis until it % becomes a sphere, solving the corresponding great circle problem on the % sphere and mapping the results back to the ellipsoid. For details, % see % % https://geographiclib.sourceforge.io/html/greatellipse.html#geformulation % % Consider two points on the ellipsoid at (lat1, lon1) and (lat2, lon2). % The plane containing these points and the center of the ellipsoid % intersects the ellipsoid on a great ellipse. The length of the shorter % portion of the great ellipse between the two points is s12 and the % great ellipse from point 1 to point 2 has forward azimuths azi1 and % azi2 at the two end points. % % Two great ellipse problems can be considered: % * the direct problem -- given lat1, lon1, s12, and azi1, determine % lat2, lon2, and azi2. This is solved by gereckon. % * the inverse problem -- given lat1, lon1, lat2, lon2, determine s12, % azi1, and azi2. This is solved by gedistance. % % The routines also optionally calculate S12 ,the area between the great % ellipse 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. % % The parameters of the ellipsoid are specified by the optional ellipsoid % argument to the routines. This is a two-element vector of the form % [a,e], where a is the equatorial radius, e is the eccentricity e = % sqrt(a^2-b^2)/a, and b is the polar semi-axis. Typically, a and b are % measured in meters and the distances returned by the routines are then % in meters. However, other units can be employed. If ellipsoid is % omitted, then the WGS84 ellipsoid (more precisely, the value returned % by defaultellipsoid) is assumed [6378137, 0.0818191908426215] % corresponding to a = 6378137 meters and a flattening f = (a-b)/a = % 1/298.257223563. The flattening and eccentricity are related by % % e = sqrt(f * (2 - f)) % f = e^2 / (1 + sqrt(1 - e^2)) % % (The functions ecc2flat and flat2ecc implement these conversions.) For % a sphere, set e = 0; for a prolate ellipsoid (b > a), specify e as a % pure imaginary number. % % All angles (latitude, longitude, azimuth) are measured in degrees with % latitudes increasing northwards, longitudes increasing eastwards, and % azimuths measured clockwise from north. For a point at a pole, the % azimuth is defined by keeping the longitude fixed, writing lat = % +/-(90-eps), and taking the limit eps -> 0+. % % Restrictions on the inputs: % * All latitudes must lie in [-90, 90]. % * The distance s12 is unrestricted. This allows great ellipses to % wrap around the ellipsoid. % * The equatorial radius, a, must be positive. % * The eccentricity, e, should be satisfy abs(e) < 0.2 in order to % retain full accuracy (this corresponds to flattenings satisfying % abs(f) <= 1/50, approximately). This condition holds for most % applications in geodesy. % % Larger values of e can be used with a corresponding drop in accuracy. % The following table gives the approximate maximum error in gedistance % and gereckon (expressed as a distance) for an ellipsoid with the same % equatorial radius as the WGS84 ellipsoid and different values of the % flattening (nm means nanometer and um means micrometer). % % |f| error % 0.01 25 nm % 0.02 30 nm % 0.05 10 um % 0.1 1.5 mm % 0.2 300 mm % % In order to compute intermediate points on a great ellipse, proceed as % in the following example which plots the track from Sydney to % Valparaiso and computes the deviation from the corresponding geodesic. % % % 1 = Sydney, 2 = Valparaiso % lat1 = -33.83; lon1 = 151.29; % lat2 = -33.02; lon2 = -71.64; % [s12g, azi1g] = geoddistance(lat1, lon1, lat2, lon2); % [s12e, azi1e] = gedistance(lat1, lon1, lat2, lon2); % fprintf('Difference in lengths = %.1f m\n', s12e - s12g); % [latg, long] = geodreckon(lat1, lon1, s12g * [0:100]/100, azi1g); % [late, lone] = gereckon(lat1, lon1, s12e * [0:100]/100, azi1e); % plot(long+360*(long<0), latg, lone+360*(lone<0), late); % legend('geodesic', 'great ellipse', 'Location', 'SouthEast'); % title('Sydney to Valparaiso'); % xlabel('longitude'); ylabel('latitude'); % fprintf('Maximum separation = %.1f km\n', ... % max(geoddistance(latg, long, late, lone))/1000); % % The restriction on e above arises because the meridian distance is % given as a series expansion in the third flattening. The exact % distance (valid for any e) can be expressed in terms of the elliptic % integral of the second kind. % % See also GEDISTANCE, GERECKON, DEFAULTELLIPSOID, ECC2FLAT, FLAT2ECC, % GEODDISTANCE, GEODRECKON. % Copyright (c) Charles Karney (2014-2017) . help gedoc end GeographicLib-1.52/matlab/geographiclib/geocent_fwd.m0000644000771000077100000000333614064202371022523 0ustar ckarneyckarneyfunction [X, Y, Z, M] = geocent_fwd(lat, lon, h, ellipsoid) %GEOCENT_FWD Conversion from geographic to geocentric coordinates % % [X, Y, Z] = GEOCENT_FWD(lat, lon) % [X, Y, Z] = GEOCENT_FWD(lat, lon, h) % [X, Y, Z, M] = GEOCENT_FWD(lat, lon, h, ellipsoid) % % converts from geographic coordinates, lat, lon, h to geocentric % coordinates X, Y, Z. lat, lon, h can be scalars or arrays of equal % size. lat and lon are in degrees. h (default 0) and X, Y, Z are in % meters. The ellipsoid vector is of the form [a, e], where a is the % equatorial radius in meters, e is the eccentricity. If ellipsoid is % omitted, the WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. The inverse operation is given by % geocent_inv. % % M is the 3 x 3 rotation matrix for the conversion. Pre-multiplying a % unit vector in local cartesian coordinates (east, north, up) by M % transforms the vector to geocentric coordinates. % % See also GEOCENT_INV, DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2015) . narginchk(2, 4) if nargin < 3, h = 0; end if nargin < 4, ellipsoid = defaultellipsoid; end try z = zeros(size(lat + lon + h)); catch error('lat, lon, h have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end lat = LatFix(lat) + z; lon = lon + z; h = h + z; a = ellipsoid(1); e2 = real(ellipsoid(2)^2); e2m = 1 - e2; [slam, clam] = sincosdx(lon); [sphi, cphi] = sincosdx(lat); n = a./sqrt(1 - e2 * sphi.^2); Z = (e2m * n + h) .* sphi; X = (n + h) .* cphi; Y = X .* slam; X = X .* clam; if nargout > 3 M = GeoRotation(sphi, cphi, slam, clam); end end GeographicLib-1.52/matlab/geographiclib/geocent_inv.m0000644000771000077100000001232014064202371022530 0ustar ckarneyckarneyfunction [lat, lon, h, M] = geocent_inv(X, Y, Z, ellipsoid) %GEOCENT_INV Conversion from geocentric to geographic coordinates % % [lat, lon, h] = GEOCENT_INV(X, Y, Z) % [lat, lon, h, M] = GEOCENT_INV(X, Y, Z, ellipsoid) % % converts from geocentric coordinates X, Y, Z to geographic coordinates, % lat, lon, h. X, Y, Z can be scalars or arrays of equal size. X, Y, Z, % and h are in meters. lat and lon are in degrees. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. The % forward operation is given by geocent_fwd. % % M is the 3 x 3 rotation matrix for the conversion. Pre-multiplying a % unit vector in geocentric coordinates by the transpose of M transforms % the vector to local cartesian coordinates (east, north, up). % % See also GEOCENT_FWD, DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2015) . narginchk(3, 4) if nargin < 4, ellipsoid = defaultellipsoid; end try z = zeros(size(X + Y + Z)); catch error('X, Y, Z have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end X = X + z; Y = Y + z; Z = Z + z; a = ellipsoid(1); e2 = real(ellipsoid(2)^2); e2m = 1 - e2; e2a = abs(e2); e4a = e2^2; maxrad = 2 * a / eps; R = hypot(X, Y); slam = Y ./ R; slam(R == 0) = 0; clam = X ./ R; clam(R == 0) = 1; h = hypot(R, Z); 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. Z1 = Z; Z1(h == 0) = 1; [sphi, cphi] = norm2(Z1, 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. p = (R / a).^2; q = e2m * (Z / a).^2; r = (p + q - e4a) / 6; if e2 < 0 [p, q] = swap(p, q); end % 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 = r.^2; r3 = r .* r2; disc = S .* (2 * r3 + S); u = r; fl2 = disc >= 0; T3 = S(fl2) + r3(fl2); % 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 = (r * t)^3 T3 = T3 + (1 - 2 * (T3 < 0)) .* sqrt(disc(fl2)); % N.B. cbrtx always returns the real root. cbrtx(-8) = -2. T = cbrtx(T3); u(fl2) = u(fl2) + T + cvmgt(r2(fl2) ./ T, 0, T ~= 0); % T is complex, but the way u is defined the result is real. ang = atan2(sqrt(-disc(~fl2)), -(S(~fl2) + r3(~fl2))); % There are three possible cube roots. We choose the root which % avoids cancellation (disc < 0 implies that r < 0). u(~fl2) = u(~fl2) + 2 * r(~fl2) .* cos(ang / 3); % guaranteed positive v = sqrt(u.^2 + e4a * q); % 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. % u+v, guaranteed positive uv = u + v; fl2 = u < 0; uv(fl2) = e4a * q(fl2) ./ (v(fl2) - u(fl2)); % Need to guard against w going negative due to roundoff in uv - q. w = max(0, e2a * (uv - q) ./ (2 * v)); k = uv ./ (sqrt(uv + w.^2) + w); if e2 >= 0 k1 = k; k2 = k + e2; else k1 = k - e2; k2 = k; end [sphi, cphi] = norm2(Z ./ k1, R ./ k2); h = (1 - e2m ./ k1) .* hypot(k1 .* R ./ k2, Z); % Deal with exceptional inputs c = e4a * q == 0 & r <= 0; if any(c) % 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) zz = e4a - p(c); xx = p(c); if e2 < 0 [zz, xx] = swap(zz, xx); end zz = sqrt(zz / e2m); xx = sqrt(xx); H = hypot(zz, xx); sphi(c) = zz ./ H; cphi(c) = xx ./ H; sphi(c & Z < 0) = - sphi(c & Z < 0); h(c) = - a * H / e2a; if e2 >= 0 h(c) = e2m * h(c); end end end far = h > maxrad; if any(far) % 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(far) = hypot(X(far)/2, Y(far)/2); slam(far) = Y(far) ./ R(far); slam(far & R == 0) = 0; clam(far) = X(far) ./ R(far); clam(far & R == 0) = 1; H = hypot(Z(far)/2, R(far)); sphi(far) = Z(far)/2 ./ H; cphi(far) = R(far) ./ H; end lat = atan2dx(sphi, cphi); lon = atan2dx(slam, clam); if nargout > 3 M = GeoRotation(sphi, cphi, slam, clam); end end GeographicLib-1.52/matlab/geographiclib/geodarea.m0000644000771000077100000001051014064202371021776 0ustar ckarneyckarneyfunction [A, P, N] = geodarea(lats, lons, ellipsoid) %GEODAREA Surface area of polygon on an ellipsoid % % A = GEODAREA(lats, lons) % [A, P, N] = GEODAREA(lats, lons, ellipsoid) % % calculates the surface area A of the geodesic polygon specified by the % input vectors lats, lons (in degrees). The ellipsoid vector is of the % form [a, e], where a is the equatorial radius in meters, e is the % eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. There is % no need to "close" the polygon by repeating the first point. Multiple % polygons can be specified by separating the vertices by NaNs in the % vectors. Thus a series of quadrilaterals can be specified as two 5 x K % arrays where the 5th row is NaN. The output, A, is in meters^2. % Counter-clockwise traversal counts as a positive area. Arbitrarily % complex polygons are allowed. In the case of self-intersecting % polygons the area is accumulated "algebraically", e.g., the areas of % the 2 loops in a figure-8 polygon will partially cancel. Also returned % are the perimeters of the polygons in P (meters) and the numbers of % vertices in N. geoddoc gives the restrictions on the allowed ranges of % the arguments. % % GEODAREA loosely duplicates the functionality of the areaint function % in the MATLAB mapping toolbox. The major difference is that the % polygon edges are taken to be geodesics and the area contributed by % each edge is computed using a series expansion with is accurate % regardless of the length of the edge. The formulas are derived in % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://doi.org/10.1007/s00190-012-0578-z % Addenda: https://geographiclib.sourceforge.io/geod-addenda.html % % See also GEODDOC, GEODDISTANCE, GEODRECKON, POLYGONAREA, % DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2012-2019) . narginchk(2, 3) if nargin < 3, ellipsoid = defaultellipsoid; end if ~isequal(size(lats), size(lons)) error('lats, lons have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end lat1 = lats(:); lon1 = lons(:); M = length(lat1); ind = [0; find(isnan(lat1 + lon1))]; if length(ind) == 1 || ind(end) ~= M ind = [ind; M + 1]; end K = length(ind) - 1; A = zeros(K, 1); P = A; N = A; if M == 0, return, end lat2 = [lat1(2:end, 1); 0]; lon2 = [lon1(2:end, 1); 0]; m0 = min(M, ind(1:end-1) + 1); m1 = max(1, ind(2:end) - 1); lat2(m1) = lat1(m0); lon2(m1) = lon1(m0); a = ellipsoid(1); e2 = real(ellipsoid(2)^2); f = e2 / (1 + sqrt(1 - e2)); b = (1 - f) * a; if e2 ~= 0 c2 = (a^2 + b^2 * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end area0 = 4 * pi * c2; [s12, ~, ~, S12] = geoddistance(lat1, lon1, lat2, lon2, ellipsoid); cross = transit(lon1, lon2); for k = 1 : K N(k) = m1(k) - m0(k) + 1; P(k) = accumulator(s12(m0(k):m1(k))); [As, At] = accumulator(S12(m0(k):m1(k))); As = remx(As, area0); [As, At] = accumulator(0, As, At); crossings = sum(cross(m0(k):m1(k))); if mod(crossings, 2) ~= 0 [As, At] = accumulator( ((As < 0) * 2 - 1) * area0 / 2, As, At); end As = -As; At = -At; if As > area0/2 As = accumulator(-area0, As, At); elseif As <= -area0/2 As = accumulator( area0, As, At); end A(k) = As; end A = 0 + A; end function cross = transit(lon1, lon2) %TRANSIT Count crossings of prime meridian % % CROSS = TRANSIT(LON1, LON2) return 1 or -1 if crossing prime meridian % in east or west direction. Otherwise return zero. lon1 = AngNormalize(lon1); lon2 = AngNormalize(lon2); lon12 = AngDiff(lon1, lon2); cross = zeros(length(lon1), 1); cross(lon1 <= 0 & lon2 > 0 & lon12 > 0) = 1; cross(lon2 <= 0 & lon1 > 0 & lon12 < 0) = -1; end function [s, t] = accumulator(x, s, t) %ACCUMULATOR Accurately sum x % % [S, T] = ACCUMULATOR(X, S, T) accumulate the sum of the elements of X % into [S, T] using extended precision. S and T are scalars. if nargin < 3, t = 0; end if nargin < 2, s = 0; end for y = x(:)' % Here's Shewchuk's solution... [z, u] = sumx(y, t); [s, t] = sumx(z, s); if s == 0 s = u; else t = t + u; end end end GeographicLib-1.52/matlab/geographiclib/geoddistance.m0000644000771000077100000004615514064202371022676 0ustar ckarneyckarneyfunction [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ... (lat1, lon1, lat2, lon2, ellipsoid) %GEODDISTANCE Distance between points on an ellipsoid % % [s12, azi1, azi2] = GEODDISTANCE(lat1, lon1, lat2, lon2) % [s12, azi1, azi2, S12, m12, M12, M21, a12] = % GEODDISTANCE(lat1, lon1, lat2, lon2, ellipsoid) % % solves the inverse geodesic problem of finding of length and azimuths % of the shortest geodesic between points specified by lat1, lon1, lat2, % lon2. The input latitudes and longitudes, lat1, lon1, lat2, lon2, can % be scalars or arrays of equal size and must be expressed in degrees. % The ellipsoid vector is of the form [a, e], where a is the equatorial % radius in meters, e is the eccentricity. If ellipsoid is omitted, the % WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. The output s12 is the distance in meters % and azi1 and azi2 are the forward azimuths at the end points in % degrees. The other optional outputs, S12, m12, M12, M21, a12 are % documented in geoddoc. geoddoc also gives the restrictions on the % allowed ranges of the arguments. % % When given a combination of scalar and array inputs, the scalar inputs % are automatically expanded to match the size of the arrays. % % This is an implementation of the algorithm given in % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://doi.org/10.1007/s00190-012-0578-z % Addenda: https://geographiclib.sourceforge.io/geod-addenda.html % % This function duplicates some of the functionality of the distance % function in the MATLAB mapping toolbox. Differences are % % * When the ellipsoid argument is omitted, use the WGS84 ellipsoid. % * The routines work for prolate (as well as oblate) ellipsoids. % * The azimuth at the second end point azi2 is returned. % * The solution is accurate to round off for abs(e) < 0.2. % * The algorithm converges for all pairs of input points. % * Additional properties of the geodesic are calcuated. % % See also GEODDOC, GEODRECKON, GEODAREA, DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2012-2021) . % % This is a straightforward transcription of the C++ implementation in % GeographicLib and the C++ source should be consulted for additional % documentation. This is a vector implementation and the results returned % with array arguments are identical to those obtained with multiple calls % with scalar arguments. The biggest change was to eliminate the branching % to allow a vectorized solution. narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat1 + lon1 + lat2 + lon2); catch error('lat1, lon1, s12, azi1 have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end Z = zeros(S); lat1 = lat1 + Z; lon1 = lon1 + Z; lat2 = lat2 + Z; lon2 = lon2 + Z; Z = Z(:); degree = pi/180; tiny = sqrt(realmin); tol0 = eps; tolb = eps * sqrt(eps); maxit1 = 20; maxit2 = maxit1 + (-log2(eps) + 1) + 10; a = ellipsoid(1); e2 = real(ellipsoid(2)^2); f = e2 / (1 + sqrt(1 - e2)); f1 = 1 - f; ep2 = e2 / (1 - e2); n = f / (2 - f); b = a * f1; distp = true; areap = nargout >= 4; redp = nargout >= 5; scalp = nargout >= 6; % mask for Lengths: 1 = distance, 2 = reduced length, 4 = geodesic scale lengthmask = distp; if redp lengthmask = 2; end if scalp lengthmask = lengthmask + 4; end A3x = A3coeff(n); C3x = C3coeff(n); [lon12, lon12s] = AngDiff(lon1(:), lon2(:)); lonsign = 2 * (lon12 >= 0) - 1; lon12 = lonsign .* AngRound(lon12); lon12s = AngRound((180 -lon12) - lonsign .* lon12s); lam12 = lon12 * degree; slam12 = Z; clam12 = Z; l = lon12 > 90; [slam12( l), clam12( l)] = sincosdx(lon12s(l)); clam12(l) = -clam12(l); [slam12(~l), clam12(~l)] = sincosdx(lon12(~l)); lat1 = AngRound(LatFix(lat1(:))); lat2 = AngRound(LatFix(lat2(:))); swapp = 2 * ~(abs(lat1) < abs(lat2)) - 1; lonsign(swapp < 0) = - lonsign(swapp < 0); [lat1(swapp < 0), lat2(swapp < 0)] = swap(lat1(swapp < 0), lat2(swapp < 0)); latsign = 2 * (lat1 < 0) - 1; lat1 = latsign .* lat1; lat2 = latsign .* lat2; [sbet1, cbet1] = sincosdx(lat1); sbet1 = f1 * sbet1; [sbet1, cbet1] = norm2(sbet1, cbet1); cbet1 = max(tiny, cbet1); [sbet2, cbet2] = sincosdx(lat2); sbet2 = f1 * sbet2; [sbet2, cbet2] = norm2(sbet2, cbet2); cbet2 = max(tiny, cbet2); c = cbet1 < -sbet1 & cbet2 == cbet1; sbet2(c) = (2 * (sbet2(c) < 0) - 1) .* sbet1(c); c = ~(cbet1 < -sbet1) & abs(sbet2) == - sbet1; cbet2(c) = cbet1(c); dn1 = sqrt(1 + ep2 * sbet1.^2); dn2 = sqrt(1 + ep2 * sbet2.^2); sig12 = Z; ssig1 = Z; csig1 = Z; ssig2 = Z; csig2 = Z; calp1 = Z; salp1 = Z; calp2 = Z; salp2 = Z; s12 = Z; m12 = Z; M12 = Z; M21 = Z; omg12 = Z; somg12 = 2+Z; comg12 = Z; domg12 = Z; m = lat1 == -90 | slam12 == 0; if any(m) calp1(m) = clam12(m); salp1(m) = slam12(m); calp2(m) = 1; salp2(m) = 0; ssig1(m) = sbet1(m); csig1(m) = calp1(m) .* cbet1(m); ssig2(m) = sbet2(m); csig2(m) = calp2(m) .* cbet2(m); sig12(m) = ... atan2(0 + max(0, csig1(m) .* ssig2(m) - ssig1(m) .* csig2(m)), ... csig1(m) .* csig2(m) + ssig1(m) .* ssig2(m)); [s12(m), m12(m), ~, M12(m), M21(m)] = ... Lengths(n, sig12(m), ... ssig1(m), csig1(m), dn1(m), ssig2(m), csig2(m), dn2(m), ... cbet1(m), cbet2(m), bitor(1+2, lengthmask), ep2); m = m & (sig12 < 1 | m12 >= 0); g = m & (sig12 < 3 * tiny | ... (sig12 < tol0 & (s12 < 0 | m12 < 0))); sig12(g) = 0; s12(g) = 0; m12(g) = 0; m12(m) = m12(m) * b; s12(m) = s12(m) * b; end eq = ~m & sbet1 == 0; if f > 0 eq = eq & lon12s >= f * 180; end calp1(eq) = 0; calp2(eq) = 0; salp1(eq) = 1; salp2(eq) = 1; s12(eq) = a * lam12(eq); sig12(eq) = lam12(eq) / f1; omg12(eq) = sig12(eq); m12(eq) = b * sin(omg12(eq)); M12(eq) = cos(omg12(eq)); M21(eq) = M12(eq); g = ~eq & ~m; if any(g) dnm = Z; [sig12(g), salp1(g), calp1(g), salp2(g), calp2(g), dnm(g)] = ... InverseStart(sbet1(g), cbet1(g), dn1(g), ... sbet2(g), cbet2(g), dn2(g), ... lam12(g), slam12(g), clam12(g), f, A3x); s = g & sig12 >= 0; s12(s) = b * sig12(s) .* dnm(s); m12(s) = b * dnm(s).^2 .* sin(sig12(s) ./ dnm(s)); if scalp M12(s) = cos(sig12(s) ./ dnm(s)); M21(s) = M12(s); end omg12(s) = lam12(s) ./ (f1 * dnm(s)); g = g & sig12 < 0; salp1a = Z + tiny; calp1a = Z + 1; salp1b = Z + tiny; calp1b = Z - 1; ssig1 = Z; csig1 = Z; ssig2 = Z; csig2 = Z; epsi = Z; v = Z; dv = Z; numit = Z; tripn = Z > 0; tripb = tripn; if any(g) gsave = g; for k = 0 : maxit2 - 1 if k == 0 && ~any(g), break, end numit(g) = k; [v(g), dv(g), ... salp2(g), calp2(g), sig12(g), ... ssig1(g), csig1(g), ssig2(g), csig2(g), epsi(g), domg12(g)] = ... Lambda12(sbet1(g), cbet1(g), dn1(g), ... sbet2(g), cbet2(g), dn2(g), ... salp1(g), calp1(g), slam12(g), clam12(g), f, A3x, C3x); g = g & ~(tripb | ~(abs(v) >= ((tripn * 7) + 1) * tol0)); if ~any(g), break, end c = g & v > 0; if k <= maxit1 c = c & calp1 ./ salp1 > calp1b ./ salp1b; end salp1b(c) = salp1(c); calp1b(c) = calp1(c); c = g & v < 0; if k <= maxit1 c = c & calp1 ./ salp1 < calp1a ./ salp1a; end salp1a(c) = salp1(c); calp1a(c) = calp1(c); if k == maxit1, tripn(g) = false; end if k < maxit1 dalp1 = -v ./ dv; sdalp1 = sin(dalp1); cdalp1 = cos(dalp1); nsalp1 = salp1 .* cdalp1 + calp1 .* sdalp1; calp1(g) = calp1(g) .* cdalp1(g) - salp1(g) .* sdalp1(g); salp1(g) = nsalp1(g); tripn = g & abs(v) <= 16 * tol0; c = g & ~(dv > 0 & nsalp1 > 0 & abs(dalp1) < pi); tripn(c) = false; else c = g; end salp1(c) = (salp1a(c) + salp1b(c))/2; calp1(c) = (calp1a(c) + calp1b(c))/2; [salp1(g), calp1(g)] = norm2(salp1(g), calp1(g)); tripb(c) = abs(salp1a(c)-salp1(c)) + (calp1a(c)-calp1(c)) < tolb ... | abs(salp1(c)-salp1b(c)) + (calp1(c)-calp1b(c)) < tolb; end g = gsave; if bitand(2+4, lengthmask) % set distance bit if redp or scalp, so that J12 is computed in a % canonical way. lengthmask = bitor(1, lengthmask); end [s12(g), m12(g), ~, M12(g), M21(g)] = ... Lengths(epsi(g), sig12(g), ... ssig1(g), csig1(g), dn1(g), ssig2(g), csig2(g), dn2(g), ... cbet1(g), cbet2(g), lengthmask, ep2); m12(g) = m12(g) * b; s12(g) = s12(g) * b; if areap sdomg12 = sin(domg12(g)); cdomg12 = cos(domg12(g)); somg12(g) = slam12(g) .* cdomg12 - clam12(g) .* sdomg12; comg12(g) = clam12(g) .* cdomg12 + slam12(g) .* sdomg12; end end end s12 = 0 + s12; if areap salp0 = salp1 .* cbet1; calp0 = hypot(calp1, salp1 .* sbet1); ssig1 = sbet1; csig1 = calp1 .* cbet1; ssig2 = sbet2; csig2 = calp2 .* cbet2; % Stop complaints from norm2 for equatorial geodesics csig1(calp0 == 0) = 1; csig2(calp0 == 0) = 1; k2 = calp0.^2 * ep2; epsi = k2 ./ (2 * (1 + sqrt(1 + k2)) + k2); A4 = (a^2 * e2) * calp0 .* salp0; [ssig1, csig1] = norm2(ssig1, csig1); [ssig2, csig2] = norm2(ssig2, csig2); C4x = C4coeff(n); Ca = C4f(epsi, C4x); B41 = SinCosSeries(false, ssig1, csig1, Ca); B42 = SinCosSeries(false, ssig2, csig2, Ca); S12 = A4 .* (B42 - B41); S12(calp0 == 0 | salp0 == 0) = 0; l = ~m & somg12 > 1; somg12(l) = sin(omg12(l)); comg12(l) = cos(omg12(l)); l = ~m & comg12 > -0.7071 & sbet2 - sbet1 < 1.75; alp12 = Z; domg12 = 1 + comg12(l); dbet1 = 1 + cbet1(l); dbet2 = 1 + cbet2(l); alp12(l) = 2 * ... atan2(somg12(l) .* (sbet1(l) .* dbet2 + sbet2(l) .* dbet1), ... domg12 .* (sbet1(l) .* sbet2(l) + dbet1 .* dbet2)); l = ~l; salp12 = salp2(l) .* calp1(l) - calp2(l) .* salp1(l); calp12 = calp2(l) .* calp1(l) + salp2(l) .* salp1(l); s = salp12 == 0 & calp12 < 0; salp12(s) = tiny * calp1(s); calp12(s) = -1; alp12(l) = atan2(salp12, calp12); if e2 ~= 0 c2 = (a^2 + b^2 * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end S12 = 0 + swapp .* lonsign .* latsign .* (S12 + c2 * alp12); end [salp1(swapp<0), salp2(swapp<0)] = swap(salp1(swapp<0), salp2(swapp<0)); [calp1(swapp<0), calp2(swapp<0)] = swap(calp1(swapp<0), calp2(swapp<0)); if scalp [M12(swapp<0), M21(swapp<0)] = swap(M12(swapp<0), M21(swapp<0)); M12 = reshape(M12, S); M21 = reshape(M21, S); end salp1 = salp1 .* swapp .* lonsign; calp1 = calp1 .* swapp .* latsign; salp2 = salp2 .* swapp .* lonsign; calp2 = calp2 .* swapp .* latsign; azi1 = atan2dx(salp1, calp1); azi2 = atan2dx(salp2, calp2); a12 = sig12 / degree; s12 = reshape(s12, S); azi1 = reshape(azi1, S); azi2 = reshape(azi2, S); if redp m12 = reshape(m12, S); end if nargout >= 8 a12 = reshape(a12, S); end if areap S12 = reshape(S12, S); end end function [sig12, salp1, calp1, salp2, calp2, dnm] = ... InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, ... lam12, slam12, clam12, f, A3x) %INVERSESTART Compute a starting point for Newton's method N = length(sbet1); f1 = 1 - f; e2 = f * (2 - f); ep2 = e2 / (1 - e2); n = f / (2 - f); tol0 = eps; tol1 = 200 * tol0; tol2 = sqrt(eps); etol2 = 0.1 * tol2 / sqrt( max(0.001, abs(f)) * min(1, 1 - f/2) / 2 ); xthresh = 1000 * tol2; sig12 = -ones(N, 1); salp2 = nan(N, 1); calp2 = nan(N, 1); sbet12 = sbet2 .* cbet1 - cbet2 .* sbet1; cbet12 = cbet2 .* cbet1 + sbet2 .* sbet1; sbet12a = sbet2 .* cbet1 + cbet2 .* sbet1; s = cbet12 >= 0 & sbet12 < 0.5 & cbet2 .* lam12 < 0.5; omg12 = lam12; dnm = nan(N, 1); sbetm2 = (sbet1(s) + sbet2(s)).^2; sbetm2 = sbetm2 ./ (sbetm2 + (cbet1(s) + cbet2(s)).^2); dnm(s) = sqrt(1 + ep2 * sbetm2); omg12(s) = omg12(s) ./ (f1 * dnm(s)); somg12 = slam12; comg12 = clam12; somg12(s) = sin(omg12(s)); comg12(s) = cos(omg12(s)); salp1 = cbet2 .* somg12; t = cbet2 .* sbet1 .* somg12.^2; calp1 = cvmgt(sbet12 + t ./ max(1, 1 + comg12), ... sbet12a - t ./ max(1, 1 - comg12), ... comg12 >= 0); ssig12 = hypot(salp1, calp1); csig12 = sbet1 .* sbet2 + cbet1 .* cbet2 .* comg12; s = s & ssig12 < etol2; salp2(s) = cbet1(s) .* somg12(s); calp2(s) = somg12(s).^2 ./ (1 + comg12(s)); calp2(s & comg12 < 0) = 1 - comg12(s & comg12 < 0); calp2(s) = sbet12(s) - cbet1(s) .* sbet2(s) .* calp2(s); [salp2, calp2] = norm2(salp2, calp2); sig12(s) = atan2(ssig12(s), csig12(s)); s = ~(s | abs(n) > 0.1 | csig12 >= 0 | ssig12 >= 6 * abs(n) * pi * cbet1.^2); if any(s) lam12x = atan2(-slam12(s), -clam12(s)); if f >= 0 k2 = sbet1(s).^2 * ep2; epsi = k2 ./ (2 * (1 + sqrt(1 + k2)) + k2); lamscale = f * cbet1(s) .* A3f(epsi, A3x) * pi; betscale = lamscale .* cbet1(s); x = lam12x ./ lamscale; y = sbet12a(s) ./ betscale; else cbet12a = cbet2(s) .* cbet1(s) - sbet2(s) .* sbet1(s); bet12a = atan2(sbet12a(s), cbet12a); [~, m12b, m0] = ... Lengths(n, pi + bet12a, ... sbet1(s), -cbet1(s), dn1(s), sbet2(s), cbet2(s), dn2(s), ... cbet1(s), cbet2(s), 2); x = -1 + m12b ./ (cbet1(s) .* cbet2(s) .* m0 * pi); betscale = cvmgt(sbet12a(s) ./ min(-0.01, x), - f * cbet1(s).^2 * pi, ... x < -0.01); lamscale = betscale ./ cbet1(s); y = lam12x ./ lamscale; end k = Astroid(x, y); str = y > -tol1 & x > -1 - xthresh; k(str) = 1; if f >= 0 omg12a = -x .* k ./ (1 + k); else omg12a = -y .* (1 + k) ./ k; end omg12a = lamscale .* omg12a; somg12 = sin(omg12a); comg12 = -cos(omg12a); salp1(s) = cbet2(s) .* somg12; calp1(s) = sbet12a(s) - cbet2(s) .* sbet1(s) .* somg12.^2 ./ (1 - comg12); if any(str) salp1s = salp1(s); calp1s = calp1(s); if f >= 0 salp1s(str) = min(1, -x(str)); calp1s(str) = -sqrt(1 - salp1s(str).^2); else calp1s(str) = max(cvmgt(0, -1, x(str) > -tol1), x(str)); salp1s(str) = sqrt(1 - calp1s(str).^2); end salp1(s) = salp1s; calp1(s) = calp1s; end end calp1(salp1 <= 0) = 0; salp1(salp1 <= 0) = 1; [salp1, calp1] = norm2(salp1, calp1); end function k = Astroid(x, y) % ASTROID Solve the astroid equation % % K = ASTROID(X, Y) solves the quartic polynomial Eq. (55) % % K^4 + 2 * K^3 - (X^2 + Y^2 - 1) * K^2 - 2*Y^2 * K - Y^2 = 0 % % for the positive root K. X and Y are column vectors of the same size % and the returned value K has the same size. k = zeros(length(x), 1); p = x.^2; q = y.^2; r = (p + q - 1) / 6; fl1 = ~(q == 0 & r <= 0); p = p(fl1); q = q(fl1); r = r(fl1); S = p .* q / 4; r2 = r.^2; r3 = r .* r2; disc = S .* (S + 2 * r3); u = r; fl2 = disc >= 0; T3 = S(fl2) + r3(fl2); T3 = T3 + (1 - 2 * (T3 < 0)) .* sqrt(disc(fl2)); T = cbrtx(T3); u(fl2) = u(fl2) + T + r2(fl2) ./ cvmgt(T, inf, T ~= 0); ang = atan2(sqrt(-disc(~fl2)), -(S(~fl2) + r3(~fl2))); u(~fl2) = u(~fl2) + 2 * r(~fl2) .* cos(ang / 3); v = sqrt(u.^2 + q); uv = u + v; fl2 = u < 0; uv(fl2) = q(fl2) ./ (v(fl2) - u(fl2)); w = (uv - q) ./ (2 * v); k(fl1) = uv ./ (sqrt(uv + w.^2) + w); end function [lam12, dlam12, ... salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, epsi, ... domg12] = ... Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, ... slam120, clam120, f, A3x, C3x) %LAMBDA12 Solve the hybrid problem tiny = sqrt(realmin); f1 = 1 - f; e2 = f * (2 - f); ep2 = e2 / (1 - e2); calp1(sbet1 == 0 & calp1 == 0) = -tiny; salp0 = salp1 .* cbet1; calp0 = hypot(calp1, salp1 .* sbet1); ssig1 = sbet1; somg1 = salp0 .* sbet1; csig1 = calp1 .* cbet1; comg1 = csig1; [ssig1, csig1] = norm2(ssig1, csig1); salp2 = cvmgt(salp0 ./ cbet2, salp1, cbet2 ~= cbet1); calp2 = cvmgt(sqrt((calp1 .* cbet1).^2 + ... cvmgt((cbet2 - cbet1) .* (cbet1 + cbet2), ... (sbet1 - sbet2) .* (sbet1 + sbet2), ... cbet1 < -sbet1)) ./ cbet2, ... abs(calp1), cbet2 ~= cbet1 | abs(sbet2) ~= -sbet1); ssig2 = sbet2; somg2 = salp0 .* sbet2; csig2 = calp2 .* cbet2; comg2 = csig2; [ssig2, csig2] = norm2(ssig2, csig2); sig12 = atan2(0 + max(0, csig1 .* ssig2 - ssig1 .* csig2), ... csig1 .* csig2 + ssig1 .* ssig2); somg12 = 0 + max(0, comg1 .* somg2 - somg1 .* comg2); comg12 = comg1 .* comg2 + somg1 .* somg2; eta = atan2(somg12 .* clam120 - comg12 .* slam120, ... comg12 .* clam120 + somg12 .* slam120); k2 = calp0.^2 * ep2; epsi = k2 ./ (2 * (1 + sqrt(1 + k2)) + k2); Ca = C3f(epsi, C3x); B312 = SinCosSeries(true, ssig2, csig2, Ca) - ... SinCosSeries(true, ssig1, csig1, Ca); domg12 = -f * A3f(epsi, A3x) .* salp0 .* (sig12 + B312); lam12 = eta + domg12; [~, dlam12] = ... Lengths(epsi, sig12, ... ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, 2); z = calp2 == 0; dlam12(~z) = dlam12(~z) .* f1 ./ (calp2(~z) .* cbet2(~z)); dlam12(z) = - 2 * f1 .* dn1(z) ./ sbet1(z); end function [s12b, m12b, m0, M12, M21] = ... Lengths(epsi, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, ... cbet1, cbet2, outmask, ep2) %LENGTHS Compute various lengths associate with a geodesic N = nan(size(sig12)); if bitand(1+2+4, outmask) A1 = A1m1f(epsi); Ca = C1f(epsi); if bitand(2+4, outmask) A2 = A2m1f(epsi); Cb = C2f(epsi); m0 = A1 - A2; A2 = 1 + A2; end A1 = 1 + A1; end if bitand(1, outmask) B1 = SinCosSeries(true, ssig2, csig2, Ca) - ... SinCosSeries(true, ssig1, csig1, Ca); s12b = A1 .* (sig12 + B1); if bitand(2+4, outmask) B2 = SinCosSeries(true, ssig2, csig2, Cb) - ... SinCosSeries(true, ssig1, csig1, Cb); J12 = m0 .* sig12 + (A1 .* B1 - A2 .* B2); end else s12b = N; % assign arbitrary unused result if bitand(2+4, outmask) for l = 1 : size(Cb, 2) % Assume here that size(Ca, 2) >= size(Cb, 2) Cb(:, l) = A1 .* Ca(:, l) - A2 .* Cb(:, l); end J12 = m0 .* sig12 + (SinCosSeries(true, ssig2, csig2, Cb) - ... SinCosSeries(true, ssig1, csig1, Cb)); end end if bitand(2, outmask) m12b = dn2 .* (csig1 .* ssig2) - dn1 .* (ssig1 .* csig2) - ... csig1 .* csig2 .* J12; else m0 = N; m12b = N; % assign arbitrary unused result end if bitand(4, outmask) csig12 = csig1 .* csig2 + ssig1 .* ssig2; t = ep2 * (cbet1 - cbet2) .* (cbet1 + cbet2) ./ (dn1 + dn2); M12 = csig12 + (t .* ssig2 - csig2 .* J12) .* ssig1 ./ dn1; M21 = csig12 - (t .* ssig1 - csig1 .* J12) .* ssig2 ./ dn2; else M12 = N; M21 = N; % assign arbitrary unused result end end GeographicLib-1.52/matlab/geographiclib/geoddoc.m0000644000771000077100000002070014064202371021635 0ustar ckarneyckarneyfunction geoddoc %GEODDOC Geodesics on an ellipsoid of revolution % % The routines geoddistance, geodreckon, and geodarea solve various % problems involving geodesics on the surface of an ellipsoid of % revolution. These are based on the paper % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://doi.org/10.1007/s00190-012-0578-z % Addenda: https://geographiclib.sourceforge.io/geod-addenda.html % % which, in turn, is based on the classic solution of the geodesic % problems pioneered by Legendre (1806), Bessel (1825), and Helmert % (1880). Links for these and other original papers on geodesics are % given in % % https://geographiclib.sourceforge.io/geodesic-papers/biblio.html % % 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 forward azimuths azi1 and azi2 at % the two end points. % % Traditionally two geodesic problems are considered: % * the direct problem -- given lat1, lon1, s12, and azi1, determine % lat2, lon2, and azi2. This is solved by geodreckon. % * the inverse problem -- given lat1, lon1, lat2, lon2, determine s12, % azi1, and azi2. This is solved by geoddistance. % In addition, geodarea computes the area of an ellipsoidal polygon % where the edges are defined as shortest geodesics. % % The parameters of the ellipsoid are specified by the optional ellipsoid % argument to the routines. This is a two-element vector of the form % [a,e], where a is the equatorial radius, e is the eccentricity e = % sqrt(a^2-b^2)/a, and b is the polar semi-axis. Typically, a and b are % measured in meters and the linear and area quantities returned by the % routines are then in meters and meters^2. However, other units can be % employed. If ELLIPSOID is omitted, then the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is assumed [6378137, % 0.0818191908426215] corresponding to a = 6378137 meters and a % flattening f = (a-b)/a = 1/298.257223563. The flattening and % eccentricity are related by % % e = sqrt(f * (2 - f)) % f = e^2 / (1 + sqrt(1 - e^2)) % % (The functions ecc2flat and flat2ecc implement these conversions.) For % a sphere, set e = 0; for a prolate ellipsoid (b > a), specify e as a % pure imaginary number. % % All angles (latitude, longitude, azimuth) are measured in degrees with % latitudes increasing northwards, longitudes increasing eastwards, and % azimuths measured clockwise from north. For a point at a pole, the % azimuth is defined by keeping the longitude fixed, writing lat = % +/-(90-eps), and taking the limit eps -> 0+. % % The routines also calculate several other quantities of interest % * 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. % * m12, the reduced length of the geodesic 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. % * a12 is the arc length on the auxiliary sphere. This is a construct % for converting the problem to one in spherical trigonometry. a12 % is measured in degrees. The spherical arc length from one equator % crossing to the next is always 180 degrees. % % If points 1, 2, and 3 lie on a single geodesic, then the following % addition rules hold: % * s13 = s12 + s23 % * a13 = a12 + a23 % * S13 = S12 + S23 % * m13 = m12*M23 + m23*M21 % * M13 = M12*M23 - (1 - M12*M21) * m23/m12 % * M31 = M32*M21 - (1 - M23*M32) * m12/m23 % % Restrictions on the inputs: % * All latitudes must lie in [-90, 90]. % * The distance s12 is unrestricted. This allows geodesics to wrap % around the ellipsoid. Such geodesics are no longer shortest paths. % However they retain the property that they are the straightest % curves on the surface. % * Similarly, the spherical arc length, a12, is unrestricted. % * The equatorial radius, a, must be positive. % * The eccentricity, e, should satisfy abs(e) < 0.2 in order to % retain full accuracy (this corresponds to flattenings satisfying % abs(f) <= 1/50, approximately). This condition holds for most % applications in geodesy. % % Larger values of e can be used with a corresponding drop in accuracy. % The following table gives the approximate maximum error in % geoddistance and geodreckon (expressed as a distance) for an ellipsoid % with the same equatorial radius as the WGS84 ellipsoid and different % values of the flattening (nm means nanometer and um means micrometer). % % |f| error % 0.01 25 nm % 0.02 30 nm % 0.05 10 um % 0.1 1.5 mm % 0.2 300 mm % % The shortest distance returned by GEODDISTANCE is (obviously) uniquely % defined. However, in a few special cases there are multiple azimuths % which yield the same shortest distance. Here is a catalog of those % cases: % * lat1 = -lat2 (with neither point at a pole). If azi1 = azi2, the % geodesic is unique. Otherwise there are two geodesics and the % second one is obtained by setting [azi1,azi2] = [azi2,azi1], % [M12,M21] = [M21,M12], S12 = -S12. (This occurs when the longitude % difference is near +/-180 for oblate ellipsoids.) % * lon2 = lon1 +/- 180 (with neither point at a pole). If azi1 = 0 or % +/-180, the geodesic is unique. Otherwise there are two geodesics % and the second one is obtained by setting [azi1,azi2] = % [-azi1,-azi2], S12 = -S12. (This occurs when lat2 is near -lat1 % for prolate ellipsoids.) % * Points 1 and 2 at opposite poles. There are infinitely many % geodesics which can be generated by setting [azi1,azi2] = % [azi1,azi2] + [d,-d], for arbitrary d. (For spheres, this % prescription applies when points 1 and 2 are antipodal.) % * s12 = 0 (coincident points). There are infinitely many geodesics % which can be generated by setting [azi1,azi2] = [azi1,azi2] + % [d,d], for arbitrary d. % % In order to compute intermediate points on a geodesic, proceed as in % the following example which plots the track from JFK Airport to % Singapore Changi Airport. % % lat1 = 40.64; lon1 = -73.78; % lat2 = 1.36; lon2 = 103.99; % [s12, azi1] = geoddistance(lat1, lon1, lat2, lon2); % [lats, lons] = geodreckon(lat1, lon1, s12 * [0:100]/100, azi1); % plot(lons, lats); % % The restriction on e above arises because the formulation is in terms % of series expansions in e^2. The exact solutions (valid for any e) can % be expressed in terms of elliptic integrals. These are provided by the % C++ classes GeodesicExact and GeodesicLineExact. % % The routines duplicate some of the functionality of the distance, % reckon, and areaint functions in the MATLAB mapping toolbox. The major % improvements offered by geoddistance, geodreckon, and geodarea are % % * The routines are accurate to round off for abs(e) < 0.2. For % example, for the WGS84 ellipsoid, the error in the distance % returned by geoddistance is less then 15 nanometers. % * The routines work for prolate (as well as oblate) ellipsoids. % * geoddistance converges for all inputs. % * Differential and integral properties of the geodesics are computed. % * geodarea is accurate regardless of the length of the edges of the % polygon. % % See also GEODDISTANCE, GEODRECKON, GEODAREA, % DEFAULTELLIPSOID, ECC2FLAT, FLAT2ECC. % Copyright (c) Charles Karney (2012-2017) . help geoddoc end GeographicLib-1.52/matlab/geographiclib/geodreckon.m0000644000771000077100000002306714064202371022362 0ustar ckarneyckarneyfunction [lat2, lon2, azi2, S12, m12, M12, M21, a12_s12] = geodreckon ... (lat1, lon1, s12_a12, azi1, ellipsoid, flags) %GEODRECKON Point at specified azimuth, range on an ellipsoid % % [lat2, lon2, azi2] = GEODRECKON(lat1, lon1, s12, azi1) % [lat2, lon2, azi2, S12, m12, M12, M21, a12_s12] = % GEODRECKON(lat1, lon1, s12_a12, azi1, ellipsoid, flags) % % solves the direct geodesic problem of finding the final point and % azimuth given lat1, lon1, s12, and azi1. The input arguments lat1, % lon1, s12, azi1, can be scalars or arrays of equal size. lat1, lon1, % azi1 are given in degrees and s12 in meters. The ellipsoid vector is % of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. lat2, % lon2, and azi2 give the position and forward azimuths at the end point % in degrees. The other outputs, S12, m12, M12, M21, a12 are documented % in geoddoc. geoddoc also gives the restrictions on the allowed ranges % of the arguments. % % flags (default 0) is a combination of 2 flags: % arcmode = bitand(flags, 1) % long_unroll = bitand(flags, 2) % % If arcmode is unset (the default), then, in the long form of the call, % the input argument s12_a12 is the distance s12 (in meters) and the % final output variable a12_s12 is the arc length on the auxiliary sphere % a12 (in degrees). If arcmode is set, then the roles of s12_a12 and % a12_s12 are reversed; s12_a12 is interpreted as the arc length on the % auxiliary sphere a12 (in degrees) and the corresponding distance s12 is % returned in the final output variable a12_s12 (in meters). % % If long_unroll is unset (the default), then the value lon2 is in the % range [-180,180]. If long_unroll is set, the longitude is "unrolled" % so that the quantity lon2 - lon1 indicates how many times and in what % sense the geodesic encircles the ellipsoid. % % The two optional arguments, ellipsoid and flags, may be given in any % order and either or both may be omitted. % % When given a combination of scalar and array inputs, GEODRECKON behaves % as though the inputs were expanded to match the size of the arrays. % However, in the particular case where lat1 and azi1 are the same for % all the input points, they should be specified as scalars since this % will considerably speed up the calculations. (In particular a series % of points along a single geodesic is efficiently computed by specifying % an array for s12 only.) % % This is an implementation of the algorithm given in % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://doi.org/10.1007/s00190-012-0578-z % Addenda: https://geographiclib.sourceforge.io/geod-addenda.html % % This function duplicates some of the functionality of the RECKON % function in the MATLAB mapping toolbox. Differences are % % * When the ellipsoid argument is omitted, use the WGS84 ellipsoid. % * The routines work for prolate (as well as oblate) ellipsoids. % * The azimuth at the end point azi2 is returned. % * The solution is accurate to round off for abs(e) < 0.2. % * Redundant calculations are avoided when computing multiple % points on a single geodesic. % * Additional properties of the geodesic are calcuated. % % See also GEODDOC, GEODDISTANCE, GEODAREA, DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2012-2018) . % % This is a straightforward transcription of the C++ implementation in % GeographicLib and the C++ source should be consulted for additional % documentation. This is a vector implementation and the results returned % with array arguments are identical to those obtained with multiple calls % with scalar arguments. narginchk(4, 6) try S = size(lat1 + lon1 + s12_a12 + azi1); catch error('lat1, lon1, s12, azi1 have incompatible sizes') end if nargin <= 4 ellipsoid = defaultellipsoid; flags = 0; elseif nargin == 5 arg5 = ellipsoid(:); if length(arg5) == 2 ellipsoid = arg5; flags = 0; else flags = arg5; ellipsoid = defaultellipsoid; end else arg5 = ellipsoid(:); arg6 = flags; if length(arg5) == 2 ellipsoid = arg5; flags = arg6; else flags = arg5; ellipsoid = arg6; end end if length(ellipsoid) ~= 2 error('ellipsoid must be a vector of size 2') end if ~isscalar(flags) error('flags must be a scalar') end arcmode = bitand(flags, 1); long_unroll = bitand(flags, 2); Z = zeros(prod(S),1); degree = pi/180; tiny = sqrt(realmin); a = ellipsoid(1); e2 = real(ellipsoid(2)^2); f = e2 / (1 + sqrt(1 - e2)); f1 = 1 - f; ep2 = e2 / (1 - e2); n = f / (2 - f); b = a * f1; areap = nargout >= 4; redlp = nargout >= 5; scalp = nargout >= 6; A3x = A3coeff(n); C3x = C3coeff(n); lat1 = AngRound(LatFix(lat1(:))); lon1 = lon1(:); azi1 = AngRound(azi1(:)); s12_a12 = s12_a12(:); [salp1, calp1] = sincosdx(azi1); [sbet1, cbet1] = sincosdx(lat1); sbet1 = f1 * sbet1; cbet1 = max(tiny, cbet1); [sbet1, cbet1] = norm2(sbet1, cbet1); dn1 = sqrt(1 + ep2 * sbet1.^2); salp0 = salp1 .* cbet1; calp0 = hypot(calp1, salp1 .* sbet1); ssig1 = sbet1; somg1 = salp0 .* sbet1; csig1 = cbet1 .* calp1; csig1(sbet1 == 0 & calp1 == 0) = 1; comg1 = csig1; [ssig1, csig1] = norm2(ssig1, csig1); k2 = calp0.^2 * ep2; epsi = k2 ./ (2 * (1 + sqrt(1 + k2)) + k2); A1m1 = A1m1f(epsi); C1a = C1f(epsi); B11 = SinCosSeries(true, ssig1, csig1, C1a); s = sin(B11); c = cos(B11); stau1 = ssig1 .* c + csig1 .* s; ctau1 = csig1 .* c - ssig1 .* s; C1pa = C1pf(epsi); C3a = C3f(epsi, C3x); A3c = -f * salp0 .* A3f(epsi, A3x); B31 = SinCosSeries(true, ssig1, csig1, C3a); if arcmode sig12 = s12_a12 * degree; [ssig12, csig12] = sincosdx(s12_a12); else tau12 = s12_a12 ./ (b * (1 + A1m1)); s = sin(tau12); c = cos(tau12); B12 = - SinCosSeries(true, stau1 .* c + ctau1 .* s, ... ctau1 .* c - stau1 .* s, C1pa); sig12 = tau12 - (B12 - B11); ssig12 = sin(sig12); csig12 = cos(sig12); if abs(f) > 0.01 ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; B12 = SinCosSeries(true, ssig2, csig2, C1a); serr = (1 + A1m1) .* (sig12 + (B12 - B11)) - s12_a12/b; sig12 = sig12 - serr ./ sqrt(1 + k2 .* ssig2.^2); ssig12 = sin(sig12); csig12 = cos(sig12); end end ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; dn2 = sqrt(1 + k2 .* ssig2.^2); if arcmode || redlp || scalp if arcmode || abs(f) > 0.01 B12 = SinCosSeries(true, ssig2, csig2, C1a); end AB1 = (1 + A1m1) .* (B12 - B11); end sbet2 = calp0 .* ssig2; cbet2 = hypot(salp0, calp0 .* csig2); cbet2(cbet2 == 0) = tiny; somg2 = salp0 .* ssig2; comg2 = csig2; salp2 = salp0; calp2 = calp0 .* csig2; if long_unroll E = copysignx(1, salp0); omg12 = E .* (sig12 ... - (atan2( ssig2, csig2) - atan2( ssig1, csig1)) ... + (atan2(E.*somg2, comg2) - atan2(E.*somg1, comg1))); else omg12 = atan2(somg2 .* comg1 - comg2 .* somg1, ... comg2 .* comg1 + somg2 .* somg1); end lam12 = omg12 + ... A3c .* ( sig12 + (SinCosSeries(true, ssig2, csig2, C3a) - B31)); lon12 = lam12 / degree; if long_unroll lon2 = lon1 + lon12; else lon12 = AngNormalize(lon12); lon2 = AngNormalize(AngNormalize(lon1) + lon12); end lat2 = atan2dx(sbet2, f1 * cbet2); azi2 = atan2dx(salp2, calp2); if arcmode a12_s12 = b * ((1 + A1m1) .* sig12 + AB1); else a12_s12 = sig12 / degree; end a12_s12 = reshape(a12_s12 + Z, S); if redlp || scalp A2m1 = A2m1f(epsi); C2a = C2f(epsi); B21 = SinCosSeries(true, ssig1, csig1, C2a); B22 = SinCosSeries(true, ssig2, csig2, C2a); AB2 = (1 + A2m1) .* (B22 - B21); J12 = (A1m1 - A2m1) .* sig12 + (AB1 - AB2); if redlp m12 = b * ((dn2 .* (csig1 .* ssig2) - dn1 .* (ssig1 .* csig2)) ... - csig1 .* csig2 .* J12); m12 = reshape(m12 + Z, S); end if scalp t = k2 .* (ssig2 - ssig1) .* (ssig2 + ssig1) ./ (dn1 + dn2); M12 = csig12 + (t .* ssig2 - csig2 .* J12) .* ssig1 ./ dn1; M21 = csig12 - (t .* ssig1 - csig1 .* J12) .* ssig2 ./ dn2; M12 = reshape(M12 + Z, S); M21 = reshape(M21 + Z, S); end end if areap C4x = C4coeff(n); C4a = C4f(epsi, C4x); A4 = (a^2 * e2) * calp0 .* salp0; B41 = SinCosSeries(false, ssig1, csig1, C4a); B42 = SinCosSeries(false, ssig2, csig2, C4a); salp12 = calp0 .* salp0 .* ... cvmgt(csig1 .* (1 - csig12) + ssig12 .* ssig1, ... ssig12 .* ... (csig1 .* ssig12 ./ max(1, (1 + csig12)) + ssig1), ... csig12 <= 0); calp12 = salp0.^2 + calp0.^2 .* csig1 .* csig2; % Deal with geodreckon(10, 0, [], 0) which has calp2 = [] if ~isempty(Z) % Enlarge salp1, calp1 is case lat1 is an array and azi1 is a scalar s = zeros(size(salp0)); salp1 = salp1 + s; calp1 = calp1 + s; s = calp0 == 0 | salp0 == 0; salp12(s) = salp2(s) .* calp1(s) - calp2(s) .* salp1(s); calp12(s) = calp2(s) .* calp1(s) + salp2(s) .* salp1(s); end if e2 ~= 0 c2 = (a^2 + b^2 * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end S12 = c2 * atan2(salp12, calp12) + A4 .* (B42 - B41); S12 = reshape(S12 + Z, S); end lat2 = reshape(lat2 + Z, S); lon2 = reshape(lon2, S); azi2 = reshape(azi2 + Z, S); end GeographicLib-1.52/matlab/geographiclib/geographiclib_test.m0000644000771000077100000010501114064202371024066 0ustar ckarneyckarneyfunction geographiclib_test %GEOGRAPHICLIB_TEST The test suite for the geographiclib package % % GEOGRAPHICLIB_TEST % % runs a variety of tests and produces no output it they are successful. n = 0; i = testrand; if i, n=n+1; fprintf('testrand fail: %d\n', i); end i = GeoConvert0 ; if i, n=n+1; fprintf('GeoConvert0 fail: %d\n', i); end i = GeoConvert8 ; if i, n=n+1; fprintf('GeoConvert8 fail: %d\n', i); end i = GeoConvert16; if i, n=n+1; fprintf('GeoConvert16 fail: %d\n', i); end i = GeoConvert17; if i, n=n+1; fprintf('GeoConvert17 fail: %d\n', i); end i = GeodSolve0 ; if i, n=n+1; fprintf('GeodSolve0 fail: %d\n', i); end i = GeodSolve1 ; if i, n=n+1; fprintf('GeodSolve1 fail: %d\n', i); end i = GeodSolve2 ; if i, n=n+1; fprintf('GeodSolve2 fail: %d\n', i); end i = GeodSolve4 ; if i, n=n+1; fprintf('GeodSolve4 fail: %d\n', i); end i = GeodSolve5 ; if i, n=n+1; fprintf('GeodSolve5 fail: %d\n', i); end i = GeodSolve6 ; if i, n=n+1; fprintf('GeodSolve6 fail: %d\n', i); end i = GeodSolve9 ; if i, n=n+1; fprintf('GeodSolve9 fail: %d\n', i); end i = GeodSolve10; if i, n=n+1; fprintf('GeodSolve10 fail: %d\n', i); end i = GeodSolve11; if i, n=n+1; fprintf('GeodSolve11 fail: %d\n', i); end i = GeodSolve12; if i, n=n+1; fprintf('GeodSolve12 fail: %d\n', i); end i = GeodSolve14; if i, n=n+1; fprintf('GeodSolve14 fail: %d\n', i); end i = GeodSolve15; if i, n=n+1; fprintf('GeodSolve15 fail: %d\n', i); end i = GeodSolve17; if i, n=n+1; fprintf('GeodSolve17 fail: %d\n', i); end i = GeodSolve26; if i, n=n+1; fprintf('GeodSolve26 fail: %d\n', i); end i = GeodSolve28; if i, n=n+1; fprintf('GeodSolve28 fail: %d\n', i); end i = GeodSolve33; if i, n=n+1; fprintf('GeodSolve33 fail: %d\n', i); end i = GeodSolve55; if i, n=n+1; fprintf('GeodSolve55 fail: %d\n', i); end i = GeodSolve59; if i, n=n+1; fprintf('GeodSolve59 fail: %d\n', i); end i = GeodSolve61; if i, n=n+1; fprintf('GeodSolve61 fail: %d\n', i); end i = GeodSolve73; if i, n=n+1; fprintf('GeodSolve73 fail: %d\n', i); end i = GeodSolve74; if i, n=n+1; fprintf('GeodSolve74 fail: %d\n', i); end i = GeodSolve76; if i, n=n+1; fprintf('GeodSolve76 fail: %d\n', i); end i = GeodSolve78; if i, n=n+1; fprintf('GeodSolve78 fail: %d\n', i); end i = GeodSolve80; if i, n=n+1; fprintf('GeodSolve80 fail: %d\n', i); end i = GeodSolve84; if i, n=n+1; fprintf('GeodSolve84 fail: %d\n', i); end i = GeodSolve92; if i, n=n+1; fprintf('GeodSolve92 fail: %d\n', i); end i = Planimeter0 ; if i, n=n+1; fprintf('Planimeter0 fail: %d\n', i); end i = Planimeter5 ; if i, n=n+1; fprintf('Planimeter5 fail: %d\n', i); end i = Planimeter6 ; if i, n=n+1; fprintf('Planimeter6 fail: %d\n', i); end i = Planimeter12; if i, n=n+1; fprintf('Planimeter12 fail: %d\n', i); end i = Planimeter13; if i, n=n+1; fprintf('Planimeter13 fail: %d\n', i); end i = Planimeter15; if i, n=n+1; fprintf('Planimeter15 fail: %d\n', i); end i = Planimeter19; if i, n=n+1; fprintf('Planimeter19 fail: %d\n', i); end i = Planimeter21; if i, n=n+1; fprintf('Planimeter21 fail: %d\n', i); end i = TransverseMercatorProj1; if i, n=n+1; fprintf('TransverseMercatorProj1 fail: %d\n', i); end i = TransverseMercatorProj3; if i, n=n+1; fprintf('TransverseMercatorProj3 fail: %d\n', i); end i = TransverseMercatorProj5; if i, n=n+1; fprintf('TransverseMercatorProj5 fail: %d\n', i); end i = geodreckon0; if i, n=n+1; fprintf('geodreckon0 fail: %d\n', i); end i = gedistance0; if i, n=n+1; fprintf('gedistance0 fail: %d\n', i); end i = tranmerc0; if i, n=n+1; fprintf('tranmerc0 fail: %d\n', i); end i = mgrs0; if i, n=n+1; fprintf('mgrs0 fail: %d\n', i); end i = mgrs1; if i, n=n+1; fprintf('mgrs1 fail: %d\n', i); end i = mgrs2; if i, n=n+1; fprintf('mgrs2 fail: %d\n', i); end i = mgrs3; if i, n=n+1; fprintf('mgrs3 fail: %d\n', i); end i = mgrs4; if i, n=n+1; fprintf('mgrs4 fail: %d\n', i); end i = mgrs5; if i, n=n+1; fprintf('mgrs5 fail: %d\n', i); end % check for suppression of "warning: division by zero" in octave [~, ~, ~, ~, ~, ~, ~, s12] = geodreckon(-30, 0, 180, 90, 1); assert(~isnan(s12)); assert(n == 0); end function n = assertEquals(x, y, d) n = abs(x - y) <= d; n = sum(~n(:)); end function n = assertNaN(x) n = isnan(x); n = sum(~n(:)); end function n = testrand n = 0; testcases = [ 35.60777, -139.44815, 111.098748429560326, ... -11.17491, -69.95921, 129.289270889708762, ... 8935244.5604818305, 80.50729714281974, 6273170.2055303837, ... 0.16606318447386067, 0.16479116945612937, 12841384694976.432; 55.52454, 106.05087, 22.020059880982801, ... 77.03196, 197.18234, 109.112041110671519, ... 4105086.1713924406, 36.892740690445894, 3828869.3344387607, ... 0.80076349608092607, 0.80101006984201008, 61674961290615.615; -21.97856, 142.59065, -32.44456876433189, ... 41.84138, 98.56635, -41.84359951440466, ... 8394328.894657671, 75.62930491011522, 6161154.5773110616, ... 0.24816339233950381, 0.24930251203627892, -6637997720646.717; -66.99028, 112.2363, 173.73491240878403, ... -12.70631, 285.90344, 2.512956620913668, ... 11150344.2312080241, 100.278634181155759, 6289939.5670446687, ... -0.17199490274700385, -0.17722569526345708, -121287239862139.744; -17.42761, 173.34268, -159.033557661192928, ... -15.84784, 5.93557, -20.787484651536988, ... 16076603.1631180673, 144.640108810286253, 3732902.1583877189, ... -0.81273638700070476, -0.81299800519154474, 97825992354058.708; 32.84994, 48.28919, 150.492927788121982, ... -56.28556, 202.29132, 48.113449399816759, ... 16727068.9438164461, 150.565799985466607, 3147838.1910180939, ... -0.87334918086923126, -0.86505036767110637, -72445258525585.010; 6.96833, 52.74123, 92.581585386317712, ... -7.39675, 206.17291, 90.721692165923907, ... 17102477.2496958388, 154.147366239113561, 2772035.6169917581, ... -0.89991282520302447, -0.89986892177110739, -1311796973197.995; -50.56724, -16.30485, -105.439679907590164, ... -33.56571, -94.97412, -47.348547835650331, ... 6455670.5118668696, 58.083719495371259, 5409150.7979815838, ... 0.53053508035997263, 0.52988722644436602, 41071447902810.047; -58.93002, -8.90775, 140.965397902500679, ... -8.91104, 133.13503, 19.255429433416599, ... 11756066.0219864627, 105.755691241406877, 6151101.2270708536, ... -0.26548622269867183, -0.27068483874510741, -86143460552774.735; -68.82867, -74.28391, 93.774347763114881, ... -50.63005, -8.36685, 34.65564085411343, ... 3956936.926063544, 35.572254987389284, 3708890.9544062657, ... 0.81443963736383502, 0.81420859815358342, -41845309450093.787; -10.62672, -32.0898, -86.426713286747751, ... 5.883, -134.31681, -80.473780971034875, ... 11470869.3864563009, 103.387395634504061, 6184411.6622659713, ... -0.23138683500430237, -0.23155097622286792, 4198803992123.548; -21.76221, 166.90563, 29.319421206936428, ... 48.72884, 213.97627, 43.508671946410168, ... 9098627.3986554915, 81.963476716121964, 6299240.9166992283, ... 0.13965943368590333, 0.14152969707656796, 10024709850277.476; -19.79938, -174.47484, 71.167275780171533, ... -11.99349, -154.35109, 65.589099775199228, ... 2319004.8601169389, 20.896611684802389, 2267960.8703918325, ... 0.93427001867125849, 0.93424887135032789, -3935477535005.785; -11.95887, -116.94513, 92.712619830452549, ... 4.57352, 7.16501, 78.64960934409585, ... 13834722.5801401374, 124.688684161089762, 5228093.177931598, ... -0.56879356755666463, -0.56918731952397221, -9919582785894.853; -87.85331, 85.66836, -65.120313040242748, ... 66.48646, 16.09921, -4.888658719272296, ... 17286615.3147144645, 155.58592449699137, 2635887.4729110181, ... -0.90697975771398578, -0.91095608883042767, 42667211366919.534; 1.74708, 128.32011, -101.584843631173858, ... -11.16617, 11.87109, -86.325793296437476, ... 12942901.1241347408, 116.650512484301857, 5682744.8413270572, ... -0.44857868222697644, -0.44824490340007729, 10763055294345.653; -25.72959, -144.90758, -153.647468693117198, ... -57.70581, -269.17879, -48.343983158876487, ... 9413446.7452453107, 84.664533838404295, 6356176.6898881281, ... 0.09492245755254703, 0.09737058264766572, 74515122850712.444; -41.22777, 122.32875, 14.285113402275739, ... -7.57291, 130.37946, 10.805303085187369, ... 3812686.035106021, 34.34330804743883, 3588703.8812128856, ... 0.82605222593217889, 0.82572158200920196, -2456961531057.857; 11.01307, 138.25278, 79.43682622782374, ... 6.62726, 247.05981, 103.708090215522657, ... 11911190.819018408, 107.341669954114577, 6070904.722786735, ... -0.29767608923657404, -0.29785143390252321, 17121631423099.696; -29.47124, 95.14681, -163.779130441688382, ... -27.46601, -69.15955, -15.909335945554969, ... 13487015.8381145492, 121.294026715742277, 5481428.9945736388, ... -0.51527225545373252, -0.51556587964721788, 104679964020340.318]; lat1 = testcases(:,1); lon1 = testcases(:,2); azi1 = testcases(:,3); lat2 = testcases(:,4); lon2 = testcases(:,5); azi2 = testcases(:,6); s12 = testcases(:,7); a12 = testcases(:,8); m12 = testcases(:,9); M12 = testcases(:,10); M21 = testcases(:,11); S12 = testcases(:,12); [s12a, azi1a, azi2a, S12a, m12a, M12a, M21a, a12a] = ... geoddistance(lat1, lon1, lat2, lon2); n = n + assertEquals(azi1, azi1a, 1e-13); n = n + assertEquals(azi2, azi2a, 1e-13); n = n + assertEquals(s12, s12a, 1e-8); n = n + assertEquals(a12, a12a, 1e-13); n = n + assertEquals(m12, m12a, 1e-8); n = n + assertEquals(M12, M12a, 1e-15); n = n + assertEquals(M21, M21a, 1e-15); n = n + assertEquals(S12, S12a, 0.1); [lat2a, lon2a, azi2a, S12a, m12a, M12a, M21a, a12a] = ... geodreckon(lat1, lon1, s12, azi1, 2); n = n + assertEquals(lat2, lat2a, 1e-13); n = n + assertEquals(lon2, lon2a, 1e-13); n = n + assertEquals(azi2, azi2a, 1e-13); n = n + assertEquals(a12, a12a, 1e-13); n = n + assertEquals(m12, m12a, 1e-8); n = n + assertEquals(M12, M12a, 1e-15); n = n + assertEquals(M21, M21a, 1e-15); n = n + assertEquals(S12, S12a, 0.1); [lat2a, lon2a, azi2a, S12a, m12a, M12a, M21a, s12a] = ... geodreckon(lat1, lon1, a12, azi1, 1+2); n = n + assertEquals(lat2, lat2a, 1e-13); n = n + assertEquals(lon2, lon2a, 1e-13); n = n + assertEquals(azi2, azi2a, 1e-13); n = n + assertEquals(s12, s12a, 1e-8); n = n + assertEquals(m12, m12a, 1e-8); n = n + assertEquals(M12, M12a, 1e-15); n = n + assertEquals(M21, M21a, 1e-15); n = n + assertEquals(S12, S12a, 0.1); end function ell = ellipsoid(a, f) ell = [a, flat2ecc(f)]; end function n = GeoConvert0 n = 0; [x, y, zone, isnorth] = utmups_fwd(33.3, 44.4); mgrs = mgrs_fwd(x, y, zone, isnorth, 2); n = n + ~strcmp(mgrs, '38SMB4484'); end function n = GeoConvert8 % Check fix to PolarStereographic es initialization blunder (2015-05-18) n = 0; [x, y, zone, isnorth] = utmups_fwd(86, 0); n = n + ~(zone == 0); n = n + ~(isnorth); n = n + assertEquals(x, 2000000, 0.5e-6); n = n + assertEquals(y, 1555731.570643, 0.5e-6); end function n = GeoConvert16 % Check MGRS::Forward improved rounding fix, 2015-07-22 n = 0; mgrs = mgrs_fwd(444140.6, 3684706.3, 38, true, 8); n = n + ~strcmp(mgrs, '38SMB4414060084706300'); end function n = GeoConvert17 % Check MGRS::Forward digit consistency fix, 2015-07-23 n = 0; mgrs = mgrs_fwd(500000, 63.811, 38, true, 8); n = n + ~strcmp(mgrs, '38NNF0000000000063811'); mgrs = mgrs_fwd(500000, 63.811, 38, true, 9); n = n + ~strcmp(mgrs, '38NNF000000000000638110'); end function n = GeodSolve0 n = 0; [s12, azi1, azi2] = geoddistance(40.6, -73.8, 49.01666667, 2.55); n = n + assertEquals(azi1, 53.47022, 0.5e-5); n = n + assertEquals(azi2, 111.59367, 0.5e-5); n = n + assertEquals(s12, 5853226, 0.5); end function n = GeodSolve1 n = 0; [lat2, lon2, azi2] = geodreckon(40.63972222, -73.77888889, 5850e3, 53.5); n = n + assertEquals(lat2, 49.01467, 0.5e-5); n = n + assertEquals(lon2, 2.56106, 0.5e-5); n = n + assertEquals(azi2, 111.62947, 0.5e-5); end function n = GeodSolve2 % Check fix for antipodal prolate bug found 2010-09-04 n = 0; ell = ellipsoid(6.4e6, -1/150.0); [s12, azi1, azi2] = geoddistance(0.07476, 0, -0.07476, 180, ell); n = n + assertEquals(azi1, 90.00078, 0.5e-5); n = n + assertEquals(azi2, 90.00078, 0.5e-5); n = n + assertEquals(s12, 20106193, 0.5); [s12, azi1, azi2] = geoddistance(0.1, 0, -0.1, 180, ell); n = n + assertEquals(azi1, 90.00105, 0.5e-5); n = n + assertEquals(azi2, 90.00105, 0.5e-5); n = n + assertEquals(s12, 20106193, 0.5); end function n = GeodSolve4 % Check fix for short line bug found 2010-05-21 % This also checks the MATLAB specific bug: % Ensure that Lengths in geoddistance is not invoked with zero-length % vectors, 2015-08-25. n = 0; s12 = geoddistance(36.493349428792, 0, 36.49334942879201, .0000008); n = n + assertEquals(s12, 0.072, 0.5e-3); end function n = GeodSolve5 % Check fix for point2=pole bug found 2010-05-03 n = 0; [lat2, lon2, azi2] = geodreckon(0.01777745589997, 30, 10e6, 0); n = n + assertEquals(lat2, 90, 0.5e-5); if lon2 < 0 n = n + assertEquals(lon2, -150, 0.5e-5); n = n + assertEquals(abs(azi2), 180, 0.5e-5); else n = n + assertEquals(lon2, 30, 0.5e-5); n = n + assertEquals(azi2, 0, 0.5e-5); end end function n = GeodSolve6 % 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). n = 0; s12 = geoddistance(88.202499451857, 0, ... -88.202499451857, 179.981022032992859592); n = n + assertEquals(s12, 20003898.214, 0.5e-3); s12 = geoddistance(89.262080389218, 0, ... -89.262080389218, 179.992207982775375662); n = n + assertEquals(s12, 20003925.854, 0.5e-3); s12 = geoddistance(89.333123580033, 0, ... -89.333123580032997687, 179.99295812360148422); n = n + assertEquals(s12, 20003926.881, 0.5e-3); end function n = GeodSolve9 % Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) n = 0; s12 = geoddistance(56.320923501171, 0, ... -56.320923501171, 179.664747671772880215); n = n + assertEquals(s12, 19993558.287, 0.5e-3); end function n = GeodSolve10 % Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio % 10 rel + debug) n = 0; s12 = geoddistance(52.784459512564, 0, ... -52.784459512563990912, 179.634407464943777557); n = n + assertEquals(s12, 19991596.095, 0.5e-3); end function n = GeodSolve11 % Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio % 10 rel + debug) n = 0; s12 = geoddistance(48.522876735459, 0, ... -48.52287673545898293, 179.599720456223079643); n = n + assertEquals(s12, 19989144.774, 0.5e-3); end function n = GeodSolve12 % Check fix for inverse geodesics on extreme prolate/oblate % ellipsoids Reported 2012-08-29 Stefan Guenther % ; fixed 2012-10-07 n = 0; ell = ellipsoid(89.8, -1.83); [s12, azi1, azi2] = geoddistance(0, 0, -10, 160, ell); n = n + assertEquals(azi1, 120.27, 1e-2); n = n + assertEquals(azi2, 105.15, 1e-2); n = n + assertEquals(s12, 266.7, 1e-1); end function n = GeodSolve14 % Check fix for inverse ignoring lon12 = nan n = 0; [s12, azi1, azi2] = geoddistance(0, 0, 1, NaN); n = n + assertNaN(azi1); n = n + assertNaN(azi2); n = n + assertNaN(s12); end function n = GeodSolve15 % Initial implementation of Math::eatanhe was wrong for e^2 < 0. This % checks that this is fixed. n = 0; ell = ellipsoid(6.4e6, -1/150.0); [~, ~, ~, S12] = geodreckon(1, 2, 4, 3, ell); n = n + assertEquals(S12, 23700, 0.5); end function n = GeodSolve17 % Check fix for LONG_UNROLL bug found on 2015-05-07 n = 0; [lat2, lon2, azi2] = geodreckon(40, -75, 2e7, -10, 2); n = n + assertEquals(lat2, -39, 1); n = n + assertEquals(lon2, -254, 1); n = n + assertEquals(azi2, -170, 1); [lat2, lon2, azi2] = geodreckon(40, -75, 2e7, -10); n = n + assertEquals(lat2, -39, 1); n = n + assertEquals(lon2, 105, 1); n = n + assertEquals(azi2, -170, 1); end function n = GeodSolve26 % Check 0/0 problem with area calculation on sphere 2015-09-08 n = 0; ell = ellipsoid(6.4e6, 0); [~, ~, ~, S12] = geoddistance(1, 2, 3, 4, ell); n = n + assertEquals(S12, 49911046115.0, 0.5); end function n = GeodSolve28 % Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in % Java implementation fixed on 2015-05-19). n = 0; ell = ellipsoid(6.4e6, 0.1); [~, ~, ~, ~, ~, ~, ~, a12] = geodreckon(1, 2, 5e6, 10, ell); n = n + assertEquals(a12, 48.55570690, 0.5e-8); end function n = GeodSolve33 % Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- % sind(-0.0) = +0.0 -- and in some version of Visual Studio -- % fmod(-0.0, 360.0) = +0.0. n = 0; [s12, azi1, azi2] = geoddistance(0, 0, 0, 179); n = n + assertEquals(azi1, 90.00000, 0.5e-5); n = n + assertEquals(azi2, 90.00000, 0.5e-5); n = n + assertEquals(s12, 19926189, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0, 179.5); n = n + assertEquals(azi1, 55.96650, 0.5e-5); n = n + assertEquals(azi2, 124.03350, 0.5e-5); n = n + assertEquals(s12, 19980862, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0, 180); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(abs(azi2), 180.00000, 0.5e-5); n = n + assertEquals(s12, 20003931, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 1, 180); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(abs(azi2), 180.00000, 0.5e-5); n = n + assertEquals(s12, 19893357, 0.5); ell = ellipsoid(6.4e6, 0); [s12, azi1, azi2] = geoddistance(0, 0, 0, 179, ell); n = n + assertEquals(azi1, 90.00000, 0.5e-5); n = n + assertEquals(azi2, 90.00000, 0.5e-5); n = n + assertEquals(s12, 19994492, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0, 180, ell); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(abs(azi2), 180.00000, 0.5e-5); n = n + assertEquals(s12, 20106193, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 1, 180, ell); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(abs(azi2), 180.00000, 0.5e-5); n = n + assertEquals(s12, 19994492, 0.5); ell = ellipsoid(6.4e6, -1/300.0); [s12, azi1, azi2] = geoddistance(0, 0, 0, 179, ell); n = n + assertEquals(azi1, 90.00000, 0.5e-5); n = n + assertEquals(azi2, 90.00000, 0.5e-5); n = n + assertEquals(s12, 19994492, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0, 180, ell); n = n + assertEquals(azi1, 90.00000, 0.5e-5); n = n + assertEquals(azi2, 90.00000, 0.5e-5); n = n + assertEquals(s12, 20106193, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 0.5, 180, ell); n = n + assertEquals(azi1, 33.02493, 0.5e-5); n = n + assertEquals(azi2, 146.97364, 0.5e-5); n = n + assertEquals(s12, 20082617, 0.5); [s12, azi1, azi2] = geoddistance(0, 0, 1, 180, ell); n = n + assertEquals(azi1, 0.00000, 0.5e-5); n = n + assertEquals(abs(azi2), 180.00000, 0.5e-5); n = n + assertEquals(s12, 20027270, 0.5); % Check also octave-specific versions of this problem. % In 1.44 this returned [-2.0004e+07, -2.0004e+07, 0.0000e+00, 0.0000e+00] s12 = geoddistance(0,0,0,[179.5, 179.6, 180, 180]); n = n + assertEquals(s12, [19980862, 19989165, 20003931, 20003931], 0.5); end function n = GeodSolve55 % Check fix for nan + point on equator or pole not returning all nans in % Geodesic::Inverse, found 2015-09-23. n = 0; [s12, azi1, azi2] = geoddistance(NaN, 0, 0, 90); n = n + assertNaN(azi1); n = n + assertNaN(azi2); n = n + assertNaN(s12); [s12, azi1, azi2] = geoddistance(NaN, 0, 90, 9); n = n + assertNaN(azi1); n = n + assertNaN(azi2); n = n + assertNaN(s12); end function n = GeodSolve59 % Check for points close with longitudes close to 180 deg apart. n = 0; [s12, azi1, azi2] = geoddistance(5, 0.00000000000001, 10, 180); n = n + assertEquals(azi1, 0.000000000000035, 1.5e-14); n = n + assertEquals(azi2, 179.99999999999996, 1.5e-14); n = n + assertEquals(s12, 18345191.174332713, 5e-9); end function n = GeodSolve61 % Make sure small negative azimuths are west-going n = 0; [lat2, lon2, azi2] = geodreckon(45, 0, 1e7, -0.000000000000000003, 2); n = n + assertEquals(lat2, 45.30632, 0.5e-5); n = n + assertEquals(lon2, -180, 0.5e-5); n = n + assertEquals(abs(azi2), 180, 0.5e-5); end function n = GeodSolve73 % Check for backwards from the pole bug reported by Anon on 2016-02-13. % This only affected the Java implementation. It was introduced in Java % version 1.44 and fixed in 1.46-SNAPSHOT on 2016-01-17. % Also the + sign on azi2 is a check on the normalizing of azimuths % (converting -0.0 to +0.0). n = 0; [lat2, lon2, azi2] = geodreckon(90, 10, -1e6, 180); n = n + assertEquals(lat2, 81.04623, 0.5e-5); n = n + assertEquals(lon2, -170, 0.5e-5); n = n + assertEquals(azi2, 0, 0); n = n + assertEquals(copysignx(1, azi2), 1, 0); end function n = GeodSolve74 % Check fix for inaccurate areas, bug introduced in v1.46, fixed % 2015-10-16. n = 0; [s12, azi1, azi2, S12, m12, M12, M21, a12] = ... geoddistance(54.1589, 15.3872, 54.1591, 15.3877); n = n + assertEquals(azi1, 55.723110355, 5e-9); n = n + assertEquals(azi2, 55.723515675, 5e-9); n = n + assertEquals(s12, 39.527686385, 5e-9); n = n + assertEquals(a12, 0.000355495, 5e-9); n = n + assertEquals(m12, 39.527686385, 5e-9); n = n + assertEquals(M12, 0.999999995, 5e-9); n = n + assertEquals(M21, 0.999999995, 5e-9); n = n + assertEquals(S12, 286698586.30197, 5e-4); end function n = GeodSolve76 % The distance from Wellington and Salamanca (a classic failure of % Vincenty) n = 0; [s12, azi1, azi2] = ... geoddistance(-(41+19/60), 174+49/60, 40+58/60, -(5+30/60)); n = n + assertEquals(azi1, 160.39137649664, 0.5e-11); n = n + assertEquals(azi2, 19.50042925176, 0.5e-11); n = n + assertEquals(s12, 19960543.857179, 0.5e-6); end function n = GeodSolve78 % An example where the NGS calculator fails to converge n = 0; [s12, azi1, azi2] = geoddistance(27.2, 0.0, -27.1, 179.5); n = n + assertEquals(azi1, 45.82468716758, 0.5e-11); n = n + assertEquals(azi2, 134.22776532670, 0.5e-11); n = n + assertEquals(s12, 19974354.765767, 0.5e-6); end function n = GeodSolve80 % Some tests to add code coverage: computing scale in special cases + zero % length geodesic (includes GeodSolve80 - GeodSolve83). n = 0; [~, ~, ~, ~, ~, M12, M21] = geoddistance(0, 0, 0, 90); n = n + assertEquals(M12, -0.00528427534, 0.5e-10); n = n + assertEquals(M21, -0.00528427534, 0.5e-10); [~, ~, ~, ~, ~, M12, M21] = geoddistance(0, 0, 1e-6, 1e-6); n = n + assertEquals(M12, 1, 0.5e-10); n = n + assertEquals(M21, 1, 0.5e-10); [s12, azi1, azi2, S12, m12, M12, M21, a12] = ... geoddistance(20.001, 0, 20.001, 0); n = n + assertEquals(a12, 0, 1e-13); n = n + assertEquals(s12, 0, 1e-8); n = n + assertEquals(azi1, 180, 1e-13); n = n + assertEquals(azi2, 180, 1e-13); n = n + assertEquals(m12, 0, 1e-8); n = n + assertEquals(M12, 1, 1e-15); n = n + assertEquals(M21, 1, 1e-15); n = n + assertEquals(S12, 0, 1e-10); n = n + assertEquals(copysignx(1, a12), 1, 0); n = n + assertEquals(copysignx(1, s12), 1, 0); n = n + assertEquals(copysignx(1, m12), 1, 0); [s12, azi1, azi2, S12, m12, M12, M21, a12] = ... geoddistance(90, 0, 90, 180); n = n + assertEquals(a12, 0, 1e-13); n = n + assertEquals(s12, 0, 1e-8); n = n + assertEquals(azi1, 0, 1e-13); n = n + assertEquals(azi2, 180, 1e-13); n = n + assertEquals(m12, 0, 1e-8); n = n + assertEquals(M12, 1, 1e-15); n = n + assertEquals(M21, 1, 1e-15); n = n + assertEquals(S12, 127516405431022.0, 0.5); end function n = GeodSolve84 % Tests for python implementation to check fix for range errors with % {fmod,sin,cos}(inf) (includes GeodSolve84 - GeodSolve86). n = 0; [lat2, lon2, azi2] = geodreckon(0, 0, inf, 90); n = n + assertNaN(lat2); n = n + assertNaN(lon2); n = n + assertNaN(azi2); [lat2, lon2, azi2] = geodreckon(0, 0, nan, 90); n = n + assertNaN(lat2); n = n + assertNaN(lon2); n = n + assertNaN(azi2); [lat2, lon2, azi2] = geodreckon(0, 0, 1000, inf); n = n + assertNaN(lat2); n = n + assertNaN(lon2); n = n + assertNaN(azi2); [lat2, lon2, azi2] = geodreckon(0, 0, 1000, nan); n = n + assertNaN(lat2); n = n + assertNaN(lon2); n = n + assertNaN(azi2); [lat2, lon2, azi2] = geodreckon(0, inf, 1000, 90); n = n + assertEquals(lat2, 0, 0); n = n + assertNaN(lon2); n = n + assertEquals(azi2, 90, 0); [lat2, lon2, azi2] = geodreckon(0, nan, 1000, 90); n = n + assertEquals(lat2, 0, 0); n = n + assertNaN(lon2); n = n + assertEquals(azi2, 90, 0); [lat2, lon2, azi2] = geodreckon(inf, 0, 1000, 90); n = n + assertNaN(lat2); n = n + assertNaN(lon2); n = n + assertNaN(azi2); [lat2, lon2, azi2] = geodreckon(nan, 0, 1000, 90); n = n + assertNaN(lat2); n = n + assertNaN(lon2); n = n + assertNaN(azi2); end function n = GeodSolve92 % Check fix for inaccurate hypot with python 3.[89]. Problem reported % by agdhruv https://github.com/geopy/geopy/issues/466 ; see % https://bugs.python.org/issue43088 n = 0; [s12, azi1, azi2] = geoddistance(37.757540000000006, -122.47018, ... 37.75754, -122.470177); n = n + assertEquals(azi1, 89.99999923, 1e-7 ); n = n + assertEquals(azi2, 90.00000106, 1e-7 ); n = n + assertEquals(s12, 0.264, 0.5e-3); end function n = Planimeter0 % Check fix for pole-encircling bug found 2011-03-16 n = 0; pa = [89, 0; 89, 90; 89, 180; 89, 270]; pb = [-89, 0; -89, 90; -89, 180; -89, 270]; pc = [0, -1; -1, 0; 0, 1; 1, 0]; pd = [90, 0; 0, 0; 0, 90]; [area, perimeter] = geodarea(pa(:,1), pa(:,2)); n = n + assertEquals(perimeter, 631819.8745, 1e-4); n = n + assertEquals(area, 24952305678.0, 1); [area, perimeter] = geodarea(pb(:,1), pb(:,2)); n = n + assertEquals(perimeter, 631819.8745, 1e-4); n = n + assertEquals(area, -24952305678.0, 1); [area, perimeter] = geodarea(pc(:,1), pc(:,2)); n = n + assertEquals(perimeter, 627598.2731, 1e-4); n = n + assertEquals(area, 24619419146.0, 1); [area, perimeter] = geodarea(pd(:,1), pd(:,2)); n = n + assertEquals(perimeter, 30022685, 1); n = n + assertEquals(area, 63758202715511.0, 1); end function n = Planimeter5 % Check fix for Planimeter pole crossing bug found 2011-06-24 n = 0; points = [89, 0.1; 89, 90.1; 89, -179.9]; [area, perimeter] = geodarea(points(:,1), points(:,2)); n = n + assertEquals(perimeter, 539297, 1); n = n + assertEquals(area, 12476152838.5, 1); end function n = Planimeter6 % Check fix for Planimeter lon12 rounding bug found 2012-12-03 n = 0; pa = [9, -0.00000000000001; 9, 180; 9, 0]; pb = [9, 0.00000000000001; 9, 0; 9, 180]; pc = [9, 0.00000000000001; 9, 180; 9, 0]; pd = [9, -0.00000000000001; 9, 0; 9, 180]; [area, perimeter] = geodarea(pa(:,1), pa(:,2)); n = n + assertEquals(perimeter, 36026861, 1); n = n + assertEquals(area, 0, 1); [area, perimeter] = geodarea(pb(:,1), pb(:,2)); n = n + assertEquals(perimeter, 36026861, 1); n = n + assertEquals(area, 0, 1); [area, perimeter] = geodarea(pc(:,1), pc(:,2)); n = n + assertEquals(perimeter, 36026861, 1); n = n + assertEquals(area, 0, 1); [area, perimeter] = geodarea(pd(:,1), pd(:,2)); n = n + assertEquals(perimeter, 36026861, 1); n = n + assertEquals(area, 0, 1); end function n = Planimeter12 % Area of arctic circle (not really -- adjunct to rhumb-area test) n = 0; points = [66.562222222, 0; 66.562222222, 180]; [area, perimeter] = geodarea(points(:,1), points(:,2)); n = n + assertEquals(perimeter, 10465729, 1); n = n + assertEquals(area, 0, 1); end function n = Planimeter13 % Check encircling pole twice n = 0; points = [89,-360; 89,-240; 89,-120; 89,0; 89,120; 89,240]; [area, perimeter] = geodarea(points(:,1), points(:,2)); n = n + assertEquals(perimeter, 1160741, 1); n = n + assertEquals(area, 32415230256.0, 1); end function n = Planimeter15 % Coverage tests, includes Planimeter15 - Planimeter18 (combinations of % reverse and sign). But flags aren't supported in the MATLAB % implementation. n = 0; points = [2,1; 1,2; 3,3]; area = geodarea(points(:,1), points(:,2)); n = n + assertEquals(area, 18454562325.45119, 1); % Interchanging lat and lon is equivalent to traversing the polygon % backwards. area = geodarea(points(:,2), points(:,1)); n = n + assertEquals(area, -18454562325.45119, 1); end function n = Planimeter19 % Coverage tests, includes Planimeter19 - Planimeter20 (degenerate % polygons). n = 0; points = [1,1]; [area, perimeter] = geodarea(points(:,1), points(:,2)); n = n + assertEquals(area, 0, 0); n = n + assertEquals(perimeter, 0, 0); end function n = Planimeter21 % Some test to add code coverage: multiple circlings of pole (includes % Planimeter21 - Planimeter28). n = 0; points = [45 60;45 180;45 -60;... 45 60;45 180;45 -60;... 45 60;45 180;45 -60;... 45 60;45 180;45 -60;... ]; r = 39433884866571.4277; % Area for one circuit for i = 3 : 4 area = geodarea(points(1:3*i,1), points(1:3*i,2)); % if i ~= 4 n = n + assertEquals(area, i*r, 0.5); % end area = geodarea(points(3*i:-1:1,1), points(3*i:-1:1,2)); % if i ~= 4 n = n + assertEquals(area, -i*r, 0.5); % end end end function n = TransverseMercatorProj1 % Test fix to bad meridian convergence at pole with % TransverseMercatorExact found 2013-06-26 n = 0; [x, y, gam, k] = tranmerc_fwd(0, 0, 90, 75); n = n + assertEquals(x, 0, 0.5e-6); n = n + assertEquals(y, 10001965.72935, 0.5e-4); n = n + assertEquals(gam, 75, 0.5e-12); n = n + assertEquals(k, 1, 0.5e-12); end function n = TransverseMercatorProj3 % Test fix to bad scale at pole with TransverseMercatorExact % found 2013-06-30 (quarter meridian = 10001965.7293127228128889202m) n = 0; [lat, lon, gam, k] = tranmerc_inv(0, 0, 0, 10001965.7293127228); n = n + assertEquals(lat, 90, 1e-11); if abs(lon) < 90 n = n + assertEquals(lon, 0, 0.5e-12); n = n + assertEquals(gam, 0, 0.5e-12); else n = n + assertEquals(abs(lon), 180, 0.5e-12); n = n + assertEquals(abs(gam), 180, 0.5e-12); end n = n + assertEquals(k, 1.0, 0.5e-12); end function n = TransverseMercatorProj5 % Generic tests for transverse Mercator added 2017-04-15 to check use of % complex arithmetic to do Clenshaw sum. n = 0; k0 = 0.9996; ell = ellipsoid(6.4e6, 1/150); [x, y, gam, k] = tranmerc_fwd(0, 0, 20, 30, ell); n = n + assertEquals(x * k0, 3266035.453860, 0.5e-6); n = n + assertEquals(y * k0, 2518371.552676, 0.5e-6); n = n + assertEquals(gam, 11.207356502141, 0.5e-12); n = n + assertEquals(k * k0, 1.134138960741, 0.5e-12); [lat, lon, gam, k] = tranmerc_inv(0, 0, 3.3e6 / k0, 2.5e6 / k0, ell); n = n + assertEquals(lat, 19.80370996793, 0.5e-11); n = n + assertEquals(lon, 30.24919702282, 0.5e-11); n = n + assertEquals(gam, 11.214378172893, 0.5e-12); n = n + assertEquals(k * k0, 1.137025775759, 0.5e-12); end function n = geodreckon0 % Check mixed array size bugs n = 0; % lat1 is an array, azi1 is a scalar: 2015-08-10 [~, ~, ~, S12] = geodreckon([10 20], 0, 0, 0); if length(S12) ~= 2, n = n+1; end % scalar args except s12 is empty: 2017-03-26 [~, ~, ~, S12] = geodreckon(10, 0, [], 0); if ~isempty(S12), n = n+1; end % atan2dx needs to accommodate scalar + array arguments: 2017-03-27 lat2 = geodreckon(3, 4, [1, 2], 90); if length(lat2) ~= 2, n = n+1; end end function n = gedistance0 % gedistance(0, 0, 0, 100) wrongly return nan; 2015-09-23 n = 0; s12 = gedistance(0, 0, 0, 100); n = n + assertEquals(s12, 11131949, 0.5); end function n = tranmerc0 % In 1.44, tranmerc_{fwd,inv} didn't work with array arguments. n = 0; % This used to result in an error [x, y, gam, k] = tranmerc_fwd(0, 0, [90,90;85,85], [10,20;10,20]); k0 = 0.9996; n = n + assertEquals(x, [0, 0; 96820.412637, 190740.935334]/k0, 0.5e-6); n = n + assertEquals(y, [9997964.943021, 9997964.943021; ... 9448171.516284, 9473242.646190]/k0, 0.5e-6); n = n + assertEquals(gam, [10, 20; ... 9.962710901776, 19.929896900550], 0.5e-12); n = n + assertEquals(k, [0.9996, 0.9996; ... 0.999714504947, 1.000044424775]/k0, 0.5e-12); % This used to result in NaNs [x, y, gam, k] = tranmerc_fwd(0, 0, [90,90;85,85]', [10,20;10,20]'); k0 = 0.9996; n = n + assertEquals(x, [0, 0; 96820.412637, 190740.935334]'/k0, 0.5e-6); n = n + assertEquals(y, [9997964.943021, 9997964.943021; ... 9448171.516284, 9473242.646190]'/k0, 0.5e-6); n = n + assertEquals(gam, [10, 20; ... 9.962710901776, 19.929896900550]', 0.5e-12); n = n + assertEquals(k, [0.9996, 0.9996; ... 0.999714504947, 1.000044424775]'/k0, 0.5e-12); end function n = mgrs0 % In 1.43, mgrs_inv didn't detect illegal letter combinations. n = 0; % This used to result in finite x, y [x, y, zone, northp] = mgrs_inv('38RMB'); n = n + assertNaN(x) + assertNaN(y); n = n + assertEquals(zone, -4, 0); n = n + assertEquals(northp, false, 0); end function n = mgrs1 % In 1.44, mgrs_fwd gives the wrong results with prec = 10 or 11 in octave n = 0; % This used to result in '38SMB-1539607552-1539607552' mgrs = mgrs_fwd(450000, 3650000, 38, 1, 11); n = n + assertEquals(mgrs{1}, '38SMB5000000000050000000000', 0); end function n = mgrs2 % In 1.43, mgrs_inv doesn't decode prec 11 string correctly n = 0; % This used to result in x = y = NaN [x, y, zone, northp] = mgrs_inv('38SMB5000000000050000000000'); n = n + assertEquals(x, 450000.0000005, 0.5e-6); n = n + assertEquals(y, 3650000.0000005, 0.5e-6); n = n + assertEquals(zone, 38, 0); n = n + assertEquals(northp, true, 0); end function n = mgrs3 % GeoConvert16: Check MGRS::Forward improved rounding fix, 2015-07-22 n = 0; mgrs = mgrs_fwd(444140.6, 3684706.3, 38, 1, 8); n = n + assertEquals(mgrs{1}, '38SMB4414060084706300', 0); end function n = mgrs4 % GeoConvert17: Check MGRS::Forward digit consistency fix, 2015-07-23 n = 0; mgrs = mgrs_fwd(500000, 63.811, 38, 1, 8); n = n + assertEquals(mgrs{1}, '38NNF0000000000063811', 0); mgrs = mgrs_fwd(500000, 63.811, 38, 1, 9); n = n + assertEquals(mgrs{1}, '38NNF000000000000638110', 0); end function n = mgrs5 % GeoConvert19: Check prec = -6 for UPS (to check fix to Matlab mgrs_fwd, % 2018-03-19) n = 0; mgrs = mgrs_fwd(2746000, 1515000, 0, 0, [-1,0,1]); n = n + assertEquals(length(mgrs{1}), 1, 0); n = n + assertEquals(mgrs{1}, 'B', 0); n = n + assertEquals(length(mgrs{2}), 3, 0); n = n + assertEquals(mgrs{2}, 'BKH', 0); n = n + assertEquals(length(mgrs{3}), 5, 0); n = n + assertEquals(mgrs{3}, 'BKH41', 0); end GeographicLib-1.52/matlab/geographiclib/geoid_height.m0000644000771000077100000001614214064202371022655 0ustar ckarneyckarneyfunction N = geoid_height(lat, lon, geoidname, geoiddir) %GEOID_HEIGHT Compute the height of the geoid above the ellipsoid % % N = GEOID_HEIGHT(lat, lon) % N = GEOID_HEIGHT(lat, lon, geoidname) % N = GEOID_HEIGHT(lat, lon, geoidname, geoiddir) % GEOID_HEIGHT([]) % N = GEOID_HEIGHT(lat, lon, geoid) % % computes the height, N, of the geoid above the WGS84 ellipsoid. lat % and lon are the latitude and longitude in degrees; these can be scalars % or arrays of the same size. N is in meters. % % The height of the geoid above the ellipsoid, N, is sometimes called the % geoid undulation. It can be used to convert a height above the % ellipsoid, h, to the corresponding height above the geoid (the % orthometric height, roughly the height above mean sea level), H, using % the relations % % h = N + H; H = -N + h. % % The possible geoids are % % egm84-30 egm84-15 % egm96-15 egm96-5 % egm2008-5 egm2008-2_5 egm2008-1 % % The first part of the name is the geoid model. The second part gives % the resolution of the gridded data (in arc-seconds). Thus egm2008-2_5 % is the egm2008 geoid model at a resolution of 2.5". % % By default the egm96-5 geoid is used. This can be overridden by % specifying geoidname. The geoiddir argument overrides the default % directory for the model. See the documentation on geoid_load for how % these arguments are interpreted. % % When geoid_height is invoked with a particular geoidname, the geoid % data is loaded from disk and cached. A subsequent invocation of % geoid_height with the same geoidname uses the cached data. Use % GEOID_HEIGHT([]) to clear this cached data. % % Alternatively, you can load a geoid with geoid_load and use the % returned structure as the third argument. This use does not change the % cached data. % % In order to use this routine with Octave, Octave needs to have been % compiled with a version of GraphicsMagick which supports 16-bit images. % Also, the first time you uses this routine, you may receive a warning % message "your version of GraphicsMagick limits images to 16 bits per % pixel"; this can safely be ignored. % % Information on downloading and installing the data for the supported % geoid models is available at % % https://geographiclib.sourceforge.io/html/geoid.html#geoidinst % % GEOID_HEIGHT uses cubic interpolation on gridded data that has been % quantized at a resolution of 3mm. % % See also GEOID_LOAD. % Copyright (c) Charles Karney (2015) . persistent saved_geoid if nargin == 1 && isempty(lat) saved_geoid = []; return end narginchk(2, 4) if nargin == 3 && isstruct(geoidname) N = geoid_height_int(lat, lon, geoidname, true); else if nargin < 3 geoidname = ''; end if nargin < 4 geoiddir = ''; end geoidfile = geoid_file(geoidname, geoiddir); if ~(isstruct(saved_geoid) && strcmp(saved_geoid.file, geoidfile)) saved_geoid = geoid_load_file(geoidfile); end N = geoid_height_int(lat, lon, saved_geoid, true); end end function N = geoid_height_int(lat, lon, geoid, cubic) persistent c0 c3 c0n c3n c0s c3s if isempty(c3s) c0 = 240; c3 = [ 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]; c0n = 372; c3n = [ 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]; c0s = 372; c3s = [ 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]; end try s = size(lat + lon); catch error('lat, lon have incompatible sizes') end num = prod(s); Z = zeros(num,1); lat = lat(:) + Z; lon = lon(:) + Z; h = geoid.h; w = geoid.w; % lat is in [0, h] flat = min(max((90 - lat) * (h - 1) / 180, 0), (h - 1)); % lon is in [0, w) flon = mod(lon * w / 360, w); flon(isnan(flon)) = 0; ilat = min(floor(flat), h - 2); ilon = floor(flon); flat = flat - ilat; flon = flon - ilon; if ~cubic ind = imgind(ilon + [0,0,1,1], ilat + [0,1,0,1], w, h); hf = double(geoid.im(ind)); N = (1 - flon) .* ((1 - flat) .* hf(:,1) + flat .* hf(:,2)) + ... flon .* ((1 - flat) .* hf(:,3) + flat .* hf(:,4)); else ind = imgind(repmat(ilon, 1, 12) + ... repmat([ 0, 1,-1, 0, 1, 2,-1, 0, 1, 2, 0, 1], num, 1), ... repmat(ilat, 1, 12) + ... repmat([-1,-1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2], num, 1), ... w, h); hf = double(geoid.im(ind)); hfx = hf * c3 / c0; hfx(ilat == 0,:) = hf(ilat == 0,:) * c3n / c0n; hfx(ilat == h-2,:) = hf(ilat == h-2,:) * c3s / c0s; N = sum(hfx .* [Z+1, flon, flat, flon.^2, flon.*flat, flat.^2, ... flon.^3, flon.^2.*flat, flon.*flat.^2, flat.^3], ... 2); end N = geoid.offset + geoid.scale * N; N(~(abs(lat) <= 90 & isfinite(lon))) = nan; N = reshape(N, s); end function ind = imgind(ix, iy, w, h) % return 1-based 1d index to w*h array for 0-based 2d indices (ix,iy) c = iy < 0; iy(c) = - iy(c); ix(c) = ix(c) + w/2; c = iy >= h; iy(c) = 2 * (h-1) - iy(c); ix(c) = ix(c) + w/2; ix = mod(ix, w); ind = 1 + iy + ix * h; end GeographicLib-1.52/matlab/geographiclib/geoid_load.m0000644000771000077100000000453414064202371022326 0ustar ckarneyckarneyfunction geoid = geoid_load(name, dir) %GEOID_LOAD Load a geoid model % % geoid = GEOID_LOAD % geoid = GEOID_LOAD(geoidname) % geoid = GEOID_LOAD(geoidname, geoiddir) % % Loads geoid data into the workspace. geoid_height uses this function % to load the geoid data it needs. The possible geoids are % % egm84-30 egm84-15 % egm96-15 egm96-5 % egm2008-5 egm2008-2_5 egm2008-1 % % The first part of the name is the geoid model. The second part gives % the resolution of the gridded data (in arc-seconds). Thus egm2008-2_5 % is the egm2008 geoid model at a resolution of 2.5". % % If geoidname is not specified (or is empty), the environment variable % GEOGRAPHICLIB_GEOID_NAME is used; if this is not defined then egm96-5 % is used. % % GEOID_LOAD determines the directory with the geoid data as follows % (here an empty string is the same as undefined): % % * if geoiddir is specified, then look there; otherwise ... % * if the environment variable GEOGRAPHICLIB_GEOID_PATH is defined, % look there; otherwise ... % * if the environment variable GEOGRAPHICLIB_DATA is defined, look in % [GEOGRAPHICLIB_DATA '/geoids']; otherwise ... % * look in /usr/local/share/GeographicLib/geoids (for non-Windows % systems) or C:/ProgramData/GeographicLib/geoids (for Windows % systems). % % If your geoid models are installed in /usr/share/GeographicLib/geoids, % for example, you can avoid the need to supply the geoiddir argument % with % % setenv GEOGRAPHICLIB_DATA /usr/share/GeographicLib % % The geoid data is loaded from the image file obtained by concatenating % the components to give geoiddir/geoidname.pgm. These files store a % grid of geoid heights above the ellipsoid encoded as 16-bit integers. % % The returned geoid can be passed to geoid_height to determine the % height of the geoid above the ellipsoid. % % Information on downloading and installing the data for the supported % geoid models is available at % % https://geographiclib.sourceforge.io/html/geoid.html#geoidinst % % See also GEOID_HEIGHT. % Copyright (c) Charles Karney (2015-2019) . narginchk(0, 2) if nargin < 1 file = geoid_file; elseif nargin < 2 file = geoid_file(name); else file = geoid_file(name, dir); end geoid = geoid_load_file(file); end GeographicLib-1.52/matlab/geographiclib/gereckon.m0000644000771000077100000001240714064202371022033 0ustar ckarneyckarneyfunction [lat2, lon2, azi2, S12] = gereckon(lat1, lon1, s12, azi1, ellipsoid) %GERECKON Point along great ellipse at given azimuth and range % % [lat2, lon2, azi2] = GERECKON(lat1, lon1, s12, azi1) % [lat2, lon2, azi2, S12] = GERECKON(lat1, lon1, s12, azi1, ellipsoid) % % solves the direct great ellipse problem of finding the final point and % azimuth given lat1, lon1, s12, and azi1. The input arguments lat1, % lon1, s12, azi1, can be scalars or arrays of equal size. lat1, lon1, % azi1 are given in degrees and s12 in meters. The ellipsoid vector is % of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. lat2, % lon2, and azi2 give the position and forward azimuths at the end point % in degrees. The optional output S12 is the area between the great % ellipse and the equator (in meters^2). gedoc gives an example and % provides additional background information. gedoc also gives the % restrictions on the allowed ranges of the arguments. % % When given a combination of scalar and array inputs, GERECKON behaves % as though the inputs were expanded to match the size of the arrays. % However, in the particular case where lat1 and azi1 are the same for % all the input points, they should be specified as scalars since this % will considerably speed up the calculations. (In particular a series % of points along a single geodesic is efficiently computed by specifying % an array for s12 only.) % % geodreckon solves the equivalent geodesic problem and usually this is % preferable to using GERECKON. % % For more information, see % % https://geographiclib.sourceforge.io/html/greatellipse.html % % See also GEDOC, GEDISTANCE, DEFAULTELLIPSOID, FLAT2ECC, GEODDISTANCE, % GEODRECKON. % Copyright (c) Charles Karney (2014-2019) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat1 + lon1 + s12 + azi1); catch error('lat1, lon1, s12, azi1 have incompatible sizes') end if length(ellipsoid) ~= 2 error('ellipsoid must be a vector of size 2') end tiny = sqrt(realmin); Z = zeros(prod(S),1); a = ellipsoid(1); e2 = real(ellipsoid(2)^2); f = e2 / (1 + sqrt(1 - e2)); f1 = 1 - f; areap = nargout >= 4; lat1 = AngRound(LatFix(lat1(:))); lon1 = lon1(:); azi1 = AngRound(azi1(:)); s12 = s12(:); [sgam1, cgam1] = sincosdx(azi1); [sbet1, cbet1] = sincosdx(lat1); sbet1 = f1 * sbet1; cbet1 = max(tiny, cbet1); [sbet1, cbet1] = norm2(sbet1, cbet1); [sgam1, cgam1] = norm2(sgam1 .* sqrt(1 - e2 * cbet1.^2), cgam1); sgam0 = sgam1 .* cbet1; cgam0 = hypot(cgam1, sgam1 .* sbet1); ssig1 = sbet1; slam1 = sgam0 .* sbet1; csig1 = cbet1 .* cgam1; csig1(sbet1 == 0 & cgam1 == 0) = 1; clam1 = csig1; [ssig1, csig1] = norm2(ssig1, csig1); k2 = e2 * cgam0.^2; epsi = k2 ./ (2 * (1 + sqrt(1 - k2)) - k2); A1 = a * (1 + A1m1f(epsi)) .* (1 - epsi)./(1 + epsi); C1a = C1f(epsi); B11 = SinCosSeries(true, ssig1, csig1, C1a); s = sin(B11); c = cos(B11); stau1 = ssig1 .* c + csig1 .* s; ctau1 = csig1 .* c - ssig1 .* s; C1pa = C1pf(epsi); tau12 = s12 ./ A1; s = sin(tau12); c = cos(tau12); B12 = - SinCosSeries(true, stau1 .* c + ctau1 .* s, ... ctau1 .* c - stau1 .* s, C1pa); sig12 = tau12 - (B12 - B11); ssig12 = sin(sig12); csig12 = cos(sig12); if abs(f) > 0.01 ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; B12 = SinCosSeries(true, ssig2, csig2, C1a); serr = A1 .* (sig12 + (B12 - B11)) - s12; sig12 = sig12 - serr ./ (a * sqrt(1 - k2 + k2 .* ssig2.^2)); ssig12 = sin(sig12); csig12 = cos(sig12); end ssig2 = ssig1 .* csig12 + csig1 .* ssig12; csig2 = csig1 .* csig12 - ssig1 .* ssig12; sbet2 = cgam0 .* ssig2; cbet2 = hypot(sgam0, cgam0 .* csig2); cbet2(cbet2 == 0) = tiny; slam2 = sgam0 .* ssig2; clam2 = csig2; sgam2 = sgam0; cgam2 = cgam0 .* csig2; lon12 = atan2dx(slam2 .* clam1 - clam2 .* slam1, ... clam2 .* clam1 + slam2 .* slam1); lon2 = AngNormalize(AngNormalize(lon1) + lon12); lat2 = atan2dx(sbet2, f1 * cbet2); azi2 = atan2dx(sgam2, cgam2 .* sqrt(1 - e2 * cbet2.^2)); lat2 = reshape(lat2 + Z, S); lon2 = reshape(lon2, S); azi2 = reshape(azi2 + Z, S); if areap n = f / (2 - f); G4x = G4coeff(n); G4a = C4f(epsi, G4x); A4 = (a^2 * e2) * cgam0 .* sgam0; B41 = SinCosSeries(false, ssig1, csig1, G4a); B42 = SinCosSeries(false, ssig2, csig2, G4a); sgam12 = cgam0 .* sgam0 .* ... cvmgt(csig1 .* (1 - csig12) + ssig12 .* ssig1, ... ssig12 .* (csig1 .* ssig12 ./ (1 + csig12) + ssig1), ... csig12 <= 0); cgam12 = sgam0.^2 + cgam0.^2 .* csig1 .* csig2; s = cgam0 == 0 | sgam0 == 0; sgam12(s) = sgam2(s) .* cgam1(s) - cgam2(s) .* sgam1(s); cgam12(s) = cgam2(s) .* cgam1(s) + sgam2(s) .* sgam1(s); s = s & sgam12 == 0 & cgam12 < 0; sgam12(s) = tiny * cgam1(s); cgam12(s) = -1; if e2 ~= 0 c2 = a^2 * (1 + (1 - e2) * eatanhe(1, e2) / e2) / 2; else c2 = a^2; end S12 = c2 * atan2(sgam12, cgam12) + A4 .* (B42 - B41); S12 = reshape(S12 + Z, S); end end GeographicLib-1.52/matlab/geographiclib/gnomonic_fwd.m0000644000771000077100000000514714064202371022712 0ustar ckarneyckarneyfunction [x, y, azi, rk] = gnomonic_fwd(lat0, lon0, lat, lon, ellipsoid) %GNOMONIC_FWD Forward ellipsoidal gnomonic projection % % [x, y] = GNOMONIC_FWD(lat0, lon0, lat, lon) % [x, y, azi, rk] = GNOMONIC_FWD(lat0, lon0, lat, lon, ellipsoid) % % performs the forward ellipsoidal gnomonic projection of points % (lat,lon) to (x,y) using (lat0,lon0) as the center of projection. % These input arguments can be scalars or arrays of equal size. The % ellipsoid vector is of the form [a, e], where a is the equatorial % radius in meters, e is the eccentricity. If ellipsoid is omitted, the % WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. projdoc defines the projection and gives % the restrictions on the allowed ranges of the arguments. The inverse % projection is given by gnomonic_inv. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the geodesic from the center of projection and rk is % the reciprocal of the azimuthal scale. The scale in the radial % direction is 1/rk^2. % % 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). % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % The ellipsoidal gnomonic projection is an azimuthal projection about a % center point. All geodesics through the center point are projected % into straight lines with the correct azimuth relative to the center % point. In addition all geodesics are pass close to the center point % are very nearly straight. The projection is derived in Section 8 of % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://doi.org/10.1007/s00190-012-0578-z % Addenda: https://geographiclib.sourceforge.io/geod-addenda.html % % which also includes methods for solving the "intersection" and % "interception" problems using the gnomonic projection. % % See also PROJDOC, GNOMONIC_INV, GEODDISTANCE, DEFAULTELLIPSOID, % FLAT2ECC. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try [~] = lat0 + lon0 + lat + lon; catch error('lat0, lon0, lat, lon have incompatible sizes') end [~, azi0, azi, ~, m, M] = geoddistance(lat0, lon0, lat, lon, ellipsoid); rho = m ./ M; [x, y] = sincosdx(azi0); x = rho .* x; y = rho .* y; rk = M; x(M <= 0) = nan; y(M <= 0) = nan; end GeographicLib-1.52/matlab/geographiclib/gnomonic_inv.m0000644000771000077100000000664314064202371022730 0ustar ckarneyckarneyfunction [lat, lon, azi, rk] = gnomonic_inv(lat0, lon0, x, y, ellipsoid) %GNOMONIC_INV Inverse ellipsoidal gnomonic projection % % [lat, lon] = GNOMONIC_INV(lat0, lon0, x, y) % [lat, lon, azi, rk] = GNOMONIC_INV(lat0, lon0, x, y, ellipsoid) % % performs the inverse ellipsoidal gnomonic projection of points (x,y) to % (lat,lon) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. projdoc % defines the projection and gives the restrictions on the allowed ranges % of the arguments. The forward projection is given by gnomonic_fwd. % % azi and rk give metric properties of the projection at (lat,lon); azi % is the azimuth of the geodesic from the center of projection and rk is % the reciprocal of the azimuthal scale. The scale in the radial % direction is 1/rk^2. % % In principle, all finite x and y are allowed. However, it's possible % that the inverse projection fails for very large x and y (when the % geographic position is close to the "horizon"). In that case, NaNs are % returned for the corresponding output variables. % % lat0, lon0, lat, lon, azi are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). rk is dimensionless. % % The ellipsoidal gnomonic projection is an azimuthal projection about a % center point. All geodesics through the center point are projected % into straight lines with the correct azimuth relative to the center % point. In addition all geodesics are pass close to the center point % are very nearly straight. The projection is derived in Section 8 of % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://doi.org/10.1007/s00190-012-0578-z % Addenda: https://geographiclib.sourceforge.io/geod-addenda.html % % which also includes methods for solving the "intersection" and % "interception" problems using the gnomonic projection. % % See also PROJDOC, GNOMONIC_FWD, GEODRECKON, DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2012-2015) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try Z = zeros(size(lat0 + lon0 + x + y)); catch error('lat0, lon0, x, y have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end a = ellipsoid(1); numit = 10; eps1 = a * 0.01 * sqrt(eps); lat0 = lat0 + Z; lon0 = lon0 + Z; x = x + Z; y = y + Z; azi0 = atan2dx(x, y); rho = hypot(x, y); s = a * atan(rho / a); little = rho <= a; rho(~little) = 1 ./ rho(~little); g = Z == 0; trip = ~g; lat = Z; lon = Z; azi = Z; m = Z; M = Z; ds = Z; for k = 1 : numit [lat(g), lon(g), azi(g), ~, m(g), M(g)] = ... geodreckon(lat0(g), lon0(g), s(g), azi0(g), ellipsoid); g = g & ~trip; if ~any(g), break, end c = little & g; ds(c) = (m(c) ./ M(c) - rho(c)) .* M(c).^2; c = ~little & g; ds(c) = (rho(c) - M(c) ./ m(c)) .* m(c).^2; s(g) = s(g) - ds(g); trip(g) = ~(abs(ds(g)) >= eps1); end c = ~trip; if any(c) lat(c) = nan; lon(c) = nan; azi(c) = nan; M(c) = nan; end rk = M; end GeographicLib-1.52/matlab/geographiclib/loccart_fwd.m0000644000771000077100000000406014064202371022521 0ustar ckarneyckarneyfunction [x, y, z, M] = loccart_fwd(lat0, lon0, h0, lat, lon, h, ellipsoid) %LOCCART_FWD Convert geographic to local cartesian coordinates % % [x, y, z] = LOCCART_FWD(lat0, lon0, h0, lat, lon) % [x, y, z] = LOCCART_FWD(lat0, lon0, h0, lat, lon, h) % [x, y, z, M] = LOCCART_FWD(lat0, lon0, h0, lat, lon, h, ellipsoid) % % converts from geodetic coordinates, lat, lon, h to local cartesian % coordinates, x, y, z, centered at lat0, lon0, h0. Latitudes and % longitudes are in degrees; h (default 0), h0, x, y, z are in meters. % lat, lon, h can be scalars or arrays of equal size. lat0, lon0, h0 % must be scalars. The ellipsoid vector is of the form [a, e], where a % is the equatorial radius in meters, e is the eccentricity. If % ellipsoid is omitted, the WGS84 ellipsoid (more precisely, the value % returned by defaultellipsoid) is used. The inverse operation is given % by loccart_inv. % % M is the 3 x 3 rotation matrix for the conversion. 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). % % See also LOCCART_INV, DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2015) . narginchk(5, 7) if nargin < 6, h = 0; end if nargin < 7, ellipsoid = defaultellipsoid; end try S = size(lat + lon + h); catch error('lat, lon, h have incompatible sizes') end if ~(isscalar(lat0) && isscalar(lon0) && isscalar(h0)) error('lat0, lon0, h0 must be scalar') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end num = prod(S); Z = zeros(num, 1); lat = lat(:) + Z; lon = lon(:) + Z; h = h(:) + Z; [X0, Y0, Z0, M0] = geocent_fwd(lat0, lon0, h0, ellipsoid); [X , Y , Z , M ] = geocent_fwd(lat , lon , h , ellipsoid); r = [X-X0, Y-Y0, Z-Z0] * M0; x = reshape(r(:, 1), S); y = reshape(r(:, 2), S); z = reshape(r(:, 3), S); if nargout > 3 for i = 1:num M(:,:, i) = M0' * M(:,:, i); end M = reshape(M, [3, 3, S]); end end GeographicLib-1.52/matlab/geographiclib/loccart_inv.m0000644000771000077100000000376114064202371022544 0ustar ckarneyckarneyfunction [lat, lon, h, M] = loccart_inv(lat0, lon0, h0, x, y, z, ellipsoid) %LOCCART_INV Convert local cartesian to geographic coordinates % % [lat, lon, h] = LOCCART_INV(lat0, lon0, h0, x, y, z) % [lat, lon, h, M] = LOCCART_INV(lat0, lon0, h0, x, y, z, ellipsoid) % % converts from local cartesian coordinates, x, y, z, centered at lat0, % lon0, h0 to geodetic coordinates, lat, lon, h. Latitudes and % longitudes are in degrees; h, h0, x, y, z are in meters. x, y, z can % be scalars or arrays of equal size. lat0, lon0, h0 must be scalars. % The ellipsoid vector is of the form [a, e], where a is the equatorial % radius in meters, e is the eccentricity. If ellipsoid is omitted, the % WGS84 ellipsoid (more precisely, the value returned by % defaultellipsoid) is used. The forward operation is given by % loccart_fwd. % % M is the 3 x 3 rotation matrix for the conversion. 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). % % See also LOCCART_FWD, DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2015) . narginchk(6, 7) if nargin < 7, ellipsoid = defaultellipsoid; end try S = size(x + y + z); catch error('x, y, z have incompatible sizes') end if ~(isscalar(lat0) && isscalar(lon0) && isscalar(h0)) error('lat0, lon0, h0 must be scalar') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end num = prod(S); Z = zeros(num, 1); x = x(:) + Z; y = y(:) + Z; z = z(:) + Z; [X0, Y0, Z0, M0] = geocent_fwd(lat0, lon0, h0, ellipsoid); r = [x, y, z] * M0'; X = r(:, 1) + X0; Y = r(:, 2) + Y0; Z = r(:, 3) + Z0; [lat , lon , h , M] = geocent_inv(X, Y, Z, ellipsoid); lat = reshape(lat, S); lon = reshape(lon, S); h = reshape(h, S); if nargout > 3 for i = 1:num M(:,:, i) = M0' * M(:,:, i); end M = reshape(M, [3, 3, S]); end end GeographicLib-1.52/matlab/geographiclib/mgrs_fwd.m0000644000771000077100000001430114064202371022041 0ustar ckarneyckarneyfunction mgrs = mgrs_fwd(x, y, zone, isnorth, prec) %MGRS_FWD Convert UTM/UPS coordinates to MGRS % % mgrs = MGRS_FWD(x, y, zone, isnorth) % mgrs = MGRS_FWD(x, y, zone, isnorth, prec) % % converts from the UTM/UPS system to MGRS. (x,y) are the easting and % northing (in meters); zone is the UTM zone, in [1,60], or 0 for UPS; % isnorth is 1 (0) for the northern (southern) hemisphere. prec in % [-1,11] gives the precision of the grid reference; the default is 5 % giving 1 m precision. For example, prec = 2 corresponding to 1 km % precision, returns a string such as 38SMB4488. A value of -1 means % that only the grid zone, e.g., 38S, is returned. The maximum allowed % value of prec is 11 (denoting 1 um precision). prec < -1 is treated a % NaN, while prec > 11 is treated the same as prec = 11. The MGRS % references are returned in a cell array of strings. x, y, zone, % isnorth, prec can be scalars or arrays of the same size. Values that % can't be converted to MGRS return the "invalid" string, INV. The % inverse operation is performed by mgrs_inv. % % The allowed values of (x,y) are % UTM: x in [100 km, 900 km] % y in [0 km, 9500 km] for northern hemisphere % y in [1000 km, 10000 km] for southern hemisphere % UPS: x and y in [1300 km, 2700 km] for northern hemisphere % x and y in [800 km, 3200 km] for southern hemisphere % % The ranges are 100 km more restrictive than for utmups_fwd and % utmups_inv. % % See also MGRS_INV, UTMUPS_FWD. % Copyright (c) Charles Karney (2015-2018) . narginchk(4, 5) if nargin < 5, prec = 5; end zone = floor(zone); prec = min(11, max(-2, floor(prec))); % this converts NaNs to -2. try s = size(x + y + zone + isnorth + prec); catch error('x, y, zone, isnorth, prec have incompatible sizes') end num = prod(s); if num == 0, mgrs = cell(0); return, end Z = zeros(num, 1); x = x(:) + Z; y = y(:) + Z; zone = zone(:) + Z; isnorth = isnorth(:) + Z; prec = prec(:) + Z; mgrs = repmat('INV', num, 1); if ~any(prec >= -1), mgrs = reshape(cellstr(mgrs), s); return, end maxprec = max(prec); mgrs = [mgrs, repmat(' ', num, 2 + 2*maxprec)]; minprec = min(prec(prec >= -1)); for p = minprec:maxprec in = prec == p; if ~any(in) continue end t = mgrs_fwd_p(x(in), y(in), zone(in), isnorth(in), p); mgrs(in,1:(5 + 2*p)) = t; end mgrs = reshape(cellstr(mgrs), s); end function mgrs = mgrs_fwd_p(x, y, zone, northp, prec) num = size(x, 1); delta = 10e-9; mgrs = repmat('INV', num, 1); mgrs = [mgrs, repmat(' ', num, 2 + 2*prec)]; utm = zone >= 1 & zone <= 60; y(utm & ~northp) = y(utm & ~northp) - 100e5; northp(utm) = 1; utm = utm & x >= 1e5 & x <= 9e5 & y >= -90e5 & y <= 95e5; x(utm & x == 9e5) = 9e5 - delta; y(utm & y == 95e5) = 95e5 - delta; upsn = zone == 0 & northp; upss = zone == 0 & ~northp; upsn = upsn & x >= 13e5 & x <= 27e5 & y >= 13e5 & y <= 27e5; x(upsn & x == 27e5) = 27e5 - delta; y(upsn & y == 27e5) = 27e5 - delta; upss = upss & x >= 8e5 & x <= 32e5 & y >= 8e5 & y <= 32e5; x(upss & x == 32e5) = 32e5 - delta; y(upss & y == 32e5) = 32e5 - delta; t = mgrs_fwd_utm(x(utm), y(utm), zone(utm), prec); mgrs(utm,:) = t; t = mgrs_fwd_upsn(x(upsn), y(upsn), prec); mgrs(upsn,1:end-2) = t; t = mgrs_fwd_upss(x(upss), y(upss), prec); mgrs(upss,1:end-2) = t; if prec == -1 % For UPS overwrite the 'NV' mgrs(upsn | upss, 2:3) = ' '; end end function mgrs = mgrs_fwd_utm(x, y, zone, prec) persistent latband utmcols utmrow if isempty(utmrow) latband = 'CDEFGHJKLMNPQRSTUVWX'; utmcols = ['ABCDEFGH', 'JKLMNPQR', 'STUVWXYZ']; utmrow = 'ABCDEFGHJKLMNPQRSTUV'; end mgrs = char(zeros(length(x), 5 + 2 * prec) + ' '); if isempty(x), return, end mgrs(:,1) = '0' + floor(zone / 10); mgrs(:,2) = '0' + mod(zone, 10); ys = y / 1e5; latp = 0.901 * ys + ((ys > 0) * 2 - 1) * 0.135; late = 0.902 * ys .* (1 - 1.85e-6 * ys .* ys); latp(abs(ys) < 1) = 0.9 * ys(abs(ys) < 1); late(abs(ys) < 1) = latp(abs(ys) < 1); band = LatitudeBand(latp); bande = LatitudeBand(late); c = band ~= bande; band(c) = LatitudeBand(utmups_inv(x(c), y(c), zone(c), 1)); mgrs(:,3) = latband(band + 11); if prec < 0, return, end x = floor(x * 1e6); y = floor(y * 1e6); xh = floor(x / 1e11); yh = floor(y / 1e11); mgrs(:,4) = utmcols(mod(zone - 1, 3) * 8 + xh); mgrs(:,5) = utmrow(mod(yh + mod(zone - 1, 2) * 5, 20) + 1); if prec == 0, return, end xy = formatnum(x, xh, y, yh, prec); mgrs(:,5+(1:2*prec)) = xy; end function mgrs = mgrs_fwd_upsn(x, y, prec) persistent upsband upscols upsrow if isempty(upsrow) upsband = 'YZ'; upscols = ['RSTUXYZ', 'ABCFGHJ']; upsrow = 'ABCDEFGHJKLMNP'; end mgrs = char(zeros(length(x), 3 + 2 * prec) + ' '); if isempty(x), return, end x = floor(x * 1e6); y = floor(y * 1e6); xh = floor(x / 1e11); yh = floor(y / 1e11); eastp = xh >= 20; mgrs(:,1) = upsband(eastp + 1); if prec < 0, return, end mgrs(:,2) = upscols(eastp * 7 + xh - cvmgt(20, 13, eastp) + 1); mgrs(:,3) = upsrow(yh - 13 + 1); if prec == 0, return, end xy = formatnum(x, xh, y, yh, prec); mgrs(:,3+(1:2*prec)) = xy; end function mgrs = mgrs_fwd_upss(x, y, prec) persistent upsband upscols upsrow if isempty(upsrow) upsband = 'AB'; upscols = ['JKLPQRSTUXYZ', 'ABCFGHJKLPQR']; upsrow = 'ABCDEFGHJKLMNPQRSTUVWXYZ'; end mgrs = char(zeros(length(x), 3 + 2 * prec) + ' '); if isempty(x), return, end x = floor(x * 1e6); y = floor(y * 1e6); xh = floor(x / 1e11); yh = floor(y / 1e11); eastp = xh >= 20; mgrs(:,1) = upsband(eastp + 1); if prec < 0, return, end mgrs(:,2) = upscols(eastp * 12 + xh - cvmgt(20, 8, eastp) + 1); mgrs(:,3) = upsrow(yh - 8 + 1); if prec == 0, return, end xy = formatnum(x, xh, y, yh, prec); mgrs(:,3+(1:2*prec)) = xy; end function xy = formatnum(x, xh, y, yh, prec) x = x - xh * 1e11; y = y - yh * 1e11; d = 10 ^ (11 - prec); x = floor(x / d); y = floor(y / d); xy = [num2str(x, ['%0', int2str(prec), '.0f']), ... num2str(y, ['%0', int2str(prec), '.0f'])]; end function band = LatitudeBand(lat) band = max(-10, min(9, floor(lat / 8))); band(~(abs(lat) <= 90)) = nan; end GeographicLib-1.52/matlab/geographiclib/mgrs_inv.m0000644000771000077100000002151614064202371022063 0ustar ckarneyckarneyfunction [x, y, zone, isnorth, prec] = mgrs_inv(mgrs, center) %MGRS_INV Convert MGRS to UTM/UPS coordinates % % [x, y, zone, isnorth] = MGRS_INV(mgrs) % [x, y, zone, isnorth, prec] = MGRS_INV(mgrs, center) % % converts MGRS grid references to the UTM/UPS system. mgrs is either a % 2d character array of MGRS grid references or a cell array of character % strings; leading and trailing white space is ignored. (x,y) are the % easting and northing (in meters); zone is the UTM zone in [1,60] or 0 % for UPS; isnorth is 1 (0) for the northern (southern) hemisphere. prec % is the precision of the grid reference, i.e., 1/2 the number of % trailing digits; for example 38SMB4488 has prec = 2 (denoting a 1 km % square). If center = 1 (the default), then for prec >= 0, the position % of the center of the grid square is returned; to obtain the SW corner % subtract 0.5 * 10^(5-prec) from the easting and northing. If center = % 0, then the SW corner is returned. center must be a scalar. prec = -1 % means that the grid reference consists of a grid zone, e.g., 38S, only; % in this case some representative position in the grid zone is returned. % Illegal MGRS references result in x = y = NaN, zone = -4, isnorth = 0, % prec = -2. The forward operation is performed by mgrs_fwd. % % See also MGRS_FWD, UTMUPS_INV. % Copyright (c) Charles Karney (2015) . narginchk(1, 2) if nargin < 2 center = true; else center = logical(center); end if ischar(mgrs) mgrs = cellstr(mgrs); end if iscell(mgrs) s = size(mgrs); mgrs = char(strtrim(mgrs)); else error('mgrs must be cell array of strings or 2d char array') end if ~isscalar(center) error('center must if a scalar logical') end mgrs = upper(mgrs); num = size(mgrs, 1); x = nan(num, 1); y = x; prec = -2 * ones(num, 1); isnorth = false(num, 1); zone = 2 * prec; if num == 0, return, end % pad with 5 spaces so we can access letter positions without checks mgrs = [mgrs, repmat(' ', num, 5)]; d = isstrprop(mgrs(:,1), 'digit') & ~isstrprop(mgrs(:,2), 'digit'); mgrs(d,2:end) = mgrs(d,1:end-1); mgrs(d,1) = '0'; % check that spaces only at end contig = sum(abs(diff(isspace(mgrs), 1, 2)), 2) <= 1; utm = isstrprop(mgrs(:,1), 'digit') & contig; upss = (mgrs(:,1) == 'A' | mgrs(:,1) == 'B') & contig; upsn = (mgrs(:,1) == 'Y' | mgrs(:,1) == 'Z') & contig; [x(utm), y(utm), zone(utm), isnorth(utm), prec(utm)] = ... mgrs_inv_utm(mgrs(utm,:), center); [x(upsn), y(upsn), zone(upsn), isnorth(upsn), prec(upsn)] = ... mgrs_inv_upsn(mgrs(upsn,:), center); [x(upss), y(upss), zone(upss), isnorth(upss), prec(upss)] = ... mgrs_inv_upss(mgrs(upss,:), center); x = reshape(x, s); y = reshape(y, s); prec = reshape(prec, s); isnorth = reshape(isnorth, s); zone = reshape(zone, s); end function [x, y, zone, northp, prec] = mgrs_inv_utm(mgrs, center) persistent latband utmcols utmrow if isempty(utmrow) latband = 'CDEFGHJKLMNPQRSTUVWX'; utmcols = ['ABCDEFGH', 'JKLMNPQR', 'STUVWXYZ']; utmrow = 'ABCDEFGHJKLMNPQRSTUV'; end zone = (mgrs(:,1) - '0') * 10 + (mgrs(:,2) - '0'); ok = zone > 0 & zone <= 60; band = lookup(latband, mgrs(:,3)); ok = ok & band >= 0; band = band - 10; northp = band >= 0; colind = lookup(utmcols, mgrs(:, 4)) - ... mod(zone - 1, 3) * 8; % good values in [0,8), bad values = -1 colind(colind >= 8) = -1; rowind = lookup(utmrow, mgrs(:, 5)); even = mod(zone, 2) == 0; bad = rowind < 0; rowind(even) = mod(rowind(even) - 5, 20); % good values in [0,20), bad values = -1 rowind(bad) = -1; rowfix = fixutmrow(band, colind, rowind); [x, y, prec] = decodexy(mgrs(:, 6:end), ... colind + 1, rowfix + (1-northp) * 100, center); prec(mgrs(:,4) == ' ') = -1; zoneonly = prec == -1; ok = ok & (zoneonly | (colind >= 0 & rowind >= 0 & rowfix < 100)); x(zoneonly) = (5 - (zone(zoneonly) == 31 & band(zoneonly) == 7)) * 1e5; y(zoneonly) = floor(8 * (band(zoneonly) + 0.5) * 100/90 + 0.5) * 1e5 + ... (1- northp(zoneonly)) * 100e5; x(~ok) = nan; y(~ok) = nan; northp(~ok) = false; zone(~ok) = -4; prec(~ok) = -2; end function [x, y, zone, northp, prec] = mgrs_inv_upsn(mgrs, center) persistent upsband upscols upsrow if isempty(upsrow) upsband = 'YZ'; upscols = ['RSTUXYZ', 'ABCFGHJ']; upsrow = 'ABCDEFGHJKLMNP'; end zone = zeros(size(mgrs,1),1); ok = zone == 0; northp = ok; eastp = lookup(upsband, mgrs(:,1)); ok = ok & eastp >= 0; colind = lookup(upscols, mgrs(:, 2)); ok = ok & (colind < 0 | mod(floor(colind / 7) + eastp, 2) == 0); rowind = lookup(upsrow, mgrs(:, 3)); rowind = rowind + 13; colind = colind + 13; [x, y, prec] = decodexy(mgrs(:, 4:end), colind, rowind, center); prec(mgrs(:,2) == ' ') = -1; zoneonly = prec == -1; ok = ok & (zoneonly | (colind >= 0 & rowind >= 0)); x(zoneonly) = ((2*eastp(zoneonly) - 1) * floor(4 * 100/90 + 0.5) + 20) * 1e5; y(zoneonly) = 20e5; x(~ok) = nan; y(~ok) = nan; northp(~ok) = false; zone(~ok) = -4; prec(~ok) = -2; end function [x, y, zone, northp, prec] = mgrs_inv_upss(mgrs, center) persistent upsband upscolA upscolB upsrow if isempty(upsrow) upsband = 'AB'; upscolA = 'JKLPQRSTUXYZ'; upscolB = 'ABCFGHJKLPQR'; upsrow = 'ABCDEFGHJKLMNPQRSTUVWXYZ'; end zone = zeros(size(mgrs,1),1); ok = zone == 0; northp = ~ok; eastp = lookup(upsband, mgrs(:,1)); ok = ok & eastp >= 0; eastp = eastp > 0; colind = lookup(upscolA, mgrs(:, 2)); colind(eastp) = lookup(upscolB, mgrs(eastp, 2)) + 12; colind(eastp & colind < 12) = -1; ok = ok & (colind < 0 | mod(floor(colind / 12) + eastp, 2) == 0); rowind = lookup(upsrow, mgrs(:, 3)); rowind = rowind + 8; colind = colind + 8; [x, y, prec] = decodexy(mgrs(:, 4:end), colind, rowind, center); prec(mgrs(:,2) == ' ') = -1; zoneonly = prec == -1; ok = ok & (zoneonly | (colind >= 0 & rowind >= 0)); x(zoneonly) = ((2*eastp(zoneonly) - 1) * floor(4 * 100/90 + 0.5) + 20) * 1e5; y(zoneonly) = 20e5; x(~ok) = nan; y(~ok) = nan; zone(~ok) = -4; prec(~ok) = -2; end function [x, y, prec] = decodexy(xy, xh, yh, center) num = size(xy, 1); x = nan(num, 1); y = x; len = strlen(xy); prec = len / 2; digits = sum(isspace(xy) | isstrprop(xy, 'digit'), 2) == size(xy, 2); ok = len <= 22 & mod(len, 2) == 0 & digits; prec(~ok) = -2; if ~any(ok), return, end cent = center * 0.5; in = prec == 0; if any(in) x(in) = (xh(in) + cent) * 1e5; y(in) = (yh(in) + cent) * 1e5; end minprec = max(1,min(prec(ok))); maxprec = max(prec(ok)); for p = minprec:maxprec in = prec == p; if ~any(in) continue end m = 10^p; x(in) = xh(in) * m + str2double(cellstr(xy(in, 0+(1:p)))) + cent; y(in) = yh(in) * m + str2double(cellstr(xy(in, p+(1:p)))) + cent; if p < 5 m = 1e5 / m; x(in) = x(in) * m; y(in) = y(in) * m; elseif p > 5 m = m / 1e5; x(in) = x(in) / m; y(in) = y(in) / m; end end end function irow = fixutmrow(iband, icol, irow) % 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 100 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 c = 100 * (8 * iband + 4)/90; northp = iband >= 0; minrow = cvmgt(floor(c - 4.3 - 0.1 * northp), -90, iband > -10); maxrow = cvmgt(floor(c + 4.4 - 0.1 * northp), 94, iband < 9); baserow = floor((minrow + maxrow) / 2) - 10; irow = mod(irow - baserow, 20) + baserow; fix = ~(irow >= minrow & irow <= maxrow); if ~any(fix), return, end % Northing = 71*100km and 80*100km intersect band boundaries % The following deals with these special cases. % Fold [-10,-1] -> [9,0] sband = cvmgt(iband, -iband - 1, iband >= 0); % Fold [-90,-1] -> [89,0] srow = cvmgt(irow, -irow - 1, irow >= 0); % Fold [4,7] -> [3,0] scol = cvmgt(icol, -icol + 7, icol < 4); irow(fix & ~( (srow == 70 & sband == 8 & scol >= 2) | ... (srow == 71 & sband == 7 & scol <= 2) | ... (srow == 79 & sband == 9 & scol >= 1) | ... (srow == 80 & sband == 8 & scol <= 1) ) ) = 100; end function len = strlen(strings) num = size(strings, 1); len = repmat(size(strings, 2), num, 1); strings = strings(:); r = cumsum(ones(num,1)); d = 1; while any(d) d = len > 0 & strings(num * (max(len, 1) - 1) + r) == ' '; len(d) = len(d) - 1; end end function ind = lookup(str, test) % str is uppercase row string to look up in. test is col array to % lookup. Result is zero-based index or -1 if not found. q = str - 'A' + 1; t = zeros(27,1); t(q) = cumsum(ones(length(q),1)); test = test - 'A' + 1; test(~(test >= 1 & test <= 26)) = 27; ind = t(test) - 1; end GeographicLib-1.52/matlab/geographiclib/polarst_fwd.m0000644000771000077100000000445014064202371022561 0ustar ckarneyckarneyfunction [x, y, gam, k] = polarst_fwd(isnorth, lat, lon, ellipsoid) %POLARST_FWD Forward polar stereographic projection % % [x, y] = POLARST_FWD(isnorth, lat, lon) % [x, y, gam, k] = POLARST_FWD(isnorth, lat, lon, ellipsoid) % % performs the forward polar stereographic projection of points (lat,lon) % to (x,y) using the north (south) as the center of projection depending % on whether isnorth is 1 (0). These input arguments can be scalars or % arrays of equal size. The ellipsoid vector is of the form [a, e], % where a is the equatorial radius in meters, e is the eccentricity. If % ellipsoid is omitted, the WGS84 ellipsoid (more precisely, the value % returned by defaultellipsoid) is used. projdoc defines the projection % and gives the restrictions on the allowed ranges of the arguments. The % inverse projection is given by polarst_inv. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat, lon, gam are in degrees. The projected coordinates x, y are in % meters (more precisely the units used for the equatorial radius). k is % dimensionless. % % See also PROJDOC, POLARST_INV, UTMUPS_FWD, UTMUPS_INV, % DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2015-2020) . narginchk(3, 4) if nargin < 4, ellipsoid = defaultellipsoid; end try Z = zeros(size(isnorth + lat + lon)); catch error('isnorth, lat, lon have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end overflow = 1/eps^2; a = ellipsoid(1); e2 = real(ellipsoid(2)^2); e2m = 1 - e2; c = sqrt(e2m) * exp(eatanhe(1, e2)); isnorth = 2 * logical(isnorth) - 1; lat = LatFix(lat) .* isnorth; tau = tand(lat); tau(abs(lat) == 90) = sign(lat(abs(lat) == 90)) * overflow; taup = taupf(tau, e2); rho = hypot(1, taup) + abs(taup); rho(taup >= 0) = cvmgt(1./rho(taup >= 0), 0, lat(taup >= 0) ~= 90); rho = rho * (2 * a / c); [x, y] = sincosdx(lon); x = rho .* x; y = -isnorth .* rho .* y; if nargout > 2 gam = AngNormalize(isnorth .* lon) + Z; if nargout > 3 secphi = hypot(1, tau); k = (rho / a) .* secphi .* sqrt(e2m + e2 .* secphi.^-2) + Z; k(lat == 90) = 1; end end end GeographicLib-1.52/matlab/geographiclib/polarst_inv.m0000644000771000077100000000417014064202371022574 0ustar ckarneyckarneyfunction [lat, lon, gam, k] = polarst_inv(isnorth, x, y, ellipsoid) %POLARST_INV Inverse polar stereographic projection % % [lat, lon] = POLARST_INV(isnorth, x, y) % [lat, lon, gam, k] = POLARST_INV(isnorth, x, y, ellipsoid) % % performs the inverse polar stereographic projection of points (x,y) to % (lat,lon) using the north (south) as the center of projection depending % on whether isnorth is 1 (0). These input arguments can be scalars or % arrays of equal size. The ellipsoid vector is of the form [a, e], % where a is the equatorial radius in meters, e is the eccentricity. If % ellipsoid is omitted, the WGS84 ellipsoid (more precisely, the value % returned by defaultellipsoid) is used. projdoc defines the projection % and gives the restrictions on the allowed ranges of the arguments. The % forward projection is given by polarst_fwd. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat, lon, gam are in degrees. The projected coordinates x, y are in % meters (more precisely the units used for the equatorial radius). k is % dimensionless. % % See also PROJDOC, POLARST_FWD, UTMUPS_FWD, UTMUPS_INV, % DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2015-2020) . narginchk(3, 4) if nargin < 4, ellipsoid = defaultellipsoid; end try Z = zeros(size(isnorth + x + y)); catch error('isnorth, x, y have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end a = ellipsoid(1); e2 = real(ellipsoid(2)^2); e2m = 1 - e2; c = sqrt(e2m) * exp(eatanhe(1, e2)); isnorth = 2 * logical(isnorth) - 1; rho = hypot(x, y); t = rho / (2 * a / c); taup = (1 ./ t - t) / 2; tau = tauf(taup, e2); lat = atand(tau); lat(rho == 0) = 90; lat = isnorth .* lat; lon = atan2dx(x, -isnorth .* y); if nargout > 2 gam = AngNormalize(isnorth .* lon); if nargout > 3 secphi = hypot(1, tau); k = (rho / a) .* secphi .* sqrt(e2m + e2 .* secphi.^-2) + Z; k(rho == 0) = 1; end end end GeographicLib-1.52/matlab/geographiclib/private/A1m1f.m0000644000771000077100000000056114064202371022553 0ustar ckarneyckarneyfunction A1m1 = A1m1f(epsi) %A1M1F Evaluate A_1 - 1 % % A1m1 = A1M1F(epsi) evaluates A_1 - 1 using Eq. (17). epsi and A1m1 are % K x 1 arrays. persistent coeff if isempty(coeff) coeff = [ ... 1, 4, 64, 0, 256, ... ]; end eps2 = epsi.^2; t = polyval(coeff(1 : end - 1), eps2) / coeff(end); A1m1 = (t + epsi) ./ (1 - epsi); end GeographicLib-1.52/matlab/geographiclib/private/A2m1f.m0000644000771000077100000000056714064202371022562 0ustar ckarneyckarneyfunction A2m1 = A2m1f(epsi) %A2M1F Evaluate A_2 - 1 % % A2m1 = A2M1F(epsi) evaluates A_2 - 1 using Eq. (42). epsi and A2m1 are % K x 1 arrays. persistent coeff if isempty(coeff) coeff = [ ... -11, -28, -192, 0, 256, ... ]; end eps2 = epsi.^2; t = polyval(coeff(1 : end - 1), eps2) / coeff(end); A2m1 = (t - epsi) ./ (1 + epsi); end GeographicLib-1.52/matlab/geographiclib/private/A3coeff.m0000644000771000077100000000115614064202371023155 0ustar ckarneyckarneyfunction A3x = A3coeff(n) %A3COEFF Evaluate coefficients for A_3 % % A3x = A3COEFF(n) evaluates the coefficients of epsilon^l in Eq. (24). % n is a scalar. A3x is a 1 x 6 array. persistent coeff nA3 if isempty(coeff) nA3 = 6; coeff = [ ... -3, 128, ... -2, -3, 64, ... -1, -3, -1, 16, ... 3, -1, -2, 8, ... 1, -1, 2, ... 1, 1, ... ]; end A3x = zeros(1, nA3); o = 1; k = 1; for j = nA3 - 1 : -1 : 0 m = min(nA3 - j - 1, j); A3x(k) = polyval(coeff(o : o + m), n) / coeff(o + m + 1); k = k + 1; o = o + m + 2; end end GeographicLib-1.52/matlab/geographiclib/private/A3f.m0000644000771000077100000000034114064202371022313 0ustar ckarneyckarneyfunction A3 = A3f(epsi, A3x) %A3F Evaluate A_3 % % A3 = A3F(epsi, A3x) evaluates A_3 using Eq. (24) and the coefficient % vector A3x. epsi and A3 are K x 1 arrays. A3x is a 1 x 6 array. A3 = polyval(A3x, epsi); end GeographicLib-1.52/matlab/geographiclib/private/AngDiff.m0000644000771000077100000000055214064202371023204 0ustar ckarneyckarneyfunction [d, e] = AngDiff(x, y) %ANGDIFF Compute angle difference accurately % % [d, e] = ANGDIFF(x, y) computes z = y - x, reduced to (-180,180]. d = % round(z) and e = z - round(z). x and y can be any compatible shapes. [d, t] = sumx(AngNormalize(-x), AngNormalize(y)); d = AngNormalize(d); d(d == 180 & t > 0) = -180; [d, e] = sumx(d, t); end GeographicLib-1.52/matlab/geographiclib/private/AngNormalize.m0000644000771000077100000000033114064202371024267 0ustar ckarneyckarneyfunction x = AngNormalize(x) %ANGNORMALIZE Reduce angle to range (-180, 180] % % x = ANGNORMALIZE(x) reduces angles to the range (-180, 180]. x can be % any shape. x = remx(x, 360); x(x == -180) = 180; end GeographicLib-1.52/matlab/geographiclib/private/AngRound.m0000644000771000077100000000045514064202371023425 0ustar ckarneyckarneyfunction y = AngRound(x) %ANGROUND Round tiny values so that tiny values become zero. % % y = ANGROUND(x) rounds x by adding and subtracting 1/16 to it if it is % small. x can be any shape. z = 1/16; y = abs(x); y(y < z) = z - (z - y(y < z)); y(x < 0) = -y(x < 0); y(x == 0) = 0; end GeographicLib-1.52/matlab/geographiclib/private/C1f.m0000644000771000077100000000120314064202371022311 0ustar ckarneyckarneyfunction C1 = C1f(epsi) %C1F Evaluate C_{1,k} % % C1 = C1F(epsi) evaluates C_{1,l} using Eq. (18). epsi is a K x 1 % array and C1 is a K x 6 array. persistent coeff nC1 if isempty(coeff) nC1 = 6; coeff = [ ... -1, 6, -16, 32, ... -9, 64, -128, 2048, ... 9, -16, 768, ... 3, -5, 512, ... -7, 1280, ... -7, 2048, ... ]; end C1 = zeros(length(epsi), nC1); eps2 = epsi.^2; d = epsi; o = 1; for l = 1 : nC1 m = floor((nC1 - l) / 2); C1(:,l) = d .* polyval(coeff(o : o + m), eps2) / coeff(o + m + 1); o = o + m + 2; d = d .* epsi; end end GeographicLib-1.52/matlab/geographiclib/private/C1pf.m0000644000771000077100000000125514064202371022500 0ustar ckarneyckarneyfunction C1p = C1pf(epsi) %C1PF Evaluate C'_{1,k} % % C1p = C1PF(epsi) evaluates C'_{1,l} using Eq. (21). epsi is a K x 1 % array and C1 is a K x 6 array. persistent coeff nC1p if isempty(coeff) nC1p = 6; coeff = [ ... 205, -432, 768, 1536, ... 4005, -4736, 3840, 12288, ... -225, 116, 384, ... -7173, 2695, 7680, ... 3467, 7680, ... 38081, 61440, ... ]; end C1p = zeros(length(epsi), nC1p); eps2 = epsi.^2; d = epsi; o = 1; for l = 1 : nC1p m = floor((nC1p - l) / 2); C1p(:,l) = d .* polyval(coeff(o : o + m), eps2) / coeff(o + m + 1); o = o + m + 2; d = d .* epsi; end end GeographicLib-1.52/matlab/geographiclib/private/C2f.m0000644000771000077100000000120014064202371022307 0ustar ckarneyckarneyfunction C2 = C2f(epsi) %C2F Evaluate C_{2,k} % % C2 = C2F(epsi) evaluates C_{2,l} using Eq. (43). epsi is a K x 1 array % and C2 is a K x 6 array. persistent coeff nC2 if isempty(coeff) nC2 = 6; coeff = [ ... 1, 2, 16, 32, ... 35, 64, 384, 2048, ... 15, 80, 768, ... 7, 35, 512, ... 63, 1280, ... 77, 2048, ... ]; end C2 = zeros(length(epsi), nC2); eps2 = epsi.^2; d = epsi; o = 1; for l = 1 : nC2 m = floor((nC2 - l) / 2); C2(:, l) = d .* polyval(coeff(o : o + m), eps2) / coeff(o + m + 1); o = o + m + 2; d = d .* epsi; end end GeographicLib-1.52/matlab/geographiclib/private/C3coeff.m0000644000771000077100000000162314064202371023156 0ustar ckarneyckarneyfunction C3x = C3coeff(n) %C3COEFF Evaluate coefficients for C_3 % % C3x = C3COEFF(n) evaluates the coefficients of epsilon^l in Eq. (25). % n is a scalar. C3x is a 1 x 15 array. persistent coeff nC3 nC3x if isempty(coeff) nC3 = 6; nC3x = (nC3 * (nC3 - 1)) / 2; coeff = [ ... 3, 128, ... 2, 5, 128, ... -1, 3, 3, 64, ... -1, 0, 1, 8, ... -1, 1, 4, ... 5, 256, ... 1, 3, 128, ... -3, -2, 3, 64, ... 1, -3, 2, 32, ... 7, 512, ... -10, 9, 384, ... 5, -9, 5, 192, ... 7, 512, ... -14, 7, 512, ... 21, 2560, ... ]; end C3x = zeros(1, nC3x); o = 1; k = 1; for l = 1 : nC3 - 1 for j = nC3 - 1 : -1 : l m = min(nC3 - j - 1, j); C3x(k) = polyval(coeff(o : o + m), n) / coeff(o + m + 1); k = k + 1; o = o + m + 2; end end end GeographicLib-1.52/matlab/geographiclib/private/C3f.m0000644000771000077100000000066514064202371022326 0ustar ckarneyckarneyfunction C3 = C3f(epsi, C3x) %C3F Evaluate C_3 % % C3 = C3F(epsi, C3x) evaluates C_{3,l} using Eq. (25) and the % coefficient vector C3x. epsi is a K x 1 array. C3x is a 1 x 15 array. % C3 is a K x 5 array. nC3 = 6; C3 = zeros(length(epsi), nC3 - 1); mult = 1; o = 1; for l = 1 : nC3 - 1 m = nC3 - l - 1; mult = mult .* epsi; C3(:, l) = mult .* polyval(C3x(o : o + m), epsi); o = o + m + 1; end end GeographicLib-1.52/matlab/geographiclib/private/C4coeff.m0000644000771000077100000000252614064202371023162 0ustar ckarneyckarneyfunction C4x = C4coeff(n) %C4COEFF Evaluate coefficients for C_4 % % C4x = C4COEFF(n) evaluates the coefficients of epsilon^l in expansion % of the area (Eq. (65) expressed in terms of n and epsi). n is a % scalar. C4x is a 1 x 21 array. persistent coeff nC4 nC4x if isempty(coeff) nC4 = 6; nC4x = (nC4 * (nC4 + 1)) / 2; coeff = [ ... 97, 15015, ... 1088, 156, 45045, ... -224, -4784, 1573, 45045, ... -10656, 14144, -4576, -858, 45045, ... 64, 624, -4576, 6864, -3003, 15015, ... 100, 208, 572, 3432, -12012, 30030, 45045, ... 1, 9009, ... -2944, 468, 135135, ... 5792, 1040, -1287, 135135, ... 5952, -11648, 9152, -2574, 135135, ... -64, -624, 4576, -6864, 3003, 135135, ... 8, 10725, ... 1856, -936, 225225, ... -8448, 4992, -1144, 225225, ... -1440, 4160, -4576, 1716, 225225, ... -136, 63063, ... 1024, -208, 105105, ... 3584, -3328, 1144, 315315, ... -128, 135135, ... -2560, 832, 405405, ... 128, 99099, ... ]; end C4x = zeros(1, nC4x); o = 1; k = 1; for l = 0 : nC4 - 1 for j = nC4 - 1 : -1 : l m = nC4 - j - 1; C4x(k) = polyval(coeff(o : o + m), n) / coeff(o + m + 1); k = k + 1; o = o + m + 2; end end end GeographicLib-1.52/matlab/geographiclib/private/C4f.m0000644000771000077100000000076514064202371022330 0ustar ckarneyckarneyfunction C4 = C4f(epsi, C4x) %C4F Evaluate C_4 % % C4 = C4F(epsi, C4x) evaluates C_{4,l} in the expansion for the area % (Eq. (65) expressed in terms of n and epsi) using the coefficient % vector C4x. epsi is a K x 1 array. C4x is a 1 x 21 array. C4 is a % K x 6 array. nC4 = 6; C4 = zeros(length(epsi), nC4); mult = 1; o = 1; for l = 0 : nC4 - 1 m = nC4 - l - 1; C4(:, l+1) = mult .* polyval(C4x(o : o + m), epsi); o = o + m + 1; mult = mult .* epsi; end end GeographicLib-1.52/matlab/geographiclib/private/G4coeff.m0000644000771000077100000000277214064202371023171 0ustar ckarneyckarneyfunction G4x = G4coeff(n) %G4COEFF Evaluate coefficients for C_4 for great ellipse % % G4x = G4COEFF(n) evaluates the coefficients of epsilon^l in expansion % of the greate ellipse area (expressed in terms of n and epsi). n is a % scalar. G4x is a 1 x 21 array. persistent coeff nG4 nG4x if isempty(coeff) nG4 = 6; nG4x = (nG4 * (nG4 + 1)) / 2; coeff = [ ... -13200233, 1537536, ... 138833443, 13938873, 5765760, ... -135037988, -32774196, -4232371, 5765760, ... 6417449, 3013374, 1012583, 172458, 720720, ... -117944, -110552, -84227, -41184, -9009, 120120, ... 200, 416, 1144, 6864, 21021, 15015, 90090, ... 2625577, 1537536, ... -39452953, -3753828, 8648640, ... 71379996, 16424252, 1987557, 17297280, ... -5975241, -2676466, -847847, -136422, 4324320, ... 117944, 110552, 84227, 41184, 9009, 1081080, ... -5512967, 15375360, ... 2443153, 208182, 2882880, ... -3634676, -741988, -76219, 5765760, ... 203633, 80106, 20735, 2574, 1441440, ... 22397, 439296, ... -71477, -5317, 768768, ... 48020, 8372, 715, 1153152, ... -5453, 1317888, ... 1407, 91, 329472, ... 21, 146432, ... ]; end G4x = zeros(1, nG4x); o = 1; k = 1; for l = 0 : nG4 - 1 for j = nG4 - 1 : -1 : l m = nG4 - j - 1; G4x(k) = polyval(coeff(o : o + m), n) / coeff(o + m + 1); k = k + 1; o = o + m + 2; end end end GeographicLib-1.52/matlab/geographiclib/private/GeoRotation.m0000644000771000077100000000173014064202371024137 0ustar ckarneyckarneyfunction M = GeoRotation(sphi, cphi, slam, clam) %GEOROTATION The rotation from geodetic to geocentric % % M = GeoRotation(sphi, cphi, slam, clam) % % sphi, cphi, slam, clam must all have the same shape, S. M has the % shape [3, 3, S]. % 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]] S = size(sphi); M = zeros(9, prod(S)); sphi = sphi(:); cphi = cphi(:); slam = slam(:); clam = clam(:); % Local X axis (east) in geocentric coords M(1,:) = -slam; M(2,:) = clam; M(3,:) = 0; % Local Y axis (north) in geocentric coords M(4,:) = -clam .* sphi; M(5,:) = -slam .* sphi; M(6,:) = cphi; % Local Z axis (up) in geocentric coords M(7,:) = clam .* cphi; M(8,:) = slam .* cphi; M(9,:) = sphi; M = reshape(M, [3, 3, S]); end GeographicLib-1.52/matlab/geographiclib/private/LatFix.m0000644000771000077100000000033514064202371023074 0ustar ckarneyckarneyfunction y = LatFix(x) %LATFIX Check that latitiude is in [-90, 90] % % y = LATFIX(x) returns x is it is in the range [-90, 90]; otherwise it % returns NaN. x can be any shape. y = x; y(abs(x) > 90) = nan; end GeographicLib-1.52/matlab/geographiclib/private/SinCosSeries.m0000644000771000077100000000152514064202371024260 0ustar ckarneyckarneyfunction y = SinCosSeries(sinp, sinx, cosx, c) %SINSCOSERIES Evaluate a sine or cosine series using Clenshaw summation % % y = SINCOSSERIES(sinp, sinx, cosx, c) evaluate % y = sum(c[i] * sin( 2*i * x), i, 1, n), if sinp % y = sum(c[i] * cos((2*i-1) * x), i, 1, n), if ~sinp % % where n is the size of c. x is given via its sine and cosine in sinx % and cosx. sinp is a scalar. sinx, cosx, and y are K x 1 arrays. c is % a K x N array. if isempty(sinx), y = sinx; return, end n = size(c, 2); ar = 2 * (cosx - sinx) .* (cosx + sinx); y1 = zeros(length(sinx), 1); if mod(n, 2) y0 = c(:, n); n = n - 1; else y0 = y1; end for k = n : -2 : 1 y1 = ar .* y0 - y1 + c(:, k); y0 = ar .* y1 - y0 + c(:, k-1); end if sinp y = 2 * sinx .* cosx .* y0; else y = cosx .* (y0 - y1); end end GeographicLib-1.52/matlab/geographiclib/private/atan2dx.m0000644000771000077100000000165614064202371023255 0ustar ckarneyckarneyfunction z = atan2dx(y, x) %ATAN2DX Compute 2 argument arctangent with result in degrees % % z = ATAN2DX(y, x) compute atan2(y, x) with result in degrees in % (-180,180] and quadrant symmetries enforced. x and y must have % compatible shapes. persistent octavep if isempty(octavep) octavep = exist('OCTAVE_VERSION', 'builtin') ~= 0; end if ~octavep % MATLAB implements symmetries already z = atan2d(y, x); else q1 = abs(y) > abs(x); q2 = ones(size(q1)); x = q2 .* x; y = q2 .* y; % expand x, y if necessary t = y(q1); y(q1) = x(q1); x(q1) = t; q2 = x < 0; x(q2) = -x(q2); q = 2 * q1 + q2; z = atan2(y, x) * (180 / pi); % z in [-45, 45] % t = q == 0; z(t) = 0 + z(t); t = q == 1 & y >= 0; z(t) = 180 - z(t); t = q == 1 & y < 0; z(t) = -180 - z(t); t = q == 2; z(t) = 90 - z(t); t = q == 3; z(t) = -90 + z(t); end end GeographicLib-1.52/matlab/geographiclib/private/cbrtx.m0000644000771000077100000000055714064202371023035 0ustar ckarneyckarneyfunction y = cbrtx(x) %CBRTX The real cube root % % CBRTX(x) is the real cube root of x (assuming x is real). x % can be any shape. persistent octavep if isempty(octavep) octavep = exist('OCTAVE_VERSION', 'builtin') ~= 0; end if octavep y = cbrt(x); else y = abs(x).^(1/3); y(x < 0) = -y(x < 0); y(x == 0) = x(x == 0); end end GeographicLib-1.52/matlab/geographiclib/private/copysignx.m0000644000771000077100000000065614064202371023736 0ustar ckarneyckarneyfunction z = copysignx(x, y) %COPYSIGNX Copy the sign % % COPYSIGNX(x,y) returns the magnitude of x with the sign of y. x and y % can be any compatible shapes. persistent octavep if isempty(octavep) octavep = exist('OCTAVE_VERSION', 'builtin') ~= 0; end if octavep z = abs(x) .* (1 - 2 * signbit(y)); else z = abs(x + 0*y); l = z > -1 & (y < 0 | (y == 0 & 1./y < 0)); z(l) = -z(l); end end GeographicLib-1.52/matlab/geographiclib/private/cvmgt.m0000644000771000077100000000106414064202371023025 0ustar ckarneyckarneyfunction z = cvmgt(x, y, p) %CVMGT Conditional merge of two vectors % % z = CVMGT(x, y, p) return a vector z whose elements are x if p is true % and y otherwise. p, x, and y should be the same shape except that x % and y may be scalars. CVMGT stands for conditional vector merge true % (an intrinsic function for the Cray fortran compiler). It implements % the C++ statement % % z = p ? x : y; z = zeros(size(p)); if isscalar(x) z(p) = x; else z(p) = x(p); end if isscalar(y) z(~p) = y; else z(~p) = y(~p); end end GeographicLib-1.52/matlab/geographiclib/private/eatanhe.m0000644000771000077100000000040314064202371023306 0ustar ckarneyckarneyfunction y = eatanhe(x, e2) %EATANHE e*atanh(e*x) % % EATANHE(x, e2) returns e*atanh(e*x) where e = sqrt(e2) % e2 is a scalar; x can be any shape. e = sqrt(abs(e2)); if (e2 >= 0) y = e * atanh(e * x); else y = -e * atan(e * x); end end GeographicLib-1.52/matlab/geographiclib/private/geoid_file.m0000644000771000077100000000127614064202371024000 0ustar ckarneyckarneyfunction filename = geoid_file(name, dir) %GEOID_FILE Return filename for geoid data % % filename = geoid_file(name, dir). See the documentation on geoid_load. if nargin < 1 || isempty(name) name = getenv('GEOGRAPHICLIB_GEOID_NAME'); if isempty(name) name = 'egm96-5'; end end if nargin < 2 || isempty(dir) dir = getenv('GEOGRAPHICLIB_GEOID_PATH'); if isempty(dir) dir = getenv('GEOGRAPHICLIB_DATA'); if isempty(dir) if ispc dir = 'C:/ProgramData/GeographicLib'; else dir = '/usr/local/share/GeographicLib'; end end dir = [dir, '/geoids']; end end filename = [dir, '/', name, '.pgm']; end GeographicLib-1.52/matlab/geographiclib/private/geoid_load_file.m0000644000771000077100000000206714064202371024776 0ustar ckarneyckarneyfunction geoid = geoid_load_file(filename) %GEOID_LOAD_FILE Loads geoid data from filename geoid.file = filename; geoid.offset = NaN; geoid.scale = NaN; fid = fopen(geoid.file, 'r'); if fid == -1, error(['Cannot open ', geoid.file]), end for i = 1:16 if isfinite(geoid.offset) && isfinite(geoid.scale), break, end text = fgetl(fid); if ~ischar(text), continue, end text = strsplit(text, ' '); if length(text) == 3 if strcmp(text{2}, 'Offset') geoid.offset = str2double(text{3}); elseif strcmp(text{2}, 'Scale') geoid.scale = str2double(text{3}); end elseif length(text) == 2 break end end fclose(fid); if ~isfinite(geoid.offset), error('Cannot find offset'), end if ~isfinite(geoid.scale), error('Cannot find scale'), end geoid.im = imread(geoid.file); if ~isa(geoid.im, 'uint16'), error('Wrong image type'), end geoid.h = size(geoid.im, 1); geoid.w = size(geoid.im, 2); if ~(bitand(geoid.w, 1) == 0 && bitand(geoid.h, 1) == 1) error('Image width/height not even/odd') end end GeographicLib-1.52/matlab/geographiclib/private/norm2.m0000644000771000077100000000031714064202371022742 0ustar ckarneyckarneyfunction [x, y] = norm2(x, y) %NORM2 Normalize x and y % % [x, y] = NORM2(x, y) normalize x and y so that x^2 + y^2 = 1. x and y % can be any shape. r = hypot(x, y); x = x ./ r; y = y ./ r; end GeographicLib-1.52/matlab/geographiclib/private/remx.m0000644000771000077100000000044514064202371022662 0ustar ckarneyckarneyfunction z = remx(x, y) %REMX The remainder function % % REMX(x, y) is the remainder of x on division by y. Result is in [-y/2, % y/2]. x and y can be any compatible shapes. y should be positive. z = rem(x, y); z(z < -y/2) = z(z < -y/2) + y; z(z > y/2) = z(z > y/2) - y; end GeographicLib-1.52/matlab/geographiclib/private/sincosdx.m0000644000771000077100000000176514064202371023547 0ustar ckarneyckarneyfunction [sinx, cosx] = sincosdx(x) %SINCOSDX Compute sine and cosine with argument in degrees % % [sinx, cosx] = SINCOSDX(x) compute sine and cosine of x in degrees with % exact argument reduction and quadrant symmetries enforced. persistent octavep if isempty(octavep) octavep = exist('OCTAVE_VERSION', 'builtin') ~= 0; end if ~octavep % MATLAB implements argument reduction and symmetries already sinx = sind(x); cosx = cosd(x); else r = rem(x, 360); % workaround rem's bad handling of -0 in octave; fixed 2015-07-22 % http://savannah.gnu.org/bugs/?45587 r(x == 0 & signbit(x)) = -0; q = 0 + round(r / 90); r = r - 90 * q; q = mod(q, 4); r = r * (pi/180); sinx = sin(r); cosx = cos(r); t = q == 1; z = -sinx(t); sinx(t) = cosx(t); cosx(t) = z; t = q == 2; sinx(t) = -sinx(t); cosx(t) = -cosx(t); t = q == 3; z = sinx(t); sinx(t) = -cosx(t); cosx(t) = z; end sinx(x ~= 0) = 0 + sinx(x ~= 0); cosx(x ~= 0) = 0 + cosx(x ~= 0); end GeographicLib-1.52/matlab/geographiclib/private/sumx.m0000644000771000077100000000047114064202371022702 0ustar ckarneyckarneyfunction [s, t] = sumx(u, v) %SUM Error free sum % % [s, t] = SUMX(u, v) returns the rounded sum u + v in s and the error in % t, such that s + t = u + v, exactly. u and v can be any compatible % shapes. s = u + v; up = s - v; vpp = s - up; up = up - u; vpp = vpp - v; t = -(up + vpp); end GeographicLib-1.52/matlab/geographiclib/private/swap.m0000644000771000077100000000015614064202371022660 0ustar ckarneyckarneyfunction [y, x] = swap(x, y) %SWAP Swap two variables. % % [a, b] = SWAP(x, y) sets A to Y and B to X. end GeographicLib-1.52/matlab/geographiclib/private/tauf.m0000644000771000077100000000123114064202371022640 0ustar ckarneyckarneyfunction tau = tauf(taup, e2) %TAUF tan(phi) % % TAUF(taup, e2) returns tangent of phi in terms of taup the tangent of % chi. e2, the square of the eccentricity, is a scalar; taup can be any % shape. numit = 5; e2m = 1 - e2; tau = taup / e2m; stol = 0.1 * sqrt(eps) * max(1, abs(taup)); g = isfinite(tau); for i = 1 : numit if ~any(g), break, end tau1 = hypot(1, tau); sig = sinh( eatanhe( tau ./ tau1, e2 ) ); taupa = hypot(1, sig) .* tau - sig .* tau1; dtau = (taup - taupa) .* (1 + e2m .* tau.^2) ./ ... (e2m * tau1 .* hypot(1, taupa)); tau(g) = tau(g) + dtau(g); g = g & abs(dtau) >= stol; end end GeographicLib-1.52/matlab/geographiclib/private/taupf.m0000644000771000077100000000051014064202371023017 0ustar ckarneyckarneyfunction taup = taupf(tau, e2) %TAUPF tan(chi) % % TAUPF(tau, e2) returns tangent of chi in terms of tau the tangent of % phi. e2, the square of the eccentricity, is a scalar; taup can be any % shape. tau1 = hypot(1, tau); sig = sinh( eatanhe( tau ./ tau1, e2 ) ); taup = hypot(1, sig) .* tau - sig .* tau1; end GeographicLib-1.52/matlab/geographiclib/projdoc.m0000644000771000077100000000640614064202371021700 0ustar ckarneyckarneyfunction projdoc %PROJDOC Projections for an ellipsoid % % This package implements five projections: % * the transverse Mercator projection (tranmerc) % * the polar stereographic projection (polarst) % * the azimuthal equidistant projection (eqdazim) % * the Cassini-Soldner projection (cassini) % * the ellipsoidal gnomonic projection (gnomonic) % % The package implements the forward projection (from geographic to % projected coordinates) and inverse projection (from projected to % geographic coordinates) with abbreviated function names (listed in % parentheses in the list above) suffixed by _fwd and _inv. For each % function, metric properties of the projection are also returned. % % The ellipsoidal gnomonic projection is defined by % % [~,azi0,~,~,m,M] = geoddistance(lat0,lon0,lat,lon) % rho = m./M, x = rho.*sind(azi0), y = rho.*cosd(azi0) % % Obviously this is an azimuthal projection. It also enjoys % approximately the property of the spherical gnomonic projection, that % geodesics map to straight lines. The projection is derived in Section % 8 of % % C. F. F. Karney, Algorithms for geodesics, % J. Geodesy 87, 43-55 (2013); % https://doi.org/10.1007/s00190-012-0578-z % Addenda: https://geographiclib.sourceforge.io/geod-addenda.html % % The parameters of the ellipsoid are specified by the optional ellipsoid % argument to the routines. This is a two-element vector of the form % [a,e], where a is the equatorial radius, e is the eccentricity e = % sqrt(a^2-b^2)/a, and b is the polar semi-axis. Typically, a and b are % measured in meters and the linear and area quantities returned by the % routines are then in meters and meters^2. However, other units can be % employed. If ellipsoid is omitted, then the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is assumed [6378137, % 0.0818191908426215] corresponding to a = 6378137 meters and a % flattening f = (a-b)/a = 1/298.257223563. The flattening and % eccentricity are related by % % e = sqrt(f * (2 - f)) % f = e^2 / (1 + sqrt(1 - e^2)) % % (The functions ecc2flat and flat2ecc implement these conversions.) For % a sphere, set e = 0; for a prolate ellipsoid (b > a), specify e as a % pure imaginary number. % % All angles (latitude, longitude, azimuth) are measured in degrees with % latitudes increasing northwards, longitudes increasing eastwards, and % azimuths measured clockwise from north. For a point at a pole, the % azimuth is defined by keeping the longitude fixed, writing lat = % +/-(90-eps), and taking the limit eps -> 0+. % % Restrictions on the inputs: % * All latitudes must lie in [-90, 90]. % * The equatorial radius, a, must be positive. % * The eccentricity, e, should be satisfy abs(e) < 0.2 in order to % retain full accuracy (this corresponds to flattenings satisfying % abs(f) <= 1/50, approximately). This condition holds for most % applications in geodesy. % % See also TRANMERC_FWD, TRANMERC_INV, POLARST_FWD, POLARST_INV, % EQDAZIM_FWD, EQDAZIM_INV, CASSINI_FWD, CASSINI_INV, GNOMONIC_FWD, % GNOMONIC_INV, DEFAULTELLIPSOID, ECC2FLAT, FLAT2ECC. % Copyright (c) Charles Karney (2012-2015) . help projdoc end GeographicLib-1.52/matlab/geographiclib/tranmerc_fwd.m0000644000771000077100000001226614064202371022714 0ustar ckarneyckarneyfunction [x, y, gam, k] = tranmerc_fwd(lat0, lon0, lat, lon, ellipsoid) %TRANMERC_FWD Forward transverse Mercator projection % % [x, y] = TRANMERC_FWD(lat0, lon0, lat, lon) % [x, y, gam, k] = TRANMERC_FWD(lat0, lon0, lat, lon, ellipsoid) % % performs the forward transverse Mercator projection of points (lat,lon) % to (x,y) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. The common % case of lat0 = 0 is treated efficiently provided that lat0 is specified % as a scalar. projdoc defines the projection and gives the restrictions % on the allowed ranges of the arguments. The inverse projection is % given by tranmerc_inv. The scale on the central meridian is 1. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat0, lon0, lat, lon, gam are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). k is dimensionless. % % This implementation of the projection is based on the series method % described in % % C. F. F. Karney, Transverse Mercator with an accuracy of a few % nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); % Addenda: https://geographiclib.sourceforge.io/tm-addenda.html % % This extends the series given by Krueger (1912) to sixth order in the % flattening. This is a substantially better series than that used by % the MATLAB mapping toolbox. In particular the errors in the projection % are less than 5 nanometers within 3900 km of the central meridian (and % less than 1 mm within 7600 km of the central meridian). The mapping % can be continued accurately over the poles to the opposite meridian. % % See also PROJDOC, TRANMERC_INV, UTMUPS_FWD, UTMUPS_INV, % DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2012-2018) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat0 + lon0 + lat + lon); catch error('lat0, lon0, lat, lon have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end Z = zeros(prod(S),1); maxpow = 6; a = ellipsoid(1); e2 = real(ellipsoid(2)^2); f = e2 / (1 + sqrt(1 - e2)); e2m = 1 - e2; cc = sqrt(e2m) * exp(eatanhe(1, e2)); n = f / (2 -f); alp = alpf(n); b1 = (1 - f) * (A1m1f(n) + 1); a1 = b1 * a; lat = LatFix(lat(:)) + Z; lon = AngDiff(lon0(:), lon(:)) + Z; latsign = 1 - 2 * (lat < 0); lonsign = 1 - 2 * (lon < 0); lon = lon .* lonsign; lat = lat .* latsign; backside = lon > 90; latsign(backside & lat == 0) = -1; lon(backside) = 180 - lon(backside); [sphi, cphi] = sincosdx(lat); [slam, clam] = sincosdx(lon); tau = sphi ./ max(sqrt(realmin), cphi); taup = taupf(tau, e2); xip = atan2(taup, clam); etap = asinh(slam ./ hypot(taup, clam)); gam = atan2dx(slam .* taup, clam .* hypot(1, taup)); k = sqrt(e2m + e2 * cphi.^2) .* hypot(1, tau) ./ hypot(taup, clam); c = ~(lat ~= 90); if any(c) xip(c) = pi/2; etap(c) = 0; gam(c) = lon(c); k(c) = cc; end c0 = cos(2 * xip); ch0 = cosh(2 * etap); s0 = sin(2 * xip); sh0 = sinh(2 * etap); a = 2 * complex(c0 .* ch0, -s0 .* sh0); j = maxpow; y0 = complex(Z); y1 = y0; z0 = y0; z1 = y0; if mod(j, 2) y0 = y0 + alp(j); z0 = z0 + 2*j * alp(j); j = j - 1; end for j = j : -2 : 1 y1 = a .* y0 - y1 + alp(j); z1 = a .* z0 - z1 + 2*j * alp(j); y0 = a .* y1 - y0 + alp(j-1); z0 = a .* z1 - z0 + 2*(j-1) * alp(j-1); end a = a/2; z1 = 1 - z1 + z0 .* a; a = complex(s0 .* ch0, c0 .* sh0); y1 = complex(xip, etap) + y0 .* a; gam = gam - atan2dx(imag(z1), real(z1)); k = k .* (b1 * abs(z1)); xi = real(y1); eta = imag(y1); xi(backside) = pi - xi(backside); y = a1 * xi .* latsign; x = a1 * eta .* lonsign; gam(backside) = 180 - gam(backside); gam = AngNormalize(gam .* latsign .* lonsign); if isscalar(lat0) && lat0 == 0 y0 = 0; else [sbet0, cbet0] = sincosdx(LatFix(lat0(:))); [sbet0, cbet0] = norm2((1-f) * sbet0, cbet0); y0 = a1 * (atan2(sbet0, cbet0) + ... SinCosSeries(true, sbet0, cbet0, C1f(n))); end y = y - y0; x = reshape(x, S); y = reshape(y, S); gam = reshape(gam, S); k = reshape(k, S); end function alp = alpf(n) persistent alpcoeff if isempty(alpcoeff) alpcoeff = [ ... 31564, -66675, 34440, 47250, -100800, 75600, 151200, ... -1983433, 863232, 748608, -1161216, 524160, 1935360, ... 670412, 406647, -533952, 184464, 725760, ... 6601661, -7732800, 2230245, 7257600, ... -13675556, 3438171, 7983360, ... 212378941, 319334400, ... ]; end maxpow = 6; alp = zeros(1, maxpow); o = 1; d = n; for l = 1 : maxpow m = maxpow - l; alp(l) = d * polyval(alpcoeff(o : o + m), n) / alpcoeff(o + m + 1); o = o + m + 2; d = d * n; end end GeographicLib-1.52/matlab/geographiclib/tranmerc_inv.m0000644000771000077100000001214514064202371022724 0ustar ckarneyckarneyfunction [lat, lon, gam, k] = tranmerc_inv(lat0, lon0, x, y, ellipsoid) %TRANMERC_INV Inverse transverse Mercator projection % % [lat, lon] = TRANMERC_INV(lat0, lon0, x, y) % [lat, lon, gam, k] = TRANMERC_INV(lat0, lon0, x, y, ellipsoid) % % performs the inverse transverse Mercator projection of points (x,y) to % (lat,lon) using (lat0,lon0) as the center of projection. These input % arguments can be scalars or arrays of equal size. The ellipsoid vector % is of the form [a, e], where a is the equatorial radius in meters, e is % the eccentricity. If ellipsoid is omitted, the WGS84 ellipsoid (more % precisely, the value returned by defaultellipsoid) is used. The common % case of lat0 = 0 is treated efficiently provided that lat0 is specified % as a scalar. projdoc defines the projection and gives the restrictions % on the allowed ranges of the arguments. The forward projection is % given by tranmerc_fwd. The scale on the central meridian is 1. % % gam and K give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat0, lon0, lat, lon, gam are in degrees. The projected coordinates x, % y are in meters (more precisely the units used for the equatorial % radius). k is dimensionless. % % This implementation of the projection is based on the series method % described in % % C. F. F. Karney, Transverse Mercator with an accuracy of a few % nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); % Addenda: https://geographiclib.sourceforge.io/tm-addenda.html % % This extends the series given by Krueger (1912) to sixth order in the % flattening. This is a substantially better series than that used by % the MATLAB mapping toolbox. In particular the errors in the projection % are less than 5 nanometers within 3900 km of the central meridian (and % less than 1 mm within 7600 km of the central meridian). The mapping % can be continued accurately over the poles to the opposite meridian. % % See also PROJDOC, TRANMERC_FWD, UTMUPS_FWD, UTMUPS_INV, % DEFAULTELLIPSOID, FLAT2ECC. % Copyright (c) Charles Karney (2012-2018) . narginchk(4, 5) if nargin < 5, ellipsoid = defaultellipsoid; end try S = size(lat0 + lon0 + x + y); catch error('lat0, lon0, x, y have incompatible sizes') end if length(ellipsoid(:)) ~= 2 error('ellipsoid must be a vector of size 2') end Z = zeros(prod(S),1); maxpow = 6; a = ellipsoid(1); e2 = real(ellipsoid(2)^2); f = e2 / (1 + sqrt(1 - e2)); e2m = 1 - e2; cc = sqrt(e2m) * exp(eatanhe(1, e2)); n = f / (2 -f); bet = betf(n); b1 = (1 - f) * (A1m1f(n) + 1); a1 = b1 * a; if isscalar(lat0) && lat0 == 0 y0 = 0; else [sbet0, cbet0] = sincosdx(LatFix(lat0(:))); [sbet0, cbet0] = norm2((1-f) * sbet0, cbet0); y0 = a1 * (atan2(sbet0, cbet0) + ... SinCosSeries(true, sbet0, cbet0, C1f(n))); end y = y(:) + y0 + Z; xi = y / a1; eta = x(:) / a1 + Z; xisign = 1 - 2 * (xi < 0 ); etasign = 1 - 2 * (eta < 0 ); xi = xi .* xisign; eta = eta .* etasign; backside = xi > pi/2; xi(backside) = pi - xi(backside); c0 = cos(2 * xi); ch0 = cosh(2 * eta); s0 = sin(2 * xi); sh0 = sinh(2 * eta); a = 2 * complex(c0 .* ch0, -s0 .* sh0); j = maxpow; y0 = complex(Z); y1 = y0; z0 = y0; z1 = y0; if mod(j, 2) y0 = y0 + bet(j); z0 = z0 - 2*j * bet(j); j = j - 1; end for j = j : -2 : 1 y1 = a .* y0 - y1 - bet(j); z1 = a .* z0 - z1 - 2*j * bet(j); y0 = a .* y1 - y0 - bet(j-1); z0 = a .* z1 - z0 - 2*(j-1) * bet(j-1); end a = a/2; z1 = 1 - z1 + z0 .* a; a = complex(s0 .* ch0, c0 .* sh0); y1 = complex(xi, eta) + y0 .* a; gam = atan2dx(imag(z1), real(z1)); k = b1 ./ abs(z1); xip = real(y1); etap = imag(y1); s = sinh(etap); c = max(0, cos(xip)); r = hypot(s, c); lon = atan2dx(s, c); sxip = sin(xip); tau = tauf(sxip./r, e2); lat = atan2dx(tau, 1 + Z); gam = gam + atan2dx(sxip .* tanh(etap), c); c = r ~= 0; k(c) = k(c) .* sqrt(e2m + e2 ./ (1 + tau.^2)) .* ... hypot(1, tau(c)) .* r(c); c = ~c; if any(c) lat(c) = 90; lon(c) = 0; k(c) = k(c) * cc; end lat = lat .* xisign; lon(backside) = 180 - lon(backside); lon = lon .* etasign; lon = AngNormalize(lon + AngNormalize(lon0(:))); gam(backside) = 180 - gam(backside); gam = AngNormalize(gam .* xisign .* etasign); lat = reshape(lat, S); lon = reshape(lon, S); gam = reshape(gam, S); k = reshape(k, S); end function bet = betf(n) persistent betcoeff if isempty(betcoeff) betcoeff = [ 384796, -382725, -6720, 932400, -1612800, 1209600, 2419200, ... -1118711, 1695744, -1174656, 258048, 80640, 3870720, ... 22276, -16929, -15984, 12852, 362880, ... -830251, -158400, 197865, 7257600, ... -435388, 453717, 15966720, ... 20648693, 638668800, ... ]; end maxpow = 6; bet = zeros(1, maxpow); o = 1; d = n; for l = 1 : maxpow m = maxpow - l; bet(l) = d * polyval(betcoeff(o : o + m), n) / betcoeff(o + m + 1); o = o + m + 2; d = d * n; end end GeographicLib-1.52/matlab/geographiclib/utmups_fwd.m0000644000771000077100000001034314064202371022430 0ustar ckarneyckarneyfunction [x, y, zone, isnorth, gam, k] = utmups_fwd(lat, lon, setzone) %UTMUPS_FWD Convert to UTM/UPS system % % [x, y, zone, isnorth] = UTMUPS_FWD(lat, lon) % [x, y, zone, isnorth, gam, k] = UTMUPS_FWD(lat, lon, setzone) % % convert from geographical coordinates, (lat,lon), to the UTM/UPS % system. The output is (x,y) = (easting,northing), zone which is either % the UTM zone or 0 for UPS, and a hemisphere selector, isnorth (0 for % the southern hemisphere, 1 for the northern). If setzone = -1 (the % default), the standard choice is made between UTM and UPS and, if UTM, % the standard zone is picked (the Norway and Svalbard exceptions are % honored). lat, lon, and setzone can be scalars or arrays of equal % size. The inverse operation is performed by utmups_inv. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat, lon, gam are in degrees. The projected coordinates x, y are in % meters. k is dimensionless. % % The optional argument, setzone, allows the UTM/UPS and zone % assignment to be overridden. The choices are % 0, use UPS % [1,60], use the corresponding UTM zone % -1, use the standard assigment (the default) % -2, use closest UTM zone % -4, an undefined zone % % The allowed values of (x,y) are % UTM: x in [0 km, 1000 km] % y in [0 km, 9600 km] for northern hemisphere % y in [900 km, 10000 km] for southern hemisphere % UPS: x and y in [1200 km, 2800 km] for northern hemisphere % x and y in [700 km, 3300 km] for southern hemisphere % % The ranges are 100 km less restrictive than for mgrs_fwd. % % UTMUPS_FWD checks its arguments and requires that lat is in % [-90deg,90deg] and that (x,y) lie in the limits given above. If these % conditions don't hold (x,y), gam, k are converted to NaN, zone to -4 % and isnorthp to 0. % % See also UTMUPS_INV, TRANMERC_FWD, POLARST_FWD, MGRS_FWD. % Copyright (c) Charles Karney (2015-2016) . narginchk(2, 3) if nargin < 3, setzone = -1; end try Z = zeros(size(lat + lon + setzone)); catch error('lat, lon, setzone have incompatible sizes') end lat = lat + Z; lon = lon + Z; isnorth = lat >= 0; zone = StandardZone(lat, lon, setzone); Z = nan(size(Z)); x = Z; y = Z; gam = Z; k = Z; utm = zone > 0; [x(utm), y(utm), gam(utm), k(utm)] = ... utm_fwd(zone(utm), isnorth(utm), lat(utm), lon(utm)); ups = zone == 0; [x(ups), y(ups), gam(ups), k(ups)] = ... ups_fwd(isnorth(ups), lat(ups), lon(ups)); zone(isnan(x)) = -4; isnorth(isnan(x)) = false; end function [x, y, gam, k] = utm_fwd(zone, isnorth, lat, lon) %UTM_FWD Forward UTM projection lon0 = -183 + 6 * floor(zone); lat0 = 0; bad = ~(abs(mod(lon - lon0 + 180, 360) - 180) <= 60); fe = 5e5; fn = 100e5 * (1-isnorth); k0 = 0.9996; [x, y, gam, k] = tranmerc_fwd(lat0, lon0, lat, lon); x = x * k0; y = y * k0; k = k * k0; bad = bad | ~(abs(x) <= 5e5 & y >= -91e5 & y <= 96e5); x = x + fe; y = y + fn; x(bad) = nan; y(bad) = nan; gam(bad) = nan; k(bad) = nan; end function [x, y, gam, k] = ups_fwd(isnorth, lat, lon) %UPS_FWD Forward UPS projection fe = 20e5; fn = 20e5; k0 = 0.994; [x, y, gam, k] = polarst_fwd(isnorth, lat, lon); x = x * k0; y = y * k0; k = k * k0; lim = (13 - 5 * isnorth) * 1e5; bad = ~(abs(x) <= lim & abs(y) <= lim); x = x + fe; y = y + fn; x(bad) = nan; y(bad) = nan; gam(bad) = nan; k(bad) = nan; end function zone = StandardZone(lat, lon, setzone) INVALID = -4; UTM = -2; MINZONE = 0; MAXZONE = 60; UPS = 0; zone = floor(setzone) + zeros(size(lat)); zone(~(zone >= INVALID & zone <= MAXZONE)) = INVALID; g = zone < MINZONE & zone ~= INVALID; c = abs(lat) <= 90 & isfinite(lon); zone(g & ~c) = INVALID; g = g & c; c = zone == UTM | (lat >= -80 & lat < 84); u = g & c; ilon = mod(floor(lon(u)) + 180, 360) - 180; z = floor((ilon + 186) / 6); % Norway exception exception = z == 31 & floor(lat(u) / 8) == 7 & ilon >= 3; z(exception) = 32; % Svalbard exception exception = lat(u) >= 72 & ilon >= 0 & ilon < 42; z(exception) = 2 * floor((ilon(exception) + 183)/12) + 1; zone(u) = z; zone(g & ~c) = UPS; end GeographicLib-1.52/matlab/geographiclib/utmups_inv.m0000644000771000077100000000570014064202371022445 0ustar ckarneyckarneyfunction [lat, lon, gam, k] = utmups_inv(x, y, zone, isnorth) %UTMUPS_INV Convert from UTM/UPS system % % [lat, lon] = UTMUPS_INV(x, y, zone, isnorth) % [lat, lon, gam, k] = UTMUPS_INV(x, y, zone, isnorth) % % convert to the UTM/UPS system to geographical coordinates, (lat,lon). % The input is (x,y) = (easting,northing), the zone which is either the % UTM zone or 0 for UPS , and a hemisphere selector, isnorth (0 for the % southern hemisphere, 1 for the northern). x, y, zone, and isnorth can % be scalars or arrays of equal size. The forward operation is performed % by utmups_fwd. % % gam and k give metric properties of the projection at (lat,lon); gam is % the meridian convergence at the point and k is the scale. % % lat, lon, gam are in degrees. The projected coordinates x, y are in % meters. k is dimensionless. % % The argument zone has the following meanings % 0, use UPS % [1,60], use the corresponding UTM zone % -4, an undefined zone % % The allowed values of (x,y) are % UTM: x in [0 km, 1000 km] % y in [0 km, 9600 km] for northern hemisphere % y in [900 km, 10000 km] for southern hemisphere % UPS: x and y in [1200 km, 2800 km] for northern hemisphere % x and y in [700 km, 3300 km] for southern hemisphere % % The ranges are 100 km less restrictive than for mgrs_fwd. % % UTMUPS_INV checks that (x,y) lie in the limits given above. If these % conditions don't hold (lat,lon), gam, k are converted to NaN. % % See also UTMUPS_FWD, TRANMERC_INV, POLARST_INV, MGRS_INV. % Copyright (c) Charles Karney (2015-2016) . narginchk(4, 4) try Z = zeros(size(x + y + zone + isnorth)); catch error('x, y, zone, isnorth have incompatible sizes') end x = x + Z; y = y + Z; zone = floor(zone) + Z; isnorth = logical(isnorth + Z); Z = nan(size(Z)); lat = Z; lon = Z; gam = Z; k = Z; utm = zone > 0 & zone <= 60; [lat(utm), lon(utm), gam(utm), k(utm)] = ... utm_inv(zone(utm), isnorth(utm), x(utm), y(utm)); ups = zone == 0; [lat(ups), lon(ups), gam(ups), k(ups)] = ... ups_inv(isnorth(ups), x(ups), y(ups)); end function [lat, lon, gam, k] = utm_inv(zone, isnorth, x, y) %UTM_INV Inverse UTM projection lon0 = -183 + 6 * floor(zone); lat0 = 0; fe = 5e5; fn = 100e5 * (1-isnorth); k0 = 0.9996; x = x - fe; y = y - fn; bad = ~(abs(x) <= 5e5 & y >= -91e5 & y <= 96e5); x = x / k0; y = y / k0; [lat, lon, gam, k] = tranmerc_inv(lat0, lon0, x, y); k = k * k0; lat(bad) = nan; lon(bad) = nan; gam(bad) = nan; k(bad) = nan; end function [lat, lon, gam, k] = ups_inv(isnorth, x, y) %UPS_INV Inverse UPS projection fe = 20e5; fn = 20e5; k0 = 0.994; x = x - fe; y = y - fn; lim = (13 - 5 * isnorth) * 1e5; bad = ~(abs(x) <= lim & abs(y) <= lim); x = x / k0; y = y / k0; [lat, lon, gam, k] = polarst_inv(isnorth, x, y); k = k * k0; lat(bad) = nan; lon(bad) = nan; gam(bad) = nan; k(bad) = nan; end GeographicLib-1.52/matlab/Makefile.in0000644000771000077100000004102514064202402017317 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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) Charles Karney (2011-2016) VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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@ pkgconfigdir = @pkgconfigdir@ 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_FILES = \ $(srcdir)/geographiclib/Contents.m \ $(srcdir)/geographiclib/geographiclib_test.m \ $(srcdir)/geographiclib/cassini_fwd.m \ $(srcdir)/geographiclib/cassini_inv.m \ $(srcdir)/geographiclib/defaultellipsoid.m \ $(srcdir)/geographiclib/ecc2flat.m \ $(srcdir)/geographiclib/eqdazim_fwd.m \ $(srcdir)/geographiclib/eqdazim_inv.m \ $(srcdir)/geographiclib/flat2ecc.m \ $(srcdir)/geographiclib/gedistance.m \ $(srcdir)/geographiclib/gedoc.m \ $(srcdir)/geographiclib/geocent_fwd.m \ $(srcdir)/geographiclib/geocent_inv.m \ $(srcdir)/geographiclib/geodarea.m \ $(srcdir)/geographiclib/geoddistance.m \ $(srcdir)/geographiclib/geoddoc.m \ $(srcdir)/geographiclib/geodreckon.m \ $(srcdir)/geographiclib/geoid_height.m \ $(srcdir)/geographiclib/geoid_load.m \ $(srcdir)/geographiclib/gereckon.m \ $(srcdir)/geographiclib/gnomonic_fwd.m \ $(srcdir)/geographiclib/gnomonic_inv.m \ $(srcdir)/geographiclib/loccart_fwd.m \ $(srcdir)/geographiclib/loccart_inv.m \ $(srcdir)/geographiclib/mgrs_fwd.m \ $(srcdir)/geographiclib/mgrs_inv.m \ $(srcdir)/geographiclib/polarst_fwd.m \ $(srcdir)/geographiclib/polarst_inv.m \ $(srcdir)/geographiclib/projdoc.m \ $(srcdir)/geographiclib/tranmerc_fwd.m \ $(srcdir)/geographiclib/tranmerc_inv.m \ $(srcdir)/geographiclib/utmups_fwd.m \ $(srcdir)/geographiclib/utmups_inv.m MATLAB_PRIVATE = \ $(srcdir)/geographiclib/private/A1m1f.m \ $(srcdir)/geographiclib/private/A2m1f.m \ $(srcdir)/geographiclib/private/A3coeff.m \ $(srcdir)/geographiclib/private/A3f.m \ $(srcdir)/geographiclib/private/AngDiff.m \ $(srcdir)/geographiclib/private/AngNormalize.m \ $(srcdir)/geographiclib/private/AngRound.m \ $(srcdir)/geographiclib/private/C1f.m \ $(srcdir)/geographiclib/private/C1pf.m \ $(srcdir)/geographiclib/private/C2f.m \ $(srcdir)/geographiclib/private/C3coeff.m \ $(srcdir)/geographiclib/private/C3f.m \ $(srcdir)/geographiclib/private/C4coeff.m \ $(srcdir)/geographiclib/private/C4f.m \ $(srcdir)/geographiclib/private/G4coeff.m \ $(srcdir)/geographiclib/private/GeoRotation.m \ $(srcdir)/geographiclib/private/LatFix.m \ $(srcdir)/geographiclib/private/SinCosSeries.m \ $(srcdir)/geographiclib/private/atan2dx.m \ $(srcdir)/geographiclib/private/cbrtx.m \ $(srcdir)/geographiclib/private/copysignx.m \ $(srcdir)/geographiclib/private/cvmgt.m \ $(srcdir)/geographiclib/private/eatanhe.m \ $(srcdir)/geographiclib/private/geoid_file.m \ $(srcdir)/geographiclib/private/geoid_load_file.m \ $(srcdir)/geographiclib/private/norm2.m \ $(srcdir)/geographiclib/private/remx.m \ $(srcdir)/geographiclib/private/sincosdx.m \ $(srcdir)/geographiclib/private/sumx.m \ $(srcdir)/geographiclib/private/swap.m \ $(srcdir)/geographiclib/private/tauf.m \ $(srcdir)/geographiclib/private/taupf.m MATLAB_LEGACY = \ $(srcdir)/geographiclib-legacy/Contents.m \ $(srcdir)/geographiclib-legacy/geocentricforward.m \ $(srcdir)/geographiclib-legacy/geocentricreverse.m \ $(srcdir)/geographiclib-legacy/geodesicdirect.m \ $(srcdir)/geographiclib-legacy/geodesicinverse.m \ $(srcdir)/geographiclib-legacy/geodesicline.m \ $(srcdir)/geographiclib-legacy/geoidheight.m \ $(srcdir)/geographiclib-legacy/localcartesianforward.m \ $(srcdir)/geographiclib-legacy/localcartesianreverse.m \ $(srcdir)/geographiclib-legacy/mgrsforward.m \ $(srcdir)/geographiclib-legacy/mgrsreverse.m \ $(srcdir)/geographiclib-legacy/polygonarea.m \ $(srcdir)/geographiclib-legacy/utmupsforward.m \ $(srcdir)/geographiclib-legacy/utmupsreverse.m MATLAB_ALL = $(MATLAB_FILES) $(MATLAB_PRIVATE) matlabdir = $(DESTDIR)$(datadir)/matlab EXTRA_DIST = Makefile.mk CMakeLists.txt $(MATLAB_ALL) $(MATLAB_LEGACY) 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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 cscopelist-am ctags-am 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 \ tags-am uninstall uninstall-am .PRECIOUS: Makefile install: $(INSTALL) -d $(matlabdir)/geographiclib/private $(INSTALL) -d $(matlabdir)/geographiclib-legacy $(INSTALL) -m 644 $(MATLAB_FILES) $(matlabdir)/geographiclib $(INSTALL) -m 644 $(MATLAB_PRIVATE) $(matlabdir)/geographiclib/private $(INSTALL) -m 644 $(MATLAB_LEGACY) $(matlabdir)/geographiclib-legacy 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.52/maxima/Makefile.mk0000644000771000077100000000023214064202371017334 0ustar ckarneyckarneyMAXIMA = tm ellint tmseries geod geodesic auxlat MAXIMASOURCES = $(addsuffix .mac,$(MAXIMA)) all: @: install: @: clean: @: .PHONY: all install clean GeographicLib-1.52/maxima/auxlat.mac0000644000771000077100000002275114064202371017260 0ustar ckarneyckarney/* Compute series expansions for the auxiliary latitudes. Copyright (c) Charles Karney (2014-2020) and licensed under the MIT/X11 License. For more information, see https://geographiclib.sourceforge.io/ This maxima program compute the coefficients for trigonometric series relating the six latitudes phi geographic beta parametric theta geocentric mu rectifying chi conformal xi authalic All 30 inter-relations are found. The coefficients are expressed as Taylor series in the third flattening n. This generates the series given on the page https://geographiclib.sourceforge.io/html/auxlat.html Instructions: * [optional] edit to set the desired value of maxpow (currently 8) * start maxima and run batch("auxlat.mac")$ * now tx[beta,phi], for example, gives the expansion of beta in terms of phi * to format the results writefile("auxlat.txt")$ dispall()$ closefile()$ Approx timings: maxpow time(s) 6 13 8 41 10 114 12 293 14 708 16 1629 20 7311 25 43020 30 210660 */ /* 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. */ maxpow:8$ 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)$ /* beta in terms of phi */ beta_phi:phi+sum((-n)^j/j*sin(2*j*phi),j,1,maxpow)$ /* Alt: beta_phi:taylor(atan((1-n)/(1+n)*tan(phi)),n,0,maxpow)$ beta_phi:subst([atan(tan(phi))=phi,tan(phi)=sin(phi)/cos(phi)], ratdisrep(beta_phi))$ beta_phi:trigreduce(ratsimp(beta_phi))$ */ /* phi in terms of beta */ phi_beta:subst([n=-n,phi=beta],beta_phi)$ /* Alt: beta_phi:reverta(beta_phi,phi,beta,n,maxpow)$ */ /* theta in terms of beta */ theta_beta:subst([phi=beta],beta_phi)$ /* theta in terms of phi */ theta_phi:subst([beta=beta_phi],theta_beta)$ theta_phi:trigreduce(taylor(theta_phi,n,0,maxpow))$ /* phi in terms of theta */ phi_theta:subst([n=-n,phi=theta],theta_phi)$ /* chi in terms of phi */ atanexp(x,eps):=''(ratdisrep(taylor(atan(x+eps),eps,0,maxpow)))$ chi_phi:block([psiv,tanchi,chiv,qq,e], /* Here qq = atanh(sin(phi)) = asinh(tan(phi)) */ psiv:qq-e*atanh(e*tanh(qq)), psiv:subst([e=sqrt(4*n/(1+n)^2),qq=atanh(sin(phi))], ratdisrep(taylor(psiv,e,0,2*maxpow))) +asinh(sin(phi)/cos(phi))-atanh(sin(phi)), tanchi: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), chiv:atanexp(tan(phi),tanchi-tan(phi)), chiv:subst([atan(tan(phi))=phi, tan(phi)=sin(phi)/cos(phi)], (chiv-phi)/cos(phi))*cos(phi)+phi, chiv:ratdisrep(taylor(chiv,n,0,maxpow)), expand(trigreduce(chiv)))$ /* phi in terms of chi */ phi_chi:reverta(chi_phi,phi,chi,n,maxpow)$ df[i]:=if i<0 then df[i+2]/(i+2) else i!!$ /* df[-1] = 1; df[-3] = -1 */ c(k,maxpow):=sum(n^(k+2*j)*(df[2*j-3]*df[2*j+2*k-3])/(df[2*j]*df[2*j+2*k]), j,0,(maxpow-k)/2)$ /* mu in terms of beta */ mu_beta:expand(ratdisrep( taylor(beta+sum(c(i,maxpow)/i*sin(2*i*beta),i,1,maxpow)/c(0,maxpow), n,0,maxpow)))$ /* beta in terms of mu */ beta_mu:reverta(mu_beta,beta,mu,n,maxpow)$ /* xi in terms of phi */ asinexp(x,eps):=''(sqrt(1-x^2)* sum(ratsimp(diff(asin(x),x,i)/i!/sqrt(1-x^2))*eps^i,i,0,maxpow))$ sinxi:(sin(phi)/2*(1/(1-e^2*sin(phi)^2) + atanh(e*sin(phi))/(e*sin(phi))))/ (1/2*(1/(1-e^2) + atanh(e)/e))$ sinxi:ratdisrep(taylor(sinxi,e,0,2*maxpow))$ sinxi:subst([e=2*sqrt(n)/(1+n)],sinxi)$ sinxi:expand(trigreduce(ratdisrep(taylor(sinxi,n,0,maxpow))))$ xi_phi:asinexp(sin(phi),sinxi-sin(phi))$ xi_phi:taylor(subst([sqrt(1-sin(phi)^2)=cos(phi),asin(sin(phi))=phi], xi_phi),n,0,maxpow)$ xi_phi:expand(ratdisrep(coeff(xi_phi,n,0))+sum( ratsimp(trigreduce(sin(phi)*ratsimp( subst([sin(phi)=sqrt(1-cos(phi)^2)], ratsimp(trigexpand(ratdisrep(coeff(xi_phi,n,i)))/sin(phi))))))*n^i, i,1,maxpow))$ /* phi in terms of xi */ phi_xi:reverta(xi_phi,phi,xi,n,maxpow)$ /* complete the set by using what we have */ mu_phi:expand(trigreduce(taylor(subst([beta=beta_phi],mu_beta),n,0,maxpow)))$ phi_mu:expand(trigreduce(taylor(subst([beta=beta_mu],phi_beta),n,0,maxpow)))$ chi_mu:expand(trigreduce(taylor(subst([phi=phi_mu],chi_phi),n,0,maxpow)))$ mu_chi:expand(trigreduce(taylor(subst([phi=phi_chi],mu_phi),n,0,maxpow)))$ beta_chi:expand(trigreduce(taylor(subst([phi=phi_chi],beta_phi),n,0,maxpow)))$ chi_beta:expand(trigreduce(taylor(subst([phi=phi_beta],chi_phi),n,0,maxpow)))$ beta_theta:expand(trigreduce (taylor(subst([phi=phi_theta],beta_phi),n,0,maxpow)))$ beta_xi:expand(trigreduce(taylor(subst([phi=phi_xi],beta_phi),n,0,maxpow)))$ chi_theta:expand(trigreduce (taylor(subst([phi=phi_theta],chi_phi),n,0,maxpow)))$ chi_xi:expand(trigreduce(taylor(subst([phi=phi_xi],chi_phi),n,0,maxpow)))$ mu_theta:expand(trigreduce(taylor(subst([phi=phi_theta],mu_phi),n,0,maxpow)))$ mu_xi:expand(trigreduce(taylor(subst([phi=phi_xi],mu_phi),n,0,maxpow)))$ theta_chi:expand(trigreduce (taylor(subst([phi=phi_chi],theta_phi),n,0,maxpow)))$ theta_mu:expand(trigreduce(taylor(subst([phi=phi_mu],theta_phi),n,0,maxpow)))$ theta_xi:expand(trigreduce(taylor(subst([phi=phi_xi],theta_phi),n,0,maxpow)))$ xi_beta:expand(trigreduce(taylor(subst([phi=phi_beta],xi_phi),n,0,maxpow)))$ xi_chi:expand(trigreduce(taylor(subst([phi=phi_chi],xi_phi),n,0,maxpow)))$ xi_mu:expand(trigreduce(taylor(subst([phi=phi_mu],xi_phi),n,0,maxpow)))$ xi_theta:expand(trigreduce(taylor(subst([phi=phi_theta],xi_phi),n,0,maxpow)))$ /* put series in canonical form */ norm(x):=block([z:subst([n=0],x)], z+sum(coeff(expand(x),sin(2*i*z))*sin(2*i*z),i,1,maxpow))$ ( tx[beta,chi]:norm(beta_chi), tx[beta,mu]:norm(beta_mu), tx[beta,phi]:norm(beta_phi), tx[beta,theta]:norm(beta_theta), tx[beta,xi]:norm(beta_xi), tx[chi,beta]:norm(chi_beta), tx[chi,mu]:norm(chi_mu), tx[chi,phi]:norm(chi_phi), tx[chi,theta]:norm(chi_theta), tx[chi,xi]:norm(chi_xi), tx[mu,beta]:norm(mu_beta), tx[mu,chi]:norm(mu_chi), tx[mu,phi]:norm(mu_phi), tx[mu,theta]:norm(mu_theta), tx[mu,xi]:norm(mu_xi), tx[phi,beta]:norm(phi_beta), tx[phi,chi]:norm(phi_chi), tx[phi,mu]:norm(phi_mu), tx[phi,theta]:norm(phi_theta), tx[phi,xi]:norm(phi_xi), tx[theta,beta]:norm(theta_beta), tx[theta,chi]:norm(theta_chi), tx[theta,mu]:norm(theta_mu), tx[theta,phi]:norm(theta_phi), tx[theta,xi]:norm(theta_xi), tx[xi,beta]:norm(xi_beta), tx[xi,chi]:norm(xi_chi), tx[xi,mu]:norm(xi_mu), tx[xi,phi]:norm(xi_phi), tx[xi,theta]:norm(xi_theta))$ ll1:[ [beta,phi], [theta,phi], [theta,beta], [mu,phi], [mu,beta], [mu,theta]]$ ll2:[ [chi,phi], [chi,beta], [chi,theta], [chi,mu], [xi,phi], [xi,beta], [xi,theta], [xi,mu], [xi,chi]]$ kill(tt)$ tt[i,j]:=if i=j then [] else block([v:tx[i,j],x:j,l:[]], for i:1 thru maxpow do block([l1:[],c:coeff(v,sin(2*i*x))], for j:i thru maxpow do l1:endcons(coeff(c,n,j),l1), l:endcons(l1,l)), l)$ texa(i,j,pow):=block([x:j,y:i,v:tt[i,j],s:"\\",sn:"\\sin "], x:concat(s,x), y:concat(s,y), print(concat(y, "-", x, "&=\\textstyle{}")), for k:1 thru pow do block([t:v[k],sgn,nterm:0,str:""], sgn:0, for l:1 thru pow-k+1 do block([m:t[l]], if m # 0 then (nterm:nterm+1, if sgn = 0 then sgn:if m>0 then 1 else -1) ), t:sgn*t, if sgn # 0 then block([f:true], str:concat(str,if sgn > 0 then "+" else "-"), if nterm > 1 then str:concat(str,"\\bigl("), for l:1 thru pow-k+1 do block([c:t[l]], if c # 0 then (sgn:if c > 0 then 1 else -1, c:sgn*c, if not f and nterm > 1 then str:concat(str,if sgn > 0 then "+" else "-"), f:false, if c # 1 then if integerp(c) then str:concat(str,c) else str:concat(str,"\\frac{",num(c),"}{",denom(c),"}"), if l+k-1 > 1 then str:concat(str,"n^{",l+k-1,"}") else str:concat(str,"n"))), if nterm > 1 then str:concat(str,"\\bigr)"), str:concat(str,sn,2*k,x)), print(str)), print(concat(if length(v)>pow and [pow+1][1] < 0 then "-" else "+","\\ldots\\\\")), 'done)$ cf(i,j):= ( print(concat("

&",i,"; − &",j,";:
")), for x in tt[i,j] do block([str:"   ["], for i:1 thru length(x) do str:concat(str,string(x[i]),if i"), print(str)), print(""), 'done)$ printfrac(x):=block([n:num(x),d:denom(x),sn,sd,m:2^31], sn:string(n), sd:concat("/",string(d)), if abs(n)>=m then sn:concat(sn,".0"), if d = 1 then sd:"" else (if d>=m or abs(n)1 then "," else ""), print(str)), print("};"), 'done)$ disptex(ll,pow):= block([linel:1000], print("\\f["), print("\\begin{align}"), for xx in ll do (texa(xx[1],xx[2],pow),texa(xx[2],xx[1],pow)), print("\\end{align}"), print("\\f]"))$ disphtml(ll):= block([linel:1000], for xx in ll do (cf(xx[1],xx[2]),cf(xx[2],xx[1])))$ dispcpp(ll):= block([linel:1000], for xx in ll do (cc(xx[1],xx[2]),cc(xx[2],xx[1])))$ dispall():=( print(""), disptex(ll1,4), print(""), disptex(ll2,3), print(""), disphtml(append(ll1,ll2)), print(""), dispcpp(append(ll1,ll2)))$ GeographicLib-1.52/maxima/ellint.mac0000644000771000077100000002006514064202371017245 0ustar ckarneyckarney/* Implementation of methods given in B. C. Carlson Computation of elliptic integrals Numerical Algorithms 10, 13-26 (1995) Copyright (c) Charles Karney (2009-2013) and licensed under the MIT/X11 License. For more information, see https://geographiclib.sourceforge.io/ */ /* fpprec:120$ Should be set outside */ etol:0.1b0^fpprec$ /* For Carlson */ tolRF : (3 * etol)^(1/8b0)$ tolRD : (etol/5)^(1/8b0)$ tolRG0 : 2.7b0 * sqrt(etol)$ tolJAC:sqrt(etol)$ /* For Bulirsch */ pi:bfloat(%pi)$ atan2x(y,x) := -atan2(-y, x)$ /* fix atan2(0b0,-1b0) = -pi */ rf(x,y,z) := block([a0:(x+y+z)/3, q,x0:x,y0:y,z0:z, an,ln,xx,yy,zz,e2,e3,mul:1b0], q:max(abs(a0-x),abs(a0-y),abs(a0-z))/tolRF, an:a0, while q >= mul * abs(an) do ( 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:mul*4), xx:(a0-x)/(mul*an), yy:(a0-y)/(mul*an), zz:-xx-yy, e2:xx*yy-zz^2, e3:xx*yy*zz, (e3 * (6930 * e3 + e2 * (15015 * e2 - 16380) + 17160) + e2 * ((10010 - 5775 * e2) * e2 - 24024) + 240240) / (240240 * 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,e2,e3,e4,e5,s:0b0,mul:1b0], q:max(abs(a0-x),abs(a0-y),abs(a0-z))/tolRD, an:a0, while q >= mul*abs(an) do ( ln:sqrt(x0)*sqrt(y0)+sqrt(y0)*sqrt(z0)+sqrt(z0)*sqrt(x0), s: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*mul), xx:(a0-x)/(mul*an), yy:(a0-y)/(mul*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, ((471240 - 540540 * e2) * e5 + (612612 * e2 - 540540 * e3 - 556920) * e4 + e3 * (306306 * e3 + e2 * (675675 * e2 - 706860) + 680680) + e2 * ((417690 - 255255 * e2) * e2 - 875160) + 4084080) / (4084080 * mul * an * sqrt(an)) + 3 * s)$ /* R_G(x,y,0) */ rg0(x,y) := block([x0:sqrt(max(x,y)),y0:sqrt(min(x,y)),xn,yn, t,s:0b0,mul:0.25b0], xn:x0, yn:y0, while abs(xn-yn) > tolRG0 * xn do ( t:(xn+yn)/2, yn:sqrt(xn*yn), xn:t, mul : 2*mul, s:s+mul*(xn-yn)^2), ((x0+y0)^2/4 - s)*pi/(2*(xn+yn)) )$ rg(x, y, z) := ( if z = 0b0 then (z:y, y:0b0), (z * rf(x, y, z) - (x-z) * (y-z) * rd(x, y, z) / 3 + sqrt(x * y / z)) / 2)$ rj(x, y, z, p) := block([A0:(x + y + z + 2*p)/5,An,delta:(p-x) * (p-y) * (p-z), Q,x0:x,y0:y,z0:z,p0:p,mul:1b0,mul3:1b0,s:0b0,X,Y,Z,P,E2,E3,E4,E5], An : A0, Q : max(abs(A0-x), abs(A0-y), abs(A0-z), abs(A0-p)) / tolRD, while Q >= mul * abs(An) do block([lam,d0,e0], lam : sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0), d0 : (sqrt(p0)+sqrt(x0)) * (sqrt(p0)+sqrt(y0)) * (sqrt(p0)+sqrt(z0)), e0 : delta/(mul3 * d0^2), s : s + rc(1b0, 1b0 + e0)/(mul * d0), An : (An + lam)/4, x0 : (x0 + lam)/4, y0 : (y0 + lam)/4, z0 : (z0 + lam)/4, p0 : (p0 + lam)/4, mul : 4*mul, mul3 : 64*mul3), X : (A0 - x) / (mul * An), Y : (A0 - y) / (mul * An), Z : (A0 - z) / (mul * An), P : -(X + Y + Z) / 2, E2 : X*Y + X*Z + Y*Z - 3*P*P, E3 : X*Y*Z + 2*P * (E2 + 2*P*P), E4 : (2*X*Y*Z + P * (E2 + 3*P*P)) * P, E5 : X*Y*Z*P*P, ((471240 - 540540 * E2) * E5 + (612612 * E2 - 540540 * E3 - 556920) * E4 + E3 * (306306 * E3 + E2 * (675675 * E2 - 706860) + 680680) + E2 * ((417690 - 255255 * E2) * E2 - 875160) + 4084080) / (4084080 * mul * An * sqrt(An)) + 6 * s)$ rd(x, y, z) := block([A0:(x + y + 3*z)/5,An,Q,x0:x,y0:y,z0:z, mul:1b0,s:0b0,X,Y,Z,E2,E3,E4,E5], An : A0, Q : max(abs(A0-x), abs(A0-y), abs(A0-z)) / tolRD, while Q >= mul * abs(An) do block([lam], lam : sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0), s : s + 1/(mul * sqrt(z0) * (z0 + lam)), An : (An + lam)/4, x0 : (x0 + lam)/4, y0 : (y0 + lam)/4, z0 : (z0 + lam)/4, mul : 4*mul), X : (A0 - x) / (mul * An), Y : (A0 - y) / (mul * An), Z : -(X + Y) / 3, E2 : X*Y - 6*Z*Z, E3 : (3*X*Y - 8*Z*Z)*Z, E4 : 3 * (X*Y - Z*Z) * Z*Z, E5 : X*Y*Z*Z*Z, ((471240 - 540540 * E2) * E5 + (612612 * E2 - 540540 * E3 - 556920) * E4 + E3 * (306306 * E3 + E2 * (675675 * E2 - 706860) + 680680) + E2 * ((417690 - 255255 * E2) * E2 - 875160) + 4084080) / (4084080 * mul * An * sqrt(An)) + 3 * s)$ rc(x, y):=if x < y then atan(sqrt((y - x) / x)) / sqrt(y - x) else ( if x = y and y > 0b0 then 1 / sqrt(y) else atanh( if y > 0b0 then sqrt((x - y) / x) else sqrt(x / (x - y)) ) / sqrt(x - y) )$ /* k^2 = m */ ec(k2):=2*rg0(1b0-k2,1b0)$ kc(k2):=rf(0b0,1b0-k2,1b0)$ dc(k2):=rd(0b0,1b0-k2,1b0)/3$ pic(k2,alpha2):=if alpha2 # 0b0 then kc(k2)+alpha2*rj(0b0,1b0-k2,1b0,1b0-alpha2)/3 else kc(k2)$ gc(k2,alpha2):=if alpha2 # 0b0 then (if k2 # 1b0 then kc(k2) + (alpha2-k2)*rj(0b0,1b0-k2,1b0,1b0-alpha2)/3 else rc(1b0,1b0-alpha2)) else ec(k2)$ hc(k2,alpha2):=if alpha2 # 0b0 then (if k2 # 1b0 then kc(k2) - (1b0-alpha2)*rj(0b0,1b0-k2,1b0,1b0-alpha2)/3 else rc(1b0,1b0-alpha2)) else kc(k2) - dc(k2)$ /* 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)<=tolJAC*a then return(false), mc:a*mc, a:c ), x:c*x, sn:sin(x), cn:cos(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] )$ Delta(sn, k2):=sqrt(1 - k2 * sn*sn)$ /* Versions of incomplete functions in terms of Jacobi elliptic function with u = am(phi) real and in [0,K(k2)] */ eirx(sn,cn,dn,k2,ec):=block([t,cn2:cn*cn,dn2:dn*dn,sn2:sn*sn,ei,kp2:1b0-k2], ei : (if k2 <= 0b0 then rf(cn2, dn2, 1b0) - k2 * sn2 * rd(cn2, dn2, 1b0) / 3 else (if kp2 >= 0b0 then kp2 * rf(cn2, dn2, 1b0) + k2 * kp2 * sn2 * rd(cn2, 1b0, dn2) / 3 + k2 * abs(cn) / dn else - kp2 * sn2 * rd(dn2, 1b0, cn2) / 3 + dn / abs(cn) ) ), ei : ei * abs(sn), if cn < 0b0 then ei : 2 * ec - ei, if sn < 0 then ei : -ei, ei)$ dirx(sn, cn, dn, k2, dc):=block( [di:abs(sn) * sn*sn * rd(cn*cn, dn*dn, 1b0) / 3], if cn < 0b0 then di : 2 * dc - di, if sn < 0b0 then di : -di, di)$ hirx(sn, cn, dn, k2, alpha2, hc):=block( [cn2 : cn*cn, dn2 : dn*dn, sn2 : sn*sn, hi, alphap2:1b0-alpha2], hi : abs(sn) * (rf(cn2, dn2, 1b0) - alphap2 * sn2 * rj(cn2, dn2, 1b0, cn2 + alphap2 * sn2) / 3), if cn < 0 then hi : 2 * hc - hi, if sn < 0 then hi : -hi, hi)$ deltae(sn, cn, dn, k2, ec):=( if cn < 0 then (cn : -cn, sn : -sn), eirx(sn, cn, dn, k2, ec) * (pi/2) / ec - atan2x(sn, cn))$ deltad(sn, cn, dn, k2, dc):=( if cn < 0 then (cn : -cn, sn : -sn), dirx(sn, cn, dn, k2, ec) * (pi/2) / dc - atan2x(sn, cn))$ deltah(sn, cn, dn, k2, alpha2, hc):=( if cn < 0 then (cn : -cn, sn : -sn), hirx(sn, cn, dn, k2, alpha2, hc) * (pi/2) / hc - atan2x(sn, cn))$ einv(x, k2, ec):=block( [n : floor(x / (2 * ec) + 0.5b0), phi, eps : k2/(sqrt(1b0-k2) + 1b0)^2, err:1b0], x : x - 2 * ec * n, phi : pi * x / (2 * ec), phi : phi - eps * sin(2 * phi) / 2, while abs(err) > tolJAC do block([sn:sin(phi), cn:cos(phi), dn], dn : Delta(sn, k2), err : (eirx(sn, cn, dn, k2, ec) - x)/dn, phi : phi - err), n * pi + phi)$ deltaeinv(stau, ctau, k2, ec) := block([tau], if ctau < 0 then (ctau : -ctau, stau : -stau), tau : atan2x(stau, ctau), einv(tau * ec / (pi/2), k2, ec) - tau)$ GeographicLib-1.52/maxima/gearea.mac0000644000771000077100000001135014064202371017177 0ustar ckarneyckarney/* Compute the series expansion for the great ellipse area. Copyright (c) Charles Karney (2014) and licensed under the MIT/X11 License. For more information, see https://geographiclib.sourceforge.io/ Area of great ellipse quad area from equator to phi dA = dlambda*b^2*sin(phi)/2* (1/(1-e^2*sin(phi)^2) + atanh(e*sin(phi))/(e*sin(phi))) Total area = 2*pi*(a^2 + b^2*atanh(e)/e) convert to beta using sin(phi)^2 = sin(beta)^2/(1-e^2*cos(beta)^2) dA = dlambda*sin(beta)/2* ( a^2*sqrt(1-e^2*cos(beta)^2) + b^2*atanh(e*sin(beta)/sqrt(1-e^2*cos(beta)^2)) /(e*sin(beta))) ) subst for great ellipse sin(beta) = cos(gamma0)*sin(sigma) dlambda = dsigma * sin(gamma0) / (1 - cos(gamma0)^2*sin(sigma)^2) (1-e^2*cos(beta)^2) = (1-e^2)*(1+k^2*sin(sigma)^2) k^2 = ep^2*cos(gamma0)^2 e*sin(beta) = sqrt(1-e^2)*k*sin(sigma) dA = dsigma*sin(gamma0)*cos(gamma0)*sin(sigma)/2*e^2*a^2*sqrt(1+ep^2)* ( (1+k^2*sin(sigma)^2) + atanh(k*sin(sigma)/sqrt(1+k^2*sin(sigma)^2)) / (k*sin(sigma))) ) / (ep^2 - k^2*sin(sigma)^2) Spherical case radius c, c^2 = a^2/2 + b^2/2*atanh(e)/e dA0 = dsigma*sin(gamma0)*cos(gamma0)*sin(sigma)/2* ( a^2 + b^2*atanh(e)/e) / (1 - cos(gamma0)^2*sin(sigma)^2) = dsigma*sin(gamma0)*cos(gamma0)*sin(sigma)/2*e^2*a^2*sqrt(1+ep^2) ( sqrt(1+ep^2) + atanh(ep/sqrt(1+ep^2))/ep ) / (ep^2 - k^2*sin(sigma)^2) dA-dA0 = dsigma*sin(gamma0)*cos(gamma0)*sin(sigma)/2*e^2*a^2*sqrt(1+ep^2)* -( ( sqrt(1+ep^2) + atanh(ep/sqrt(1+ep^2))/ep ) - ( sqrt(1+k^2*sin(sigma)^2) + atanh(k*sin(sigma)/sqrt(1+k^2*sin(sigma)^2)) / (k*sin(sigma)) ) ) / / (ep^2 - k^2*sin(sigma)^2) atanh(y/sqrt(1+y^2)) = asinh(y) dA-dA0 = dsigma*sin(gamma0)*cos(gamma0)*sin(sigma)/2*e^2*a^2* - ( ( sqrt(1+ep^2) + asinh(ep)/ep ) - ( sqrt(1+k^2*sin(sigma)^2) + asinh(k*sin(sigma)) / (k*sin(sigma)) ) ) / / (ep^2 - k^2*sin(sigma)^2) r(x) = sqrt(1+x) + asinh(sqrt(x))/sqrt(x) dA-dA0 = e^2*a^2*dsigma*sin(gamma0)*cos(gamma0)* - ( r(ep^2) - r(k^2*sin(sigma)^2)) / ( ep^2 - k^2*sin(sigma)^2 ) * sin(sigma)/2*sqrt(1+ep^2)* subst ep^2=4*n/(1-n)^2 -- second eccentricity in terms of third flattening ellipse semi axes = [a, a * sqrt(1-e^2*cos(gamma0)^2)] third flattening for ellipsoid eps = (1 - sqrt(1-e^2*cos(gamma0)^2)) / (1 + sqrt(1-e^2*cos(gamma0)^2)) e^2*cos(gamma0)^2 = 4*eps/(1+eps)^2 -- 1st ecc in terms of 3rd flattening k2=((1+n)/(1-n))^2 * 4*eps/(1+eps)^2 Taylor expand in n and eps, integrate, trigreduce */ taylordepth:5$ jtaylor(expr,var1,var2,ord):=block([zz],expand(subst([zz=1], ratdisrep(taylor(subst([var1=zz*var1,var2=zz*var2],expr),zz,0,ord)))))$ /* Great ellipse via r */ computeG4(maxpow):=block([int,r,intexp,area, x,ep2,k2], maxpow:maxpow-1, r : sqrt(1+x) + asinh(sqrt(x))/sqrt(x), int:-(rf(ep2) - rf(k2*sin(sigma)^2)) / (ep2 - k2*sin(sigma)^2) * sin(sigma)/2*sqrt(1+ep2), int:subst([rf(ep2)=subst([x=ep2],r), rf(k2*sin(sigma)^2)=subst([x=k2*sin(sigma)^2],r)], int), int:subst([abs(sin(sigma))=sin(sigma)],int), int:subst([k2=((1+n)/(1-n))^2 * 4*eps/(1+eps)^2,ep2=4*n/(1-n)^2],int), intexp:jtaylor(int,n,eps,maxpow), area:trigreduce(integrate(intexp,sigma)), area:expand(area-subst(sigma=%pi/2,area)), for i:0 thru maxpow do G4[i]:coeff(area,cos((2*i+1)*sigma)), if expand(area-sum(G4[i]*cos((2*i+1)*sigma),i,0,maxpow)) # 0 then error("left over terms in G4"), 'done)$ codeG4(maxpow):=block([tab1:" ",nn:maxpow,c], c:0, for m:0 thru nn-1 do block( [q:jtaylor(G4[m],n,eps,nn-1), linel:1200], for j:m thru nn-1 do ( print(concat(tab1,"G4x(",c,"+1) = ", string(horner(coeff(q,eps,j))),";")), c:c+1) ), 'done)$ dispG4(ord):=(ord:ord-1,for i:0 thru ord do block([tt:jtaylor(G4[i],n,eps,ord), ttt,t4,linel:1200], 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("G4[",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,")"), if j>0 then s:concat(s," * ", string(eps^j)), print(concat(s,if j = ord then ";" else ""))))))$ maxpow:6$ (computeG4(maxpow), print(""), codeG4(maxpow), print(""), dispG4(maxpow))$ GeographicLib-1.52/maxima/geod.mac0000644000771000077100000004545014064202371016701 0ustar ckarneyckarney/* Compute the series expansions for the ellipsoidal geodesic problem. Copyright (c) Charles Karney (2009-2015) and licensed under the MIT/X11 License. For more information, see https://geographiclib.sourceforge.io/ References: Charles F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013), https://doi.org/10.1007/s00190-012-0578-z Addenda: https://geographiclib.sourceforge.io/geod-addenda.html 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 about 10 secs. If you want to compute accurate geodesics using geodesic.mac, then you need alse to uncomment the last line of this file so that the series get saved as geodNN.lsp. 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):=block([zz],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, https://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/(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), 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. It is convenient to write k2 = 4 * eps / (1 - eps)^2 and ep2 = 4 * n / (1 - n)^2 and to expand in eps and n. This procedure leads to a series which converges even for very eccentric ellipsoids. */ 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), int:subst([k2=4*eps/(1-eps)^2,ep2=4*n/(1-n)^2],int), intexp:jtaylor(int,n,eps,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. GEOGRAPHICLIB_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 (d/dsigma)I1 - 1 Math::real Geodesic::A1m1f(real eps) { real eps2 = Math::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:1200], print(concat(tab2,"case ",string(n),":")), print(concat(tab3,"t = ",string(q),";")), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"GEOGRAPHICLIB_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[]) { real eps2 = Math::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:1200], 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,"GEOGRAPHICLIB_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[]) { real eps2 = Math::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:1200], 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,"GEOGRAPHICLIB_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 (d/dsigma)I2 - 1 Math::real Geodesic::A2m1f(real eps) { real eps2 = Math::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:1200], print(concat(tab2,"case ",string(n),":")), print(concat(tab3,"t = ",string(q),";")), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"GEOGRAPHICLIB_STATIC_ASSERT(nA2_ >= ",string(0), " && nA2_ <= ",string(maxpow),", \"Bad value of nA2_\");")), print(concat(tab3,"t = 0;")), print(" } return (t - eps) / (1 + 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[]) { real eps2 = Math::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:1200], 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,"GEOGRAPHICLIB_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 (d/dsigma)I3 void Geodesic::A3coeff() { 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:1200], 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,"GEOGRAPHICLIB_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() { 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:1200], 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,"GEOGRAPHICLIB_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() { 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([n=_n],C4[m]),_n,eps,nn-1), linel:1200], for j:m thru nn-1 do ( print(concat(tab3,"_C4x[",c,"] = ", string(horner(coeff(q,eps,j))),";")), c:c+1) ), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"GEOGRAPHICLIB_STATIC_ASSERT(nC4_ >= ",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:1200], 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:1200], 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:1200], 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:1200], 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:1200], 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:1200,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:1200], 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],n,eps,ord), ttt,t4,linel:1200], 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("C4[",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,")"), if j>0 then s:concat(s," * ", string(eps^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 8 10 19 12 43 20 571 30 6671 (111m) */ maxpow:8$ computeall()$ /* printcode()$ */ dispseries()$ load("polyprint.mac")$ printgeod():= block([macro:if simplenum then "GEOGRAPHICLIB_GEODESIC_ORDER" else "GEOGRAPHICLIB_GEODESICEXACT_ORDER"], value1('(A1*(1-eps)-1),'eps,2,0), array1('C1,'eps,2,0), array1('C1p,'eps,2,0), value1('(A2*(1+eps)-1),'eps,2,0), array1('C2,eps,2,0), value2('A3,'n,'eps,1), array2('C3,'n,'eps,1), array2('C4,'n,'eps,1))$ printgeod()$ /* Save the values needed for geodesic.mac This is commented out here to avoid accidentally overwriting files in a user's directory. */ /* (file:concat("geod",maxpow,".lsp"), save(file, values, arrays))$ */ GeographicLib-1.52/maxima/geodesic.mac0000644000771000077100000014203214064202371017537 0ustar ckarneyckarney/* Solve the direct and inverse geodesic problems accurately. Copyright (c) Charles Karney (2013-2021) and licensed under the MIT/X11 License. For more information, see https://geographiclib.sourceforge.io/ References: Charles F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013), https://doi.org/10.1007/s00190-012-0578-z Addenda: https://geographiclib.sourceforge.io/geod-addenda.html This program solves the geodesic problem either using series expansions (exact : false) or using elliptic integrals (exact : true). Elliptic integrals give reliably high accuracy (especially when f is large). Note that the area calculation always uses the series expansion (I don't know how to express the integrals in terms of elliptic integrals). Before running this file, you need to compute and save the series expansions by editing geod.mac setting maxpow appropriately (near the end of the file) and uncommenting the last line (to save the results). If you're testing the accuracy of the series expansions (exact : false) or if you're interested in accurate results for the area, that pick a largish value of maxpow (e.g., 20). This program can truncate the series to a smaller power. If you just want to compute accurate geodesics and are not interested in the area, then use elliptic integrals (exact : true) and leave maxpow at some small value (6 or 8). To use this program, (1) Edit the file name for the series "geod30.lsp" to reflect the value of maxpow that you used. (2) Set fpprec (the number of decimal digits of precision). (3) Set exact (true for elliptic integrals, false for series). (4) If exact = false, set the order of the series you want to use, by replacing the "20" in min(maxpow,20) below. (5) Start maxima and run load("geodesic.mac")$ (If you want to change fpprec, exact, or the order of the series, you should edit this file and run this command again.) (6) Define an ellipsoid with g:geod_init(radius, flattening)$ The ellipsoids wgs84 and grs80 are pre-defined. (7) To solve a direct problem, run geod_direct(ellipsoid, lat1, lon1, azi1, s12); e.g., geod_direct(wgs84, -30, 0, 45, 1b7); This returns a list, [a12, lat2, lon2, azi2, s12, m12, M12, M21, S12], e.g., [9.00979560785581153132573611946234278938679821643464129576496b1, 3.795350501490084914310911431201705948430953526031024848204b1, 6.3403810943391419431089434638892210208040664981080107562114b1, 5.09217379721155238753530133334186917347878103616352193700526b1,1.0b7, 6.35984161356437923135381788735707599997546833534230510111197b6, -1.42475315175601879366432145888870774855600761387337970018946b-3, -7.47724030796032158868881196081763293754486469000152919698785b-4, 4.18229766667689593851692491830627309580972454148317773382384b12] (8) To solve an inverse problem, run geod_inverse(ellipsoid, lat1, lon1, lat2, lon2); e.g., geod_inverse(wgs84, -30, 0, 29.9b0, 179.9b0); This returns a list, [a12, s12, azi1, azi2, m12, M12, M21, S12], e.g., [1.79898924051433853264945993266804037171884583041584874134816b2, 1.99920903023269266279365620501124020214744990997998731526732b7, 1.70994569965518052741917124376016361591705298855243347424863b2, 8.99634915141674951478756137150809390696858860117887233257945b0, 6.04691725017600149958466836698242794713940408239599801996017b4, -9.95488849775559128989753386111595867497859420132749768254471b-1, -1.00448979492598025351148808245250847420628601706577993586242b0, -1.14721359300439474273586680489951630835335433189068889945966b14] (9) Use geod_polygonarea(ellipsoid, points) to compute polygon areas. (10) The interface is copied from the C library for geodesics which is documented at https://geographiclib.sourceforge.io/html/C/index.html */ /* The corresponding version of GeographicLib */ geod_version:[1,52,0]$ /* Load series created by geod.mac (NEED TO UNCOMMENT THE LAST LINE OF geod.mac TO GENERATE THIS FILE). */ load("geod30.lsp")$ /* Edit to reflect precision and order of the series to be used */ ( fpprec:60, exact:true, GEOGRAPHICLIB_GEODESIC_ORDER:if exact then maxpow else min(maxpow,20))$ if exact then load("ellint.mac")$ ( nA1 :GEOGRAPHICLIB_GEODESIC_ORDER, nC1 :GEOGRAPHICLIB_GEODESIC_ORDER, nC1p :GEOGRAPHICLIB_GEODESIC_ORDER, nA2 :GEOGRAPHICLIB_GEODESIC_ORDER, nC2 :GEOGRAPHICLIB_GEODESIC_ORDER, nA3 :GEOGRAPHICLIB_GEODESIC_ORDER, nA3x :nA3, nC3 :GEOGRAPHICLIB_GEODESIC_ORDER, nC3x :((nC3 * (nC3 - 1)) / 2), nC4 :GEOGRAPHICLIB_GEODESIC_ORDER, nC4x :((nC4 * (nC4 + 1)) / 2) )$ taylordepth:5$ jtaylor(expr,var1,var2,ord):=expand(subst([zz=1], ratdisrep(taylor(subst([var1=zz*var1,var2=zz*var2],expr),zz,0,ord))))$ ataylor(expr,var,ord):=expand(ratdisrep(taylor(expr,var,0,ord)))$ if not exact then ( A1m1f(eps):=''((horner(ataylor(A1*(1-eps)-1,eps,nA1)) +eps)/(1-eps)), C1f(eps):=''(block([l:[]],for i:1 thru nC1 do l:endcons(horner(ataylor(C1[i],eps,nC1)),l),l)), C1pf(eps):=''(block([l:[]],for i:1 thru nC1p do l:endcons(horner(ataylor(C1p[i],eps,nC1p)),l),l)), A2m1f(eps):=''((horner(ataylor(A2*(1+eps)-1,eps,nA2)) -eps)/(1+eps)), C2f(eps):=''(block([l:[]],for i:1 thru nC2 do l:endcons(horner(ataylor(C2[i],eps,nC2)),l),l)), A3coeff(n):= ''(block([q:jtaylor(A3,n,eps,nA3-1),l:[]], for i:0 thru nA3-1 do l:endcons(horner(coeff(q,eps,i)),l), l)), C3coeff(n):= ''(block([q,l:[]], for m:1 thru nC3-1 do ( q:jtaylor(C3[m],n,eps,nC3-1), for j:m thru nC3-1 do l:endcons(horner(coeff(q,eps,j)),l)), l)))$ C4coeff(n):= ''(block([q,l:[]], for m:0 thru nC4-1 do ( q:jtaylor(C4[m],n,eps,nC4-1), for j:m thru nC4-1 do l:endcons(horner(coeff(q,eps,j)),l)), l))$ ( digits:floor((fpprec-1)*log(10.0)/log(2.0)), epsilon : 0.5b0^(digits - 1), realmin : 0.1b0^(3*fpprec), pi : bfloat(%pi), maxit1 : 100, maxit2 : maxit1 + digits + 10, tiny : sqrt(realmin), tol0 : epsilon, tol1 : 200 * tol0, tol2 : sqrt(tol0), tolb : tol0 * tol2, xthresh : 1000 * tol2, degree : pi/180, NaN : 'nan )$ sq(x):=x^2$ hypotx(x, y):=sqrt(x * x + y * y)$ /* doesn't handle -0.0 */ copysign(x, y):=abs(x) * (if y < 0b0 then -1 else 1)$ /* pow(x,y):=x^y$ cbrtx(x) := block([y:pow(abs(x), 1/3b0)], if x < 0b0 then -y else y)$ */ cbrtx(x):=x^(1/3)$ sumx(u, v):=block([s,up,vpp,t], s : u + v, up : s - v, vpp : s - up, up : up-u, vpp : vpp-v, t : -(up + vpp), [s,t])$ swapx(x, y):=[y,x]$ norm2(x, y):=block([r : hypotx(x, y)], [x/r, y/r])$ AngNormalize(x):=block([y:x-360b0*round(x/360b0)], if y <= -180b0 then y+360b0 else if y <= 180b0 then y else y-360b0)$ AngDiff(x, y) := block([t,d,r:sumx(AngNormalize(-x),AngNormalize(y))], d:AngNormalize(r[1]), t:r[2], sumx(if d = 180b0 and t > 0b0 then -180b0 else d, t))$ AngRound(x) := block([z:1/16b0, y:abs(x)], if x = 0b0 then return(x), y : if y < z then z - (z - y) else y, if x < 0b0 then -y else y)$ sincosdx(x):=block([r,q:round(x/90b0),s,c], r:(x-q*90b0)*degree, s:sin(r), c:cos(r), q:mod(q,4), r: if q = 0 then [ s, c] elseif q = 1 then [ c, -s] elseif q = 2 then [-s, -c] else [-c, s], if x # 0b0 then r:0b0+r, r)$ atan2dx(y,x):=block([q,xx,yy,ang], if abs(y) > abs(x) then (xx:y, yy:x, q:2) else (xx:x, yy:y, q:0), if xx < 0 then (xx:-xx, q:q+1), ang:atan2(yy, xx) / degree, if q = 0 then ang elseif q = 1 then (if y >= 0b0 then 180b0 else -180b0) - ang elseif q = 2 then 90 - ang else -90 + ang)$ /* Indices in geodesic struct */ block([i:0], g_a:(i:i+1), g_f:(i:i+1), g_f1:(i:i+1), g_e2:(i:i+1), g_ep2:(i:i+1), g_n:(i:i+1), g_b:(i:i+1), g_c2:(i:i+1), g_etol2:(i:i+1), g_A3x:(i:i+1), g_C3x:(i:i+1), g_C4x:(i:i+1) )$ geod_init(a, f):= (a:bfloat(a),f:bfloat(f), block([f1,e2,ep2,n,b,c2,etol2], f1:1-f, e2:f*(2-f), ep2:e2/f1^2, n:f/(2-f), b:a*f1, c2 : (sq(a) + sq(b) * (if e2 = 0b0 then 1b0 else (if e2 > 0b0 then atanh(sqrt(e2)) else atan(sqrt(-e2))) / sqrt(abs(e2))))/2, /* authalic radius squared */ /* The sig12 threshold for "really short". Using the auxiliary sphere solution with dnm computed at (bet1 + bet2) / 2, the relative error in the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a given f and sig12, the max error occurs for lines near the pole. If the old rule for computing dnm = (dn1 + dn2)/2 is used, then the error increases by a factor of 2.) Setting this equal to epsilon gives sig12 = etol2. Here 0.1 is a safety factor (error decreased by 100) and max(0.001, abs(f)) stops etol2 getting too large in the nearly spherical case. */ etol2 : 0.1b0 * tol2 / sqrt( max(0.001b0, abs(f)) * min(1b0, 1-f/2) / 2 ), [ a, f, f1, e2, ep2, n, b, c2, etol2, if exact then [] else bfloat(A3coeff(n)), if exact then [] else bfloat(C3coeff(n)), bfloat(C4coeff(n))]))$ /* Indices into geodesicline struct */ block([i:0], l_lat1:(i:i+1), l_lon1:(i:i+1), l_azi1:(i:i+1), l_a:(i:i+1), l_f:(i:i+1), l_b:(i:i+1), l_c2:(i:i+1), l_f1:(i:i+1), l_salp0:(i:i+1), l_calp0:(i:i+1), l_k2:(i:i+1), l_salp1:(i:i+1), l_calp1:(i:i+1), l_ssig1:(i:i+1), l_csig1:(i:i+1), l_dn1:(i:i+1), l_stau1:(i:i+1), l_ctau1:(i:i+1), l_somg1:(i:i+1), l_comg1:(i:i+1), if exact then (l_e2:(i:i+1), l_cchi1:(i:i+1), l_A4:(i:i+1), l_B41:(i:i+1), l_E0:(i:i+1), l_D0:(i:i+1), l_H0:(i:i+1), l_E1:(i:i+1), l_D1:(i:i+1), l_H1:(i:i+1), l_C4a:(i:i+1), l_E:(i:i+1), e_k2:1, e_alpha2:2, e_ec:3, e_dc:4, e_hc:5) else (l_A1m1:(i:i+1), l_A2m1:(i:i+1), l_A3c:(i:i+1), l_B11:(i:i+1), l_B21:(i:i+1), l_B31:(i:i+1), l_A4:(i:i+1), l_B41:(i:i+1), l_C1a:(i:i+1), l_C1pa:(i:i+1), l_C2a:(i:i+1), l_C3a:(i:i+1), l_C4a:(i:i+1) ))$ Ef(k2, alpha2):=if exact then [k2, alpha2, ec(k2), dc(k2), hc(k2, alpha2)] else []$ geod_lineinit(g,lat1,lon1,azi1):=block([a, f, b, c2, f1, salp0, calp0, k2, salp1, calp1, ssig1, csig1, dn1, stau1, ctau1, somg1, comg1, A1m1, A2m1, A3c, B11, B21, B31, A4, B41, C1a, C1pa, C2a, C3a, C4a, cbet1, sbet1, eps, e2, cchi1, A4, B41, E0, D0, H0, E1, D1, H1, C4a, E], lat1:bfloat(lat1),lon1:bfloat(lon1), azi1:bfloat(azi1), a : g[g_a], f : g[g_f], b : g[g_b], c2 : g[g_c2], f1 : g[g_f1], e2 : g[g_e2], lat1 : lat1, /* If caps is 0 assume the standard direct calculation caps = (caps ? caps : GEOD_DISTANCE_IN | GEOD_LONGITUDE) | GEOD_LATITUDE | GEOD_AZIMUTH, Always allow latitude and azimuth Guard against underflow in salp0 */ azi1 : AngNormalize(azi1), /* Don't normalize lon1... */ block([t:sincosdx(AngRound(azi1))], salp1:t[1], calp1:t[2]), block([t:sincosdx(AngRound(lat1))], sbet1:t[1], cbet1:t[2]), sbet1 : f1 * sbet1, block([t:norm2(sbet1, cbet1)], sbet1:t[1], cbet1:t[2]), /* Ensure cbet1 = +epsilon at poles */ cbet1 = max(tiny, cbet1), dn1 : sqrt(1 + g[g_ep2] * sq(sbet1)), /* 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 : hypotx(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 : if sbet1 # 0b0 or calp1 # 0b0 then cbet1 * calp1 else 1b0, /* Without normalization we have schi1 = somg1. */ cchi1 : f1 * dn1 * comg1, /* sig1 in (-pi, pi] */ block([t:norm2(ssig1, csig1)], ssig1:t[1], csig1:t[2]), /* norm2 (somg1, comg1); -- don't need to normalize! norm2 (schi1, cchi1); -- don't need to normalize! */ k2 : sq(calp0) * g[g_ep2], eps : k2 / (2 * (1 + sqrt(1 + k2)) + k2), E:Ef(-k2,-g[g_ep2]), block([s,c], if exact then (E0 : E[e_ec]/(pi/2), E1 : deltae(ssig1,csig1,dn1,E[e_k2],E[e_ec]), s:sin(E1),c:cos(E1)) else ( A1m1 : A1m1f(eps), C1a : C1f(eps), B11 : SinCosSeries(true, ssig1, csig1, C1a), 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 exact then (D0 : E[e_dc]/(pi/2), D1 : deltad(ssig1, csig1, dn1, E[e_k2], E[e_dc]), H0 : E[e_hc]/(pi/2), H1 : deltah(ssig1, csig1, dn1, E[e_k2], E[e_alpha2], E[e_hc])) else ( C1pa: C1pf(eps), A2m1 : A2m1f(eps), C2a : C2f(eps), B21 : SinCosSeries(true, ssig1, csig1, C2a), C3a : C3f(g, eps), A3c : -f * salp0 * A3f(g, eps), B31 : SinCosSeries(true, ssig1, csig1, C3a)), C4a : C4f(g, eps), /* Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) */ A4 : sq(a) * calp0 * salp0 * e2, B41 : SinCosSeries(false, ssig1, csig1, C4a), if exact then [ lat1, lon1, azi1, a, f, b, c2, f1, salp0, calp0, k2, salp1, calp1, ssig1, csig1, dn1, stau1, ctau1, somg1, comg1, e2, cchi1, A4, B41, E0, D0, H0, E1, D1, H1, C4a, E] else [ lat1, lon1, azi1, a, f, b, c2, f1, salp0, calp0, k2, salp1, calp1, ssig1, csig1, dn1, stau1, ctau1, somg1, comg1, A1m1, A2m1, A3c, B11, B21, B31, A4, B41, C1a, C1pa, C2a, C3a, C4a] )$ /* Return [a12, lat2, lon2, azi2, s12, m12, M12, M21, S12] */ geod_genposition(l, arcmode, s12_a12):=block( [ lat2 : 0, lon2 : 0, azi2 : 0, s12 : 0, m12 : 0, M12 : 0, M21 : 0, S12 : 0, /* Avoid warning about uninitialized B12. */ sig12, ssig12, csig12, B12 : 0, E2 : 0, AB1 : 0, omg12, lam12, lon12, ssig2, csig2, sbet2, cbet2, somg2, comg2, salp2, calp2, dn2, E], s12_a12 : bfloat(s12_a12), if (arcmode) then ( /* Interpret s12_a12 as spherical arc length */ sig12 : s12_a12 * degree, block([t:sincosdx(s12_a12)], ssig12:t[1], csig12:t[2])) else block([tau12 : s12_a12 / (l[l_b] * (if exact then l[l_E0] else (1 + l[l_A1m1]))),s,c], /* Interpret s12_a12 as distance */ s : sin(tau12), c : cos(tau12), /* tau2 = tau1 + tau12 */ if exact then (E2 : - deltaeinv(l[l_stau1] * c + l[l_ctau1] * s, l[l_ctau1] * c - l[l_stau1] * s, l[l_E][e_k2], l[l_E][e_ec]), sig12 : tau12 - (E2 - l[l_E1]), ssig12 : sin(sig12), csig12 : cos(sig12)) else (B12 : - SinCosSeries(true, l[l_stau1] * c + l[l_ctau1] * s, l[l_ctau1] * c - l[l_stau1] * s, l[l_C1pa]), sig12 : tau12 - (B12 - l[l_B11]), ssig12 : sin(sig12), csig12 : cos(sig12), if abs(l[l_f]) > 0.01 then block( /* Reverted distance series is inaccurate for |f| > 1/100, so correct sig12 with 1 Newton iteration. The following table shows the approximate maximum error for a = WGS_a() and various f relative to GeodesicExact. erri = the error in the inverse solution (nm) errd = the error in the direct solution (series only) (nm) errda = the error in the direct solution (series + 1 Newton) (nm) f erri errd errda -1/5 12e6 1.2e9 69e6 -1/10 123e3 12e6 765e3 -1/20 1110 108e3 7155 -1/50 18.63 200.9 27.12 -1/100 18.63 23.78 23.37 -1/150 18.63 21.05 20.26 1/150 22.35 24.73 25.83 1/100 22.35 25.03 25.31 1/50 29.80 231.9 30.44 1/20 5376 146e3 10e3 1/10 829e3 22e6 1.5e6 1/5 157e6 3.8e9 280e6 */ [ssig2 : l[l_ssig1] * csig12 + l[l_csig1] * ssig12, csig2 : l[l_csig1] * csig12 - l[l_ssig1] * ssig12, serr], B12 : SinCosSeries(true, ssig2, csig2, l[l_C1a]), serr : (1 + l[l_A1m1]) * (sig12 + (B12 - l[l_B11])) - s12_a12 / l[l_b], sig12 : sig12 - serr / sqrt(1 + l[l_k2] * sq(ssig2)), ssig12 : sin(sig12), csig12 : cos(sig12) /* Update B12 below */ ))), /* sig2 = sig1 + sig12 */ ssig2 : l[l_ssig1] * csig12 + l[l_csig1] * ssig12, csig2 : l[l_csig1] * csig12 - l[l_ssig1] * ssig12, dn2 : sqrt(1 + l[l_k2] * sq(ssig2)), if exact then (if arcmode then E2 : deltae(ssig2, csig2, dn2, l[l_E][e_k2], l[l_E][e_ec]), AB1 : l[l_E0] * (E2 - l[l_E1])) else (if arcmode or abs(l[l_f]) > 0.01b0 then B12 : SinCosSeries(true, ssig2, csig2, l[l_C1a]), AB1 : (1 + l[l_A1m1]) * (B12 - l[l_B11])), /* sin(bet2) = cos(alp0) * sin(sig2) */ sbet2 : l[l_calp0] * ssig2, /* Alt: cbet2 = hypot(csig2, salp0 * ssig2); */ cbet2 : hypotx(l[l_salp0], l[l_calp0] * csig2), if cbet2 = 0b0 then /* I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case */ cbet2 : csig2 : tiny, if not exact then ( /* tan(omg2) = sin(alp0) * tan(sig2) */ somg2 : l[l_salp0] * ssig2, comg2 : csig2), /* No need to normalize */ /* tan(alp0) = cos(sig2)*tan(alp2) */ salp2 : l[l_salp0], calp2 : l[l_calp0] * csig2, /* No need to normalize */ E : copysign(1b0, l[l_salp0]), if not exact then /* omg12 = omg2 - omg1 */ omg12 : E * (sig12 - (atan2( ssig2, csig2) - atan2( l[l_ssig1], l[l_csig1])) + (atan2(E*somg2, comg2) - atan2(E*l[l_somg1], l[l_comg1]))), s12 : if arcmode then l[l_b] * ((if exact then l[l_E0] else (1 + l[l_A1m1])) * sig12 + AB1) else s12_a12, if exact then block([somg2:l[l_salp0] * ssig2, comg2 : csig2, /* No need to normalize */ cchi2], /* Without normalization we have schi2 = somg2. */ cchi2 : l[l_f1] * dn2 * comg2, lam12 : E * (sig12 - (atan2( ssig2, csig2) - atan2( l[l_ssig1], l[l_csig1])) + (atan2(E*somg2, cchi2) - atan2(E*l[l_somg1], l[l_cchi1]))) - l[l_e2]/l[l_f1] * l[l_salp0] * l[l_H0] * (sig12 + deltah(ssig2, csig2, dn2, l[l_E][e_k2], l[l_E][e_alpha2], l[l_E][e_hc]) - l[l_H1] ) ) else lam12 : omg12 + l[l_A3c] * ( sig12 + (SinCosSeries(true, ssig2, csig2, l[l_C3a]) - l[l_B31])), lon12 : lam12 / degree, /* Don't normalize lon2... */ lon2 : l[l_lon1] + lon12, lat2 : atan2dx(sbet2, l[l_f1] * cbet2), azi2 : atan2dx(salp2, calp2), block([B22, AB2, J12], if exact then J12 : l[l_k2] * l[l_D0] * (sig12 + deltad(ssig2, csig2, dn2, l[l_E][e_k2], l[l_E][e_dc]) - l[l_D1]) else ( B22 : SinCosSeries(true, ssig2, csig2, l[l_C2a]), AB2 : (1 + l[l_A2m1]) * (B22 - l[l_B21]), J12 : (l[l_A1m1] - l[l_A2m1]) * sig12 + (AB1 - AB2)), /* Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure accurate cancellation in the case of coincident points. */ m12 : l[l_b] * ((dn2 * (l[l_csig1] * ssig2) - l[l_dn1] * (l[l_ssig1] * csig2)) - l[l_csig1] * csig2 * J12), block([t : l[l_k2] * (ssig2 - l[l_ssig1]) * (ssig2 + l[l_ssig1]) / (l[l_dn1] + dn2)], M12 : csig12 + (t * ssig2 - csig2 * J12) * l[l_ssig1] / l[l_dn1], M21 : csig12 - (t * l[l_ssig1] - l[l_csig1] * J12) * ssig2 / dn2)), block([ B42 : SinCosSeries(false, ssig2, csig2, l[l_C4a]), salp12, calp12], if l[l_calp0] = 0b0 or l[l_salp0] = 0b0 then ( /* alp12 = alp2 - alp1, used in atan2 so no need to normalize */ salp12 : salp2 * l[l_calp1] - calp2 * l[l_salp1], calp12 : calp2 * l[l_calp1] + salp2 * l[l_salp1]) 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 : l[l_calp0] * l[l_salp0] * ( if csig12 <= 0b0 then l[l_csig1] * (1 - csig12) + ssig12 * l[l_ssig1] else ssig12 * (l[l_csig1] * ssig12 / (1 + csig12) + l[l_ssig1])), calp12 : sq(l[l_salp0]) + sq(l[l_calp0]) * l[l_csig1] * csig2), S12 : l[l_c2] * atan2(salp12, calp12) + l[l_A4] * (B42 - l[l_B41])), [if arcmode then s12_a12 else sig12 / degree, lat2, lon2, azi2, s12, m12, M12, M21, S12])$ geod_position(l, s12) := geod_genposition(l, false, s12)$ geod_gendirect(g, lat1, lon1, azi1, arcmode, s12_a12):= block([l:geod_lineinit(g, lat1, lon1, azi1)], geod_genposition(l, arcmode, s12_a12))$ geod_direct(g, lat1, lon1, azi1, s12):= geod_gendirect(g, lat1, lon1, azi1, false, s12)$ /* Return [a12, s12, azi1, azi2, m12, M12, M21, S12] */ geod_geninverse(g, lat1, lon1, lat2, lon2):=block( [s12 : 0b0, azi1 : 0b0, azi2 : 0b0, m12 : 0b0, M12 : 0b0, M21 : 0b0, S12 : 0b0, lon12, lon12s, latsign, lonsign, swapp, sbet1, cbet1, sbet2, cbet2, s12x : 0b0, m12x : 0b0, dn1, dn2, lam12, slam12, clam12, a12 : 0b0, sig12, calp1 : 0b0, salp1 : 0b0, calp2 : 0b0, salp2 : 0b0, meridian, omg12 : 0b0, somg12 : 2b0, comg12, /* Initialize for the meridian. No longitude calculation is done in this case to let the parameter default to 0. */ E : Ef(-g[g_ep2], 0b0)], lat1:bfloat(lat1),lon1:bfloat(lon1), lat2:bfloat(lat2),lon2:bfloat(lon2), /* Compute longitude difference (AngDiff does this carefully). Result is in [-180, 180] but -180 is only for west-going geodesics. 180 is for east-going and meridional geodesics. */ lon12 : AngDiff(lon1, lon2), lon12s:lon12[2], lon12:lon12[1], /* Make longitude difference positive. */ lonsign : if lon12 >= 0b0 then 1 else -1, /* If very close to being on the same half-meridian, then make it so. */ lon12 : lonsign * AngRound(lon12), lon12s : AngRound((180 - lon12) - lonsign * lon12s), lam12 : lon12 * degree, if lon12 > 90 then block([t:sincosdx(lon12s)], slam12:t[1], clam12:-t[2]) else block([t:sincosdx(lon12)], slam12:t[1], clam12:t[2]), /* 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 */ swapp : if abs(lat1) >= abs(lat2) then 1 else -1, if swapp < 0 then (lonsign : -lonsign, block([t:swapx(lat1, lat2)], lat1:t[1], lat2:t[2])), /* Make lat1 <= 0 */ latsign : if lat1 < 0b0 then 1 else -1, lat1 : lat1 * latsign, lat2 : 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. */ block([t:sincosdx(lat1)], sbet1:t[1], cbet1:t[2]), sbet1 : g[g_f1] * sbet1, block([t:norm2(sbet1, cbet1)], sbet1:t[1], cbet1:t[2]), /* Ensure cbet1 = +epsilon at poles */ cbet1 = max(tiny, cbet1), block([t:sincosdx(lat2)], sbet2:t[1], cbet2:t[2]), sbet2 : g[g_f1] * sbet2, block([t:norm2(sbet2, cbet2)], sbet2:t[1], cbet2:t[2]), /* Ensure cbet2 = +epsilon at poles */ cbet2 = max(tiny, 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 then ( if cbet2 = cbet1 then sbet2 : if sbet2 < 0b0 then sbet1 else -sbet1 ) else ( if abs(sbet2) = -sbet1 then cbet2 : cbet1 ), dn1 : sqrt(1 + g[g_ep2] * sq(sbet1)), dn2 : sqrt(1 + g[g_ep2] * sq(sbet2)), meridian : is(lat1 = -90b0 or slam12 = 0b0), if meridian then block( /* Endpoints are on a single full meridian, so the geodesic might lie on a meridian. */ [ ssig1, csig1, ssig2, csig2], calp1 : clam12, salp1 : slam12, /* Head to the target longitude */ calp2 : 1b0, salp2 : 0b0, /* 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 : atan2(0b0 + max(0b0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2), block([r], r:Lengths(g, g[g_n], E, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2), s12x:r[1], m12x:r[2], M12:r[4], M21:r[5]), /* Add the check for sig12 since zero length geodesics might yield m12 < 0. Test case was echo 20.001 0 20.001 0 | GeodTest -i In fact, we will have sig12 > pi/2 for meridional geodesic which is not a shortest path. */ if sig12 < 1b0 or m12x >= 0b0 then ( if sig12 < 3 * tiny or (sig12 < tol0 and (s12x < 0 or m12x < 0)) then sig12 : m12x : s12x : 0b0, m12x : m12x * g[g_b], s12x : s12x * g[g_b], a12 : sig12 / degree ) else /* m12 < 0, i.e., prolate and too close to anti-podal */ meridian : false ), if not meridian and sbet1 = 0b0 and /* and sbet2 == 0 */ /* Mimic the way Lambda12 works with calp1 = 0 */ (g[g_f] <= 0b0 or lon12s >= g[g_f] * 180) then ( /* Geodesic runs along equator */ calp1 : calp2 : 0b0, salp1 : salp2 : 1b0, s12x : g[g_a] * lam12, sig12 : omg12 : lam12 / g[g_f1], m12x : g[g_b] * sin(sig12), M12 : M21 : cos(sig12), a12 : lon12 / g[g_f1] ) else if not meridian then block([dnm], /* 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 */ block([r], r : InverseStart(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12), sig12:r[1], salp1:r[2], calp1:r[3], salp2:r[4], calp2:r[5], dnm:r[6]), if sig12 >= 0b0 then ( /* Short lines (InverseStart sets salp2, calp2, dnm) */ s12x : sig12 * g[g_b] * dnm, m12x : sq(dnm) * g[g_b] * sin(sig12 / dnm), M12 : M21 : cos(sig12 / dnm), a12 : sig12 / degree, omg12 : lam12 / (g[g_f1] * dnm)) else block( /* Newton's method. This is a straightforward solution of f(alp1) = lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one root in the interval (0, pi) and its derivative is positive at the root. Thus f(alp) is positive for alp > alp1 and negative for alp < alp1. During the course of the iteration, a range (alp1a, alp1b) is maintained which brackets the root and with each evaluation of f(alp) the range is shrunk, if possible. Newton's method is restarted whenever the derivative of f is negative (because the new value of alp1 is then further from the solution) or if the new estimate of alp1 lies outside (0,pi); in this case, the new starting guess is taken to be (alp1a + alp1b) / 2. */ [ssig1 : 0b0, csig1 : 0b0, ssig2 : 0b0, csig2 : 0b0, eps : 0b0, domg12 : 0b0, numit : 0, /* Bracketing range */ salp1a : tiny, calp1a : 1b0, salp1b : tiny, calp1b : -1b0, tripn : false, tripb : false, contflag, dv, v], for i:0 thru maxit2-1 do ( contflag:false, numit:i, /* the WGS84 test set: mean : 1.47, sd = 1.25, max = 16 WGS84 and random input: mean = 2.85, sd = 0.60 */ block([r], r : Lambda12(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, is(numit < maxit1)), v : r[1], salp2:r[2], calp2:r[3], sig12:r[4], ssig1:r[5], csig1:r[6], ssig2:r[7], csig2:r[8], if exact then E:r[9] else eps:r[9], domg12:r[10], dv:r[11]), /* Reversed test to allow escape with NaNs */ if tripb or not(abs(v) >= (if tripn then 8 else 1) * tol0) then return(true), /* Update bracketing values */ if v > 0b0 and (numit > maxit1 or calp1/salp1 > calp1b/salp1b) then ( salp1b : salp1, calp1b : calp1 ) else if v < 0b0 and (numit > maxit1 or calp1/salp1 < calp1a/salp1a) then ( salp1a : salp1, calp1a : calp1 ), if numit < maxit1 and dv > 0b0 then block( [dalp1, sdalp1, cdalp1,nsalp1], dalp1 : -v/dv, sdalp1 : sin(dalp1), cdalp1 : cos(dalp1), nsalp1 : salp1 * cdalp1 + calp1 * sdalp1, if nsalp1 > 0b0 and abs(dalp1) < pi then ( calp1 : calp1 * cdalp1 - salp1 * sdalp1, salp1 : nsalp1, block([t:norm2(salp1, calp1)], salp1:t[1], calp1:t[2]), /* In some regimes we don't get quadratic convergence because slope -> 0. So use convergence conditions based on epsilon instead of sqrt(epsilon). */ tripn : is(abs(v) <= 16 * tol0), contflag:true ) ), if not contflag then ( /* Either dv was not positive or updated value was outside legal range. Use the midpoint of the bracket as the next estimate. This mechanism is not needed for the WGS84 ellipsoid, but it does catch problems with more eccentric ellipsoids. Its efficacy is such for the WGS84 test set with the starting guess set to alp1 = 90deg: the WGS84 test set: mean = 5.21, sd = 3.93, max = 24 WGS84 and random input: mean = 4.74, sd = 0.99 */ salp1 : (salp1a + salp1b)/2, calp1 : (calp1a + calp1b)/2, block([t:norm2(salp1, calp1)], salp1:t[1], calp1:t[2]), tripn : false, tripb : is(abs(salp1a - salp1) + (calp1a - calp1) < tolb or abs(salp1 - salp1b) + (calp1 - calp1b) < tolb)) ), block([r], r:Lengths(g, eps, E, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2), s12x:r[1], m12x:r[2], M12:r[4], M21:r[5]), m12x : m12x * g[g_b], s12x : s12x * g[g_b], a12 : sig12 / degree, block([sdomg12 : sin(domg12), cdomg12 : cos(domg12)], somg12 : slam12 * cdomg12 - clam12 * sdomg12, comg12 : clam12 * cdomg12 + slam12 * sdomg12) ) ), s12 : 0b0 + s12x, /* Convert -0 to 0 */ m12 : 0b0 + m12x, /* Convert -0 to 0 */ block( /* From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) */ [ salp0 : salp1 * cbet1, calp0 : hypotx(calp1, salp1 * sbet1), /* calp0 > 0 */ alp12], if calp0 # 0b0 and salp0 # 0b0 then block( /* From Lambda12: tan(bet) = tan(sig) * cos(alp) */ [ssig1 : sbet1, csig1 : calp1 * cbet1, ssig2 : sbet2, csig2 : calp2 * cbet2, k2 : sq(calp0) * g[g_ep2], eps, /* Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). */ A4 : sq(g[g_a]) * calp0 * salp0 * g[g_e2], Ca, B41, B42], eps : k2 / (2 * (1 + sqrt(1 + k2)) + k2), block([t:norm2(ssig1, csig1)], ssig1:t[1], csig1:t[2]), block([t:norm2(ssig2, csig2)], ssig2:t[1], csig2:t[2]), Ca : C4f(g, eps), B41 : SinCosSeries(false, ssig1, csig1, Ca), B42 : SinCosSeries(false, ssig2, csig2, Ca), S12 : A4 * (B42 - B41)) else S12 : 0, /* Avoid problems with indeterminate sig1, sig2 on equator */ if not meridian and somg12 > 1 then (somg12 : sin(omg12), comg12 : cos(omg12)), if not meridian and /* omg12 < 3/4 * pi */ comg12 > -0.7071b0 and /* Long difference not too big */ sbet2 - sbet1 < 1.75b0 then block( /* Lat difference not 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)) */ [domg12 : 1 + comg12, dbet1 : 1 + cbet1, dbet2 : 1 + cbet2], alp12 : 2 * atan2( somg12 * ( sbet1 * dbet2 + sbet2 * dbet1 ), domg12 * ( sbet1 * sbet2 + dbet1 * dbet2 ) )) else block( /* 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 = 0b0 and calp12 < 0b0 then ( salp12 : tiny * calp1, calp12 : -1b0), alp12 : atan2(salp12, calp12) ), S12 : S12 + g[g_c2] * alp12, S12 : S12 * swapp * lonsign * latsign, /* Convert -0 to 0 */ S12 : S12 + 0b0 ), /* Convert calp, salp to azimuth accounting for lonsign, swapp, latsign. */ if swapp < 0 then ( block([t:swapx(salp1, salp2)], salp1:t[1], salp2:t[2]), block([t:swapx(calp1, calp2)], calp1:t[1], calp2:t[2]), block([t:swapx(M12, M21)], M12:t[1], M21:t[2])), salp1 : salp1 * swapp * lonsign, calp1 : calp1 * swapp * latsign, salp2 : salp2 * swapp * lonsign, calp2 : calp2 * swapp * latsign, azi1 : atan2dx(salp1, calp1), azi2 : atan2dx(salp2, calp2), [a12, s12, azi1, azi2, m12, M12, M21, S12] )$ geod_inverse(g, lat1, lon1, lat2, lon2):= geod_geninverse(g, lat1, lon1, lat2, lon2)$ SinCosSeries(sinp, sinx, cosx, c):=block([n:length(c), ar, y0, y1, n2, k], /* Evaluate y = sinp ? sum(c[i] * sin( 2*i * x), i, 1, n) : sum(c[i] * cos((2*i-1) * x), i, 1, n) using Clenshaw summation. where n = length(c) Approx operation count = (n + 5) mult and (2 * n + 2) add */ /* 2 * cos(2 * x) */ ar : 2 * (cosx - sinx) * (cosx + sinx), /* accumulators for sum */ if mod(n, 2)=1 then (y0 : c[n], n2 : n - 1) else (y0 : 0b0, n2 : n), y1 : 0b0, /* Now n2 is even */ for k : n2 thru 1 step -2 do ( /* Unroll loop x 2, so accumulators return to their original role */ y1 : ar * y0 - y1 + c[k], y0 : ar * y1 - y0 + c[k-1]), if sinp then 2 * sinx * cosx * y0 /* sin(2 * x) * y0 */ else cosx * (y0 - y1) /* cos(x) * (y0 - y1) */ )$ /* Return [s12b, m12b, m0, M12, M21] */ Lengths(g, eps, E, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2):= block([Ca, s12b : 0b0, m12b : 0b0, m0 : 0b0, M12 : 0b0, M21 : 0b0, A1m1, AB1, A2m1, AB2, J12], /* Return m12b = (reduced length)/b; also calculate s12b = distance/b, and m0 = coefficient of secular term in expression for reduced length. */ if exact then ( m0 : - E[e_k2] * E[e_dc] / (pi/2), J12 : m0 * (sig12 + deltad(ssig2, csig2, dn2, E[e_k2], E[e_dc]) - deltad(ssig1, csig1, dn1, E[e_k2], E[e_dc])) ) else ( A1m1 : A1m1f(eps), Ca : C1f(eps), AB1 : (1 + A1m1) * (SinCosSeries(true, ssig2, csig2, Ca) - SinCosSeries(true, ssig1, csig1, Ca)), A2m1 : A2m1f(eps), Ca : C2f(eps), AB2 : (1 + A2m1) * (SinCosSeries(true, ssig2, csig2, Ca) - SinCosSeries(true, ssig1, csig1, Ca)), m0 : A1m1 - A2m1, J12 : m0 * sig12 + (AB1 - AB2)), /* Missing a factor of b. Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure accurate cancellation in the case of coincident points. */ m12b : dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12, /* Missing a factor of b */ s12b : if exact then E[e_ec] / (pi/2) * (sig12 + deltae(ssig2, csig2, dn2, E[e_k2], E[e_ec]) - deltae(ssig1, csig1, dn1, E[e_k2], E[e_ec])) else (1 + A1m1) * sig12 + AB1, block([csig12 : csig1 * csig2 + ssig1 * ssig2, t : g[g_ep2] * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2)], M12 : csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1, M21 : csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2 ), [s12b, m12b, m0, M12, M21])$ Astroid(x, y):= block( /* 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. */ [k, p : sq(x), q : sq(y), r], r : (p + q - 1) / 6, if not(q = 0b0 and r <= 0b0) then block( /* 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 : sq(r), r3, disc, u, v, uv, w], r3 : r * r2, /* The discriminant 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, v, uv, w, if disc >= 0b0 then block([T3 : S + r3, T], /* 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 = (r * t)^3 */ T3 : T3 + (if T3 < 0b0 then -sqrt(disc) else sqrt(disc)), /* N.B. cbrtx always returns the real root. cbrtx(-8) = -2. */ T : cbrtx(T3), /* T = r * t */ /* T can be zero, but then r2 / T -> 0. */ u : u + T + (if T # 0b0 then r2 / T else 0b0)) else block( /* T is complex, but the way u is defined the result is 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 : u + 2 * r * cos(ang / 3)), v : sqrt(sq(u) + q), /* guaranteed positive */ /* Avoid loss of accuracy when u < 0. */ uv : if u < 0b0 then q / (v - u) 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 / (sqrt(uv + 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 : 0b0, k)$ /* Return [sig12, salp1, calp1, salp2, calp2, dnm] */ InverseStart(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12):=block( [ salp1 : 0b0, calp1 : 0b0, salp2 : 0b0, calp2 : 0b0, dnm : 0b0, /* 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 : -1b0, /* Return value */ /* bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0] */ sbet12 : sbet2 * cbet1 - cbet2 * sbet1, cbet12 : cbet2 * cbet1 + sbet2 * sbet1, sbet12a : sbet2 * cbet1 + cbet2 * sbet1, shortline, somg12, comg12, ssig12, csig12, E:[]], shortline : is(cbet12 >= 0b0 and sbet12 < 0.5b0 and cbet2 * lam12 < 0.5b0), if shortline then block([sbetm2 : sq(sbet1 + sbet2), omg12], /* sin((bet1+bet2)/2)^2 = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) */ sbetm2 : sbetm2 / (sbetm2 + sq(cbet1 + cbet2)), dnm : sqrt(1 + g[g_ep2] * sbetm2), omg12 : lam12 / (g[g_f1] * dnm), somg12 : sin(omg12), comg12 : cos(omg12)) else (somg12 : slam12, comg12 : clam12), salp1 : cbet2 * somg12, calp1 : if comg12 >= 0b0 then sbet12 + cbet2 * sbet1 * sq(somg12) / (1 + comg12) else sbet12a - cbet2 * sbet1 * sq(somg12) / (1 - comg12), ssig12 : hypotx(salp1, calp1), csig12 : sbet1 * sbet2 + cbet1 * cbet2 * comg12, if shortline and ssig12 < g[g_etol2] then ( /* really short lines */ salp2 : cbet1 * somg12, calp2 : sbet12 - cbet1 * sbet2 * (if comg12 >= 0 then sq(somg12) / (1 + comg12) else 1 - comg12), block([t:norm2(salp2, calp2)], salp2:t[1], calp2:t[2]), /* Set return value */ sig12 : atan2(ssig12, csig12)) else if abs(g[g_n]) > 0.1b0 or /* No astroid calc if too eccentric */ csig12 >= 0 or ssig12 >= 6 * abs(g[g_n]) * pi * sq(cbet1) then true /* Nothing to do, zeroth order spherical approximation is OK */ else block( /* Scale lam12 and bet2 to x, y coordinate system where antipodal point is at origin and singular point is at y = 0, x = -1. */ [y, lamscale, betscale,x, lam12x], lam12x : atan2(-slam12, -clam12), /* lam12 - pi */ if g[g_f] >= 0 then ( /* In fact f == 0 does not get here */ /* x = dlong, y = dlat */ if exact then block([k2 : sq(sbet1) * g[g_ep2]], E : Ef(-k2, -g[g_ep2]), lamscale : g[g_e2]/g[g_f1] * cbet1 * 2 * E[e_hc]) else block([k2 : sq(sbet1) * g[g_ep2],eps], eps : k2 / (2 * (1 + sqrt(1 + k2)) + k2), lamscale : g[g_f] * cbet1 * A3f(g, eps) * pi), betscale : lamscale * cbet1, x : lam12x / lamscale, y : sbet12a / betscale) else block( /* f < 0 */ /* x = dlat, y = dlong */ [cbet12a : cbet2 * cbet1 - sbet2 * sbet1,bet12a,m12b, m0], bet12a : atan2(sbet12a, cbet12a), /* In the case of lon12 = 180, this repeats a calculation made in * Inverse. */ block([r], r:Lengths(g, g[g_n], E, pi + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2), m12b:r[2], m0:r[3]), x : -1 + m12b / (cbet1 * cbet2 * m0 * pi), betscale : if x < -0.01b0 then sbet12a / x else -g[g_f] * sq(cbet1) * pi, lamscale : betscale / cbet1, y : lam12x / lamscale), if y > -tol1 and x > -1 - xthresh then ( /* strip near cut */ if g[g_f] >= 0b0 then ( salp1 : min(1b0, -x), calp1 : - sqrt(1 - sq(salp1))) else ( calp1 : max(if x > -tol1 then 0b0 else -1b0, x), salp1 : sqrt(1 - sq(calp1)))) else block( /* 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 : Astroid(x, y),omg12a], omg12a : lamscale * ( if g[g_f] >= 0b0 then -x * k/(1 + k) else -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 * sq(somg12) / (1 - comg12))), if salp1 > 0 then /* Sanity check on starting guess */ block([t:norm2(salp1, calp1)], salp1:t[1], calp1:t[2]) else ( salp1 : 1b0, calp1 : 0b0 ), [sig12, salp1, calp1, salp2, calp2, dnm] )$ /* Return [lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, (E or eps), domg12, dlam12] */ Lambda12(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam120, clam120, diffp):= block([salp2 : 0b0, calp2 : 0b0, sig12 : 0b0, ssig1 : 0b0, csig1 : 0b0, ssig2 : 0b0, csig2 : 0b0, eps : 0b0, E : [], domg12 : 0b0, somg12 : 0b0, comg12 : 0b0, dlam12 : 0b0, salp0, calp0, somg1, comg1, somg2, comg2, cchi1, cchi2, lam12, B312, k2, Ca, eta], if sbet1 = 0b0 and calp1 = 0b0 then /* Break degeneracy of equatorial line. This case has already been handled. */ calp1 : -tiny, /* sin(alp1) * cos(bet1) = sin(alp0) */ salp0 : salp1 * cbet1, calp0 : hypotx(calp1, salp1 * sbet1), /* calp0 > 0 */ /* 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, /* Without normalization we have schi1 = somg1. */ if exact then cchi1 : g[g_f1] * dn1 * comg1, block([t:norm2(ssig1, csig1)], ssig1:t[1], csig1:t[2]), /* norm2 (&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 : if cbet2 # cbet1 then salp0 / cbet2 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 : if cbet2 # cbet1 or abs(sbet2) # -sbet1 then sqrt(sq(calp1 * cbet1) + (if cbet1 < -sbet1 then (cbet2 - cbet1) * (cbet1 + cbet2) else (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 else abs(calp1), /* tan(bet2) = tan(sig2) * cos(alp2) tan(omg2) = sin(alp0) * tan(sig2). */ ssig2 : sbet2, somg2 : salp0 * sbet2, csig2 : comg2 : calp2 * cbet2, /* Without normalization we have schi2 = somg2. */ if exact then cchi2 : g[g_f1] * dn2 * comg2, block([t:norm2(ssig2, csig2)], ssig2:t[1], csig2:t[2]), /* norm2(&somg2, &comg2); -- don't need to normalize! */ /* sig12 = sig2 - sig1, limit to [0, pi] */ sig12 : atan2(0b0 + max(0b0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2), /* omg12 = omg2 - omg1, limit to [0, pi] */ somg12 : 0b0 + max(0b0, comg1 * somg2 - somg1 * comg2), comg12 : comg1 * comg2 + somg1 * somg2, k2 : sq(calp0) * g[g_ep2], if exact then block([schi12, cchi12, deta12], E : Ef(-k2, -g[g_ep2]), schi12 : 0b0 + max(0b0, cchi1 * somg2 - somg1 * cchi2), cchi12 : cchi1 * cchi2 + somg1 * somg2, /* eta = chi12 - lam120 */ eta : atan2(schi12 * clam120 - cchi12 * slam120, cchi12 * clam120 + schi12 * slam120), deta12 : -g[g_e2]/g[g_f1] * salp0 * E[e_hc] / (pi/2) * (sig12 + deltah(ssig2, csig2, dn2, E[e_k2], E[e_alpha2], E[e_hc]) - deltah(ssig1, csig1, dn1, E[e_k2], E[e_alpha2], E[e_hc]) ), lam12 : eta + deta12, domg12 : deta12 + atan2(schi12 * comg12 - cchi12 * somg12, cchi12 * comg12 + schi12 * somg12)) else ( /* eta = omg12 - lam120 */ eta : atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120), eps : k2 / (2 * (1 + sqrt(1 + k2)) + k2), Ca : C3f(g, eps), B312 : (SinCosSeries(true, ssig2, csig2, Ca) - SinCosSeries(true, ssig1, csig1, Ca)), domg12 : -g[g_f] * A3f(g, eps) * salp0 * (sig12 + B312), lam12 : eta + domg12), if diffp then ( if calp2 = 0b0 then dlam12 : - 2 * g[g_f1] * dn1 / sbet1 else (block([r], r:Lengths(g, eps, E, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2), dlam12:r[2]), dlam12 : dlam12 * g[g_f1] / (calp2 * cbet2))), [lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, if exact then E else eps, domg12, dlam12])$ A3f(g, eps):=block( /* Evaluate sum(A3x[k] * eps^k, k, 0, nA3x-1) by Horner's method */ [v : 0b0], for i:nA3x step -1 thru 1 do v : eps * v + g[g_A3x][i], v)$ C3f(g, eps):=block( /* Evaluate C3 coeffs by Horner's method * Elements c[1] thru c[nC3 - 1] are set */ [i, j, k, mult : 1b0, c : makelist(0, i, 1, nC3-1)], j : nC3x, for k : nC3-1 step -1 thru 1 do block( [t : 0b0], for i : nC3 - k step -1 thru 1 do ( t : eps * t + g[g_C3x][j], j : j - 1), c[k] : t), for k:1 thru nC3-1 do ( mult : mult * eps, c[k] : c[k] * mult), c)$ C4f(g, eps):=block( /* Evaluate C4 coeffs by Horner's method * Elements c[1] thru c[nC4] are set */ [i, j, k, mult : 1b0, c : makelist(0, i, 1, nC4)], j : nC4x, for k : nC4-1 step -1 thru 0 do block( [t : 0b0], for i : nC4 - k step -1 thru 1 do ( t : eps * t + g[g_C4x][j], j : j - 1), c[k+1] : t), for k : 2 thru nC4 do ( mult : mult * eps, c[k] : c[k] * mult), c)$ transit(lon1, lon2):=block([lon12], /* Return 1 or -1 if crossing prime meridian in east or west direction. Otherwise return zero. */ /* Compute lon12 the same way as Geodesic::Inverse. */ lon1 : AngNormalize(lon1), lon2 : AngNormalize(lon2), lon12 : AngDiff(lon1, lon2)[1], if lon1 <= 0b0 and lon2 > 0b0 and lon12 > 0b0 then 1 else (if lon2 <= 0b0 and lon1 > 0b0 and lon12 < 0b0 then -1 else 0))$ /* Return [P, A, mins, maxs] */ geod_polygonarea(g, points) := block([n:length(points), crossings : 0, area0 : 4 * pi * g[g_c2], A : 0, P : 0, mins : g[g_a] * 100, maxs : 0b0], for i : 1 thru n do block( [ s12, S12, r ], r:geod_geninverse(g, points[i][1], points[i][2], points[mod(i,n)+1][1], points[mod(i,n)+1][2]), s12:r[2], S12:r[8], if s12 > maxs then maxs:s12, if s12 < mins then mins:s12, P : P + s12, /* The minus sign is due to the counter-clockwise convention */ A : A - S12, crossings : crossings + transit(points[i][2], points[mod(i,n)+1][2])), A : mod(A+area0/2, area0) - area0/2, if mod(crossings, 2) = 1 then A : A + (if A < 0b0 then 1 else -1) * area0/2, /* Put area in (-area0/2, area0/2] */ if A > area0/2 then A : A - area0 else if A <= -area0/2 then A : A + area0, [P, A, mins, maxs])$ wgs84:geod_init(6378137b0, 1/298.257223563b0)$ flat(a, GM, omega, J2):=block( [e2:3*J2, K : 2 * (a*omega)^2 * a / (15 * GM), e2a, q0], for j:0 thru 100 do ( e2a:e2,q0:qf(e2/(1-e2)), e2:3*J2+K*e2*sqrt(e2)/q0, if e2 = e2a then return(done)), e2/(1+sqrt(1-e2)))$ qf(ep2):=block([ep,fpprec:3*fpprec],ep:sqrt(ep2), ((1 + 3/ep2) * atan(ep) - 3/ep)/2)$ /* 1/298.257222100882711243162836607614495 */ fgrs80:flat(6378137b0, 3986005b8, 7292115b-11, 108263b-8)$ grs80:geod_init(6378137b0, fgrs80)$ GeographicLib-1.52/maxima/polyprint.mac0000644000771000077100000001237114064202371020017 0ustar ckarneyckarney/* Print out the coefficients for the geodesic series in a format that allows Math::polyval to be used. */ taylordepth:5$ simplenum:true$ count:0$ jtaylor(expr,var1,var2,ord):=expand(subst([zz=1], ratdisrep(taylor(subst([var1=zz*var1,var2=zz*var2],expr),zz,0,ord))))$ h(x):=if x=0 then 0 else block([n:0],while not(oddp(x)) do (x:x/2,n:n+1),n); decorhex(x):=if x=0 then "0" else if abs(x)<10^12 then string(x) else concat(if x<0 then "-" else "", "0x",block([obase:16,s], s:sdowncase(string(abs(x))), if substring(s,1,2) = "0" then s:substring(s,2), s))$ formatnum(x):=block([n,neg:is(x<0),s1,s2,ll],x:abs(x),n:h(x), ll:if x<2^31 then "" else "LL", s1:concat(if neg then "-" else "", decorhex(x), ll), s2:concat(if neg then "-(" else "", decorhex(x/2^n), ll, "<<", n, if neg then ")" else ""), if slength(s2) < slength(s1) then s2 else s1)$ formatnumx(x):=if simplenum then concat(string(x),if abs(x) < 2^31 then "" else "LL") else if abs(x)<2^63 then (if abs(x) < 2^24 /* test used to be: abs(x)/2^h(abs(x)) < 2^24; but Visual Studio complains about truncation of __int64 to real even if trailing bits are zero */ then formatnum(x) else concat(s:if x<0 then "-" else "","real(",formatnum(abs(x)),")")) else block([s:if x<0 then "-" else ""], x:abs(x), concat(s,"reale(",formatnum(floor(x/2^52)),",", formatnum(x-floor(x/2^52)*2^52),")"))$ printterm(x,line):=block([lx:slength(x)+1,lline:slength(line)], count:count+1, x:concat(x,if simplenum then ", " else ","), if lline=0 then line:concat(" ",x) else (if lx+lline<80 then line:concat(line,x) else (print(line),line:concat(" ",x))), line)$ flushline(line):=(if slength(line)>0 then (print(line),line:""),line)$ polyprint(p, var, title):=block([linel:90,d,line:"",h], p:ratsimp(p), d:abs(denom(p)), p:expand(d*p), h:hipow(p,var), print(concat(" // ", title, ", polynomial in ", var, " of order ",h)), for k:h step -1 thru 0 do line:printterm(formatnumx(coeff(p,var,k)),line), line:printterm(formatnumx(d),line), flushline(line), done)$ value1(val,var,pow,dord):=block([tab2:" ",linel:90,div], print(concat(tab2,"// Generated by Maxima on ",timedate())), div:if pow = 1 then "" else concat("/",pow), for nn:0 step pow thru maxpow do block([c], if nn = 0 then print(concat("#if ", macro, div, " == ",nn/pow)) else print(concat("#elif ", macro, div, " == ",nn/pow)), count:0, print(concat(tab2,"static const real coeff[] = {")), block( [q:ratdisrep(taylor(ev(val),var,0,nn-dord)),line:""], if pow = 2 then ( q:subst(var=sqrt(concat(var,2)),expand(q)), polyprint(q,concat(var,2),string(val))) else (polyprint(q,var,string(val))), line:flushline(line)), print(concat(tab2,"}; // count = ",count))), print("#else #error", concat("\"Bad value for ", macro, "\""), " #endif "), 'done)$ array1(array,var,pow,dord):=block([tab2:" ",linel:90], print(concat(tab2,"// Generated by Maxima on ",timedate())), for nn:0 thru maxpow do block([c], if nn = 0 then print(concat("#if ", macro, " == ",nn)) else print(concat("#elif ", macro, " == ",nn)), count:0, print(concat(tab2,"static const real coeff[] = {")), for m:0 thru nn do if part(arrayapply(array,[m]),0) # array then block( [q:ratdisrep(taylor(arrayapply(array,[m]),var,0,nn-dord)),line:""], if pow = 2 then ( q:subst(var=sqrt(concat(var,2)),expand(q/var^(m-dord))), polyprint(q,concat(var,2),concat(array, "[", m, "]/",var,"^",m-dord))) else ( q:expand(q/var^(m-dord)), polyprint(q,var,concat(array, "[", m, "]/",var,"^",m-dord))), line:flushline(line)), print(concat(tab2,"}; // count = ",count))), print("#else #error", concat("\"Bad value for ", macro, "\""), " #endif "), 'done)$ value2(val,var1,var2,dord):=block([tab2:" ",linel:90], print(concat(tab2,"// Generated by Maxima on ",timedate())), for nn:0 thru maxpow do block([c], if nn = 0 then print(concat("#if ", macro, " == ",nn)) else print(concat("#elif ", macro, " == ",nn)), count:0, print(concat(tab2,"static const real coeff[] = {")), block( [q:jtaylor(ev(val),n,eps,nn-dord),line:""], for j:nn-dord step -1 thru 0 do block( [p:coeff(q,var2,j)], polyprint(p,var1,concat(val, ", coeff of eps^",j))), line:flushline(line)), print(concat(tab2,"}; // count = ",count))), print("#else #error", concat("\"Bad value for ", macro, "\""), " #endif "), 'done)$ array2(array,var1,var2,dord):=block([tab2:" ",linel:90], print(concat(tab2,"// Generated by Maxima on ",timedate())), for nn:0 thru maxpow do block([c], if nn = 0 then print(concat("#if ", macro, " == ",nn)) else print(concat("#elif ", macro, " == ",nn)), count:0, print(concat(tab2,"static const real coeff[] = {")), for m:0 thru nn-1 do if part(arrayapply(array,[m]),0) # array then block( [q:jtaylor(arrayapply(array,[m]),n,eps,nn-dord),line:""], for j:nn-dord step -1 thru m do block( [p:coeff(q,var2,j)], polyprint(p,var1,concat(array, "[", m ,"], coeff of eps^",j))), line:flushline(line)), print(concat(tab2,"}; // count = ",count))), print("#else #error", concat("\"Bad value for ", macro, "\""), " #endif "), 'done)$ GeographicLib-1.52/maxima/rhumbarea.mac0000644000771000077100000001542214064202371017725 0ustar ckarneyckarney/* Compute the series expansion for the rhumb area. Copyright (c) Charles Karney (2014) and licensed under the MIT/X11 License. For more information, see https://geographiclib.sourceforge.io/ Instructions: edit the value of maxpow near the end of this file. Then load the file into maxima. Area of rhumb quad dA = c^2 sin(xi) * dlambda c = authalic radius xi = authalic latitude Express sin(xi) in terms of chi and expand for small n this can be written in terms of powers of sin(chi) Subst sin(chi) = tanh(psi) = tanh(m*lambda) Integrate over lambda to give A = c^2 * S(chi)/m S(chi) = log(sec(chi)) + sum(R[i]*cos(2*i*chi),i,0,maxpow) R[0] = + 1/3 * n - 16/45 * n^2 + 131/945 * n^3 + 691/56700 * n^4 R[1] = - 1/3 * n + 22/45 * n^2 - 356/945 * n^3 + 1772/14175 * n^4; R[2] = - 2/15 * n^2 + 106/315 * n^3 - 1747/4725 * n^4; R[3] = - 31/315 * n^3 + 104/315 * n^4; R[4] = - 41/420 * n^4; i=0 term is just the integration const so can be dropped. However including this terms gives S(0) = 0. Evaluate A between limits lam1 and lam2 gives A = c^2 * (lam2 - lam1) * (S(chi2) - S(chi1)) / (atanh(sin(chi2)) - atanh(sin(chi1))) In limit chi2 -> chi, chi1 -> chi diff(atanh(sin(chi)),chi) = sec(chi) diff(log(sec(chi)),chi) = tan(chi) c^2 * (lam2 - lam1) * [ (1-R[1]) * sin(chi) - (R[1]+2*R[2]) * sin(3*chi) - (2*R[2]+3*R[3]) * sin(5*chi) - (3*R[3]+4*R[4]) * sin(7*chi) ... ] which is expansion of c^2 * (lam2 - lam1) * sin(xi) in terms of sin(chi) Note: limit chi->0 = 0 limit chi->pi/2 = c^2 * (lam2-lam1) Express in terms of psi A = c^2 * (lam2 - lam1) * (S(chi(psi2)) - S(chi(psi2))) / (psi2 - psi1) sum(R[i]*cos(2*i*chi),i,0,maxpow) = sum(sin(chi),cos(chi)) S(chi(psi)) = log(cosh(psi)) + sum(tanh(psi),sech(psi)) (S(chi(psi2)) - S(chi(psi2))) / (psi2 - psi1) = Dlog(cosh(psi1),cosh(psi2)) * Dcosh(psi1,psi2) + Dsum(chi1,chi2) * Dgd(psi1,psi2) */ 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)$ /* chi in terms of phi -- from auxlat.mac*/ chi_phi(maxpow):=block([psiv,tanchi,chiv,qq,e,atanexp,x,eps], /* Here qq = atanh(sin(phi)) = asinh(tan(phi)) */ psiv:qq-e*atanh(e*tanh(qq)), psiv:subst([e=sqrt(4*n/(1+n)^2),qq=atanh(sin(phi))], ratdisrep(taylor(psiv,e,0,2*maxpow))) +asinh(sin(phi)/cos(phi))-atanh(sin(phi)), tanchi: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), atanexp:ratdisrep(taylor(atan(x+eps),eps,0,maxpow)), chiv:subst([x=tan(phi),eps=tanchi-tan(phi)],atanexp), chiv:subst([atan(tan(phi))=phi, tan(phi)=sin(phi)/cos(phi)], (chiv-phi)/cos(phi))*cos(phi)+phi, chiv:ratdisrep(taylor(chiv,n,0,maxpow)), expand(trigreduce(chiv)))$ /* phi in terms of chi -- from auxlat.mac */ phi_chi(maxpow):=reverta(chi_phi(maxpow),phi,chi,n,maxpow)$ /* xi in terms of phi */ xi_phi(maxpow):=block([sinxi,asinexp,x,eps,v], sinxi:(sin(phi)/2*(1/(1-e^2*sin(phi)^2) + atanh(e*sin(phi))/(e*sin(phi))))/ (1/2*(1/(1-e^2) + atanh(e)/e)), sinxi:ratdisrep(taylor(sinxi,e,0,2*maxpow)), sinxi:subst([e=2*sqrt(n)/(1+n)],sinxi), sinxi:expand(trigreduce(ratdisrep(taylor(sinxi,n,0,maxpow)))), asinexp:sqrt(1-x^2)* sum(ratsimp(diff(asin(x),x,i)/i!/sqrt(1-x^2))*eps^i,i,0,maxpow), v:subst([x=sin(phi),eps=sinxi-sin(phi)],asinexp), v:taylor(subst([sqrt(1-sin(phi)^2)=cos(phi),asin(sin(phi))=phi], v),n,0,maxpow), v:expand(ratdisrep(coeff(v,n,0))+sum( ratsimp(trigreduce(sin(phi)*ratsimp( subst([sin(phi)=sqrt(1-cos(phi)^2)], ratsimp(trigexpand(ratdisrep(coeff(v,n,i)))/sin(phi)))))) *n^i, i,1,maxpow)))$ xi_chi(maxpow):= expand(trigreduce(taylor(subst([phi=phi_chi(maxpow)],xi_phi(maxpow)), n,0,maxpow)))$ computeR(maxpow):=block([xichi,xxn,inttanh,yy,m,yyi,yyj,s], local(inttanh), xichi:xi_chi(maxpow), xxn:expand(subst([cos(chi)=sqrt(1-sin(chi)^2)], trigexpand(taylor(sin(xichi),n,0,maxpow)))), /* integrals of tanh(x)^l. Use tanh(x)^2 + sech(x)^2 = 1. */ inttanh[0](x):=x, /* Not needed -- only odd l occurs in this problem */ inttanh[1](x):=log(cosh(x)), inttanh[l](x):=inttanh[l-2](x) - tanh(x)^(l-1)/(l-1), yy:subst([sin(chi)=tanh(m*lambda)],xxn), /* psi = atanh(sin(chi)) = m*lambda sin(chi)=tanh(m*lambda) sech(m*lambda) = sqrt(1-tanh(m*lambda))^2 = cos(chi) cosh(m*lambda) = sec(chi) m=(atanh(sin(chi2))-atanh(sin(chi1)))/(lam2-lam1) */ yyi:block([v:yy/m,ii], local(ii), for j:2*maxpow+1 step -2 thru 1 do v:subst([tanh(m*lambda)^j=ii[j](m*lambda)],v), for j:2*maxpow+1 step -2 thru 1 do v:subst([ii[j](m*lambda)=inttanh[j](m*lambda)],v), expand(v)), yyj:expand(m*trigreduce( subst([tanh(m*lambda)=sin(chi),cosh(m*lambda)=sec(chi)],yyi)))/ ( (atanh(sin(chi2))-atanh(sin(chi1)))/(lam2-lam1) ), s:( (atanh(sin(chi2))-atanh(sin(chi1)))/(lam2-lam1) )*yyj-log(sec(chi)), for i:1 thru maxpow do R[i]:coeff(s,cos(2*i*chi)), R[0]:s-expand(sum(R[i]*cos(2*i*chi),i,1,maxpow)), if expand(s-sum(R[i]*cos(2*i*chi),i,0,maxpow)) # 0 then error("Left over terms in R"), if expand(trigreduce(expand( diff(sum(R[i]*cos(2*i*chi),i,0,maxpow),chi)*cos(chi)+sin(chi))))- expand(trigreduce(expand(xxn))) # 0 then error("Derivative error in R"), 'done)$ ataylor(expr,var,ord):=expand(ratdisrep(taylor(expr,var,0,ord)))$ dispR(ord):=for i:1 thru ord do block([tt:ataylor(R[i],n,ord),ttt,linel:1200], print(), for j:max(i,1) step 1 thru ord do (ttt:coeff(tt,n,j), print(concat( if j = max(i,1) then concat("R[",string(i),"] = ") else " ", if ttt<0 then "- " else "+ ", string(abs(ttt)), " * ", string(n^j), if j=ord then ";" else ""))))$ codeR(minpow,maxpow):=block([tab2:" ",tab3:" "], print(" // The coefficients R[l] in the Fourier expansion of rhumb area real nx = n; switch (maxpow_) {"), for k:minpow thru maxpow do ( print(concat(tab2,"case ",string(k),":")), for m:1 thru k do block([q:nx*horner( ataylor(R[m],n,k)/n^m), linel:1200], if m>1 then print(concat(tab3,"nx *= n;")), print(concat(tab3,"c[",string(m),"] = ",string(q),";"))), print(concat(tab3,"break;"))), print(concat(tab2,"default:")), print(concat(tab3,"GEOGRAPHICLIB_STATIC_ASSERT(maxpow_ >= ",string(minpow), " && maxpow_ <= ",string(maxpow),", \"Bad value of maxpow_\");")), print(" }"), 'done)$ maxpow:8$ computeR(maxpow)$ dispR(maxpow)$ /* codeR(4,maxpow)$ */ load("polyprint.mac")$ printrhumb():=block([macro:GEOGRAPHICLIB_RHUMBAREA_ORDER], array1('R,'n,1,0))$ printrhumb()$ GeographicLib-1.52/maxima/tm.mac0000644000771000077100000003066314064202371016403 0ustar ckarneyckarney/* Arbitrary precision Transverse Mercator Projection Copyright (c) Charles Karney (2009-2017) and licensed under the MIT/X11 License. For more information, see https://geographiclib.sourceforge.io/ 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 https://arxiv.org/abs/1002.1417 resource page https://geographiclib.sourceforge.io/tm.html The parameters for the transformation are set by setparams(a,f,k0)$ sets the equatorial radius, inverse flattening, and central scale factor. The default is setparams(6378137b0, 1/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,f1,k1):=(a:bfloat(a1),f:bfloat(f1),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, 1/298.257223563b0, 0.9996b0)$ /* WGS 84 */ /* setparams(6378388b0, 1/297b0, 0.9996b0)$ International */ /* setparams(1/ec(0.01b0), 1/(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.52/maxima/tmseries.mac0000644000771000077100000001644514064202371017620 0ustar ckarneyckarney/* Compute series approximations for Transverse Mercator Projection Copyright (c) Charles Karney (2009-2010) and licensed under the MIT/X11 License. For more information, see https://geographiclib.sourceforge.io/ 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 https://arxiv.org/abs/1002.1417 resource page https://geographiclib.sourceforge.io/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:8$ /* 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()$ (b1:a1, for i:1 thru maxpow do (alp[i]:coeff(zeta_zetap,sin(2*i*zetap)), bet[i]:coeff(expand(-zetap_zeta),sin(2*i*zeta))))$ load("polyprint.mac")$ printtm():=block([macro:GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER], value1('(b1*(1+n)),'n,2,0), array1('alp,'n,1,0), array1('bet,'n,1,0))$ printtm()$ /* defarrayfuns()$ save("tmseries.lsp",maxpow,arrays)$ */ GeographicLib-1.52/python/LICENSE0000644000771000077100000000220114064202371016336 0ustar ckarneyckarneyThe MIT License (MIT); this license applies to GeographicLib, versions 1.12 and later. Copyright (c) 2008-2019, 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.52/python/MANIFEST.in0000644000771000077100000000004214064202371017070 0ustar ckarneyckarneyinclude README.md include LICENSE GeographicLib-1.52/python/Makefile.am0000644000771000077100000000244014064202371017372 0ustar ckarneyckarney# # Makefile.am # # Copyright (c) Charles Karney (2011-2016) 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 TEST_FILES = \ $(srcdir)/$(PACKAGE)/test/__init__.py \ $(srcdir)/$(PACKAGE)/test/test_geodesic.py DOC_FILES = \ $(srcdir)/doc/conf.py \ $(srcdir)/doc/code.rst \ $(srcdir)/doc/examples.rst \ $(srcdir)/doc/geodesics.rst \ $(srcdir)/doc/index.rst \ $(srcdir)/doc/interface.rst pythondir=$(libdir)/python/site-packages/$(PACKAGE) install: $(INSTALL) -d $(DESTDIR)$(pythondir) $(INSTALL) -m 644 $(PYTHON_FILES) $(DESTDIR)$(pythondir) $(INSTALL) -d $(DESTDIR)$(pythondir)/test $(INSTALL) -m 644 $(TEST_FILES) $(DESTDIR)$(pythondir)/test # 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) \ $(TEST_FILES) $(DOC_FILES) LICENSE setup.py MANIFEST.in README.md GeographicLib-1.52/python/Makefile.mk0000644000771000077100000000127314064202371017407 0ustar ckarneyckarneyMODULES = __init__ geomath constants accumulator geodesiccapability \ geodesic geodesicline polygonarea PACKAGE = geographiclib PYTHON_FILES = $(patsubst %,$(PACKAGE)/%.py,$(MODULES)) TEST_FILES = $(PACKAGE)/test/__init__.py $(PACKAGE)/test/test_geodesic.py DEST = $(PREFIX)/lib/python/site-packages/$(PACKAGE) INSTALL = install -b all: @: install: test -d $(DEST)/test || mkdir -p $(DEST)/test $(INSTALL) -m 644 $(PYTHON_FILES) $(DEST)/ $(INSTALL) -m 644 $(TEST_FILES) $(DEST)/test/ # 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.52/python/README.md0000644000771000077100000000040514064202371016614 0ustar ckarneyckarneyThis implements [Algorithms for Geodesics](https://doi.org/10.1007/s00190-012-0578-z) (Karney, 2013) for solving the direct and inverse problems for an ellipsoid of revolution. Documentation is available at . GeographicLib-1.52/python/doc/code.rst0000644000771000077100000000120614064202371017546 0ustar ckarneyckarneyGeographicLib API ================= geographiclib ------------- .. automodule:: geographiclib :members: __version_info__, __version__ geographiclib.geodesic ---------------------- .. automodule:: geographiclib.geodesic :members: .. data:: Geodesic.WGS84 :annotation: = Instantiation for the WGS84 ellipsoid geographiclib.geodesicline -------------------------- .. automodule:: geographiclib.geodesicline :members: geographiclib.polygonarea ------------------------- .. automodule:: geographiclib.polygonarea :members: geographiclib.constants ----------------------- .. automodule:: geographiclib.constants :members: GeographicLib-1.52/python/doc/conf.py0000644000771000077100000002077114064202371017411 0ustar ckarneyckarney# -*- coding: utf-8 -*- # # geographiclib documentation build configuration file, created by # sphinx-quickstart on Sat Oct 24 17:14:00 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os import sphinx sys.path.insert(0, os.path.abspath('..')) import geographiclib import geographiclib.geodesic import geographiclib.geodesicline import geographiclib.polygonarea import geographiclib.geodesiccapability import geographiclib.geomath import geographiclib.constants import geographiclib.accumulator # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', ] # Add any paths that contain templates here, relative to this directory. #templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'geographiclib' copyright = u'2015, Charles Karney' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = geographiclib.__version__ # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. #exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' if sphinx.__version__ < '1.3' else 'classic' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'geographiclibdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'geographiclib.tex', u'geographiclib Documentation', u'Charles Karney', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'geographiclib', u'geographiclib Documentation', [u'Charles Karney'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'geographiclib', u'geographiclib Documentation', u'Charles Karney', 'geographiclib', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False autodoc_member_order = 'bysource' autoclass_content = 'both' GeographicLib-1.52/python/doc/examples.rst0000644000771000077100000001154714064202371020463 0ustar ckarneyckarneyExamples ======== Initializing ------------ The following examples all assume that the following commands have been carried out: >>> from geographiclib.geodesic import Geodesic >>> import math >>> geod = Geodesic.WGS84 # define the WGS84 ellipsoid You can determine the ellipsoid parameters with the *a* and *f* member variables, for example, >>> geod.a, 1/geod.f (6378137.0, 298.257223563) If you need to use a different ellipsoid, construct one by, for example >>> geod = Geodesic(6378388, 1/297.0) # the international ellipsoid Basic geodesic calculations --------------------------- The distance from Wellington, NZ (41.32S, 174.81E) to Salamanca, Spain (40.96N, 5.50W) using :meth:`~geographiclib.geodesic.Geodesic.Inverse`: >>> g = geod.Inverse(-41.32, 174.81, 40.96, -5.50) >>> print("The distance is {:.3f} m.".format(g['s12'])) The distance is 19959679.267 m. The point 20000 km SW of Perth, Australia (32.06S, 115.74E) using :meth:`~geographiclib.geodesic.Geodesic.Direct`: >>> g = geod.Direct(-32.06, 115.74, 225, 20000e3) >>> print("The position is ({:.8f}, {:.8f}).".format(g['lat2'],g['lon2'])) The position is (32.11195529, -63.95925278). The area between the geodesic from JFK Airport (40.6N, 73.8W) to LHR Airport (51.6N, 0.5W) and the equator. This is an example of setting the the :ref:`output mask ` parameter. >>> g = geod.Inverse(40.6, -73.8, 51.6, -0.5, Geodesic.AREA) >>> print("The area is {:.1f} m^2".format(g['S12'])) The area is 40041368848742.5 m^2 Computing waypoints ------------------- Consider the geodesic between Beijing Airport (40.1N, 116.6E) and San Fransisco Airport (37.6N, 122.4W). Compute waypoints and azimuths at intervals of 1000 km using :meth:`Geodesic.Line ` and :meth:`GeodesicLine.Position `: >>> l = geod.InverseLine(40.1, 116.6, 37.6, -122.4) >>> ds = 1000e3; n = int(math.ceil(l.s13 / ds)) >>> for i in range(n + 1): ... if i == 0: ... print("distance latitude longitude azimuth") ... s = min(ds * i, l.s13) ... g = l.Position(s, Geodesic.STANDARD | Geodesic.LONG_UNROLL) ... print("{:.0f} {:.5f} {:.5f} {:.5f}".format( ... g['s12'], g['lat2'], g['lon2'], g['azi2'])) ... distance latitude longitude azimuth 0 40.10000 116.60000 42.91642 1000000 46.37321 125.44903 48.99365 2000000 51.78786 136.40751 57.29433 3000000 55.92437 149.93825 68.24573 4000000 58.27452 165.90776 81.68242 5000000 58.43499 183.03167 96.29014 6000000 56.37430 199.26948 109.99924 7000000 52.45769 213.17327 121.33210 8000000 47.19436 224.47209 129.98619 9000000 41.02145 233.58294 136.34359 9513998 37.60000 237.60000 138.89027 The inclusion of Geodesic.LONG_UNROLL in the call to GeodesicLine.Position ensures that the longitude does not jump on crossing the international dateline. If the purpose of computing the waypoints is to plot a smooth geodesic, then it's not important that they be exactly equally spaced. In this case, it's faster to parameterize the line in terms of the spherical arc length with :meth:`GeodesicLine.ArcPosition `. Here the spacing is about 1° of arc which means that the distance between the waypoints will be about 60 NM. >>> l = geod.InverseLine(40.1, 116.6, 37.6, -122.4, ... Geodesic.LATITUDE | Geodesic.LONGITUDE) >>> da = 1; n = int(math.ceil(l.a13 / da)); da = l.a13 / n >>> for i in range(n + 1): ... if i == 0: ... print("latitude longitude") ... a = da * i ... g = l.ArcPosition(a, Geodesic.LATITUDE | ... Geodesic.LONGITUDE | Geodesic.LONG_UNROLL) ... print("{:.5f} {:.5f}".format(g['lat2'], g['lon2'])) ... latitude longitude 40.10000 116.60000 40.82573 117.49243 41.54435 118.40447 42.25551 119.33686 42.95886 120.29036 43.65403 121.26575 44.34062 122.26380 ... 39.82385 235.05331 39.08884 235.91990 38.34746 236.76857 37.60000 237.60000 The variation in the distance between these waypoints is on the order of 1/*f*. Measuring areas --------------- Measure the area of Antarctica using :meth:`Geodesic.Polygon ` and the :class:`~geographiclib.polygonarea.PolygonArea` class: >>> p = geod.Polygon() >>> antarctica = [ ... [-63.1, -58], [-72.9, -74], [-71.9,-102], [-74.9,-102], [-74.3,-131], ... [-77.5,-163], [-77.4, 163], [-71.7, 172], [-65.9, 140], [-65.7, 113], ... [-66.6, 88], [-66.9, 59], [-69.8, 25], [-70.0, -4], [-71.0, -14], ... [-77.3, -33], [-77.9, -46], [-74.7, -61] ... ] >>> for pnt in antarctica: ... p.AddPoint(pnt[0], pnt[1]) ... >>> num, perim, area = p.Compute() >>> print("Perimeter/area of Antarctica are {:.3f} m / {:.1f} m^2". ... format(perim, area)) Perimeter/area of Antarctica are 16831067.893 m / 13662703680020.1 m^2 GeographicLib-1.52/python/doc/geodesics.rst0000644000771000077100000001725714064202371020616 0ustar ckarneyckarneyGeodesics on an ellipsoid ========================= Jump to * :ref:`intro` * :ref:`additional` * :ref:`multiple` * :ref:`background` * :ref:`references` .. _intro: Introduction ------------ Consider a ellipsoid of revolution with equatorial radius *a*, polar semi-axis *b*, and flattening *f* = (*a* − *b*)/*a* . Points on the surface of the ellipsoid are characterized by their latitude φ and longitude λ. (Note that latitude here means the *geographical latitude*, the angle between the normal to the ellipsoid and the equatorial plane). The shortest path between two points on the ellipsoid at (φ\ :sub:`1`, λ\ :sub:`1`) and (φ\ :sub:`2`, λ\ :sub:`2`) is called the geodesic. Its length is *s*\ :sub:`12` and the geodesic from point 1 to point 2 has forward azimuths α\ :sub:`1` and α\ :sub:`2` at the two end points. In this figure, we have λ\ :sub:`12` = λ\ :sub:`2` − λ\ :sub:`1`. .. raw:: html

Figure from wikipedia
A geodesic can be extended indefinitely by requiring that any sufficiently small segment is a shortest path; geodesics are also the straightest curves on the surface. Traditionally two geodesic problems are considered: * the direct problem — given φ\ :sub:`1`, λ\ :sub:`1`, α\ :sub:`1`, *s*\ :sub:`12`, determine φ\ :sub:`2`, λ\ :sub:`2`, and α\ :sub:`2`; this is solved by :meth:`Geodesic.Direct `. * the inverse problem — given φ\ :sub:`1`, λ\ :sub:`1`, φ\ :sub:`2`, λ\ :sub:`2`, determine *s*\ :sub:`12`, α\ :sub:`1`, and α\ :sub:`2`; this is solved by :meth:`Geodesic.Inverse `. .. _additional: Additional properties --------------------- The routines also calculate several other quantities of interest * *S*\ :sub:`12` 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 (φ\ :sub:`1`,λ\ :sub:`1`), (0,λ\ :sub:`1`), (0,λ\ :sub:`2`), and (φ\ :sub:`2`,λ\ :sub:`2`). It is given in meters\ :sup:`2`. * *m*\ :sub:`12`, the reduced length of the geodesic is defined such that if the initial azimuth is perturbed by *d*\ α\ :sub:`1` (radians) then the second point is displaced by *m*\ :sub:`12` *d*\ α\ :sub:`1` in the direction perpendicular to the geodesic. *m*\ :sub:`12` is given in meters. On a curved surface the reduced length obeys a symmetry relation, *m*\ :sub:`12` + *m*\ :sub:`21` = 0. On a flat surface, we have *m*\ :sub:`12` = *s*\ :sub:`12`. * *M*\ :sub:`12` and *M*\ :sub:`21` 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 *M*\ :sub:`12` *dt* at point 2. *M*\ :sub:`21` is defined similarly (with the geodesics being parallel to one another at point 2). *M*\ :sub:`12` and *M*\ :sub:`21` are dimensionless quantities. On a flat surface, we have *M*\ :sub:`12` = *M*\ :sub:`21` = 1. * σ\ :sub:`12` is the arc length on the auxiliary sphere. This is a construct for converting the problem to one in spherical trigonometry. The spherical arc length from one equator crossing to the next is always 180°. If points 1, 2, and 3 lie on a single geodesic, then the following addition rules hold: * *s*\ :sub:`13` = *s*\ :sub:`12` + *s*\ :sub:`23` * σ\ :sub:`13` = σ\ :sub:`12` + σ\ :sub:`23` * *S*\ :sub:`13` = *S*\ :sub:`12` + *S*\ :sub:`23` * *m*\ :sub:`13` = *m*\ :sub:`12`\ *M*\ :sub:`23` + *m*\ :sub:`23`\ *M*\ :sub:`21` * *M*\ :sub:`13` = *M*\ :sub:`12`\ *M*\ :sub:`23` − (1 − *M*\ :sub:`12`\ *M*\ :sub:`21`) *m*\ :sub:`23`/*m*\ :sub:`12` * *M*\ :sub:`31` = *M*\ :sub:`32`\ *M*\ :sub:`21` − (1 − *M*\ :sub:`23`\ *M*\ :sub:`32`) *m*\ :sub:`12`/*m*\ :sub:`23` .. _multiple: Multiple shortest geodesics --------------------------- The shortest distance found by solving the inverse problem is (obviously) uniquely defined. However, in a few special cases there are multiple azimuths which yield the same shortest distance. Here is a catalog of those cases: * φ\ :sub:`1` = −φ\ :sub:`2` (with neither point at a pole). If α\ :sub:`1` = α\ :sub:`2`, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [α\ :sub:`1`,α\ :sub:`2`] ← [α\ :sub:`2`,α\ :sub:`1`], [*M*\ :sub:`12`,\ *M*\ :sub:`21`] ← [*M*\ :sub:`21`,\ *M*\ :sub:`12`], *S*\ :sub:`12` ← −\ *S*\ :sub:`12`. (This occurs when the longitude difference is near ±180° for oblate ellipsoids.) * λ\ :sub:`2` = λ\ :sub:`1` ± 180° (with neither point at a pole). If α\ :sub:`1` = 0° or ±180°, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [α\ :sub:`1`,α\ :sub:`2`] ← [−α\ :sub:`1`,−α\ :sub:`2`], *S*\ :sub:`12` ← −\ *S*\ :sub:`12`. (This occurs when φ\ :sub:`2` is near −φ\ :sub:`1` for prolate ellipsoids.) * Points 1 and 2 at opposite poles. There are infinitely many geodesics which can be generated by setting [α\ :sub:`1`,α\ :sub:`2`] ← [α\ :sub:`1`,α\ :sub:`2`] + [δ,−δ], for arbitrary δ. (For spheres, this prescription applies when points 1 and 2 are antipodal.) * *s*\ :sub:`12` = 0 (coincident points). There are infinitely many geodesics which can be generated by setting [α\ :sub:`1`,α\ :sub:`2`] ← [α\ :sub:`1`,α\ :sub:`2`] + [δ,δ], for arbitrary δ. .. _background: Background ---------- The algorithms implemented by this package are given in Karney (2013) and are based on Bessel (1825) and Helmert (1880); the algorithm for areas is based on Danielsen (1989). These improve on the work of Vincenty (1975) in the following respects: * The results are accurate to round-off for terrestrial ellipsoids (the error in the distance is less than 15 nanometers, compared to 0.1 mm for Vincenty). * The solution of the inverse problem is always found. (Vincenty's method fails to converge for nearly antipodal points.) * The routines calculate differential and integral properties of a geodesic. This allows, for example, the area of a geodesic polygon to be computed. .. _references: 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. * F. R. Helmert, `Mathematical and Physical Theories of Higher Geodesy, Vol 1 `_, (Teubner, Leipzig, 1880), Chaps. 5–7. * T. Vincenty, `Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations `_, Survey Review **23**\ (176), 88–93 (1975). * J. Danielsen, `The area under the geodesic `_, Survey Review **30**\ (232), 61–66 (1989). * C. F. F. Karney, `Algorithms for geodesics `_, J. Geodesy **87**\ (1) 43–55 (2013); `addenda `_. * C. F. F. Karney, `Geodesics on an ellipsoid of revolution `_, Feb. 2011; `errata `_. * `A geodesic bibliography `_. * The wikipedia page, `Geodesics on an ellipsoid `_. GeographicLib-1.52/python/doc/index.rst0000644000771000077100000001100414064202371017740 0ustar ckarneyckarney.. geographiclib documentation master file, created by sphinx-quickstart on Sat Oct 24 17:14:00 2015. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. geographiclib ============= Author: Charles F. F. Karney (charles@karney.com) Version: |version| The documentation for other versions is available at ``https://geographiclib.sourceforge.io/m.nn/python/`` for versions numbers ``m.nn`` ≥ 1.46. Licensed under the MIT/X11 License; see `LICENSE.txt `_. Introduction ============ This is a python implementation of the geodesic routines in `GeographicLib `_. Although it is maintained in conjunction with the larger C++ library, this python package can be used independently. Installation ------------ The full `Geographic `_ package can be downloaded from `sourceforge `_. However the python implementation is available as a stand-alone package. To install this, run .. code-block:: sh pip install geographiclib Alternatively downloaded the package directly from `Python Package Index `_ and install it with .. code-block:: sh tar xpfz geographiclib-1.52.tar.gz cd geographiclib-1.52 python setup.py install It's a good idea to run the unit tests to verify that the installation worked OK by running .. code-block:: sh python -m unittest geographiclib.test.test_geodesic Contents -------- .. toctree:: :maxdepth: 2 geodesics interface code examples GeographicLib in various languages ---------------------------------- * C++ (complete library): `documentation <../index.html>`__, `download `_ * C (geodesic routines): `documentation <../C/index.html>`__, also included with recent versions of `proj.4 `_ * Fortran (geodesic routines): `documentation <../Fortran/index.html>`__ * Java (geodesic routines): `Maven Central package `_, `documentation <../java/index.html>`__ * JavaScript (geodesic routines): `npm package `_, `documentation <../js/index.html>`__ * Python (geodesic routines): `PyPI package `_, `documentation <../python/index.html>`__ * Matlab/Octave (geodesic and some other routines): `Matlab Central package `_, `documentation `__ * C# (.NET wrapper for complete C++ library): `documentation <../NET/index.html>`__ Change log ---------- * Version 1.52 (released 2021-06-22) * Work around inaccurate math.hypot for python 3.[89] * Be more aggressive in preventing negative s12 and m12 for short lines. * Version 1.50 (released 2019-09-24) * PolygonArea can now handle arbitrarily complex polygons. In the case of self-intersecting polygons the area is accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. * Fixed bug in counting pole encirclings when adding edges to a polygon. * Work around problems caused by sin(inf) and fmod(inf) raising exceptions. * Math.cbrt, Math.atanh, and Math.asinh now preserve the sign of −0. * Version 1.49 (released 2017-10-05) * Fix code formatting; add tests. * Version 1.48 (released 2017-04-09) * Change default range for longitude and azimuth to (−180°, 180°] (instead of [−180°, 180°)). * Version 1.47 (released 2017-02-15) * Fix the packaging, incorporating the patches in version 1.46.3. * Improve accuracy of area calculation (fixing a flaw introduced in version 1.46) * Version 1.46 (released 2016-02-15) * Add Geodesic.DirectLine, Geodesic.ArcDirectLine, Geodesic.InverseLine, GeodesicLine.SetDistance, GeodesicLine.SetArc, GeodesicLine.s13, GeodesicLine.a13. * More accurate inverse solution when longitude difference is close to 180°. * Remove unnecessary functions, CheckPosition, CheckAzimuth, CheckDistance. Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` GeographicLib-1.52/python/doc/interface.rst0000644000771000077100000001231014064202371020572 0ustar ckarneyckarneyThe library interface ===================== Jump to * :ref:`units` * :ref:`dict` * :ref:`outmask` * :ref:`restrictions` .. _units: The units --------- All angles (latitude, longitude, azimuth, arc length) are measured in degrees with latitudes increasing northwards, longitudes increasing eastwards, and azimuths measured clockwise from north. For a point at a pole, the azimuth is defined by keeping the longitude fixed, writing φ = ±(90° − ε), and taking the limit ε → 0+ .. _dict: Geodesic dictionary ------------------- The results returned by :meth:`Geodesic.Direct `, :meth:`Geodesic.Inverse `, :meth:`GeodesicLine.Position `, etc., return a dictionary with some of the following 12 fields set: * *lat1* = φ\ :sub:`1`, latitude of point 1 (degrees) * *lon1* = λ\ :sub:`1`, longitude of point 1 (degrees) * *azi1* = α\ :sub:`1`, azimuth of line at point 1 (degrees) * *lat2* = φ\ :sub:`2`, latitude of point 2 (degrees) * *lon2* = λ\ :sub:`2`, longitude of point 2 (degrees) * *azi2* = α\ :sub:`2`, (forward) azimuth of line at point 2 (degrees) * *s12* = *s*\ :sub:`12`, distance from 1 to 2 (meters) * *a12* = σ\ :sub:`12`, arc length on auxiliary sphere from 1 to 2 (degrees) * *m12* = *m*\ :sub:`12`, reduced length of geodesic (meters) * *M12* = *M*\ :sub:`12`, geodesic scale at 2 relative to 1 (dimensionless) * *M21* = *M*\ :sub:`21`, geodesic scale at 1 relative to 2 (dimensionless) * *S12* = *S*\ :sub:`12`, area between geodesic and equator (meters\ :sup:`2`) .. _outmask: *outmask* and *caps* -------------------- By default, the geodesic routines return the 7 basic quantities: *lat1*, *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, together with the arc length *a12*. The optional output mask parameter, *outmask*, can be used to tailor which quantities to calculate. In addition, when a :class:`~geographiclib.geodesicline.GeodesicLine` is constructed it can be provided with the optional capabilities parameter, *caps*, which specifies what quantities can be returned from the resulting object. Both *outmask* and *caps* are obtained by or'ing together the following values * :data:`~geographiclib.geodesic.Geodesic.EMPTY`, no capabilities, no output * :data:`~geographiclib.geodesic.Geodesic.LATITUDE`, compute latitude, *lat2* * :data:`~geographiclib.geodesic.Geodesic.LONGITUDE`, compute longitude, *lon2* * :data:`~geographiclib.geodesic.Geodesic.AZIMUTH`, compute azimuths, *azi1* and *azi2* * :data:`~geographiclib.geodesic.Geodesic.DISTANCE`, compute distance, *s12* * :data:`~geographiclib.geodesic.Geodesic.STANDARD`, all of the above * :data:`~geographiclib.geodesic.Geodesic.DISTANCE_IN`, allow *s12* to be used as input in the direct problem * :data:`~geographiclib.geodesic.Geodesic.REDUCEDLENGTH`, compute reduced length, *m12* * :data:`~geographiclib.geodesic.Geodesic.GEODESICSCALE`, compute geodesic scales, *M12* and *M21* * :data:`~geographiclib.geodesic.Geodesic.AREA`, compute area, *S12* * :data:`~geographiclib.geodesic.Geodesic.ALL`, all of the above; * :data:`~geographiclib.geodesic.Geodesic.LONG_UNROLL`, unroll longitudes DISTANCE_IN is a capability provided to the GeodesicLine constructor. It allows the position on the line to specified in terms of distance. (Without this, the position can only be specified in terms of the arc length.) This only makes sense in the *caps* parameter. LONG_UNROLL controls the treatment of longitude. If it is not set then the *lon1* and *lon2* fields are both reduced to the range [−180°, 180°). If it is set, then *lon1* is as given in the function call and (*lon2* − *lon1*) determines how many times and in what sense the geodesic has encircled the ellipsoid. This only makes sense in the *outmask* parameter. Note that *a12* is always included in the result. .. _restrictions: Restrictions on the parameters ------------------------------ * Latitudes must lie in [−90°, 90°]. Latitudes outside this range are replaced by NaNs. * The distance *s12* is unrestricted. This allows geodesics to wrap around the ellipsoid. Such geodesics are no longer shortest paths. However they retain the property that they are the straightest curves on the surface. * Similarly, the spherical arc length *a12* is unrestricted. * Longitudes and azimuths are unrestricted; internally these are exactly reduced to the range [−180°, 180°); but see also the LONG_UNROLL bit. * The equatorial radius *a* and the polar semi-axis *b* must both be positive and finite (this implies that −∞ < *f* < 1). * The flattening *f* should satisfy *f* ∈ [−1/50,1/50] in order to retain full accuracy. This condition holds for most applications in geodesy. Reasonably accurate results can be obtained for −0.2 ≤ *f* ≤ 0.2. Here is a table of the approximate maximum error (expressed as a distance) for an ellipsoid with the same equatorial radius as the WGS84 ellipsoid and different values of the flattening. ======== ======= abs(*f*) error -------- ------- 0.003 15 nm 0.01 25 nm 0.02 30 nm 0.05 10 μm 0.1 1.5 mm 0.2 300 mm ======== ======= Here 1 nm = 1 nanometer = 10\ :sup:`−9` m (*not* 1 nautical mile!) GeographicLib-1.52/python/geographiclib/CMakeLists.txt0000644000771000077100000000164514064202371022703 0ustar ckarneyckarney# 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 [A-Za-z_]*.py) file (GLOB TEST_FILES test/[A-Za-z_]*.py) if (COMMON_INSTALL_PATH) set (INSTALL_PYTHON_DIR "lib${LIB_SUFFIX}/python/site-packages") else () set (INSTALL_PYTHON_DIR "python") endif () install (FILES ${PYTHON_FILES} DESTINATION ${INSTALL_PYTHON_DIR}/geographiclib) install (FILES ${TEST_FILES} DESTINATION ${INSTALL_PYTHON_DIR}/geographiclib/test) # Only install setup.py under Windows because the installation tree is, # e.g., c:/Program Files/GeographicLib/${INSTALL_PYTHON_PATH}. Don't # install on other systems where this command would create, e.g., # /usr/local/${INSTALL_PYTHON_PATH}/setup.py which is likely to cause # conflicts. if (NOT COMMON_INSTALL_PATH) install (FILES ../setup.py DESTINATION ${INSTALL_PYTHON_DIR}) endif () GeographicLib-1.52/python/geographiclib/__init__.py0000644000771000077100000000027614064202371022253 0ustar ckarneyckarney"""geographiclib: geodesic routines from GeographicLib""" __version_info__ = (1, 52, 0) """GeographicLib version as a tuple""" __version__ = "1.52" """GeographicLib version as a string""" GeographicLib-1.52/python/geographiclib/accumulator.py0000644000771000077100000000611614064202371023032 0ustar ckarneyckarney"""accumulator.py: transcription of GeographicLib::Accumulator class.""" # 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 # # https://geographiclib.sourceforge.io/html/annotated.html # # Copyright (c) Charles Karney (2011-2019) and # licensed under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ ###################################################################### from geographiclib.geomath import Math class Accumulator(object): """Like math.fsum, but allows a running sum""" def Set(self, y): """Set value from argument""" 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): """Constructor""" self.Set(y) def Add(self, y): """Add a value""" # Here's Shewchuk's solution... # hold exact sum as [s, t, u] y, u = Math.sum(y, self._t) # Accumulate starting at self._s, self._t = Math.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): """Return sum + y""" if y == 0.0: return self._s else: b = Accumulator(self) b.Add(y) return b._s def Negate(self): """Negate sum""" self._s *= -1 self._t *= -1 def Remainder(self, y): """Remainder on division by y""" self._s = Math.remainder(self._s, y) self.Add(0.0) GeographicLib-1.52/python/geographiclib/constants.py0000644000771000077100000000142314064202371022523 0ustar ckarneyckarney"""Define the WGS84 ellipsoid""" # constants.py # # This is a translation of the GeographicLib::Constants class to python. See # the documentation for the C++ class for more information at # # https://geographiclib.sourceforge.io/html/annotated.html # # Copyright (c) Charles Karney (2011-2016) and # licensed under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ ###################################################################### class Constants(object): """ Constants describing the WGS84 ellipsoid """ WGS84_a = 6378137.0 # meters """the equatorial radius in meters of the WGS84 ellipsoid in meters""" WGS84_f = 1/298.257223563 """the flattening of the WGS84 ellipsoid, 1/298.257223563""" GeographicLib-1.52/python/geographiclib/geodesic.py0000644000771000077100000014275414064202371022306 0ustar ckarneyckarney"""Define the :class:`~geographiclib.geodesic.Geodesic` class The ellipsoid parameters are defined by the constructor. The direct and inverse geodesic problems are solved by * :meth:`~geographiclib.geodesic.Geodesic.Inverse` Solve the inverse geodesic problem * :meth:`~geographiclib.geodesic.Geodesic.Direct` Solve the direct geodesic problem * :meth:`~geographiclib.geodesic.Geodesic.ArcDirect` Solve the direct geodesic problem in terms of spherical arc length :class:`~geographiclib.geodesicline.GeodesicLine` objects can be created with * :meth:`~geographiclib.geodesic.Geodesic.Line` * :meth:`~geographiclib.geodesic.Geodesic.DirectLine` * :meth:`~geographiclib.geodesic.Geodesic.ArcDirectLine` * :meth:`~geographiclib.geodesic.Geodesic.InverseLine` :class:`~geographiclib.polygonarea.PolygonArea` objects can be created with * :meth:`~geographiclib.geodesic.Geodesic.Polygon` The public attributes for this class are * :attr:`~geographiclib.geodesic.Geodesic.a` :attr:`~geographiclib.geodesic.Geodesic.f` *outmask* and *caps* bit masks are * :const:`~geographiclib.geodesic.Geodesic.EMPTY` * :const:`~geographiclib.geodesic.Geodesic.LATITUDE` * :const:`~geographiclib.geodesic.Geodesic.LONGITUDE` * :const:`~geographiclib.geodesic.Geodesic.AZIMUTH` * :const:`~geographiclib.geodesic.Geodesic.DISTANCE` * :const:`~geographiclib.geodesic.Geodesic.STANDARD` * :const:`~geographiclib.geodesic.Geodesic.DISTANCE_IN` * :const:`~geographiclib.geodesic.Geodesic.REDUCEDLENGTH` * :const:`~geographiclib.geodesic.Geodesic.GEODESICSCALE` * :const:`~geographiclib.geodesic.Geodesic.AREA` * :const:`~geographiclib.geodesic.Geodesic.ALL` * :const:`~geographiclib.geodesic.Geodesic.LONG_UNROLL` :Example: >>> from geographiclib.geodesic import Geodesic >>> # The geodesic inverse problem ... Geodesic.WGS84.Inverse(-41.32, 174.81, 40.96, -5.50) {'lat1': -41.32, 'a12': 179.6197069334283, 's12': 19959679.26735382, 'lat2': 40.96, 'azi2': 18.825195123248392, 'azi1': 161.06766998615882, 'lon1': 174.81, 'lon2': -5.5} """ # 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 # # https://geographiclib.sourceforge.io/html/annotated.html # # The algorithms are derived in # # Charles F. F. Karney, # Algorithms for geodesics, J. Geodesy 87, 43-55 (2013), # https://doi.org/10.1007/s00190-012-0578-z # Addenda: https://geographiclib.sourceforge.io/geod-addenda.html # # Copyright (c) Charles Karney (2011-2021) and licensed # under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ ###################################################################### import math from geographiclib.geomath import Math from geographiclib.constants import Constants from geographiclib.geodesiccapability import GeodesicCapability class Geodesic(object): """Solve geodesic problems""" GEOGRAPHICLIB_GEODESIC_ORDER = 6 nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER nA3x_ = nA3_ nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER nC3x_ = (nC3_ * (nC3_ - 1)) // 2 nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER nC4x_ = (nC4_ * (nC4_ + 1)) // 2 maxit1_ = 20 maxit2_ = maxit1_ + Math.digits + 10 tiny_ = math.sqrt(Math.minval) tol0_ = Math.epsilon tol1_ = 200 * tol0_ tol2_ = math.sqrt(tol0_) tolb_ = tol0_ * tol2_ xthresh_ = 1000 * tol2_ CAP_NONE = GeodesicCapability.CAP_NONE CAP_C1 = GeodesicCapability.CAP_C1 CAP_C1p = GeodesicCapability.CAP_C1p CAP_C2 = GeodesicCapability.CAP_C2 CAP_C3 = GeodesicCapability.CAP_C3 CAP_C4 = GeodesicCapability.CAP_C4 CAP_ALL = GeodesicCapability.CAP_ALL CAP_MASK = GeodesicCapability.CAP_MASK OUT_ALL = GeodesicCapability.OUT_ALL OUT_MASK = GeodesicCapability.OUT_MASK def _SinCosSeries(sinp, sinx, cosx, c): """Private: Evaluate a trig series using Clenshaw summation.""" # 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 = len(c) # Point to one beyond last element n = k - sinp 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 = 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 _Astroid(x, y): """Private: solve astroid equation.""" # 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 discriminant 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): """Private: return A1-1.""" coeff = [ 1, 4, 64, 0, 256, ] m = Geodesic.nA1_//2 t = Math.polyval(m, coeff, 0, Math.sq(eps)) / coeff[m + 1] return (t + eps) / (1 - eps) _A1m1f = staticmethod(_A1m1f) def _C1f(eps, c): """Private: return C1.""" coeff = [ -1, 6, -16, 32, -9, 64, -128, 2048, 9, -16, 768, 3, -5, 512, -7, 1280, -7, 2048, ] eps2 = Math.sq(eps) d = eps o = 0 for l in range(1, Geodesic.nC1_ + 1): # l is index of C1p[l] m = (Geodesic.nC1_ - l) // 2 # order of polynomial in eps^2 c[l] = d * Math.polyval(m, coeff, o, eps2) / coeff[o + m + 1] o += m + 2 d *= eps _C1f = staticmethod(_C1f) def _C1pf(eps, c): """Private: return C1'""" coeff = [ 205, -432, 768, 1536, 4005, -4736, 3840, 12288, -225, 116, 384, -7173, 2695, 7680, 3467, 7680, 38081, 61440, ] eps2 = Math.sq(eps) d = eps o = 0 for l in range(1, Geodesic.nC1p_ + 1): # l is index of C1p[l] m = (Geodesic.nC1p_ - l) // 2 # order of polynomial in eps^2 c[l] = d * Math.polyval(m, coeff, o, eps2) / coeff[o + m + 1] o += m + 2 d *= eps _C1pf = staticmethod(_C1pf) def _A2m1f(eps): """Private: return A2-1""" coeff = [ -11, -28, -192, 0, 256, ] m = Geodesic.nA2_//2 t = Math.polyval(m, coeff, 0, Math.sq(eps)) / coeff[m + 1] return (t - eps) / (1 + eps) _A2m1f = staticmethod(_A2m1f) def _C2f(eps, c): """Private: return C2""" coeff = [ 1, 2, 16, 32, 35, 64, 384, 2048, 15, 80, 768, 7, 35, 512, 63, 1280, 77, 2048, ] eps2 = Math.sq(eps) d = eps o = 0 for l in range(1, Geodesic.nC2_ + 1): # l is index of C2[l] m = (Geodesic.nC2_ - l) // 2 # order of polynomial in eps^2 c[l] = d * Math.polyval(m, coeff, o, eps2) / coeff[o + m + 1] o += m + 2 d *= eps _C2f = staticmethod(_C2f) def __init__(self, a, f): """Construct a Geodesic object :param a: the equatorial radius of the ellipsoid in meters :param f: the flattening of the ellipsoid An exception is thrown if *a* or the polar semi-axis *b* = *a* (1 - *f*) is not a finite positive quantity. """ self.a = float(a) """The equatorial radius in meters (readonly)""" self.f = float(f) """The flattening (readonly)""" 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". Using the auxiliary sphere # solution with dnm computed at (bet1 + bet2) / 2, the relative error in # the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. # (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a given # f and sig12, the max error occurs for lines near the pole. If the old # rule for computing dnm = (dn1 + dn2)/2 is used, then the error increases # by a factor of 2.) Setting this equal to epsilon gives sig12 = etol2. # Here 0.1 is a safety factor (error decreased by 100) and max(0.001, # abs(f)) stops etol2 getting too large in the nearly spherical case. self._etol2 = 0.1 * Geodesic.tol2_ / math.sqrt( max(0.001, abs(self.f)) * min(1.0, 1-self.f/2) / 2 ) if not(Math.isfinite(self.a) and self.a > 0): raise ValueError("Equatorial radius is not positive") if not(Math.isfinite(self._b) and self._b > 0): raise ValueError("Polar semi-axis is not positive") self._A3x = list(range(Geodesic.nA3x_)) self._C3x = list(range(Geodesic.nC3x_)) self._C4x = list(range(Geodesic.nC4x_)) self._A3coeff() self._C3coeff() self._C4coeff() def _A3coeff(self): """Private: return coefficients for A3""" coeff = [ -3, 128, -2, -3, 64, -1, -3, -1, 16, 3, -1, -2, 8, 1, -1, 2, 1, 1, ] o = 0; k = 0 for j in range(Geodesic.nA3_ - 1, -1, -1): # coeff of eps^j m = min(Geodesic.nA3_ - j - 1, j) # order of polynomial in n self._A3x[k] = Math.polyval(m, coeff, o, self._n) / coeff[o + m + 1] k += 1 o += m + 2 def _C3coeff(self): """Private: return coefficients for C3""" coeff = [ 3, 128, 2, 5, 128, -1, 3, 3, 64, -1, 0, 1, 8, -1, 1, 4, 5, 256, 1, 3, 128, -3, -2, 3, 64, 1, -3, 2, 32, 7, 512, -10, 9, 384, 5, -9, 5, 192, 7, 512, -14, 7, 512, 21, 2560, ] o = 0; k = 0 for l in range(1, Geodesic.nC3_): # l is index of C3[l] for j in range(Geodesic.nC3_ - 1, l - 1, -1): # coeff of eps^j m = min(Geodesic.nC3_ - j - 1, j) # order of polynomial in n self._C3x[k] = Math.polyval(m, coeff, o, self._n) / coeff[o + m + 1] k += 1 o += m + 2 def _C4coeff(self): """Private: return coefficients for C4""" coeff = [ 97, 15015, 1088, 156, 45045, -224, -4784, 1573, 45045, -10656, 14144, -4576, -858, 45045, 64, 624, -4576, 6864, -3003, 15015, 100, 208, 572, 3432, -12012, 30030, 45045, 1, 9009, -2944, 468, 135135, 5792, 1040, -1287, 135135, 5952, -11648, 9152, -2574, 135135, -64, -624, 4576, -6864, 3003, 135135, 8, 10725, 1856, -936, 225225, -8448, 4992, -1144, 225225, -1440, 4160, -4576, 1716, 225225, -136, 63063, 1024, -208, 105105, 3584, -3328, 1144, 315315, -128, 135135, -2560, 832, 405405, 128, 99099, ] o = 0; k = 0 for l in range(Geodesic.nC4_): # l is index of C4[l] for j in range(Geodesic.nC4_ - 1, l - 1, -1): # coeff of eps^j m = Geodesic.nC4_ - j - 1 # order of polynomial in n self._C4x[k] = Math.polyval(m, coeff, o, self._n) / coeff[o + m + 1] k += 1 o += m + 2 def _A3f(self, eps): """Private: return A3""" # Evaluate A3 return Math.polyval(Geodesic.nA3_ - 1, self._A3x, 0, eps) def _C3f(self, eps, c): """Private: return C3""" # Evaluate C3 # Elements c[1] thru c[nC3_ - 1] are set mult = 1 o = 0 for l in range(1, Geodesic.nC3_): # l is index of C3[l] m = Geodesic.nC3_ - l - 1 # order of polynomial in eps mult *= eps c[l] = mult * Math.polyval(m, self._C3x, o, eps) o += m + 1 def _C4f(self, eps, c): """Private: return C4""" # Evaluate C4 coeffs by Horner's method # Elements c[0] thru c[nC4_ - 1] are set mult = 1 o = 0 for l in range(Geodesic.nC4_): # l is index of C4[l] m = Geodesic.nC4_ - l - 1 # order of polynomial in eps c[l] = mult * Math.polyval(m, self._C4x, o, eps) o += m + 1 mult *= eps # return s12b, m12b, m0, M12, M21 def _Lengths(self, eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask, # Scratch areas of the right size C1a, C2a): """Private: return a bunch of lengths""" # Return s12b, m12b, m0, M12, M21, where # m12b = (reduced length)/_b; s12b = distance/_b, # m0 = coefficient of secular term in expression for reduced length. outmask &= Geodesic.OUT_MASK # outmask & DISTANCE: set s12b # outmask & REDUCEDLENGTH: set m12b & m0 # outmask & GEODESICSCALE: set M12 & M21 s12b = m12b = m0 = M12 = M21 = Math.nan if outmask & (Geodesic.DISTANCE | Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE): A1 = Geodesic._A1m1f(eps) Geodesic._C1f(eps, C1a) if outmask & (Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE): A2 = Geodesic._A2m1f(eps) Geodesic._C2f(eps, C2a) m0x = A1 - A2 A2 = 1 + A2 A1 = 1 + A1 if outmask & Geodesic.DISTANCE: B1 = (Geodesic._SinCosSeries(True, ssig2, csig2, C1a) - Geodesic._SinCosSeries(True, ssig1, csig1, C1a)) # Missing a factor of _b s12b = A1 * (sig12 + B1) if outmask & (Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE): B2 = (Geodesic._SinCosSeries(True, ssig2, csig2, C2a) - Geodesic._SinCosSeries(True, ssig1, csig1, C2a)) J12 = m0x * sig12 + (A1 * B1 - A2 * B2) elif outmask & (Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE): # Assume here that nC1_ >= nC2_ for l in range(1, Geodesic.nC2_): C2a[l] = A1 * C1a[l] - A2 * C2a[l] J12 = m0x * sig12 + (Geodesic._SinCosSeries(True, ssig2, csig2, C2a) - Geodesic._SinCosSeries(True, ssig1, csig1, C2a)) if outmask & Geodesic.REDUCEDLENGTH: m0 = m0x # Missing a factor of _b. # Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure # accurate cancellation in the case of coincident points. m12b = (dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12) if outmask & Geodesic.GEODESICSCALE: csig12 = csig1 * csig2 + ssig1 * ssig2 t = self._ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2) M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1 M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2 return s12b, m12b, m0, M12, M21 # return sig12, salp1, calp1, salp2, calp2, dnm def _InverseStart(self, sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, # Scratch areas of the right size C1a, C2a): """Private: Find a starting value for Newton's method.""" # 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 = dnm = 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 cbet2 * lam12 < 0.5 if shortline: sbetm2 = Math.sq(sbet1 + sbet2) # sin((bet1+bet2)/2)^2 # = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) sbetm2 /= sbetm2 + Math.sq(cbet1 + cbet2) dnm = math.sqrt(1 + self._ep2 * sbetm2) omg12 = lam12 / (self._f1 * dnm) somg12 = math.sin(omg12); comg12 = math.cos(omg12) else: somg12 = slam12; comg12 = clam12 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) if comg12 >= 0 else 1 - comg12) salp2, calp2 = Math.norm(salp2, calp2) # Set return value sig12 = math.atan2(ssig12, csig12) elif (abs(self._n) >= 0.1 or # Skip astroid calc if too eccentric csig12 >= 0 or ssig12 >= 6 * abs(self._n) * 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 lam12x = math.atan2(-slam12, -clam12) 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 = lam12x / lamscale y = sbet12a / betscale else: # _f < 0 # x = dlat, y = dlong cbet12a = cbet2 * cbet1 - sbet2 * sbet1 bet12a = math.atan2(sbet12a, cbet12a) # real m12b, m0, dummy # In the case of lon12 = 180, this repeats a calculation made in # Inverse. dummy, m12b, m0, dummy, dummy = self._Lengths( self._n, math.pi + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, Geodesic.REDUCEDLENGTH, C1a, C2a) x = -1 + m12b / (cbet1 * cbet2 * m0 * math.pi) betscale = (sbet12a / x if x < -0.01 else -self.f * Math.sq(cbet1) * math.pi) lamscale = betscale / cbet1 y = lam12x / 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) # Sanity check on starting guess. Backwards check allows NaN through. if not (salp1 <= 0): salp1, calp1 = Math.norm(salp1, calp1) else: salp1 = 1; calp1 = 0 return sig12, salp1, calp1, salp2, calp2, dnm # return lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, # domg12, dlam12 def _Lambda12(self, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam120, clam120, diffp, # Scratch areas of the right size C1a, C2a, C3a): """Private: Solve hybrid problem""" 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, 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 = Math.norm(ssig1, csig1) # Math.norm(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 = Math.norm(ssig2, csig2) # Math.norm(somg2, comg2); -- don't need to normalize! # sig12 = sig2 - sig1, limit to [0, pi] sig12 = math.atan2(max(0.0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2) # omg12 = omg2 - omg1, limit to [0, pi] somg12 = max(0.0, comg1 * somg2 - somg1 * comg2) comg12 = comg1 * comg2 + somg1 * somg2 # eta = omg12 - lam120 eta = math.atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120) # real B312 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._SinCosSeries(True, ssig1, csig1, C3a)) domg12 = -self.f * self._A3f(eps) * salp0 * (sig12 + B312) lam12 = eta + domg12 if diffp: if calp2 == 0: dlam12 = - 2 * self._f1 * dn1 / sbet1 else: dummy, dlam12, dummy, dummy, dummy = self._Lengths( eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, Geodesic.REDUCEDLENGTH, C1a, C2a) dlam12 *= self._f1 / (calp2 * cbet2) else: dlam12 = Math.nan return (lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, domg12, dlam12) # return a12, s12, salp1, calp1, salp2, calp2, m12, M12, M21, S12 def _GenInverse(self, lat1, lon1, lat2, lon2, outmask): """Private: General version of the inverse problem""" a12 = s12 = m12 = M12 = M21 = S12 = Math.nan # return vals outmask &= Geodesic.OUT_MASK # Compute longitude difference (AngDiff does this carefully). Result is # in [-180, 180] but -180 is only for west-going geodesics. 180 is for # east-going and meridional geodesics. lon12, lon12s = Math.AngDiff(lon1, lon2) # Make longitude difference positive. lonsign = 1 if lon12 >= 0 else -1 # If very close to being on the same half-meridian, then make it so. lon12 = lonsign * Math.AngRound(lon12) lon12s = Math.AngRound((180 - lon12) - lonsign * lon12s) lam12 = math.radians(lon12) if lon12 > 90: slam12, clam12 = Math.sincosd(lon12s); clam12 = -clam12 else: slam12, clam12 = Math.sincosd(lon12) # If really close to the equator, treat as on equator. lat1 = Math.AngRound(Math.LatFix(lat1)) lat2 = Math.AngRound(Math.LatFix(lat2)) # Swap points so that point with higher (abs) latitude is point 1 # If one latitude is a nan, then it becomes lat1. 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 sbet1, cbet1 = Math.sincosd(lat1); sbet1 *= self._f1 # Ensure cbet1 = +epsilon at poles sbet1, cbet1 = Math.norm(sbet1, cbet1); cbet1 = max(Geodesic.tiny_, cbet1) sbet2, cbet2 = Math.sincosd(lat2); sbet2 *= self._f1 # Ensure cbet2 = +epsilon at poles sbet2, cbet2 = Math.norm(sbet2, cbet2); cbet2 = max(Geodesic.tiny_, 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 dn1 = math.sqrt(1 + self._ep2 * Math.sq(sbet1)) dn2 = math.sqrt(1 + self._ep2 * Math.sq(sbet2)) # real a12, sig12, calp1, salp1, calp2, salp2 # index zero elements of these arrays are unused C1a = list(range(Geodesic.nC1_ + 1)) C2a = list(range(Geodesic.nC2_ + 1)) C3a = list(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.0; salp2 = 0.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(0.0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2) s12x, m12x, dummy, M12, M21 = self._Lengths( self._n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | Geodesic.DISTANCE | Geodesic.REDUCEDLENGTH, 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 | GeodSolve -i # # In fact, we will have sig12 > pi/2 for meridional geodesic which is # not a shortest path. if sig12 < 1 or m12x >= 0: if (sig12 < 3 * Geodesic.tiny_ or # Prevent negative s12 or m12 for short lines (sig12 < Geodesic.tol0_ and (s12x < 0 or m12x < 0))): sig12 = m12x = s12x = 0.0 m12x *= self._b s12x *= self._b a12 = math.degrees(sig12) else: # m12 < 0, i.e., prolate and too close to anti-podal meridian = False # end if meridian: # somg12 > 1 marks that it needs to be calculated somg12 = 2.0; comg12 = 0.0; omg12 = 0.0 if (not meridian and sbet1 == 0 and # and sbet2 == 0 # Mimic the way Lambda12 works with calp1 = 0 (self.f <= 0 or lon12s >= self.f * 180)): # Geodesic runs along equator calp1 = calp2 = 0.0; salp1 = salp2 = 1.0 s12x = self.a * lam12 sig12 = omg12 = lam12 / self._f1 m12x = self._b * math.sin(sig12) if outmask & Geodesic.GEODESICSCALE: M12 = M21 = math.cos(sig12) a12 = lon12 / 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, dnm = self._InverseStart( sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a) if sig12 >= 0: # Short lines (InverseStart sets salp2, calp2, dnm) s12x = sig12 * self._b * dnm m12x = (Math.sq(dnm) * self._b * math.sin(sig12 / dnm)) if outmask & Geodesic.GEODESICSCALE: M12 = M21 = math.cos(sig12 / dnm) a12 = math.degrees(sig12) omg12 = lam12 / (self._f1 * dnm) else: # Newton's method. This is a straightforward solution of f(alp1) = # lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one # root in the interval (0, pi) and its derivative is positive at the # root. Thus f(alp) is positive for alp > alp1 and negative for alp < # alp1. During the course of the iteration, a range (alp1a, alp1b) is # maintained which brackets the root and with each evaluation of f(alp) # the range is shrunk if possible. Newton's method is restarted # whenever the derivative of f is negative (because the new value of # alp1 is then further from the solution) or if the new estimate of # alp1 lies outside (0,pi); in this case, the new starting guess is # taken to be (alp1a + alp1b) / 2. # real ssig1, csig1, ssig2, csig2, eps numit = 0 tripn = tripb = False # Bracketing range salp1a = Geodesic.tiny_; calp1a = 1.0 salp1b = Geodesic.tiny_; calp1b = -1.0 while numit < Geodesic.maxit2_: # the WGS84 test set: mean = 1.47, sd = 1.25, max = 16 # WGS84 and random input: mean = 2.85, sd = 0.60 (v, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, domg12, dv) = self._Lambda12( sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, numit < Geodesic.maxit1_, C1a, C2a, C3a) # Reversed test to allow escape with NaNs if tripb or not (abs(v) >= (8 if tripn else 1) * Geodesic.tol0_): break # Update bracketing values if v > 0 and (numit > Geodesic.maxit1_ or calp1/salp1 > calp1b/salp1b): salp1b = salp1; calp1b = calp1 elif v < 0 and (numit > Geodesic.maxit1_ or calp1/salp1 < calp1a/salp1a): salp1a = salp1; calp1a = calp1 numit += 1 if numit < Geodesic.maxit1_ and dv > 0: dalp1 = -v/dv sdalp1 = math.sin(dalp1); cdalp1 = math.cos(dalp1) nsalp1 = salp1 * cdalp1 + calp1 * sdalp1 if nsalp1 > 0 and abs(dalp1) < math.pi: calp1 = calp1 * cdalp1 - salp1 * sdalp1 salp1 = nsalp1 salp1, calp1 = Math.norm(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). tripn = abs(v) <= 16 * Geodesic.tol0_ continue # Either dv was not positive or updated value was outside # legal range. Use the midpoint of the bracket as the next # estimate. This mechanism is not needed for the WGS84 # ellipsoid, but it does catch problems with more eccentric # ellipsoids. Its efficacy is such for # the WGS84 test set with the starting guess set to alp1 = 90deg: # the WGS84 test set: mean = 5.21, sd = 3.93, max = 24 # WGS84 and random input: mean = 4.74, sd = 0.99 salp1 = (salp1a + salp1b)/2 calp1 = (calp1a + calp1b)/2 salp1, calp1 = Math.norm(salp1, calp1) tripn = False tripb = (abs(salp1a - salp1) + (calp1a - calp1) < Geodesic.tolb_ or abs(salp1 - salp1b) + (calp1 - calp1b) < Geodesic.tolb_) lengthmask = (outmask | (Geodesic.DISTANCE if (outmask & (Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE)) else Geodesic.EMPTY)) s12x, m12x, dummy, M12, M21 = self._Lengths( eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, lengthmask, C1a, C2a) m12x *= self._b s12x *= self._b a12 = math.degrees(sig12) if outmask & Geodesic.AREA: # omg12 = lam12 - domg12 sdomg12 = math.sin(domg12); cdomg12 = math.cos(domg12) somg12 = slam12 * cdomg12 - clam12 * sdomg12 comg12 = clam12 * cdomg12 + slam12 * sdomg12 # end elif not meridian if outmask & Geodesic.DISTANCE: s12 = 0.0 + s12x # Convert -0 to 0 if outmask & Geodesic.REDUCEDLENGTH: m12 = 0.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 eps = k2 / (2 * (1 + math.sqrt(1 + k2)) + k2) # Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = Math.sq(self.a) * calp0 * salp0 * self._e2 ssig1, csig1 = Math.norm(ssig1, csig1) ssig2, csig2 = Math.norm(ssig2, csig2) C4a = list(range(Geodesic.nC4_)) self._C4f(eps, C4a) B41 = Geodesic._SinCosSeries(False, ssig1, csig1, C4a) B42 = Geodesic._SinCosSeries(False, ssig2, csig2, C4a) S12 = A4 * (B42 - B41) else: # Avoid problems with indeterminate sig1, sig2 on equator S12 = 0.0 if not meridian and somg12 > 1: somg12 = math.sin(omg12); comg12 = math.cos(omg12) if (not meridian and # omg12 < 3/4 * pi comg12 > -0.7071 and # Long difference not too big sbet2 - sbet1 < 1.75): # Lat difference not 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)) domg12 = 1 + comg12; 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.0 alp12 = math.atan2(salp12, calp12) S12 += self._c2 * alp12 S12 *= swapp * lonsign * latsign # Convert -0 to 0 S12 += 0.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 return a12, s12, salp1, calp1, salp2, calp2, m12, M12, M21, S12 def Inverse(self, lat1, lon1, lat2, lon2, outmask = GeodesicCapability.STANDARD): """Solve the inverse geodesic problem :param lat1: latitude of the first point in degrees :param lon1: longitude of the first point in degrees :param lat2: latitude of the second point in degrees :param lon2: longitude of the second point in degrees :param outmask: the :ref:`output mask ` :return: a :ref:`dict` Compute geodesic between (*lat1*, *lon1*) and (*lat2*, *lon2*). The default value of *outmask* is STANDARD, i.e., the *lat1*, *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, *a12* entries are returned. """ a12, s12, salp1,calp1, salp2,calp2, m12, M12, M21, S12 = self._GenInverse( lat1, lon1, lat2, lon2, outmask) outmask &= Geodesic.OUT_MASK if outmask & Geodesic.LONG_UNROLL: lon12, e = Math.AngDiff(lon1, lon2) lon2 = (lon1 + lon12) + e else: lon2 = Math.AngNormalize(lon2) result = {'lat1': Math.LatFix(lat1), 'lon1': lon1 if outmask & Geodesic.LONG_UNROLL else Math.AngNormalize(lon1), 'lat2': Math.LatFix(lat2), 'lon2': lon2} result['a12'] = a12 if outmask & Geodesic.DISTANCE: result['s12'] = s12 if outmask & Geodesic.AZIMUTH: result['azi1'] = Math.atan2d(salp1, calp1) result['azi2'] = Math.atan2d(salp2, calp2) 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): """Private: General version of direct problem""" from geographiclib.geodesicline import GeodesicLine # Automatically supply DISTANCE_IN if necessary if not arcmode: outmask |= Geodesic.DISTANCE_IN line = GeodesicLine(self, lat1, lon1, azi1, outmask) return line._GenPosition(arcmode, s12_a12, outmask) def Direct(self, lat1, lon1, azi1, s12, outmask = GeodesicCapability.STANDARD): """Solve the direct geodesic problem :param lat1: latitude of the first point in degrees :param lon1: longitude of the first point in degrees :param azi1: azimuth at the first point in degrees :param s12: the distance from the first point to the second in meters :param outmask: the :ref:`output mask ` :return: a :ref:`dict` Compute geodesic starting at (*lat1*, *lon1*) with azimuth *azi1* and length *s12*. The default value of *outmask* is STANDARD, i.e., the *lat1*, *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, *a12* entries are returned. """ a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 = self._GenDirect( lat1, lon1, azi1, False, s12, outmask) outmask &= Geodesic.OUT_MASK result = {'lat1': Math.LatFix(lat1), 'lon1': lon1 if outmask & Geodesic.LONG_UNROLL else Math.AngNormalize(lon1), 'azi1': Math.AngNormalize(azi1), 's12': s12} 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 ArcDirect(self, lat1, lon1, azi1, a12, outmask = GeodesicCapability.STANDARD): """Solve the direct geodesic problem in terms of spherical arc length :param lat1: latitude of the first point in degrees :param lon1: longitude of the first point in degrees :param azi1: azimuth at the first point in degrees :param a12: spherical arc length from the first point to the second in degrees :param outmask: the :ref:`output mask ` :return: a :ref:`dict` Compute geodesic starting at (*lat1*, *lon1*) with azimuth *azi1* and arc length *a12*. The default value of *outmask* is STANDARD, i.e., the *lat1*, *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, *a12* entries are returned. """ a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 = self._GenDirect( lat1, lon1, azi1, True, a12, outmask) outmask &= Geodesic.OUT_MASK result = {'lat1': Math.LatFix(lat1), 'lon1': lon1 if outmask & Geodesic.LONG_UNROLL else Math.AngNormalize(lon1), 'azi1': Math.AngNormalize(azi1), 'a12': a12} if outmask & Geodesic.DISTANCE: result['s12'] = s12 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 = GeodesicCapability.STANDARD | GeodesicCapability.DISTANCE_IN): """Return a GeodesicLine object :param lat1: latitude of the first point in degrees :param lon1: longitude of the first point in degrees :param azi1: azimuth at the first point in degrees :param caps: the :ref:`capabilities ` :return: a :class:`~geographiclib.geodesicline.GeodesicLine` This allows points along a geodesic starting at (*lat1*, *lon1*), with azimuth *azi1* to be found. The default value of *caps* is STANDARD | DISTANCE_IN, allowing direct geodesic problem to be solved. """ from geographiclib.geodesicline import GeodesicLine return GeodesicLine(self, lat1, lon1, azi1, caps) def _GenDirectLine(self, lat1, lon1, azi1, arcmode, s12_a12, caps = GeodesicCapability.STANDARD | GeodesicCapability.DISTANCE_IN): """Private: general form of DirectLine""" from geographiclib.geodesicline import GeodesicLine # Automatically supply DISTANCE_IN if necessary if not arcmode: caps |= Geodesic.DISTANCE_IN line = GeodesicLine(self, lat1, lon1, azi1, caps) if arcmode: line.SetArc(s12_a12) else: line.SetDistance(s12_a12) return line def DirectLine(self, lat1, lon1, azi1, s12, caps = GeodesicCapability.STANDARD | GeodesicCapability.DISTANCE_IN): """Define a GeodesicLine object in terms of the direct geodesic problem specified in terms of spherical arc length :param lat1: latitude of the first point in degrees :param lon1: longitude of the first point in degrees :param azi1: azimuth at the first point in degrees :param s12: the distance from the first point to the second in meters :param caps: the :ref:`capabilities ` :return: a :class:`~geographiclib.geodesicline.GeodesicLine` This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem. The default value of *caps* is STANDARD | DISTANCE_IN, allowing direct geodesic problem to be solved. """ return self._GenDirectLine(lat1, lon1, azi1, False, s12, caps) def ArcDirectLine(self, lat1, lon1, azi1, a12, caps = GeodesicCapability.STANDARD | GeodesicCapability.DISTANCE_IN): """Define a GeodesicLine object in terms of the direct geodesic problem specified in terms of spherical arc length :param lat1: latitude of the first point in degrees :param lon1: longitude of the first point in degrees :param azi1: azimuth at the first point in degrees :param a12: spherical arc length from the first point to the second in degrees :param caps: the :ref:`capabilities ` :return: a :class:`~geographiclib.geodesicline.GeodesicLine` This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem. The default value of *caps* is STANDARD | DISTANCE_IN, allowing direct geodesic problem to be solved. """ return self._GenDirectLine(lat1, lon1, azi1, True, a12, caps) def InverseLine(self, lat1, lon1, lat2, lon2, caps = GeodesicCapability.STANDARD | GeodesicCapability.DISTANCE_IN): """Define a GeodesicLine object in terms of the invese geodesic problem :param lat1: latitude of the first point in degrees :param lon1: longitude of the first point in degrees :param lat2: latitude of the second point in degrees :param lon2: longitude of the second point in degrees :param caps: the :ref:`capabilities ` :return: a :class:`~geographiclib.geodesicline.GeodesicLine` This function sets point 3 of the GeodesicLine to correspond to point 2 of the inverse geodesic problem. The default value of *caps* is STANDARD | DISTANCE_IN, allowing direct geodesic problem to be solved. """ from geographiclib.geodesicline import GeodesicLine a12, _, salp1, calp1, _, _, _, _, _, _ = self._GenInverse( lat1, lon1, lat2, lon2, 0) azi1 = Math.atan2d(salp1, calp1) if caps & (Geodesic.OUT_MASK & Geodesic.DISTANCE_IN): caps |= Geodesic.DISTANCE line = GeodesicLine(self, lat1, lon1, azi1, caps, salp1, calp1) line.SetArc(a12) return line def Polygon(self, polyline = False): """Return a PolygonArea object :param polyline: if True then the object describes a polyline instead of a polygon :return: a :class:`~geographiclib.polygonarea.PolygonArea` """ from geographiclib.polygonarea import PolygonArea return PolygonArea(self, polyline) EMPTY = GeodesicCapability.EMPTY """No capabilities, no output.""" LATITUDE = GeodesicCapability.LATITUDE """Calculate latitude *lat2*.""" LONGITUDE = GeodesicCapability.LONGITUDE """Calculate longitude *lon2*.""" AZIMUTH = GeodesicCapability.AZIMUTH """Calculate azimuths *azi1* and *azi2*.""" DISTANCE = GeodesicCapability.DISTANCE """Calculate distance *s12*.""" STANDARD = GeodesicCapability.STANDARD """All of the above.""" DISTANCE_IN = GeodesicCapability.DISTANCE_IN """Allow distance *s12* to be used as input in the direct geodesic problem.""" REDUCEDLENGTH = GeodesicCapability.REDUCEDLENGTH """Calculate reduced length *m12*.""" GEODESICSCALE = GeodesicCapability.GEODESICSCALE """Calculate geodesic scales *M12* and *M21*.""" AREA = GeodesicCapability.AREA """Calculate area *S12*.""" ALL = GeodesicCapability.ALL """All of the above.""" LONG_UNROLL = GeodesicCapability.LONG_UNROLL """Unroll longitudes, rather than reducing them to the range [-180d,180d]. """ Geodesic.WGS84 = Geodesic(Constants.WGS84_a, Constants.WGS84_f) """Instantiation for the WGS84 ellipsoid""" GeographicLib-1.52/python/geographiclib/geodesiccapability.py0000644000771000077100000000257614064202371024345 0ustar ckarneyckarney"""geodesiccapability.py: capability constants for geodesic{,line}.py""" # 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 # # https://geographiclib.sourceforge.io/html/annotated.html # # Copyright (c) Charles Karney (2011-2014) and licensed # under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ ###################################################################### 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 CAP_MASK = CAP_ALL OUT_ALL = 0x7F80 OUT_MASK = 0xFF80 # Includes LONG_UNROLL EMPTY = 0 LATITUDE = 1 << 7 | CAP_NONE LONGITUDE = 1 << 8 | CAP_C3 AZIMUTH = 1 << 9 | CAP_NONE DISTANCE = 1 << 10 | CAP_C1 STANDARD = LATITUDE | LONGITUDE | AZIMUTH | DISTANCE 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 LONG_UNROLL = 1 << 15 ALL = OUT_ALL | CAP_ALL # Does not include LONG_UNROLL GeographicLib-1.52/python/geographiclib/geodesicline.py0000644000771000077100000004376014064202371023153 0ustar ckarneyckarney"""Define the :class:`~geographiclib.geodesicline.GeodesicLine` class The constructor defines the starting point of the line. Points on the line are given by * :meth:`~geographiclib.geodesicline.GeodesicLine.Position` position given in terms of distance * :meth:`~geographiclib.geodesicline.GeodesicLine.ArcPosition` position given in terms of spherical arc length A reference point 3 can be defined with * :meth:`~geographiclib.geodesicline.GeodesicLine.SetDistance` set position of 3 in terms of the distance from the starting point * :meth:`~geographiclib.geodesicline.GeodesicLine.SetArc` set position of 3 in terms of the spherical arc length from the starting point The object can also be constructed by * :meth:`Geodesic.Line ` * :meth:`Geodesic.DirectLine ` * :meth:`Geodesic.ArcDirectLine ` * :meth:`Geodesic.InverseLine ` The public attributes for this class are * :attr:`~geographiclib.geodesicline.GeodesicLine.a` :attr:`~geographiclib.geodesicline.GeodesicLine.f` :attr:`~geographiclib.geodesicline.GeodesicLine.caps` :attr:`~geographiclib.geodesicline.GeodesicLine.lat1` :attr:`~geographiclib.geodesicline.GeodesicLine.lon1` :attr:`~geographiclib.geodesicline.GeodesicLine.azi1` :attr:`~geographiclib.geodesicline.GeodesicLine.salp1` :attr:`~geographiclib.geodesicline.GeodesicLine.calp1` :attr:`~geographiclib.geodesicline.GeodesicLine.s13` :attr:`~geographiclib.geodesicline.GeodesicLine.a13` """ # 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 # # https://geographiclib.sourceforge.io/html/annotated.html # # The algorithms are derived in # # Charles F. F. Karney, # Algorithms for geodesics, J. Geodesy 87, 43-55 (2013), # https://doi.org/10.1007/s00190-012-0578-z # Addenda: https://geographiclib.sourceforge.io/geod-addenda.html # # Copyright (c) Charles Karney (2011-2019) and licensed # under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ ###################################################################### 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.STANDARD | GeodesicCapability.DISTANCE_IN, salp1 = Math.nan, calp1 = Math.nan): """Construct a GeodesicLine object :param geod: a :class:`~geographiclib.geodesic.Geodesic` object :param lat1: latitude of the first point in degrees :param lon1: longitude of the first point in degrees :param azi1: azimuth at the first point in degrees :param caps: the :ref:`capabilities ` This creates an object allowing points along a geodesic starting at (*lat1*, *lon1*), with azimuth *azi1* to be found. The default value of *caps* is STANDARD | DISTANCE_IN. The optional parameters *salp1* and *calp1* should not be supplied; they are part of the private interface. """ from geographiclib.geodesic import Geodesic self.a = geod.a """The equatorial radius in meters (readonly)""" self.f = geod.f """The flattening (readonly)""" self._b = geod._b self._c2 = geod._c2 self._f1 = geod._f1 self.caps = (caps | Geodesic.LATITUDE | Geodesic.AZIMUTH | Geodesic.LONG_UNROLL) """the capabilities (readonly)""" # Guard against underflow in salp0 self.lat1 = Math.LatFix(lat1) """the latitude of the first point in degrees (readonly)""" self.lon1 = lon1 """the longitude of the first point in degrees (readonly)""" if Math.isnan(salp1) or Math.isnan(calp1): self.azi1 = Math.AngNormalize(azi1) self.salp1, self.calp1 = Math.sincosd(Math.AngRound(azi1)) else: self.azi1 = azi1 """the azimuth at the first point in degrees (readonly)""" self.salp1 = salp1 """the sine of the azimuth at the first point (readonly)""" self.calp1 = calp1 """the cosine of the azimuth at the first point (readonly)""" # real cbet1, sbet1 sbet1, cbet1 = Math.sincosd(Math.AngRound(self.lat1)); sbet1 *= self._f1 # Ensure cbet1 = +epsilon at poles sbet1, cbet1 = Math.norm(sbet1, cbet1); cbet1 = max(Geodesic.tiny_, cbet1) self._dn1 = math.sqrt(1 + geod._ep2 * Math.sq(sbet1)) # 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 = Math.norm(self._ssig1, self._csig1) # No need to normalize # self._somg1, self._comg1 = Math.norm(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 = list(range(Geodesic.nC1_ + 1)) Geodesic._C1f(eps, self._C1a) self._B11 = Geodesic._SinCosSeries( True, self._ssig1, self._csig1, self._C1a) 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) if self.caps & Geodesic.CAP_C1p: self._C1pa = list(range(Geodesic.nC1p_ + 1)) Geodesic._C1pf(eps, self._C1pa) if self.caps & Geodesic.CAP_C2: self._A2m1 = Geodesic._A2m1f(eps) self._C2a = list(range(Geodesic.nC2_ + 1)) Geodesic._C2f(eps, self._C2a) self._B21 = Geodesic._SinCosSeries( True, self._ssig1, self._csig1, self._C2a) if self.caps & Geodesic.CAP_C3: self._C3a = list(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) if self.caps & Geodesic.CAP_C4: self._C4a = list(range(Geodesic.nC4_)) geod._C4f(eps, 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) self.s13 = Math.nan """the distance between point 1 and point 3 in meters (readonly)""" self.a13 = Math.nan """the arc length between point 1 and point 3 in degrees (readonly)""" # return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 def _GenPosition(self, arcmode, s12_a12, outmask): """Private: General solution of position along geodesic""" from geographiclib.geodesic import Geodesic a12 = lat2 = lon2 = azi2 = s12 = m12 = M12 = M21 = S12 = Math.nan outmask &= self.caps & Geodesic.OUT_MASK if not (arcmode or (self.caps & (Geodesic.OUT_MASK & Geodesic.DISTANCE_IN))): # Uninitialized or impossible distance calculation requested return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 # Avoid warning about uninitialized B12. B12 = 0.0; AB1 = 0.0 if arcmode: # Interpret s12_a12 as spherical arc length sig12 = math.radians(s12_a12) ssig12, csig12 = Math.sincosd(s12_a12) else: # Interpret s12_a12 as distance tau12 = s12_a12 / (self._b * (1 + self._A1m1)) tau12 = tau12 if Math.isfinite(tau12) else Math.nan 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) sig12 = tau12 - (B12 - self._B11) ssig12 = math.sin(sig12); csig12 = math.cos(sig12) if abs(self.f) > 0.01: # Reverted distance series is inaccurate for |f| > 1/100, so correct # sig12 with 1 Newton iteration. The following table shows the # approximate maximum error for a = WGS_a() and various f relative to # GeodesicExact. # erri = the error in the inverse solution (nm) # errd = the error in the direct solution (series only) (nm) # errda = the error in the direct solution (series + 1 Newton) (nm) # # f erri errd errda # -1/5 12e6 1.2e9 69e6 # -1/10 123e3 12e6 765e3 # -1/20 1110 108e3 7155 # -1/50 18.63 200.9 27.12 # -1/100 18.63 23.78 23.37 # -1/150 18.63 21.05 20.26 # 1/150 22.35 24.73 25.83 # 1/100 22.35 25.03 25.31 # 1/50 29.80 231.9 30.44 # 1/20 5376 146e3 10e3 # 1/10 829e3 22e6 1.5e6 # 1/5 157e6 3.8e9 280e6 ssig2 = self._ssig1 * csig12 + self._csig1 * ssig12 csig2 = self._csig1 * csig12 - self._ssig1 * ssig12 B12 = Geodesic._SinCosSeries(True, ssig2, csig2, self._C1a) serr = ((1 + self._A1m1) * (sig12 + (B12 - self._B11)) - s12_a12 / self._b) sig12 = sig12 - serr / math.sqrt(1 + self._k2 * Math.sq(ssig2)) ssig12 = math.sin(sig12); csig12 = math.cos(sig12) # Update B12 below # 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 dn2 = math.sqrt(1 + self._k2 * Math.sq(ssig2)) if outmask & ( Geodesic.DISTANCE | Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE): if arcmode or abs(self.f) > 0.01: B12 = Geodesic._SinCosSeries(True, ssig2, csig2, self._C1a) 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(alp0) = cos(sig2)*tan(alp2) salp2 = self._salp0; calp2 = self._calp0 * csig2 # No need to normalize if outmask & Geodesic.DISTANCE: s12 = self._b * ((1 + self._A1m1) * sig12 + AB1) if arcmode else s12_a12 if outmask & Geodesic.LONGITUDE: # tan(omg2) = sin(alp0) * tan(sig2) somg2 = self._salp0 * ssig2; comg2 = csig2 # No need to normalize E = Math.copysign(1, self._salp0) # East or west going? # omg12 = omg2 - omg1 omg12 = (E * (sig12 - (math.atan2( ssig2, csig2) - math.atan2( self._ssig1, self._csig1)) + (math.atan2(E * somg2, comg2) - math.atan2(E * self._somg1, self._comg1))) if outmask & Geodesic.LONG_UNROLL else math.atan2(somg2 * self._comg1 - comg2 * self._somg1, comg2 * self._comg1 + somg2 * self._somg1)) lam12 = omg12 + self._A3c * ( sig12 + (Geodesic._SinCosSeries(True, ssig2, csig2, self._C3a) - self._B31)) lon12 = math.degrees(lam12) lon2 = (self.lon1 + lon12 if outmask & Geodesic.LONG_UNROLL else Math.AngNormalize(Math.AngNormalize(self.lon1) + Math.AngNormalize(lon12))) if outmask & Geodesic.LATITUDE: lat2 = Math.atan2d(sbet2, self._f1 * cbet2) if outmask & Geodesic.AZIMUTH: azi2 = Math.atan2d(salp2, calp2) if outmask & (Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE): B22 = Geodesic._SinCosSeries(True, ssig2, csig2, self._C2a) 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 * (( dn2 * (self._csig1 * ssig2) - self._dn1 * (self._ssig1 * csig2)) - self._csig1 * csig2 * J12) if outmask & Geodesic.GEODESICSCALE: t = (self._k2 * (ssig2 - self._ssig1) * (ssig2 + self._ssig1) / (self._dn1 + dn2)) M12 = csig12 + (t * ssig2 - csig2 * J12) * self._ssig1 / self._dn1 M21 = csig12 - (t * self._ssig1 - self._csig1 * J12) * ssig2 / dn2 if outmask & Geodesic.AREA: B42 = Geodesic._SinCosSeries(False, ssig2, csig2, self._C4a) # real salp12, calp12 if self._calp0 == 0 or self._salp0 == 0: # alp12 = alp2 - alp1, used in atan2 so no need to normalize salp12 = salp2 * self.calp1 - calp2 * self.salp1 calp12 = calp2 * self.calp1 + salp2 * self.salp1 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 math.degrees(sig12) return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 def Position(self, s12, outmask = GeodesicCapability.STANDARD): """Find the position on the line given *s12* :param s12: the distance from the first point to the second in meters :param outmask: the :ref:`output mask ` :return: a :ref:`dict` The default value of *outmask* is STANDARD, i.e., the *lat1*, *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, *a12* entries are returned. The :class:`~geographiclib.geodesicline.GeodesicLine` object must have been constructed with the DISTANCE_IN capability. """ from geographiclib.geodesic import Geodesic result = {'lat1': self.lat1, 'lon1': self.lon1 if outmask & Geodesic.LONG_UNROLL else Math.AngNormalize(self.lon1), 'azi1': self.azi1, 's12': s12} a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 = self._GenPosition( False, s12, outmask) outmask &= Geodesic.OUT_MASK 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 ArcPosition(self, a12, outmask = GeodesicCapability.STANDARD): """Find the position on the line given *a12* :param a12: spherical arc length from the first point to the second in degrees :param outmask: the :ref:`output mask ` :return: a :ref:`dict` The default value of *outmask* is STANDARD, i.e., the *lat1*, *lon1*, *azi1*, *lat2*, *lon2*, *azi2*, *s12*, *a12* entries are returned. """ from geographiclib.geodesic import Geodesic result = {'lat1': self.lat1, 'lon1': self.lon1 if outmask & Geodesic.LONG_UNROLL else Math.AngNormalize(self.lon1), 'azi1': self.azi1, 'a12': a12} a12, lat2, lon2, azi2, s12, m12, M12, M21, S12 = self._GenPosition( True, a12, outmask) outmask &= Geodesic.OUT_MASK if outmask & Geodesic.DISTANCE: result['s12'] = s12 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 SetDistance(self, s13): """Specify the position of point 3 in terms of distance :param s13: distance from point 1 to point 3 in meters """ self.s13 = s13 self.a13, _, _, _, _, _, _, _, _ = self._GenPosition(False, self.s13, 0) def SetArc(self, a13): """Specify the position of point 3 in terms of arc length :param a13: spherical arc length from point 1 to point 3 in degrees """ from geographiclib.geodesic import Geodesic self.a13 = a13 _, _, _, _, self.s13, _, _, _, _ = self._GenPosition(True, self.a13, Geodesic.DISTANCE) GeographicLib-1.52/python/geographiclib/geomath.py0000644000771000077100000001502114064202371022132 0ustar ckarneyckarney"""geomath.py: transcription of GeographicLib::Math class.""" # 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 # # https://geographiclib.sourceforge.io/html/annotated.html # # Copyright (c) Charles Karney (2011-2021) and # licensed under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ ###################################################################### import sys import math class Math(object): """ Additional math routines for GeographicLib. This defines constants: epsilon, difference between 1 and the next bigger number digits, the number of digits in the fraction of a real number minval, minimum normalized positive number maxval, maximum finite number nan, not a number inf, infinity """ digits = 53 epsilon = math.pow(2.0, 1-digits) minval = math.pow(2.0, -1022) maxval = math.pow(2.0, 1023) * (2 - epsilon) inf = float("inf") if sys.version_info > (2, 6) else 2 * maxval nan = float("nan") if sys.version_info > (2, 6) else inf - 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 if x < 0 else x) 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 if x < 0 else x) atanh = staticmethod(atanh) def copysign(x, y): """return x with the sign of y (missing from python 2.5.2)""" if sys.version_info > (2, 6): return math.copysign(x, y) return math.fabs(x) * (-1 if y < 0 or (y == 0 and 1/y < 0) else 1) copysign = staticmethod(copysign) def norm(x, y): """Private: Normalize a two-vector.""" r = (math.sqrt(Math.sq(x) + Math.sq(y)) # hypot is inaccurate for 3.[89]. Problem reported by agdhruv # https://github.com/geopy/geopy/issues/466 ; see # https://bugs.python.org/issue43088 # Visual Studio 2015 32-bit has a similar problem. if (3, 8) <= sys.version_info < (3, 10) else math.hypot(x, y)) return x/r, y/r norm = staticmethod(norm) def sum(u, v): """Error free transformation of a sum.""" # 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 polyval(N, p, s, x): """Evaluate a polynomial.""" y = float(0 if N < 0 else p[s]) # make sure the returned value is a float while N > 0: N -= 1; s += 1 y = y * x + p[s] return y polyval = staticmethod(polyval) def AngRound(x): """Private: Round an angle so that small values underflow to zero.""" # 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 = 1/16.0 y = abs(x) # The compiler mustn't "simplify" z - (z - y) to y if y < z: y = z - (z - y) return 0.0 if x == 0 else (-y if x < 0 else y) AngRound = staticmethod(AngRound) def remainder(x, y): """remainder of x/y in the range [-y/2, y/2].""" z = math.fmod(x, y) if Math.isfinite(x) else Math.nan # On Windows 32-bit with python 2.7, math.fmod(-0.0, 360) = +0.0 # This fixes this bug. See also Math::AngNormalize in the C++ library. # sincosd has a similar fix. z = x if x == 0 else z return (z + y if z < -y/2 else (z if z < y/2 else z -y)) remainder = staticmethod(remainder) def AngNormalize(x): """reduce angle to (-180,180]""" y = Math.remainder(x, 360) return 180 if y == -180 else y AngNormalize = staticmethod(AngNormalize) def LatFix(x): """replace angles outside [-90,90] by NaN""" return Math.nan if abs(x) > 90 else x LatFix = staticmethod(LatFix) def AngDiff(x, y): """compute y - x and reduce to [-180,180] accurately""" d, t = Math.sum(Math.AngNormalize(-x), Math.AngNormalize(y)) d = Math.AngNormalize(d) return Math.sum(-180 if d == 180 and t > 0 else d, t) AngDiff = staticmethod(AngDiff) def sincosd(x): """Compute sine and cosine of x in degrees.""" r = math.fmod(x, 360) if Math.isfinite(x) else Math.nan q = 0 if Math.isnan(r) else int(round(r / 90)) r -= 90 * q; r = math.radians(r) s = math.sin(r); c = math.cos(r) q = q % 4 if q == 1: s, c = c, -s elif q == 2: s, c = -s, -c elif q == 3: s, c = -c, s # Remove the minus sign on -0.0 except for sin(-0.0). # On Windows 32-bit with python 2.7, math.fmod(-0.0, 360) = +0.0 # (x, c) here fixes this bug. See also Math::sincosd in the C++ library. # AngNormalize has a similar fix. s, c = (x, c) if x == 0 else (0.0+s, 0.0+c) return s, c sincosd = staticmethod(sincosd) def atan2d(y, x): """compute atan2(y, x) with the result in degrees""" if abs(y) > abs(x): q = 2; x, y = y, x else: q = 0 if x < 0: q += 1; x = -x ang = math.degrees(math.atan2(y, x)) if q == 1: ang = (180 if y >= 0 else -180) - ang elif q == 2: ang = 90 - ang elif q == 3: ang = -90 + ang return ang atan2d = staticmethod(atan2d) def isfinite(x): """Test for finiteness""" return abs(x) <= Math.maxval isfinite = staticmethod(isfinite) def isnan(x): """Test if nan""" return math.isnan(x) if sys.version_info > (2, 6) else x != x isnan = staticmethod(isnan) GeographicLib-1.52/python/geographiclib/polygonarea.py0000644000771000077100000002771714064202371023045 0ustar ckarneyckarney"""Define the :class:`~geographiclib.polygonarea.PolygonArea` class The constructor initializes a empty polygon. The available methods are * :meth:`~geographiclib.polygonarea.PolygonArea.Clear` reset the polygon * :meth:`~geographiclib.polygonarea.PolygonArea.AddPoint` add a vertex to the polygon * :meth:`~geographiclib.polygonarea.PolygonArea.AddEdge` add an edge to the polygon * :meth:`~geographiclib.polygonarea.PolygonArea.Compute` compute the properties of the polygon * :meth:`~geographiclib.polygonarea.PolygonArea.TestPoint` compute the properties of the polygon with a tentative additional vertex * :meth:`~geographiclib.polygonarea.PolygonArea.TestEdge` compute the properties of the polygon with a tentative additional edge The public attributes for this class are * :attr:`~geographiclib.polygonarea.PolygonArea.earth` :attr:`~geographiclib.polygonarea.PolygonArea.polyline` :attr:`~geographiclib.polygonarea.PolygonArea.area0` :attr:`~geographiclib.polygonarea.PolygonArea.num` :attr:`~geographiclib.polygonarea.PolygonArea.lat1` :attr:`~geographiclib.polygonarea.PolygonArea.lon1` """ # 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 # # https://geographiclib.sourceforge.io/html/annotated.html # # The algorithms are derived in # # Charles F. F. Karney, # Algorithms for geodesics, J. Geodesy 87, 43-55 (2013), # https://doi.org/10.1007/s00190-012-0578-z # Addenda: https://geographiclib.sourceforge.io/geod-addenda.html # # Copyright (c) Charles Karney (2011-2019) and licensed # under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ ###################################################################### import math from geographiclib.geomath import Math from geographiclib.accumulator import Accumulator class PolygonArea(object): """Area of a geodesic polygon""" def _transit(lon1, lon2): """Count crossings of prime meridian for AddPoint.""" # Return 1 or -1 if crossing prime meridian in east or west direction. # Otherwise return zero. # Compute lon12 the same way as Geodesic::Inverse. lon1 = Math.AngNormalize(lon1) lon2 = Math.AngNormalize(lon2) lon12, _ = Math.AngDiff(lon1, lon2) 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 _transitdirect(lon1, lon2): """Count crossings of prime meridian for AddEdge.""" # We want to compute exactly # int(ceil(lon2 / 360)) - int(ceil(lon1 / 360)) # Since we only need the parity of the result we can use std::remquo but # this is buggy with g++ 4.8.3 and requires C++11. So instead we do lon1 = math.fmod(lon1, 720.0); lon2 = math.fmod(lon2, 720.0) return ( (1 if ((lon2 <= 0 and lon2 > -360) or lon2 > 360) else 0) - (1 if ((lon1 <= 0 and lon1 > -360) or lon1 > 360) else 0) ) _transitdirect = staticmethod(_transitdirect) def _areareduceA(area, area0, crossings, reverse, sign): """Reduce accumulator area to allowed range.""" area.Remainder(area0) if crossings & 1: area.Add( (1 if area.Sum() < 0 else -1) * area0/2 ) # area is with the clockwise sense. If !reverse convert to # counter-clockwise convention. if not reverse: area.Negate() # If sign put area in (-area0/2, area0/2], else put area in [0, area0) if sign: if area.Sum() > area0/2: area.Add( -area0 ) elif area.Sum() <= -area0/2: area.Add( area0 ) else: if area.Sum() >= area0: area.Add( -area0 ) elif area.Sum() < 0: area.Add( area0 ) return 0.0 + area.Sum() _areareduceA = staticmethod(_areareduceA) def _areareduceB(area, area0, crossings, reverse, sign): """Reduce double area to allowed range.""" area = Math.remainder(area, area0) if crossings & 1: area += (1 if area < 0 else -1) * area0/2 # area is with the clockwise sense. If !reverse convert to # counter-clockwise convention. if not reverse: area *= -1 # If sign put area in (-area0/2, area0/2], else put area in [0, area0) if sign: if area > area0/2: area -= area0 elif area <= -area0/2: area += area0 else: if area >= area0: area -= area0 elif area < 0: area += area0 return 0.0 + area _areareduceB = staticmethod(_areareduceB) def __init__(self, earth, polyline = False): """Construct a PolygonArea object :param earth: a :class:`~geographiclib.geodesic.Geodesic` object :param polyline: if true, treat object as a polyline instead of a polygon Initially the polygon has no vertices. """ from geographiclib.geodesic import Geodesic self.earth = earth """The geodesic object (readonly)""" self.polyline = polyline """Is this a polyline? (readonly)""" self.area0 = 4 * math.pi * earth._c2 """The total area of the ellipsoid in meter^2 (readonly)""" self._mask = (Geodesic.LATITUDE | Geodesic.LONGITUDE | Geodesic.DISTANCE | (Geodesic.EMPTY if self.polyline else Geodesic.AREA | Geodesic.LONG_UNROLL)) if not self.polyline: self._areasum = Accumulator() self._perimetersum = Accumulator() self.num = 0 """The current number of points in the polygon (readonly)""" self.lat1 = Math.nan """The current latitude in degrees (readonly)""" self.lon1 = Math.nan """The current longitude in degrees (readonly)""" self.Clear() def Clear(self): """Reset to empty polygon.""" 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 = Math.nan def AddPoint(self, lat, lon): """Add the next vertex to the polygon :param lat: the latitude of the point in degrees :param lon: the longitude of the point in degrees This adds an edge from the current vertex to the new vertex. """ if self.num == 0: self._lat0 = self.lat1 = lat self._lon0 = self.lon1 = lon else: _, s12, _, _, _, _, _, _, _, 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 def AddEdge(self, azi, s): """Add the next edge to the polygon :param azi: the azimuth at the current the point in degrees :param s: the length of the edge in meters This specifies the new vertex in terms of the edge from the current vertex. """ if self.num != 0: _, lat, lon, _, _, _, _, _, S12 = self.earth._GenDirect( self.lat1, self.lon1, azi, False, s, self._mask) self._perimetersum.Add(s) if not self.polyline: self._areasum.Add(S12) self._crossings += PolygonArea._transitdirect(self.lon1, lon) self.lat1 = lat self.lon1 = lon self.num += 1 # return number, perimeter, area def Compute(self, reverse = False, sign = True): """Compute the properties of the polygon :param reverse: if true then clockwise (instead of counter-clockwise) traversal counts as a positive area :param 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 :return: a tuple of number, perimeter (meters), area (meters^2) Arbitrarily complex polygons are allowed. In the case of self-intersecting polygons the area is accumulated "algebraically", e.g., the areas of the 2 loops in a figure-8 polygon will partially cancel. If the object is a polygon (and not a polyline), the perimeter includes the length of a final edge connecting the current point to the initial point. If the object is a polyline, then area is nan. More points can be added to the polygon after this call. """ if self.polyline: area = Math.nan if self.num < 2: perimeter = 0.0 if not self.polyline: area = 0.0 return self.num, perimeter, area if self.polyline: perimeter = self._perimetersum.Sum() return self.num, perimeter, area _, s12, _, _, _, _, _, _, _, 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) area = PolygonArea._areareduceA(tempsum, self.area0, crossings, reverse, sign) return self.num, perimeter, area # return number, perimeter, area def TestPoint(self, lat, lon, reverse = False, sign = True): """Compute the properties for a tentative additional vertex :param lat: the latitude of the point in degrees :param lon: the longitude of the point in degrees :param reverse: if true then clockwise (instead of counter-clockwise) traversal counts as a positive area :param 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 :return: a tuple of number, perimeter (meters), area (meters^2) """ if self.polyline: area = Math.nan if self.num == 0: perimeter = 0.0 if not self.polyline: area = 0.0 return 1, perimeter, area perimeter = self._perimetersum.Sum() tempsum = 0.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]): _, s12, _, _, _, _, _, _, _, 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 area = PolygonArea._areareduceB(tempsum, self.area0, crossings, reverse, sign) return num, perimeter, area # return num, perimeter, area def TestEdge(self, azi, s, reverse = False, sign = True): """Compute the properties for a tentative additional edge :param azi: the azimuth at the current the point in degrees :param s: the length of the edge in meters :param reverse: if true then clockwise (instead of counter-clockwise) traversal counts as a positive area :param 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 :return: a tuple of number, perimeter (meters), area (meters^2) """ if self.num == 0: # we don't have a starting point! return 0, Math.nan, Math.nan num = self.num + 1 perimeter = self._perimetersum.Sum() + s if self.polyline: return num, perimeter, Math.nan tempsum = self._areasum.Sum() crossings = self._crossings _, lat, lon, _, _, _, _, _, S12 = self.earth._GenDirect( self.lat1, self.lon1, azi, False, s, self._mask) tempsum += S12 crossings += PolygonArea._transitdirect(self.lon1, lon) _, s12, _, _, _, _, _, _, _, S12 = self.earth._GenInverse( lat, lon, self._lat0, self._lon0, self._mask) perimeter += s12 tempsum += S12 crossings += PolygonArea._transit(lon, self._lon0) area = PolygonArea._areareduceB(tempsum, self.area0, crossings, reverse, sign) return num, perimeter, area GeographicLib-1.52/python/geographiclib/test/__init__.py0000644000771000077100000000041514064202371023225 0ustar ckarneyckarney""" test_geodesic: test the geodesic routines from GeographicLib Run these tests with one of python2 -m unittest -v geographiclib.test.test_geodesic python3 -m unittest -v geographiclib.test.test_geodesic executed in this directory's parent directory. """ GeographicLib-1.52/python/geographiclib/test/test_geodesic.py0000644000771000077100000011643714064202371024323 0ustar ckarneyckarneyimport unittest from geographiclib.geodesic import Geodesic from geographiclib.geomath import Math class GeodesicTest(unittest.TestCase): testcases = [ [35.60777, -139.44815, 111.098748429560326, -11.17491, -69.95921, 129.289270889708762, 8935244.5604818305, 80.50729714281974, 6273170.2055303837, 0.16606318447386067, 0.16479116945612937, 12841384694976.432], [55.52454, 106.05087, 22.020059880982801, 77.03196, 197.18234, 109.112041110671519, 4105086.1713924406, 36.892740690445894, 3828869.3344387607, 0.80076349608092607, 0.80101006984201008, 61674961290615.615], [-21.97856, 142.59065, -32.44456876433189, 41.84138, 98.56635, -41.84359951440466, 8394328.894657671, 75.62930491011522, 6161154.5773110616, 0.24816339233950381, 0.24930251203627892, -6637997720646.717], [-66.99028, 112.2363, 173.73491240878403, -12.70631, 285.90344, 2.512956620913668, 11150344.2312080241, 100.278634181155759, 6289939.5670446687, -0.17199490274700385, -0.17722569526345708, -121287239862139.744], [-17.42761, 173.34268, -159.033557661192928, -15.84784, 5.93557, -20.787484651536988, 16076603.1631180673, 144.640108810286253, 3732902.1583877189, -0.81273638700070476, -0.81299800519154474, 97825992354058.708], [32.84994, 48.28919, 150.492927788121982, -56.28556, 202.29132, 48.113449399816759, 16727068.9438164461, 150.565799985466607, 3147838.1910180939, -0.87334918086923126, -0.86505036767110637, -72445258525585.010], [6.96833, 52.74123, 92.581585386317712, -7.39675, 206.17291, 90.721692165923907, 17102477.2496958388, 154.147366239113561, 2772035.6169917581, -0.89991282520302447, -0.89986892177110739, -1311796973197.995], [-50.56724, -16.30485, -105.439679907590164, -33.56571, -94.97412, -47.348547835650331, 6455670.5118668696, 58.083719495371259, 5409150.7979815838, 0.53053508035997263, 0.52988722644436602, 41071447902810.047], [-58.93002, -8.90775, 140.965397902500679, -8.91104, 133.13503, 19.255429433416599, 11756066.0219864627, 105.755691241406877, 6151101.2270708536, -0.26548622269867183, -0.27068483874510741, -86143460552774.735], [-68.82867, -74.28391, 93.774347763114881, -50.63005, -8.36685, 34.65564085411343, 3956936.926063544, 35.572254987389284, 3708890.9544062657, 0.81443963736383502, 0.81420859815358342, -41845309450093.787], [-10.62672, -32.0898, -86.426713286747751, 5.883, -134.31681, -80.473780971034875, 11470869.3864563009, 103.387395634504061, 6184411.6622659713, -0.23138683500430237, -0.23155097622286792, 4198803992123.548], [-21.76221, 166.90563, 29.319421206936428, 48.72884, 213.97627, 43.508671946410168, 9098627.3986554915, 81.963476716121964, 6299240.9166992283, 0.13965943368590333, 0.14152969707656796, 10024709850277.476], [-19.79938, -174.47484, 71.167275780171533, -11.99349, -154.35109, 65.589099775199228, 2319004.8601169389, 20.896611684802389, 2267960.8703918325, 0.93427001867125849, 0.93424887135032789, -3935477535005.785], [-11.95887, -116.94513, 92.712619830452549, 4.57352, 7.16501, 78.64960934409585, 13834722.5801401374, 124.688684161089762, 5228093.177931598, -0.56879356755666463, -0.56918731952397221, -9919582785894.853], [-87.85331, 85.66836, -65.120313040242748, 66.48646, 16.09921, -4.888658719272296, 17286615.3147144645, 155.58592449699137, 2635887.4729110181, -0.90697975771398578, -0.91095608883042767, 42667211366919.534], [1.74708, 128.32011, -101.584843631173858, -11.16617, 11.87109, -86.325793296437476, 12942901.1241347408, 116.650512484301857, 5682744.8413270572, -0.44857868222697644, -0.44824490340007729, 10763055294345.653], [-25.72959, -144.90758, -153.647468693117198, -57.70581, -269.17879, -48.343983158876487, 9413446.7452453107, 84.664533838404295, 6356176.6898881281, 0.09492245755254703, 0.09737058264766572, 74515122850712.444], [-41.22777, 122.32875, 14.285113402275739, -7.57291, 130.37946, 10.805303085187369, 3812686.035106021, 34.34330804743883, 3588703.8812128856, 0.82605222593217889, 0.82572158200920196, -2456961531057.857], [11.01307, 138.25278, 79.43682622782374, 6.62726, 247.05981, 103.708090215522657, 11911190.819018408, 107.341669954114577, 6070904.722786735, -0.29767608923657404, -0.29785143390252321, 17121631423099.696], [-29.47124, 95.14681, -163.779130441688382, -27.46601, -69.15955, -15.909335945554969, 13487015.8381145492, 121.294026715742277, 5481428.9945736388, -0.51527225545373252, -0.51556587964721788, 104679964020340.318]] def test_inverse(self): for l in GeodesicTest.testcases: (lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12) = l inv = Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2, Geodesic.ALL | Geodesic.LONG_UNROLL) self.assertAlmostEqual(lon2, inv["lon2"], delta = 1e-13) self.assertAlmostEqual(azi1, inv["azi1"], delta = 1e-13) self.assertAlmostEqual(azi2, inv["azi2"], delta = 1e-13) self.assertAlmostEqual(s12, inv["s12"], delta = 1e-8) self.assertAlmostEqual(a12, inv["a12"], delta = 1e-13) self.assertAlmostEqual(m12, inv["m12"], delta = 1e-8) self.assertAlmostEqual(M12, inv["M12"], delta = 1e-15) self.assertAlmostEqual(M21, inv["M21"], delta = 1e-15) self.assertAlmostEqual(S12, inv["S12"], delta = 0.1) def test_direct(self): for l in GeodesicTest.testcases: (lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12) = l dir = Geodesic.WGS84.Direct(lat1, lon1, azi1, s12, Geodesic.ALL | Geodesic.LONG_UNROLL) self.assertAlmostEqual(lat2, dir["lat2"], delta = 1e-13) self.assertAlmostEqual(lon2, dir["lon2"], delta = 1e-13) self.assertAlmostEqual(azi2, dir["azi2"], delta = 1e-13) self.assertAlmostEqual(a12, dir["a12"], delta = 1e-13) self.assertAlmostEqual(m12, dir["m12"], delta = 1e-8) self.assertAlmostEqual(M12, dir["M12"], delta = 1e-15) self.assertAlmostEqual(M21, dir["M21"], delta = 1e-15) self.assertAlmostEqual(S12, dir["S12"], delta = 0.1) def test_arcdirect(self): for l in GeodesicTest.testcases: (lat1, lon1, azi1, lat2, lon2, azi2, s12, a12, m12, M12, M21, S12) = l dir = Geodesic.WGS84.ArcDirect(lat1, lon1, azi1, a12, Geodesic.ALL | Geodesic.LONG_UNROLL) self.assertAlmostEqual(lat2, dir["lat2"], delta = 1e-13) self.assertAlmostEqual(lon2, dir["lon2"], delta = 1e-13) self.assertAlmostEqual(azi2, dir["azi2"], delta = 1e-13) self.assertAlmostEqual(s12, dir["s12"], delta = 1e-8) self.assertAlmostEqual(m12, dir["m12"], delta = 1e-8) self.assertAlmostEqual(M12, dir["M12"], delta = 1e-15) self.assertAlmostEqual(M21, dir["M21"], delta = 1e-15) self.assertAlmostEqual(S12, dir["S12"], delta = 0.1) class GeodSolveTest(unittest.TestCase): def test_GeodSolve0(self): inv = Geodesic.WGS84.Inverse(40.6, -73.8, 49.01666667, 2.55) self.assertAlmostEqual(inv["azi1"], 53.47022, delta = 0.5e-5) self.assertAlmostEqual(inv["azi2"], 111.59367, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 5853226, delta = 0.5) def test_GeodSolve1(self): dir = Geodesic.WGS84.Direct(40.63972222, -73.77888889, 53.5, 5850e3) self.assertAlmostEqual(dir["lat2"], 49.01467, delta = 0.5e-5) self.assertAlmostEqual(dir["lon2"], 2.56106, delta = 0.5e-5) self.assertAlmostEqual(dir["azi2"], 111.62947, delta = 0.5e-5) def test_GeodSolve2(self): # Check fix for antipodal prolate bug found 2010-09-04 geod = Geodesic(6.4e6, -1/150.0) inv = geod.Inverse(0.07476, 0, -0.07476, 180) self.assertAlmostEqual(inv["azi1"], 90.00078, delta = 0.5e-5) self.assertAlmostEqual(inv["azi2"], 90.00078, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 20106193, delta = 0.5) inv = geod.Inverse(0.1, 0, -0.1, 180) self.assertAlmostEqual(inv["azi1"], 90.00105, delta = 0.5e-5) self.assertAlmostEqual(inv["azi2"], 90.00105, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 20106193, delta = 0.5) def test_GeodSolve4(self): # Check fix for short line bug found 2010-05-21 inv = Geodesic.WGS84.Inverse(36.493349428792, 0, 36.49334942879201, 0.0000008) self.assertAlmostEqual(inv["s12"], 0.072, delta = 0.5e-3) def test_GeodSolve5(self): # Check fix for point2=pole bug found 2010-05-03 dir = Geodesic.WGS84.Direct(0.01777745589997, 30, 0, 10e6) self.assertAlmostEqual(dir["lat2"], 90, delta = 0.5e-5) if dir["lon2"] < 0: self.assertAlmostEqual(dir["lon2"], -150, delta = 0.5e-5) self.assertAlmostEqual(abs(dir["azi2"]), 180, delta = 0.5e-5) else: self.assertAlmostEqual(dir["lon2"], 30, delta = 0.5e-5) self.assertAlmostEqual(dir["azi2"], 0, delta = 0.5e-5) def test_GeodSolve6(self): # 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). inv = Geodesic.WGS84.Inverse(88.202499451857, 0, -88.202499451857, 179.981022032992859592) self.assertAlmostEqual(inv["s12"], 20003898.214, delta = 0.5e-3) inv = Geodesic.WGS84.Inverse(89.262080389218, 0, -89.262080389218, 179.992207982775375662) self.assertAlmostEqual(inv["s12"], 20003925.854, delta = 0.5e-3) inv = Geodesic.WGS84.Inverse(89.333123580033, 0, -89.333123580032997687, 179.99295812360148422) self.assertAlmostEqual(inv["s12"], 20003926.881, delta = 0.5e-3) def test_GeodSolve9(self): # Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) inv = Geodesic.WGS84.Inverse(56.320923501171, 0, -56.320923501171, 179.664747671772880215) self.assertAlmostEqual(inv["s12"], 19993558.287, delta = 0.5e-3) def test_GeodSolve10(self): # Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio # 10 rel + debug) inv = Geodesic.WGS84.Inverse(52.784459512564, 0, -52.784459512563990912, 179.634407464943777557) self.assertAlmostEqual(inv["s12"], 19991596.095, delta = 0.5e-3) def test_GeodSolve11(self): # Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio # 10 rel + debug) inv = Geodesic.WGS84.Inverse(48.522876735459, 0, -48.52287673545898293, 179.599720456223079643) self.assertAlmostEqual(inv["s12"], 19989144.774, delta = 0.5e-3) def test_GeodSolve12(self): # Check fix for inverse geodesics on extreme prolate/oblate # ellipsoids Reported 2012-08-29 Stefan Guenther # ; fixed 2012-10-07 geod = Geodesic(89.8, -1.83) inv = geod.Inverse(0, 0, -10, 160) self.assertAlmostEqual(inv["azi1"], 120.27, delta = 1e-2) self.assertAlmostEqual(inv["azi2"], 105.15, delta = 1e-2) self.assertAlmostEqual(inv["s12"], 266.7, delta = 1e-1) def test_GeodSolve14(self): # Check fix for inverse ignoring lon12 = nan inv = Geodesic.WGS84.Inverse(0, 0, 1, Math.nan) self.assertTrue(Math.isnan(inv["azi1"])) self.assertTrue(Math.isnan(inv["azi2"])) self.assertTrue(Math.isnan(inv["s12"])) def test_GeodSolve15(self): # Initial implementation of Math::eatanhe was wrong for e^2 < 0. This # checks that this is fixed. geod = Geodesic(6.4e6, -1/150.0) dir = geod.Direct(1, 2, 3, 4, Geodesic.AREA) self.assertAlmostEqual(dir["S12"], 23700, delta = 0.5) def test_GeodSolve17(self): # Check fix for LONG_UNROLL bug found on 2015-05-07 dir = Geodesic.WGS84.Direct(40, -75, -10, 2e7, Geodesic.STANDARD | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lat2"], -39, delta = 1) self.assertAlmostEqual(dir["lon2"], -254, delta = 1) self.assertAlmostEqual(dir["azi2"], -170, delta = 1) line = Geodesic.WGS84.Line(40, -75, -10) dir = line.Position(2e7, Geodesic.STANDARD | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lat2"], -39, delta = 1) self.assertAlmostEqual(dir["lon2"], -254, delta = 1) self.assertAlmostEqual(dir["azi2"], -170, delta = 1) dir = Geodesic.WGS84.Direct(40, -75, -10, 2e7) self.assertAlmostEqual(dir["lat2"], -39, delta = 1) self.assertAlmostEqual(dir["lon2"], 105, delta = 1) self.assertAlmostEqual(dir["azi2"], -170, delta = 1) dir = line.Position(2e7) self.assertAlmostEqual(dir["lat2"], -39, delta = 1) self.assertAlmostEqual(dir["lon2"], 105, delta = 1) self.assertAlmostEqual(dir["azi2"], -170, delta = 1) def test_GeodSolve26(self): # Check 0/0 problem with area calculation on sphere 2015-09-08 geod = Geodesic(6.4e6, 0) inv = geod.Inverse(1, 2, 3, 4, Geodesic.AREA) self.assertAlmostEqual(inv["S12"], 49911046115.0, delta = 0.5) def test_GeodSolve28(self): # Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in # Java implementation fixed on 2015-05-19). geod = Geodesic(6.4e6, 0.1) dir = geod.Direct(1, 2, 10, 5e6) self.assertAlmostEqual(dir["a12"], 48.55570690, delta = 0.5e-8) def test_GeodSolve29(self): # Check longitude unrolling with inverse calculation 2015-09-16 dir = Geodesic.WGS84.Inverse(0, 539, 0, 181) self.assertAlmostEqual(dir["lon1"], 179, delta = 1e-10) self.assertAlmostEqual(dir["lon2"], -179, delta = 1e-10) self.assertAlmostEqual(dir["s12"], 222639, delta = 0.5) dir = Geodesic.WGS84.Inverse(0, 539, 0, 181, Geodesic.STANDARD | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lon1"], 539, delta = 1e-10) self.assertAlmostEqual(dir["lon2"], 541, delta = 1e-10) self.assertAlmostEqual(dir["s12"], 222639, delta = 0.5) def test_GeodSolve33(self): # Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in # Octave -- sind(-0.0) = +0.0 -- and in some version of Visual # Studio -- fmod(-0.0, 360.0) = +0.0. inv = Geodesic.WGS84.Inverse(0, 0, 0, 179) self.assertAlmostEqual(inv["azi1"], 90.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["azi2"], 90.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 19926189, delta = 0.5) inv = Geodesic.WGS84.Inverse(0, 0, 0, 179.5) self.assertAlmostEqual(inv["azi1"], 55.96650, delta = 0.5e-5) self.assertAlmostEqual(inv["azi2"], 124.03350, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 19980862, delta = 0.5) inv = Geodesic.WGS84.Inverse(0, 0, 0, 180) self.assertAlmostEqual(inv["azi1"], 0.00000, delta = 0.5e-5) self.assertAlmostEqual(abs(inv["azi2"]), 180.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 20003931, delta = 0.5) inv = Geodesic.WGS84.Inverse(0, 0, 1, 180) self.assertAlmostEqual(inv["azi1"], 0.00000, delta = 0.5e-5) self.assertAlmostEqual(abs(inv["azi2"]), 180.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 19893357, delta = 0.5) geod = Geodesic(6.4e6, 0) inv = geod.Inverse(0, 0, 0, 179) self.assertAlmostEqual(inv["azi1"], 90.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["azi2"], 90.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 19994492, delta = 0.5) inv = geod.Inverse(0, 0, 0, 180) self.assertAlmostEqual(inv["azi1"], 0.00000, delta = 0.5e-5) self.assertAlmostEqual(abs(inv["azi2"]), 180.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 20106193, delta = 0.5) inv = geod.Inverse(0, 0, 1, 180) self.assertAlmostEqual(inv["azi1"], 0.00000, delta = 0.5e-5) self.assertAlmostEqual(abs(inv["azi2"]), 180.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 19994492, delta = 0.5) geod = Geodesic(6.4e6, -1/300.0) inv = geod.Inverse(0, 0, 0, 179) self.assertAlmostEqual(inv["azi1"], 90.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["azi2"], 90.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 19994492, delta = 0.5) inv = geod.Inverse(0, 0, 0, 180) self.assertAlmostEqual(inv["azi1"], 90.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["azi2"], 90.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 20106193, delta = 0.5) inv = geod.Inverse(0, 0, 0.5, 180) self.assertAlmostEqual(inv["azi1"], 33.02493, delta = 0.5e-5) self.assertAlmostEqual(inv["azi2"], 146.97364, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 20082617, delta = 0.5) inv = geod.Inverse(0, 0, 1, 180) self.assertAlmostEqual(inv["azi1"], 0.00000, delta = 0.5e-5) self.assertAlmostEqual(abs(inv["azi2"]), 180.00000, delta = 0.5e-5) self.assertAlmostEqual(inv["s12"], 20027270, delta = 0.5) def test_GeodSolve55(self): # Check fix for nan + point on equator or pole not returning all nans in # Geodesic::Inverse, found 2015-09-23. inv = Geodesic.WGS84.Inverse(Math.nan, 0, 0, 90) self.assertTrue(Math.isnan(inv["azi1"])) self.assertTrue(Math.isnan(inv["azi2"])) self.assertTrue(Math.isnan(inv["s12"])) inv = Geodesic.WGS84.Inverse(Math.nan, 0, 90, 9) self.assertTrue(Math.isnan(inv["azi1"])) self.assertTrue(Math.isnan(inv["azi2"])) self.assertTrue(Math.isnan(inv["s12"])) def test_GeodSolve59(self): # Check for points close with longitudes close to 180 deg apart. inv = Geodesic.WGS84.Inverse(5, 0.00000000000001, 10, 180) self.assertAlmostEqual(inv["azi1"], 0.000000000000035, delta = 1.5e-14) self.assertAlmostEqual(inv["azi2"], 179.99999999999996, delta = 1.5e-14) self.assertAlmostEqual(inv["s12"], 18345191.174332713, delta = 5e-9) def test_GeodSolve61(self): # Make sure small negative azimuths are west-going dir = Geodesic.WGS84.Direct(45, 0, -0.000000000000000003, 1e7, Geodesic.STANDARD | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lat2"], 45.30632, delta = 0.5e-5) self.assertAlmostEqual(dir["lon2"], -180, delta = 0.5e-5) self.assertAlmostEqual(abs(dir["azi2"]), 180, delta = 0.5e-5) line = Geodesic.WGS84.InverseLine(45, 0, 80, -0.000000000000000003) dir = line.Position(1e7, Geodesic.STANDARD | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lat2"], 45.30632, delta = 0.5e-5) self.assertAlmostEqual(dir["lon2"], -180, delta = 0.5e-5) self.assertAlmostEqual(abs(dir["azi2"]), 180, delta = 0.5e-5) def test_GeodSolve65(self): # Check for bug in east-going check in GeodesicLine (needed to check for # sign of 0) and sign error in area calculation due to a bogus override # of the code for alp12. Found/fixed on 2015-12-19. line = Geodesic.WGS84.InverseLine(30, -0.000000000000000001, -31, 180, Geodesic.ALL) dir = line.Position(1e7, Geodesic.ALL | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lat1"], 30.00000 , delta = 0.5e-5) self.assertAlmostEqual(dir["lon1"], -0.00000 , delta = 0.5e-5) self.assertAlmostEqual(abs(dir["azi1"]), 180.00000, delta = 0.5e-5) self.assertAlmostEqual(dir["lat2"], -60.23169 , delta = 0.5e-5) self.assertAlmostEqual(dir["lon2"], -0.00000 , delta = 0.5e-5) self.assertAlmostEqual(abs(dir["azi2"]), 180.00000, delta = 0.5e-5) self.assertAlmostEqual(dir["s12"] , 10000000 , delta = 0.5) self.assertAlmostEqual(dir["a12"] , 90.06544 , delta = 0.5e-5) self.assertAlmostEqual(dir["m12"] , 6363636 , delta = 0.5) self.assertAlmostEqual(dir["M12"] , -0.0012834, delta = 0.5e7) self.assertAlmostEqual(dir["M21"] , 0.0013749 , delta = 0.5e-7) self.assertAlmostEqual(dir["S12"] , 0 , delta = 0.5) dir = line.Position(2e7, Geodesic.ALL | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lat1"], 30.00000 , delta = 0.5e-5) self.assertAlmostEqual(dir["lon1"], -0.00000 , delta = 0.5e-5) self.assertAlmostEqual(abs(dir["azi1"]), 180.00000, delta = 0.5e-5) self.assertAlmostEqual(dir["lat2"], -30.03547 , delta = 0.5e-5) self.assertAlmostEqual(dir["lon2"], -180.00000, delta = 0.5e-5) self.assertAlmostEqual(dir["azi2"], -0.00000 , delta = 0.5e-5) self.assertAlmostEqual(dir["s12"] , 20000000 , delta = 0.5) self.assertAlmostEqual(dir["a12"] , 179.96459 , delta = 0.5e-5) self.assertAlmostEqual(dir["m12"] , 54342 , delta = 0.5) self.assertAlmostEqual(dir["M12"] , -1.0045592, delta = 0.5e7) self.assertAlmostEqual(dir["M21"] , -0.9954339, delta = 0.5e-7) self.assertAlmostEqual(dir["S12"] , 127516405431022.0, delta = 0.5) def test_GeodSolve66(self): # Check for InverseLine if line is slightly west of S and that s13 is # correctly set. line = Geodesic.WGS84.InverseLine(-5, -0.000000000000002, -10, 180) dir = line.Position(2e7, Geodesic.STANDARD | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lat2"], 4.96445 , delta = 0.5e-5) self.assertAlmostEqual(dir["lon2"], -180.00000, delta = 0.5e-5) self.assertAlmostEqual(dir["azi2"], -0.00000 , delta = 0.5e-5) dir = line.Position(0.5 * line.s13, Geodesic.STANDARD | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lat2"], -87.52461 , delta = 0.5e-5) self.assertAlmostEqual(dir["lon2"], -0.00000 , delta = 0.5e-5) self.assertAlmostEqual(dir["azi2"], -180.00000, delta = 0.5e-5) def test_GeodSolve71(self): # Check that DirectLine sets s13. line = Geodesic.WGS84.DirectLine(1, 2, 45, 1e7) dir = line.Position(0.5 * line.s13, Geodesic.STANDARD | Geodesic.LONG_UNROLL) self.assertAlmostEqual(dir["lat2"], 30.92625, delta = 0.5e-5) self.assertAlmostEqual(dir["lon2"], 37.54640, delta = 0.5e-5) self.assertAlmostEqual(dir["azi2"], 55.43104, delta = 0.5e-5) def test_GeodSolve73(self): # Check for backwards from the pole bug reported by Anon on 2016-02-13. # This only affected the Java implementation. It was introduced in Java # version 1.44 and fixed in 1.46-SNAPSHOT on 2016-01-17. # Also the + sign on azi2 is a check on the normalizing of azimuths # (converting -0.0 to +0.0). dir = Geodesic.WGS84.Direct(90, 10, 180, -1e6) self.assertAlmostEqual(dir["lat2"], 81.04623, delta = 0.5e-5) self.assertAlmostEqual(dir["lon2"], -170, delta = 0.5e-5) self.assertAlmostEqual(dir["azi2"], 0, delta = 0.5e-5) self.assertTrue(Math.copysign(1, dir["azi2"]) > 0) def test_GeodSolve74(self): # Check fix for inaccurate areas, bug introduced in v1.46, fixed # 2015-10-16. inv = Geodesic.WGS84.Inverse(54.1589, 15.3872, 54.1591, 15.3877, Geodesic.ALL) self.assertAlmostEqual(inv["azi1"], 55.723110355, delta = 5e-9) self.assertAlmostEqual(inv["azi2"], 55.723515675, delta = 5e-9) self.assertAlmostEqual(inv["s12"], 39.527686385, delta = 5e-9) self.assertAlmostEqual(inv["a12"], 0.000355495, delta = 5e-9) self.assertAlmostEqual(inv["m12"], 39.527686385, delta = 5e-9) self.assertAlmostEqual(inv["M12"], 0.999999995, delta = 5e-9) self.assertAlmostEqual(inv["M21"], 0.999999995, delta = 5e-9) self.assertAlmostEqual(inv["S12"], 286698586.30197, delta = 5e-4) def test_GeodSolve76(self): # The distance from Wellington and Salamanca (a classic failure of # Vincenty) inv = Geodesic.WGS84.Inverse(-(41+19/60.0), 174+49/60.0, 40+58/60.0, -(5+30/60.0)) self.assertAlmostEqual(inv["azi1"], 160.39137649664, delta = 0.5e-11) self.assertAlmostEqual(inv["azi2"], 19.50042925176, delta = 0.5e-11) self.assertAlmostEqual(inv["s12"], 19960543.857179, delta = 0.5e-6) def test_GeodSolve78(self): # An example where the NGS calculator fails to converge inv = Geodesic.WGS84.Inverse(27.2, 0.0, -27.1, 179.5) self.assertAlmostEqual(inv["azi1"], 45.82468716758, delta = 0.5e-11) self.assertAlmostEqual(inv["azi2"], 134.22776532670, delta = 0.5e-11) self.assertAlmostEqual(inv["s12"], 19974354.765767, delta = 0.5e-6) def test_GeodSolve80(self): # Some tests to add code coverage: computing scale in special cases + zero # length geodesic (includes GeodSolve80 - GeodSolve83) + using an incapable # line. inv = Geodesic.WGS84.Inverse(0, 0, 0, 90, Geodesic.GEODESICSCALE) self.assertAlmostEqual(inv["M12"], -0.00528427534, delta = 0.5e-10) self.assertAlmostEqual(inv["M21"], -0.00528427534, delta = 0.5e-10) inv = Geodesic.WGS84.Inverse(0, 0, 1e-6, 1e-6, Geodesic.GEODESICSCALE) self.assertAlmostEqual(inv["M12"], 1, delta = 0.5e-10) self.assertAlmostEqual(inv["M21"], 1, delta = 0.5e-10) inv = Geodesic.WGS84.Inverse(20.001, 0, 20.001, 0, Geodesic.ALL) self.assertAlmostEqual(inv["a12"], 0, delta = 1e-13) self.assertAlmostEqual(inv["s12"], 0, delta = 1e-8) self.assertAlmostEqual(inv["azi1"], 180, delta = 1e-13) self.assertAlmostEqual(inv["azi2"], 180, delta = 1e-13) self.assertAlmostEqual(inv["m12"], 0, delta = 1e-8) self.assertAlmostEqual(inv["M12"], 1, delta = 1e-15) self.assertAlmostEqual(inv["M21"], 1, delta = 1e-15) self.assertAlmostEqual(inv["S12"], 0, delta = 1e-10) self.assertTrue(Math.copysign(1, inv["a12"]) > 0) self.assertTrue(Math.copysign(1, inv["s12"]) > 0) self.assertTrue(Math.copysign(1, inv["m12"]) > 0) inv = Geodesic.WGS84.Inverse(90, 0, 90, 180, Geodesic.ALL) self.assertAlmostEqual(inv["a12"], 0, delta = 1e-13) self.assertAlmostEqual(inv["s12"], 0, delta = 1e-8) self.assertAlmostEqual(inv["azi1"], 0, delta = 1e-13) self.assertAlmostEqual(inv["azi2"], 180, delta = 1e-13) self.assertAlmostEqual(inv["m12"], 0, delta = 1e-8) self.assertAlmostEqual(inv["M12"], 1, delta = 1e-15) self.assertAlmostEqual(inv["M21"], 1, delta = 1e-15) self.assertAlmostEqual(inv["S12"], 127516405431022.0, delta = 0.5) # An incapable line which can't take distance as input line = Geodesic.WGS84.Line(1, 2, 90, Geodesic.LATITUDE) dir = line.Position(1000, Geodesic.EMPTY) self.assertTrue(Math.isnan(dir["a12"])) def test_GeodSolve84(self): # Tests for python implementation to check fix for range errors with # {fmod,sin,cos}(inf) (includes GeodSolve84 - GeodSolve91). dir = Geodesic.WGS84.Direct(0, 0, 90, Math.inf) self.assertTrue(Math.isnan(dir["lat2"])) self.assertTrue(Math.isnan(dir["lon2"])) self.assertTrue(Math.isnan(dir["azi2"])) dir = Geodesic.WGS84.Direct(0, 0, 90, Math.nan) self.assertTrue(Math.isnan(dir["lat2"])) self.assertTrue(Math.isnan(dir["lon2"])) self.assertTrue(Math.isnan(dir["azi2"])) dir = Geodesic.WGS84.Direct(0, 0, Math.inf, 1000) self.assertTrue(Math.isnan(dir["lat2"])) self.assertTrue(Math.isnan(dir["lon2"])) self.assertTrue(Math.isnan(dir["azi2"])) dir = Geodesic.WGS84.Direct(0, 0, Math.nan, 1000) self.assertTrue(Math.isnan(dir["lat2"])) self.assertTrue(Math.isnan(dir["lon2"])) self.assertTrue(Math.isnan(dir["azi2"])) dir = Geodesic.WGS84.Direct(0, Math.inf, 90, 1000) self.assertTrue(dir["lat1"] == 0) self.assertTrue(Math.isnan(dir["lon2"])) self.assertTrue(dir["azi2"] == 90) dir = Geodesic.WGS84.Direct(0, Math.nan, 90, 1000) self.assertTrue(dir["lat1"] == 0) self.assertTrue(Math.isnan(dir["lon2"])) self.assertTrue(dir["azi2"] == 90) dir = Geodesic.WGS84.Direct(Math.inf, 0, 90, 1000) self.assertTrue(Math.isnan(dir["lat2"])) self.assertTrue(Math.isnan(dir["lon2"])) self.assertTrue(Math.isnan(dir["azi2"])) dir = Geodesic.WGS84.Direct(Math.nan, 0, 90, 1000) self.assertTrue(Math.isnan(dir["lat2"])) self.assertTrue(Math.isnan(dir["lon2"])) self.assertTrue(Math.isnan(dir["azi2"])) def test_GeodSolve92(self): # Check fix for inaccurate hypot with python 3.[89]. Problem reported # by agdhruv https://github.com/geopy/geopy/issues/466 ; see # https://bugs.python.org/issue43088 inv = Geodesic.WGS84.Inverse(37.757540000000006, -122.47018, 37.75754, -122.470177) self.assertAlmostEqual(inv["azi1"], 89.99999923, delta = 1e-7 ) self.assertAlmostEqual(inv["azi2"], 90.00000106, delta = 1e-7 ) self.assertAlmostEqual(inv["s12"], 0.264, delta = 0.5e-3) class PlanimeterTest(unittest.TestCase): polygon = Geodesic.WGS84.Polygon(False) polyline = Geodesic.WGS84.Polygon(True) def Planimeter(points): PlanimeterTest.polygon.Clear() for p in points: PlanimeterTest.polygon.AddPoint(p[0], p[1]) return PlanimeterTest.polygon.Compute(False, True) Planimeter = staticmethod(Planimeter) def PolyLength(points): PlanimeterTest.polyline.Clear() for p in points: PlanimeterTest.polyline.AddPoint(p[0], p[1]) return PlanimeterTest.polyline.Compute(False, True) PolyLength = staticmethod(PolyLength) def test_Planimeter0(self): # Check fix for pole-encircling bug found 2011-03-16 points = [[89, 0], [89, 90], [89, 180], [89, 270]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 631819.8745, delta = 1e-4) self.assertAlmostEqual(area, 24952305678.0, delta = 1) points = [[-89, 0], [-89, 90], [-89, 180], [-89, 270]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 631819.8745, delta = 1e-4) self.assertAlmostEqual(area, -24952305678.0, delta = 1) points = [[0, -1], [-1, 0], [0, 1], [1, 0]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 627598.2731, delta = 1e-4) self.assertAlmostEqual(area, 24619419146.0, delta = 1) points = [[90, 0], [0, 0], [0, 90]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 30022685, delta = 1) self.assertAlmostEqual(area, 63758202715511.0, delta = 1) num, perimeter, area = PlanimeterTest.PolyLength(points) self.assertAlmostEqual(perimeter, 20020719, delta = 1) self.assertTrue(Math.isnan(area)) def test_Planimeter5(self): # Check fix for Planimeter pole crossing bug found 2011-06-24 points = [[89, 0.1], [89, 90.1], [89, -179.9]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 539297, delta = 1) self.assertAlmostEqual(area, 12476152838.5, delta = 1) def test_Planimeter6(self): # Check fix for Planimeter lon12 rounding bug found 2012-12-03 points = [[9, -0.00000000000001], [9, 180], [9, 0]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 36026861, delta = 1) self.assertAlmostEqual(area, 0, delta = 1) points = [[9, 0.00000000000001], [9, 0], [9, 180]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 36026861, delta = 1) self.assertAlmostEqual(area, 0, delta = 1) points = [[9, 0.00000000000001], [9, 180], [9, 0]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 36026861, delta = 1) self.assertAlmostEqual(area, 0, delta = 1) points = [[9, -0.00000000000001], [9, 0], [9, 180]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 36026861, delta = 1) self.assertAlmostEqual(area, 0, delta = 1) def test_Planimeter12(self): # Area of arctic circle (not really -- adjunct to rhumb-area test) points = [[66.562222222, 0], [66.562222222, 180]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 10465729, delta = 1) self.assertAlmostEqual(area, 0, delta = 1) def test_Planimeter13(self): # Check encircling pole twice points = [[89,-360], [89,-240], [89,-120], [89,0], [89,120], [89,240]] num, perimeter, area = PlanimeterTest.Planimeter(points) self.assertAlmostEqual(perimeter, 1160741, delta = 1) self.assertAlmostEqual(area, 32415230256.0, delta = 1) def test_Planimeter15(self): # Coverage tests, includes Planimeter15 - Planimeter18 (combinations of # reverse and sign) + calls to testpoint, testedge. lat = [2, 1, 3] lon = [1, 2, 3] r = 18454562325.45119 a0 = 510065621724088.5093 # ellipsoid area PlanimeterTest.polygon.Clear() PlanimeterTest.polygon.AddPoint(lat[0], lon[0]) PlanimeterTest.polygon.AddPoint(lat[1], lon[1]) num, perimeter, area = PlanimeterTest.polygon.TestPoint(lat[2], lon[2], False, True) self.assertAlmostEqual(area, r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestPoint(lat[2], lon[2], False, False) self.assertAlmostEqual(area, r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestPoint(lat[2], lon[2], True, True) self.assertAlmostEqual(area, -r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestPoint(lat[2], lon[2], True, False) self.assertAlmostEqual(area, a0-r, delta = 0.5) inv = Geodesic.WGS84.Inverse(lat[1], lon[1], lat[2], lon[2]) azi1 = inv["azi1"] s12 = inv["s12"] num, perimeter, area = PlanimeterTest.polygon.TestEdge(azi1, s12, False, True) self.assertAlmostEqual(area, r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestEdge(azi1, s12, False, False) self.assertAlmostEqual(area, r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestEdge(azi1, s12, True, True) self.assertAlmostEqual(area, -r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestEdge(azi1, s12, True, False) self.assertAlmostEqual(area, a0-r, delta = 0.5) PlanimeterTest.polygon.AddPoint(lat[2], lon[2]) num, perimeter, area = PlanimeterTest.polygon.Compute(False, True) self.assertAlmostEqual(area, r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.Compute(False, False) self.assertAlmostEqual(area, r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.Compute(True, True) self.assertAlmostEqual(area, -r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.Compute(True, False) self.assertAlmostEqual(area, a0-r, delta = 0.5) def test_Planimeter19(self): # Coverage tests, includes Planimeter19 - Planimeter20 (degenerate # polygons) + extra cases. PlanimeterTest.polygon.Clear() num, perimeter, area = PlanimeterTest.polygon.Compute(False, True) self.assertTrue(area == 0) self.assertTrue(perimeter == 0) num, perimeter, area = PlanimeterTest.polygon.TestPoint(1, 1, False, True) self.assertTrue(area == 0) self.assertTrue(perimeter == 0) num, perimeter, area = PlanimeterTest.polygon.TestEdge(90, 1000, False, True) self.assertTrue(Math.isnan(area)) self.assertTrue(Math.isnan(perimeter)) PlanimeterTest.polygon.AddPoint(1, 1) num, perimeter, area = PlanimeterTest.polygon.Compute(False, True) self.assertTrue(area == 0) self.assertTrue(perimeter == 0) PlanimeterTest.polyline.Clear() num, perimeter, area = PlanimeterTest.polyline.Compute(False, True) self.assertTrue(perimeter == 0) num, perimeter, area = PlanimeterTest.polyline.TestPoint(1, 1, False, True) self.assertTrue(perimeter == 0) num, perimeter, area = PlanimeterTest.polyline.TestEdge(90, 1000, False, True) self.assertTrue(Math.isnan(perimeter)) PlanimeterTest.polyline.AddPoint(1, 1) num, perimeter, area = PlanimeterTest.polyline.Compute(False, True) self.assertTrue(perimeter == 0) PlanimeterTest.polygon.AddPoint(1, 1) num, perimeter, area = PlanimeterTest.polyline.TestEdge(90, 1000, False, True) self.assertAlmostEqual(perimeter, 1000, delta = 1e-10) num, perimeter, area = PlanimeterTest.polyline.TestPoint(2, 2, False, True) self.assertAlmostEqual(perimeter, 156876.149, delta = 0.5e-3) def test_Planimeter21(self): # Some test to add code coverage: multiple circlings of pole (includes # Planimeter21 - Planimeter28) + invocations via testpoint and testedge. lat = 45 azi = 39.2144607176828184218 s = 8420705.40957178156285 r = 39433884866571.4277 # Area for one circuit a0 = 510065621724088.5093 # Ellipsoid area PlanimeterTest.polygon.Clear() PlanimeterTest.polygon.AddPoint(lat, 60) PlanimeterTest.polygon.AddPoint(lat, 180) PlanimeterTest.polygon.AddPoint(lat, -60) PlanimeterTest.polygon.AddPoint(lat, 60) PlanimeterTest.polygon.AddPoint(lat, 180) PlanimeterTest.polygon.AddPoint(lat, -60) for i in [3, 4]: PlanimeterTest.polygon.AddPoint(lat, 60) PlanimeterTest.polygon.AddPoint(lat, 180) num, perimeter, area = PlanimeterTest.polygon.TestPoint(lat, -60, False, True) self.assertAlmostEqual(area, i*r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestPoint(lat, -60, False, False) self.assertAlmostEqual(area, i*r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestPoint(lat, -60, True, True) self.assertAlmostEqual(area, -i*r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestPoint(lat, -60, True, False) self.assertAlmostEqual(area, -i*r + a0, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestEdge(azi, s, False, True) self.assertAlmostEqual(area, i*r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestEdge(azi, s, False, False) self.assertAlmostEqual(area, i*r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestEdge(azi, s, True, True) self.assertAlmostEqual(area, -i*r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.TestEdge(azi, s, True, False) self.assertAlmostEqual(area, -i*r + a0, delta = 0.5) PlanimeterTest.polygon.AddPoint(lat, -60) num, perimeter, area = PlanimeterTest.polygon.Compute(False, True) self.assertAlmostEqual(area, i*r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.Compute(False, False) self.assertAlmostEqual(area, i*r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.Compute(True, True) self.assertAlmostEqual(area, -i*r, delta = 0.5) num, perimeter, area = PlanimeterTest.polygon.Compute(True, False) self.assertAlmostEqual(area, -i*r + a0, delta = 0.5) def test_Planimeter29(self): # Check fix to transitdirect vs transit zero handling inconsistency PlanimeterTest.polygon.Clear() PlanimeterTest.polygon.AddPoint(0, 0) PlanimeterTest.polygon.AddEdge( 90, 1000) PlanimeterTest.polygon.AddEdge( 0, 1000) PlanimeterTest.polygon.AddEdge(-90, 1000) num, perimeter, area = PlanimeterTest.polygon.Compute(False, True) # The area should be 1e6. Prior to the fix it was 1e6 - A/2, where # A = ellipsoid area. self.assertAlmostEqual(area, 1000000.0, delta = 0.01) GeographicLib-1.52/python/setup.py0000644000771000077100000000303214064202371017046 0ustar ckarneyckarney# setup.py, config file for distutils # # To install this package, execute # # python setup.py install # # in this directory. To run the unit tests, execute # # python setup.py test # # To update the HTML page for this version, run # # python setup.py register # # 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 . import setuptools name = "geographiclib" version = "1.52" with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name = name, version = version, author = "Charles Karney", author_email = "charles@karney.com", description = "The geodesic routines from GeographicLib", long_description = long_description, long_description_content_type = "text/markdown", url = "https://geographiclib.sourceforge.io/" + version + "/python", include_package_data = True, packages = setuptools.find_packages(), 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", ], test_suite = "geographiclib.test.test_geodesic", ) GeographicLib-1.52/python/Makefile.in0000644000771000077100000003343614064202402017407 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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) Charles Karney (2011-2016) VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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@ pkgconfigdir = @pkgconfigdir@ 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 TEST_FILES = \ $(srcdir)/$(PACKAGE)/test/__init__.py \ $(srcdir)/$(PACKAGE)/test/test_geodesic.py DOC_FILES = \ $(srcdir)/doc/conf.py \ $(srcdir)/doc/code.rst \ $(srcdir)/doc/examples.rst \ $(srcdir)/doc/geodesics.rst \ $(srcdir)/doc/index.rst \ $(srcdir)/doc/interface.rst pythondir = $(libdir)/python/site-packages/$(PACKAGE) EXTRA_DIST = Makefile.mk $(PACKAGE)/CMakeLists.txt $(PYTHON_FILES) \ $(TEST_FILES) $(DOC_FILES) LICENSE setup.py MANIFEST.in README.md 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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 cscopelist-am ctags-am 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 \ tags-am uninstall uninstall-am .PRECIOUS: Makefile install: $(INSTALL) -d $(DESTDIR)$(pythondir) $(INSTALL) -m 644 $(PYTHON_FILES) $(DESTDIR)$(pythondir) $(INSTALL) -d $(DESTDIR)$(pythondir)/test $(INSTALL) -m 644 $(TEST_FILES) $(DESTDIR)$(pythondir)/test # 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.52/src/Accumulator.cpp0000644000771000077100000000130114064202371017562 0ustar ckarneyckarney/** * \file Accumulator.cpp * \brief Implementation for GeographicLib::Accumulator class * * Copyright (c) Charles Karney (2013) and licensed under * the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { /// \cond SKIP // Need to instantiate Accumulator to get the code into the shared library // (without this, NETGeographic complains about not finding the == and != // operators). template class GEOGRAPHICLIB_EXPORT Accumulator; /// \endcond } // namespace GeographicLib GeographicLib-1.52/src/AlbersEqualArea.cpp0000644000771000077100000005170214064202371020306 0ustar ckarneyckarney/** * \file AlbersEqualArea.cpp * \brief Implementation for GeographicLib::AlbersEqualArea class * * Copyright (c) Charles Karney (2010-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif namespace GeographicLib { using namespace std; AlbersEqualArea::AlbersEqualArea(real a, real f, real stdlat, real k0) : eps_(numeric_limits::epsilon()) , epsx_(Math::sq(eps_)) , epsx2_(Math::sq(epsx_)) , tol_(sqrt(eps_)) , tol0_(tol_ * sqrt(sqrt(eps_))) , _a(a) , _f(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 (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_f) && _f < 1)) throw GeographicErr("Polar semi-axis is not positive"); if (!(isfinite(k0) && k0 > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(stdlat) <= 90)) throw GeographicErr("Standard latitude not in [-90d, 90d]"); real sphi, cphi; Math::sincosd(stdlat, sphi, cphi); Init(sphi, cphi, sphi, cphi, k0); } AlbersEqualArea::AlbersEqualArea(real a, real f, real stdlat1, real stdlat2, real k1) : eps_(numeric_limits::epsilon()) , epsx_(Math::sq(eps_)) , epsx2_(Math::sq(epsx_)) , tol_(sqrt(eps_)) , tol0_(tol_ * sqrt(sqrt(eps_))) , _a(a) , _f(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 (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_f) && _f < 1)) throw GeographicErr("Polar semi-axis is not positive"); if (!(isfinite(k1) && k1 > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(stdlat1) <= 90)) throw GeographicErr("Standard latitude 1 not in [-90d, 90d]"); if (!(abs(stdlat2) <= 90)) throw GeographicErr("Standard latitude 2 not in [-90d, 90d]"); real sphi1, cphi1, sphi2, cphi2; Math::sincosd(stdlat1, sphi1, cphi1); Math::sincosd(stdlat2, sphi2, cphi2); Init(sphi1, cphi1, sphi2, cphi2, k1); } AlbersEqualArea::AlbersEqualArea(real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1) : eps_(numeric_limits::epsilon()) , epsx_(Math::sq(eps_)) , epsx2_(Math::sq(epsx_)) , tol_(sqrt(eps_)) , tol0_(tol_ * sqrt(sqrt(eps_))) , _a(a) , _f(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 (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_f) && _f < 1)) throw GeographicErr("Polar semi-axis is not positive"); if (!(isfinite(k1) && k1 > 0)) throw GeographicErr("Scale is not positive"); if (!(coslat1 >= 0)) throw GeographicErr("Standard latitude 1 not in [-90d, 90d]"); if (!(coslat2 >= 0)) throw GeographicErr("Standard latitude 2 not in [-90d, 90d]"); 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) { { real r; r = hypot(sphi1, cphi1); sphi1 /= r; cphi1 /= r; r = 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_ || GEOGRAPHICLIB_PANIC; ++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() { static const AlbersEqualArea cylindricalequalarea(Constants::WGS84_a(), Constants::WGS84_f(), real(0), real(1), real(0), real(1), real(1)); return cylindricalequalarea; } const AlbersEqualArea& AlbersEqualArea::AzimuthalEqualAreaNorth() { static const AlbersEqualArea azimuthalequalareanorth(Constants::WGS84_a(), Constants::WGS84_f(), real(1), real(0), real(1), real(0), real(1)); return azimuthalequalareanorth; } const AlbersEqualArea& AlbersEqualArea::AzimuthalEqualAreaSouth() { static const AlbersEqualArea azimuthalequalareasouth(Constants::WGS84_a(), Constants::WGS84_f(), real(-1), real(0), real(-1), real(0), real(1)); return azimuthalequalareasouth; } Math::real AlbersEqualArea::txif(real tphi) const { // 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)) ) ) // = ( tphi/(1-e2*sphi^2) + atanhee(sphi, e2)/cphi ) / // sqrt( // ( (1+e2*sphi)/( (1-e2*sphi^2) * (1-e2) ) + Datanhee(1, sphi) ) * // ( (1-e2*sphi)/( (1-e2*sphi^2) * (1-e2) ) + Datanhee(1, -sphi) ) ) // // This function maintains odd parity real cphi = 1 / sqrt(1 + Math::sq(tphi)), sphi = tphi * cphi, es1 = _e2 * sphi, es2m1 = 1 - es1 * sphi, // 1 - e2 * sphi^2 es2m1a = _e2m * es2m1; // (1 - e2 * sphi^2) * (1 - e2) return ( tphi / es2m1 + atanhee(sphi) / cphi ) / sqrt( ( (1 + es1) / es2m1a + Datanhee(1, sphi) ) * ( (1 - es1) / es2m1a + Datanhee(1, -sphi) ) ); } Math::real AlbersEqualArea::tphif(real txi) const { 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_ || GEOGRAPHICLIB_PANIC; ++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 = x/3 + x^2/5 + x^3/7 + ... // typical x < e^2 = 2*f Math::real AlbersEqualArea::atanhxm1(real x) { real s = 0; if (abs(x) < real(0.5)) { static const real lg2eps_ = -log2(numeric_limits::epsilon() / 2); int e; frexp(x, &e); e = -e; // x = [0.5,1) * 2^(-e) // estimate n s.t. x^n/(2*n+1) < x/3 * epsilon/2 // a stronger condition is x^(n-1) < epsilon/2 // taking log2 of both sides, a stronger condition is // (n-1)*(-e) < -lg2eps or (n-1)*e > lg2eps or n > ceiling(lg2eps/e)+1 int n = x == 0 ? 1 : int(ceil(lg2eps_ / e)) + 1; while (n--) // iterating from n-1 down to 0 s = x * s + (n ? 1 : 0)/Math::real(2*n + 1); } else { real xs = sqrt(abs(x)); s = (x > 0 ? 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 { // This function is called with x = sphi1, y = sphi2, phi1 <= phi2, sphi2 // >= 0, abs(sphi1) <= phi2. However for safety's sake we enforce x <= y. if (y < x) swap(x, y); // ensure that x <= y real q1 = abs(_e2), q2 = abs(2 * _e / _e2m * (1 - x)); return x <= 0 || !(min(q1, q2) < real(0.75)) ? DDatanhee0(x, y) : (q1 < q2 ? DDatanhee1(x, y) : DDatanhee2(x, y)); } // Rearrange difference so that 1 - x is in the denominator, then do a // straight divided difference. Math::real AlbersEqualArea::DDatanhee0(real x, real y) const { return (Datanhee(1, y) - Datanhee(x, y))/(1 - x); } // The expansion for e2 small Math::real AlbersEqualArea::DDatanhee1(real x, real y) const { // The series in e2 is // sum( c[l] * e2^l, l, 1, N) // where // c[l] = sum( x^i * y^j; i >= 0, j >= 0, i+j < 2*l) / (2*l + 1) // = ( (x-y) - (1-y) * x^(2*l+1) + (1-x) * y^(2*l+1) ) / // ( (2*l+1) * (x-y) * (1-y) * (1-x) ) // For x = y = 1, c[l] = l // // In the limit x,y -> 1, // // DDatanhee -> e2/(1-e2)^2 = sum(l * e2^l, l, 1, inf) // // Use if e2 is sufficiently small. real s = 0; real z = 1, k = 1, t = 0, c = 0, en = 1; while (true) { 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) / (2*l + 1) // Taylor expansion is // s = sum( c[l] * e2^l, l, 1, N) real ds = en * c / k; s += ds; if (!(abs(ds) > abs(s) * eps_/2)) break; // Iterate until the added term is sufficiently small } return s; } // The expansion for x (and y) close to 1 Math::real AlbersEqualArea::DDatanhee2(real x, real y) const { // If x and y are both close to 1, expand in Taylor series in dx = 1-x and // dy = 1-y: // // DDatanhee = sum(C_m * (dx^(m+1) - dy^(m+1)) / (dx - dy), m, 0, inf) // // where // // C_m = sum( (m+2)!! / (m+2-2*k)!! * // ((m+1)/2)! / ((m+1)/2-k)! / // (k! * (2*k-1)!!) * // e2^((m+1)/2+k), // k, 0, (m+1)/2) * (-1)^m / ((m+2) * (1-e2)^(m+2)) // for m odd, and // // C_m = sum( 2 * (m+1)!! / (m+1-2*k)!! * // (m/2+1)! / (m/2-k)! / // (k! * (2*k+1)!!) * // e2^(m/2+1+k), // k, 0, m/2)) * (-1)^m / ((m+2) * (1-e2)^(m+2)) // for m even. // // Here i!! is the double factorial extended to negative i with // i!! = (i+2)!!/(i+2). // // Note that // (dx^(m+1) - dy^(m+1)) / (dx - dy) = // dx^m + dx^(m-1)*dy ... + dx*dy^(m-1) + dy^m // // Leading (m = 0) term is e2 / (1 - e2)^2 // // Magnitude of mth term relative to the leading term scales as // // 2*(2*e/(1-e2)*dx)^m // // So use series if (2*e/(1-e2)*dx) is sufficiently small real s, dx = 1 - x, dy = 1 - y, xy = 1, yy = 1, ee = _e2 / Math::sq(_e2m); s = ee; for (int m = 1; ; ++m) { real c = m + 2, t = c; yy *= dy; // yy = dy^m xy = dx * xy + yy; // Now xy = dx^m + dx^(m-1)*dy ... + dx*dy^(m-1) + dy^m // = (dx^(m+1) - dy^(m+1)) / (dx - dy) // max value = (m+1) * max(dx,dy)^m ee /= -_e2m; if (m % 2 == 0) ee *= _e2; // Now ee = (-1)^m * e2^(floor(m/2)+1) / (1-e2)^(m+2) int kmax = (m+1)/2; for (int k = kmax - 1; k >= 0; --k) { // max coeff is less than 2^(m+1) c *= (k + 1) * (2 * (k + m - 2*kmax) + 3); c /= (kmax - k) * (2 * (kmax - k) + 1); // Horner sum for inner _e2 series t = _e2 * t + c; } // Straight sum for outer m series real ds = t * ee * xy / (m + 2); s = s + ds; if (!(abs(ds) > abs(s) * eps_/2)) break; // Iterate until the added term is sufficiently small } return s; } void AlbersEqualArea::Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const { lon = Math::AngDiff(lon0, lon); lat *= _sign; real sphi, cphi; Math::sincosd(Math::LatFix(lat) * _sign, sphi, cphi); cphi = max(epsx_, cphi); real lam = lon * Math::degree(), 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 { y *= _sign; real nx = _k0 * _n0 * x, ny = _k0 * _n0 * y, y1 = _nrho0 - ny, den = 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), theta = atan2(nx, y1), lam = _n0 != 0 ? theta / (_k2 * _n0) : x / (y1 * _k0); gamma = _sign * theta / Math::degree(); lat = Math::atand(_sign * tphi); lon = lam / Math::degree(); lon = Math::AngNormalize(lon + Math::AngNormalize(lon0)); k = _k0 * (den != 0 ? (_nrho0 + _n0 * drho) * hyp(_fm * tphi) / _a : 1); } void AlbersEqualArea::SetScale(real lat, real k) { if (!(isfinite(k) && k > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(lat) < 90)) throw GeographicErr("Latitude for SetScale not in (-90d, 90d)"); 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.52/src/AzimuthalEquidistant.cpp0000644000771000077100000000261414064202371021464 0ustar ckarneyckarney/** * \file AzimuthalEquidistant.cpp * \brief Implementation for GeographicLib::AzimuthalEquidistant class * * Copyright (c) Charles Karney (2009-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { using namespace std; AzimuthalEquidistant::AzimuthalEquidistant(const Geodesic& earth) : eps_(real(0.01) * sqrt(numeric_limits::min())) , _earth(earth) {} void AzimuthalEquidistant::Forward(real lat0, real lon0, real lat, real lon, real& x, real& y, real& azi, real& rk) const { real sig, s, azi0, m; sig = _earth.Inverse(lat0, lon0, lat, lon, s, azi0, azi, m); Math::sincosd(azi0, x, y); x *= s; y *= s; 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 { real azi0 = Math::atan2d(x, y), s = 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.52/src/CMakeLists.txt0000644000771000077100000000744014064202371017351 0ustar ckarneyckarney# Build the library... # Include all the .cpp files in the library. file (GLOB SOURCES [A-Za-z]*.cpp) file (GLOB HEADERS ${PROJECT_BINARY_DIR}/include/GeographicLib/Config.h ../include/GeographicLib/[A-Za-z]*.hpp) # Define the library and specify whether it is shared or not. if (GEOGRAPHICLIB_SHARED_LIB) add_library (${PROJECT_SHARED_LIBRARIES} SHARED ${SOURCES} ${HEADERS}) add_library (${PROJECT_NAME}::${PROJECT_SHARED_LIBRARIES} ALIAS ${PROJECT_SHARED_LIBRARIES}) endif () if (GEOGRAPHICLIB_STATIC_LIB) add_library (${PROJECT_STATIC_LIBRARIES} STATIC ${SOURCES} ${HEADERS}) add_library (${PROJECT_NAME}::${PROJECT_STATIC_LIBRARIES} ALIAS ${PROJECT_STATIC_LIBRARIES}) endif () add_library (${PROJECT_INTERFACE_LIBRARIES} INTERFACE) add_library (${PROJECT_NAME}::${PROJECT_INTERFACE_LIBRARIES} ALIAS ${PROJECT_INTERFACE_LIBRARIES}) target_link_libraries (${PROJECT_INTERFACE_LIBRARIES} INTERFACE ${PROJECT_LIBRARIES}) # Set the version number on the library if (MSVC) if (GEOGRAPHICLIB_SHARED_LIB) set_target_properties (${PROJECT_SHARED_LIBRARIES} PROPERTIES VERSION "${LIBVERSION_BUILD}" OUTPUT_NAME ${LIBNAME} IMPORT_SUFFIX -i.lib) target_compile_definitions (${PROJECT_SHARED_LIBRARIES} PUBLIC GEOGRAPHICLIB_SHARED_LIB=1) endif () if (GEOGRAPHICLIB_STATIC_LIB) set_target_properties (${PROJECT_STATIC_LIBRARIES} PROPERTIES VERSION "${LIBVERSION_BUILD}" OUTPUT_NAME ${LIBNAME}) target_compile_definitions (${PROJECT_STATIC_LIBRARIES} PUBLIC GEOGRAPHICLIB_SHARED_LIB=0) endif () else () set_target_properties ( ${PROJECT_SHARED_LIBRARIES} ${PROJECT_STATIC_LIBRARIES} PROPERTIES VERSION "${LIBVERSION_BUILD}" SOVERSION "${LIBVERSION_API}" OUTPUT_NAME ${LIBNAME}) if (APPLE AND GEOGRAPHICLIB_PRECISION EQUAL 5) if (GEOGRAPHICLIB_SHARED_LIB) target_link_libraries (${PROJECT_SHARED_LIBRARIES} ${HIGHPREC_LIBRARIES}) endif () if (GEOGRAPHICLIB_STATIC_LIB) target_link_libraries (${PROJECT_STATIC_LIBRARIES} ${HIGHPREC_LIBRARIES}) endif () endif () endif () if (GEOGRAPHICLIB_SHARED_LIB) target_include_directories (${PROJECT_SHARED_LIBRARIES} PUBLIC $ $ $) endif () if (GEOGRAPHICLIB_STATIC_LIB) target_include_directories (${PROJECT_STATIC_LIBRARIES} PUBLIC $ $ $) endif () # Specify where the library is installed, adding it to the export targets install (TARGETS ${PROJECT_ALL_LIBRARIES} EXPORT targets # A potentially useful option. However it's only supported in recent # versions of cmake (2.8.12 and later?). So comment out for now. # INCLUDES DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX}) if (MSVC AND PACKAGE_DEBUG_LIBS) if (GEOGRAPHICLIB_SHARED_LIB) install (FILES "${PROJECT_BINARY_DIR}/lib/Debug/${LIBNAME}${CMAKE_DEBUG_POSTFIX}-i.lib" DESTINATION lib${LIB_SUFFIX} CONFIGURATIONS Release) install (PROGRAMS "${PROJECT_BINARY_DIR}/bin/Debug/${LIBNAME}${CMAKE_DEBUG_POSTFIX}.dll" DESTINATION bin CONFIGURATIONS Release) endif () if (GEOGRAPHICLIB_STATIC_LIB) install (FILES "${PROJECT_BINARY_DIR}/lib/Debug/${LIBNAME}${CMAKE_DEBUG_POSTFIX}.lib" DESTINATION lib${LIB_SUFFIX} CONFIGURATIONS Release) endif () endif () if (MSVC AND GEOGRAPHICLIB_SHARED_LIB) install (FILES $ DESTINATION bin OPTIONAL) endif () # Put the library into a folder in the IDE set_target_properties ( ${PROJECT_SHARED_LIBRARIES} ${PROJECT_STATIC_LIBRARIES} PROPERTIES FOLDER library) GeographicLib-1.52/src/CassiniSoldner.cpp0000644000771000077100000000545514064202371020241 0ustar ckarneyckarney/** * \file CassiniSoldner.cpp * \brief Implementation for GeographicLib::CassiniSoldner class * * Copyright (c) Charles Karney (2009-2015) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { using namespace std; CassiniSoldner::CassiniSoldner(const Geodesic& earth) : _earth(earth) {} CassiniSoldner::CassiniSoldner(real lat0, real lon0, const Geodesic& earth) : _earth(earth) { Reset(lat0, lon0); } void CassiniSoldner::Reset(real lat0, real lon0) { _meridian = _earth.Line(lat0, lon0, real(0), Geodesic::LATITUDE | Geodesic::LONGITUDE | Geodesic::DISTANCE | Geodesic::DISTANCE_IN | Geodesic::AZIMUTH); real f = _earth.Flattening(); Math::sincosd(LatitudeOrigin(), _sbet0, _cbet0); _sbet0 *= (1 - f); Math::norm(_sbet0, _cbet0); } void CassiniSoldner::Forward(real lat, real lon, real& x, real& y, real& azi, real& rk) const { if (!Init()) return; real dlon = Math::AngDiff(LongitudeOrigin(), lon); real sig12, s12, azi1, azi2; sig12 = _earth.Inverse(lat, -abs(dlon), lat, abs(dlon), s12, azi1, azi2); sig12 *= real(0.5); s12 *= real(0.5); if (s12 == 0) { real da = Math::AngDiff(azi1, azi2)/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 = Math::AngNormalize(azi2); GeodesicLine perp(_earth.Line(lat, dlon, azi, Geodesic::GEODESICSCALE)); real t; perp.GenPosition(true, -sig12, Geodesic::GEODESICSCALE, t, t, t, t, t, t, rk, t); real salp0, calp0; Math::sincosd(perp.EquatorialAzimuth(), salp0, calp0); real 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 { 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.52/src/CircularEngine.cpp0000644000771000077100000000674514064202371020216 0ustar ckarneyckarney/** * \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 * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { using namespace std; Math::real CircularEngine::Value(bool gradp, real sl, real cl, real& gradx, real& grady, real& gradz) const { gradp = _gradp && gradp; const vector& root( SphericalEngine::sqrttable() ); // 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.52/src/DMS.cpp0000644000771000077100000004420214064202371015735 0ustar ckarneyckarney/** * \file DMS.cpp * \brief Implementation for GeographicLib::DMS class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif namespace GeographicLib { using namespace std; const char* const DMS::hemispheres_ = "SNWE"; const char* const DMS::signs_ = "-+"; const char* const DMS::digits_ = "0123456789"; const char* const DMS::dmsindicators_ = "D'\":"; const char* const DMS::components_[] = {"degrees", "minutes", "seconds"}; Math::real DMS::Decode(const std::string& dms, flag& ind) { // Here's a table of the allowed characters // S unicode dec UTF-8 descripton // DEGREE // d U+0064 100 64 d // D U+0044 68 44 D // ° U+00b0 176 c2 b0 degree symbol // º U+00ba 186 c2 ba alt symbol // ⁰ U+2070 8304 e2 81 b0 sup zero // ˚ U+02da 730 cb 9a ring above // ∘ U+2218 8728 e2 88 98 compose function // * U+002a 42 2a GRiD symbol for degrees // MINUTES // ' U+0027 39 27 apostrophe // ` U+0060 96 60 grave accent // ′ U+2032 8242 e2 80 b2 prime // ‵ U+2035 8245 e2 80 b5 back prime // ´ U+00b4 180 c2 b4 acute accent // ‘ U+2018 8216 e2 80 98 left single quote (also ext ASCII 0x91) // ’ U+2019 8217 e2 80 99 right single quote (also ext ASCII 0x92) // ‛ U+201b 8219 e2 80 9b reversed-9 single quote // ʹ U+02b9 697 ca b9 modifier letter prime // ˊ U+02ca 714 cb 8a modifier letter acute accent // ˋ U+02cb 715 cb 8b modifier letter grave accent // SECONDS // " U+0022 34 22 quotation mark // ″ U+2033 8243 e2 80 b3 double prime // ‶ U+2036 8246 e2 80 b6 reversed double prime // ˝ U+02dd 733 cb 9d double acute accent // “ U+201c 8220 e2 80 9c left double quote (also ext ASCII 0x93) // ” U+201d 8221 e2 80 9d right double quote (also ext ASCII 0x94) // ‟ U+201f 8223 e2 80 9f reversed-9 double quote // ʺ U+02ba 698 ca ba modifier letter double prime // PLUS // + U+002b 43 2b plus sign // ➕ U+2795 10133 e2 9e 95 heavy plus // U+2064 8292 e2 81 a4 invisible plus |⁤| // MINUS // - U+002d 45 2d hyphen // ‐ U+2010 8208 e2 80 90 dash // ‑ U+2011 8209 e2 80 91 non-breaking hyphen // – U+2013 8211 e2 80 93 en dash (also ext ASCII 0x96) // — U+2014 8212 e2 80 94 em dash (also ext ASCII 0x97) // − U+2212 8722 e2 88 92 minus sign // ➖ U+2796 10134 e2 9e 96 heavy minus // IGNORED //   U+00a0 160 c2 a0 non-breaking space // U+2007 8199 e2 80 87 figure space | | // U+2009 8201 e2 80 89 thin space | | // U+200a 8202 e2 80 8a hair space | | // U+200b 8203 e2 80 8b invisible space |​| //   U+202f 8239 e2 80 af narrow space | | // U+2063 8291 e2 81 a3 invisible separator |⁣| // « U+00ab 171 c2 ab left guillemot (for cgi-bin) // » U+00bb 187 c2 bb right guillemot (for cgi-bin) string dmsa = dms; replace(dmsa, "\xc2\xb0", 'd' ); // U+00b0 degree symbol replace(dmsa, "\xc2\xba", 'd' ); // U+00ba alt symbol replace(dmsa, "\xe2\x81\xb0", 'd' ); // U+2070 sup zero replace(dmsa, "\xcb\x9a", 'd' ); // U+02da ring above replace(dmsa, "\xe2\x88\x98", 'd' ); // U+2218 compose function replace(dmsa, "\xe2\x80\xb2", '\''); // U+2032 prime replace(dmsa, "\xe2\x80\xb5", '\''); // U+2035 back prime replace(dmsa, "\xc2\xb4", '\''); // U+00b4 acute accent replace(dmsa, "\xe2\x80\x98", '\''); // U+2018 left single quote replace(dmsa, "\xe2\x80\x99", '\''); // U+2019 right single quote replace(dmsa, "\xe2\x80\x9b", '\''); // U+201b reversed-9 single quote replace(dmsa, "\xca\xb9", '\''); // U+02b9 modifier letter prime replace(dmsa, "\xcb\x8a", '\''); // U+02ca modifier letter acute accent replace(dmsa, "\xcb\x8b", '\''); // U+02cb modifier letter grave accent replace(dmsa, "\xe2\x80\xb3", '"' ); // U+2033 double prime replace(dmsa, "\xe2\x80\xb6", '"' ); // U+2036 reversed double prime replace(dmsa, "\xcb\x9d", '"' ); // U+02dd double acute accent replace(dmsa, "\xe2\x80\x9c", '"' ); // U+201c left double quote replace(dmsa, "\xe2\x80\x9d", '"' ); // U+201d right double quote replace(dmsa, "\xe2\x80\x9f", '"' ); // U+201f reversed-9 double quote replace(dmsa, "\xca\xba", '"' ); // U+02ba modifier letter double prime replace(dmsa, "\xe2\x9e\x95", '+' ); // U+2795 heavy plus replace(dmsa, "\xe2\x81\xa4", '+' ); // U+2064 invisible plus replace(dmsa, "\xe2\x80\x90", '-' ); // U+2010 dash replace(dmsa, "\xe2\x80\x91", '-' ); // U+2011 non-breaking hyphen replace(dmsa, "\xe2\x80\x93", '-' ); // U+2013 en dash replace(dmsa, "\xe2\x80\x94", '-' ); // U+2014 em dash replace(dmsa, "\xe2\x88\x92", '-' ); // U+2212 minus sign replace(dmsa, "\xe2\x9e\x96", '-' ); // U+2796 heavy minus replace(dmsa, "\xc2\xa0", '\0'); // U+00a0 non-breaking space replace(dmsa, "\xe2\x80\x87", '\0'); // U+2007 figure space replace(dmsa, "\xe2\x80\x89", '\0'); // U+2007 thin space replace(dmsa, "\xe2\x80\x8a", '\0'); // U+200a hair space replace(dmsa, "\xe2\x80\x8b", '\0'); // U+200b invisible space replace(dmsa, "\xe2\x80\xaf", '\0'); // U+202f narrow space replace(dmsa, "\xe2\x81\xa3", '\0'); // U+2063 invisible separator replace(dmsa, "\xb0", 'd' ); // 0xb0 bare degree symbol replace(dmsa, "\xba", 'd' ); // 0xba bare alt symbol replace(dmsa, "*", 'd' ); // GRiD symbol for degree replace(dmsa, "`", '\''); // grave accent replace(dmsa, "\xb4", '\''); // 0xb4 bare acute accent // Don't implement these alternatives; they are only relevant for cgi-bin // replace(dmsa, "\x91", '\''); // 0x91 ext ASCII left single quote // replace(dmsa, "\x92", '\''); // 0x92 ext ASCII right single quote // replace(dmsa, "\x93", '"' ); // 0x93 ext ASCII left double quote // replace(dmsa, "\x94", '"' ); // 0x94 ext ASCII right double quote // replace(dmsa, "\x96", '-' ); // 0x96 ext ASCII en dash // replace(dmsa, "\x97", '-' ); // 0x97 ext ASCII em dash replace(dmsa, "\xa0", '\0'); // 0xa0 bare non-breaking space replace(dmsa, "''", '"' ); // '' -> " string::size_type beg = 0, end = unsigned(dmsa.size()); while (beg < end && isspace(dmsa[beg])) ++beg; while (beg < end && isspace(dmsa[end - 1])) --end; // The trimmed string in [beg, end) real v = 0; int i = 0; flag ind1 = NONE; // p is pointer to the next piece that needs decoding for (string::size_type p = beg, pb; p < end; p = pb, ++i) { string::size_type pa = p; // Skip over initial hemisphere letter (for i == 0) if (i == 0 && Utility::lookup(hemispheres_, dmsa[pa]) >= 0) ++pa; // Skip over initial sign (checking for it if i == 0) if (i > 0 || (pa < end && Utility::lookup(signs_, dmsa[pa]) >= 0)) ++pa; // Find next sign pb = min(dmsa.find_first_of(signs_, pa), end); flag ind2 = NONE; v += InternalDecode(dmsa.substr(p, pb - p), ind2); if (ind1 == NONE) ind1 = ind2; else if (!(ind2 == NONE || ind1 == ind2)) throw GeographicErr("Incompatible hemisphere specifier in " + dmsa.substr(beg, pb - beg)); } if (i == 0) throw GeographicErr("Empty or incomplete DMS string " + dmsa.substr(beg, end - beg)); ind = ind1; return v; } Math::real DMS::InternalDecode(const string& dmsa, flag& ind) { string errormsg; do { // Executed once (provides the ability to break) int sign = 1; unsigned beg = 0, end = unsigned(dmsa.size()); 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, intcount = 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; ++intcount; } } 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 " + string(components_[k]) + " component in " + dmsa.substr(beg, end - beg); break; } else if (unsigned(k) < npiece) { errormsg = string(components_[k]) + " component follows " + string(components_[npiece - 1]) + " component in " + dmsa.substr(beg, end - beg); break; } if (ncurrent == 0) { errormsg = "Missing numbers in " + string(components_[k]) + " component of " + dmsa.substr(beg, end - beg); break; } if (digcount > 0) { istringstream s(dmsa.substr(p - intcount - digcount - 1, intcount + digcount)); s >> fcurrent; icurrent = 0; } ipieces[k] = icurrent; fpieces[k] = icurrent + fcurrent; if (p < end) { npiece = k + 1; icurrent = fcurrent = 0; ncurrent = digcount = intcount = 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 > 0) { istringstream s(dmsa.substr(p - intcount - digcount, intcount + digcount)); s >> fcurrent; icurrent = 0; } 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 || fpieces[1] > 60 ) { errormsg = "Minutes " + Utility::str(fpieces[1]) + " not in range [0, 60)"; break; } if (ipieces[2] >= 60 || fpieces[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[2] != 0 ? (60*(60*fpieces[0] + fpieces[1]) + fpieces[2]) / 3600 : ( fpieces[1] != 0 ? (60*fpieces[0] + fpieces[1]) / 60 : fpieces[0] ) ); } while (false); real val = Utility::nummatch(dmsa); if (val == 0) throw GeographicErr(errormsg); else ind = NONE; return val; } void DMS::DecodeLatLon(const string& stra, const string& strb, real& lat, real& lon, bool longfirst) { real a, b; flag ia, ib; a = Decode(stra, ia); b = Decode(strb, ib); if (ia == NONE && ib == NONE) { // Default to lat, long unless longfirst ia = longfirst ? LONGITUDE : LATITUDE; ib = longfirst ? 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 (abs(lat1) > 90) throw GeographicErr("Latitude " + Utility::str(lat1) + "d not in [-90d, 90d]"); lat = lat1; lon = lon1; } Math::real DMS::DecodeAngle(const 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 string& azistr) { flag ind; real azi = Decode(azistr, ind); if (ind == LATITUDE) throw GeographicErr("Azimuth " + azistr + " has a latitude hemisphere, N/S"); return Math::AngNormalize(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 (!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 + Math::extra_digits() - 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 = (angle - idegree) * scale + real(0.5); { // Implement the "round ties to even" rule real f = floor(fdegree); fdegree = (f == fdegree && fmod(f, real(2)) == 1) ? f - 1 : f; } fdegree /= 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 << Utility::str(pieces[0], prec); // 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 << int(pieces[0]) << (dmssep ? dmssep : char(tolower(dmsindicators_[0]))); switch (trailing) { case MINUTE: s << setw(2 + prec + (prec ? 1 : 0)) << Utility::str(pieces[1], prec); if (!dmssep) s << char(tolower(dmsindicators_[1])); break; case SECOND: s << setw(2) << int(pieces[1]) << (dmssep ? dmssep : char(tolower(dmsindicators_[1]))) << setw(2 + prec + (prec ? 1 : 0)) << Utility::str(pieces[2], prec); 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(); } } // namespace GeographicLib GeographicLib-1.52/src/Ellipsoid.cpp0000644000771000077100000001013214064202371017231 0ustar ckarneyckarney/** * \file Ellipsoid.cpp * \brief Implementation for GeographicLib::Ellipsoid class * * Copyright (c) Charles Karney (2012-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { using namespace std; Ellipsoid::Ellipsoid(real a, real f) : stol_(real(0.01) * sqrt(numeric_limits::epsilon())) , _a(a) , _f(f) , _f1(1 - _f) , _f12(Math::sq(_f1)) , _e2(_f * (2 - _f)) , _es((_f < 0 ? -1 : 1) * sqrt(abs(_e2))) , _e12(_e2 / (1 - _e2)) , _n(_f / (2 - _f)) , _b(_a * _f1) , _tm(_a, _f, real(1)) , _ell(-_e12) , _au(_a, _f, real(0), real(1), real(0), real(1), real(1)) {} const Ellipsoid& Ellipsoid::WGS84() { static const Ellipsoid wgs84(Constants::WGS84_a(), Constants::WGS84_f()); return wgs84; } Math::real Ellipsoid::QuarterMeridian() const { return _b * _ell.E(); } Math::real Ellipsoid::Area() const { return 4 * Math::pi() * ((Math::sq(_a) + Math::sq(_b) * (_e2 == 0 ? 1 : (_e2 > 0 ? atanh(sqrt(_e2)) : atan(sqrt(-_e2))) / sqrt(abs(_e2))))/2); } Math::real Ellipsoid::ParametricLatitude(real phi) const { return Math::atand(_f1 * Math::tand(Math::LatFix(phi))); } Math::real Ellipsoid::InverseParametricLatitude(real beta) const { return Math::atand(Math::tand(Math::LatFix(beta)) / _f1); } Math::real Ellipsoid::GeocentricLatitude(real phi) const { return Math::atand(_f12 * Math::tand(Math::LatFix(phi))); } Math::real Ellipsoid::InverseGeocentricLatitude(real theta) const { return Math::atand(Math::tand(Math::LatFix(theta)) / _f12); } Math::real Ellipsoid::RectifyingLatitude(real phi) const { return abs(phi) == 90 ? phi: 90 * MeridianDistance(phi) / QuarterMeridian(); } Math::real Ellipsoid::InverseRectifyingLatitude(real mu) const { if (abs(mu) == 90) return mu; return InverseParametricLatitude(_ell.Einv(mu * _ell.E() / 90) / Math::degree()); } Math::real Ellipsoid::AuthalicLatitude(real phi) const { return Math::atand(_au.txif(Math::tand(Math::LatFix(phi)))); } Math::real Ellipsoid::InverseAuthalicLatitude(real xi) const { return Math::atand(_au.tphif(Math::tand(Math::LatFix(xi)))); } Math::real Ellipsoid::ConformalLatitude(real phi) const { return Math::atand(Math::taupf(Math::tand(Math::LatFix(phi)), _es)); } Math::real Ellipsoid::InverseConformalLatitude(real chi) const { return Math::atand(Math::tauf(Math::tand(Math::LatFix(chi)), _es)); } Math::real Ellipsoid::IsometricLatitude(real phi) const { return asinh(Math::taupf(Math::tand(Math::LatFix(phi)), _es)) / Math::degree(); } Math::real Ellipsoid::InverseIsometricLatitude(real psi) const { return Math::atand(Math::tauf(sinh(psi * Math::degree()), _es)); } Math::real Ellipsoid::CircleRadius(real phi) const { return abs(phi) == 90 ? 0 : // a * cos(beta) _a / hypot(real(1), _f1 * Math::tand(Math::LatFix(phi))); } Math::real Ellipsoid::CircleHeight(real phi) const { real tbeta = _f1 * Math::tand(phi); // b * sin(beta) return _b * tbeta / hypot(real(1), _f1 * Math::tand(Math::LatFix(phi))); } Math::real Ellipsoid::MeridianDistance(real phi) const { return _b * _ell.Ed( ParametricLatitude(phi) ); } Math::real Ellipsoid::MeridionalCurvatureRadius(real phi) const { real v = 1 - _e2 * Math::sq(Math::sind(Math::LatFix(phi))); return _a * (1 - _e2) / (v * sqrt(v)); } Math::real Ellipsoid::TransverseCurvatureRadius(real phi) const { real v = 1 - _e2 * Math::sq(Math::sind(Math::LatFix(phi))); return _a / sqrt(v); } Math::real Ellipsoid::NormalCurvatureRadius(real phi, real azi) const { real calp, salp, v = 1 - _e2 * Math::sq(Math::sind(Math::LatFix(phi))); Math::sincosd(azi, salp, calp); return _a / (sqrt(v) * (Math::sq(calp) * v / (1 - _e2) + Math::sq(salp))); } } // namespace GeographicLib GeographicLib-1.52/src/EllipticFunction.cpp0000644000771000077100000004444114064202371020572 0ustar ckarneyckarney/** * \file EllipticFunction.cpp * \brief Implementation for GeographicLib::EllipticFunction class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif namespace GeographicLib { using namespace std; /* * 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) { // Carlson, eqs 2.2 - 2.7 static const real tolRF = pow(3 * numeric_limits::epsilon() * real(0.01), 1/real(8)); 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 lam = sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0); An = (An + lam)/4; x0 = (x0 + lam)/4; y0 = (y0 + lam)/4; z0 = (z0 + lam)/4; mul *= 4; } real X = (A0 - x) / (mul * An), Y = (A0 - y) / (mul * An), Z = - (X + Y), E2 = X*Y - Z*Z, E3 = X*Y*Z; // https://dlmf.nist.gov/19.36.E1 // Polynomial is // (1 - E2/10 + E3/14 + E2^2/24 - 3*E2*E3/44 // - 5*E2^3/208 + 3*E3^2/104 + E2^2*E3/16) // convert to Horner form... return (E3 * (6930 * E3 + E2 * (15015 * E2 - 16380) + 17160) + E2 * ((10010 - 5775 * E2) * E2 - 24024) + 240240) / (240240 * sqrt(An)); } Math::real EllipticFunction::RF(real x, real y) { // Carlson, eqs 2.36 - 2.38 static const real tolRG0 = real(2.7) * sqrt((numeric_limits::epsilon() * real(0.01))); real xn = sqrt(x), yn = sqrt(y); if (xn < yn) swap(xn, yn); while (abs(xn-yn) > tolRG0 * xn) { // Max 4 trips real t = (xn + yn) /2; yn = sqrt(xn * yn); xn = t; } return Math::pi() / (xn + yn); } Math::real EllipticFunction::RC(real x, real y) { // Defined only for y != 0 and x >= 0. return ( !(x >= y) ? // x < y and catch nans // https://dlmf.nist.gov/19.2.E18 atan(sqrt((y - x) / x)) / sqrt(y - x) : ( x == y ? 1 / sqrt(y) : asinh( y > 0 ? // https://dlmf.nist.gov/19.2.E19 // atanh(sqrt((x - y) / x)) sqrt((x - y) / y) : // https://dlmf.nist.gov/19.2.E20 // atanh(sqrt(x / (x - y))) sqrt(-x / y) ) / sqrt(x - y) ) ); } Math::real EllipticFunction::RG(real x, real y, real z) { if (z == 0) swap(y, z); // Carlson, eq 1.7 return (z * RF(x, y, z) - (x-z) * (y-z) * RD(x, y, z) / 3 + sqrt(x * y / z)) / 2; } Math::real EllipticFunction::RG(real x, real y) { // Carlson, eqs 2.36 - 2.39 static const real tolRG0 = real(2.7) * sqrt((numeric_limits::epsilon() * real(0.01))); real x0 = sqrt(max(x, y)), y0 = sqrt(min(x, y)), xn = x0, yn = y0, s = 0, mul = real(0.25); while (abs(xn-yn) > tolRG0 * xn) { // Max 4 trips real t = (xn + yn) /2; yn = sqrt(xn * yn); xn = t; mul *= 2; t = xn - yn; s += mul * t * t; } return (Math::sq( (x0 + y0)/2 ) - s) * Math::pi() / (2 * (xn + yn)); } Math::real EllipticFunction::RJ(real x, real y, real z, real p) { // Carlson, eqs 2.17 - 2.25 static const real tolRD = pow(real(0.2) * (numeric_limits::epsilon() * real(0.01)), 1/real(8)); real A0 = (x + y + z + 2*p)/5, An = A0, delta = (p-x) * (p-y) * (p-z), Q = max(max(abs(A0-x), abs(A0-y)), max(abs(A0-z), abs(A0-p))) / tolRD, x0 = x, y0 = y, z0 = z, p0 = p, mul = 1, mul3 = 1, s = 0; while (Q >= mul * abs(An)) { // Max 7 trips real lam = sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0), d0 = (sqrt(p0)+sqrt(x0)) * (sqrt(p0)+sqrt(y0)) * (sqrt(p0)+sqrt(z0)), e0 = delta/(mul3 * Math::sq(d0)); s += RC(1, 1 + e0)/(mul * d0); An = (An + lam)/4; x0 = (x0 + lam)/4; y0 = (y0 + lam)/4; z0 = (z0 + lam)/4; p0 = (p0 + lam)/4; mul *= 4; mul3 *= 64; } real X = (A0 - x) / (mul * An), Y = (A0 - y) / (mul * An), Z = (A0 - z) / (mul * An), P = -(X + Y + Z) / 2, E2 = X*Y + X*Z + Y*Z - 3*P*P, E3 = X*Y*Z + 2*P * (E2 + 2*P*P), E4 = (2*X*Y*Z + P * (E2 + 3*P*P)) * P, E5 = X*Y*Z*P*P; // https://dlmf.nist.gov/19.36.E2 // Polynomial is // (1 - 3*E2/14 + E3/6 + 9*E2^2/88 - 3*E4/22 - 9*E2*E3/52 + 3*E5/26 // - E2^3/16 + 3*E3^2/40 + 3*E2*E4/20 + 45*E2^2*E3/272 // - 9*(E3*E4+E2*E5)/68) return ((471240 - 540540 * E2) * E5 + (612612 * E2 - 540540 * E3 - 556920) * E4 + E3 * (306306 * E3 + E2 * (675675 * E2 - 706860) + 680680) + E2 * ((417690 - 255255 * E2) * E2 - 875160) + 4084080) / (4084080 * mul * An * sqrt(An)) + 6 * s; } Math::real EllipticFunction::RD(real x, real y, real z) { // Carlson, eqs 2.28 - 2.34 static const real tolRD = pow(real(0.2) * (numeric_limits::epsilon() * real(0.01)), 1/real(8)); 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 lam = sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0); s += 1/(mul * sqrt(z0) * (z0 + lam)); An = (An + lam)/4; x0 = (x0 + lam)/4; y0 = (y0 + lam)/4; z0 = (z0 + lam)/4; mul *= 4; } real X = (A0 - x) / (mul * An), Y = (A0 - y) / (mul * An), Z = -(X + Y) / 3, E2 = X*Y - 6*Z*Z, E3 = (3*X*Y - 8*Z*Z)*Z, E4 = 3 * (X*Y - Z*Z) * Z*Z, E5 = X*Y*Z*Z*Z; // https://dlmf.nist.gov/19.36.E2 // Polynomial is // (1 - 3*E2/14 + E3/6 + 9*E2^2/88 - 3*E4/22 - 9*E2*E3/52 + 3*E5/26 // - E2^3/16 + 3*E3^2/40 + 3*E2*E4/20 + 45*E2^2*E3/272 // - 9*(E3*E4+E2*E5)/68) return ((471240 - 540540 * E2) * E5 + (612612 * E2 - 540540 * E3 - 556920) * E4 + E3 * (306306 * E3 + E2 * (675675 * E2 - 706860) + 680680) + E2 * ((417690 - 255255 * E2) * E2 - 875160) + 4084080) / (4084080 * mul * An * sqrt(An)) + 3 * s; } void EllipticFunction::Reset(real k2, real alpha2, real kp2, real alphap2) { // Accept nans here (needed for GeodesicExact) if (k2 > 1) throw GeographicErr("Parameter k2 is not in (-inf, 1]"); if (alpha2 > 1) throw GeographicErr("Parameter alpha2 is not in (-inf, 1]"); if (kp2 < 0) throw GeographicErr("Parameter kp2 is not in [0, inf)"); if (alphap2 < 0) throw GeographicErr("Parameter alphap2 is not in [0, inf)"); _k2 = k2; _kp2 = kp2; _alpha2 = alpha2; _alphap2 = alphap2; _eps = _k2/Math::sq(sqrt(_kp2) + 1); // Values of complete elliptic integrals for k = 0,1 and alpha = 0,1 // K E D // k = 0: pi/2 pi/2 pi/4 // k = 1: inf 1 inf // Pi G H // k = 0, alpha = 0: pi/2 pi/2 pi/4 // k = 1, alpha = 0: inf 1 1 // k = 0, alpha = 1: inf inf pi/2 // k = 1, alpha = 1: inf inf inf // // Pi(0, k) = K(k) // G(0, k) = E(k) // H(0, k) = K(k) - D(k) // Pi(0, k) = K(k) // G(0, k) = E(k) // H(0, k) = K(k) - D(k) // Pi(alpha2, 0) = pi/(2*sqrt(1-alpha2)) // G(alpha2, 0) = pi/(2*sqrt(1-alpha2)) // H(alpha2, 0) = pi/(2*(1 + sqrt(1-alpha2))) // Pi(alpha2, 1) = inf // H(1, k) = K(k) // G(alpha2, 1) = H(alpha2, 1) = RC(1, alphap2) if (_k2 != 0) { // Complete elliptic integral K(k), Carlson eq. 4.1 // https://dlmf.nist.gov/19.25.E1 _Kc = _kp2 != 0 ? RF(_kp2, 1) : Math::infinity(); // Complete elliptic integral E(k), Carlson eq. 4.2 // https://dlmf.nist.gov/19.25.E1 _Ec = _kp2 != 0 ? 2 * RG(_kp2, 1) : 1; // D(k) = (K(k) - E(k))/k^2, Carlson eq.4.3 // https://dlmf.nist.gov/19.25.E1 _Dc = _kp2 != 0 ? RD(0, _kp2, 1) / 3 : Math::infinity(); } else { _Kc = _Ec = Math::pi()/2; _Dc = _Kc/2; } if (_alpha2 != 0) { // https://dlmf.nist.gov/19.25.E2 real rj = (_kp2 != 0 && _alphap2 != 0) ? RJ(0, _kp2, 1, _alphap2) : Math::infinity(), // Only use rc if _kp2 = 0. rc = _kp2 != 0 ? 0 : (_alphap2 != 0 ? RC(1, _alphap2) : Math::infinity()); // Pi(alpha^2, k) _Pic = _kp2 != 0 ? _Kc + _alpha2 * rj / 3 : Math::infinity(); // G(alpha^2, k) _Gc = _kp2 != 0 ? _Kc + (_alpha2 - _k2) * rj / 3 : rc; // H(alpha^2, k) _Hc = _kp2 != 0 ? _Kc - (_alphap2 != 0 ? _alphap2 * rj : 0) / 3 : rc; } else { _Pic = _Kc; _Gc = _Ec; // Hc = Kc - Dc but this involves large cancellations if k2 is close to // 1. So write (for alpha2 = 0) // Hc = int(cos(phi)^2/sqrt(1-k2*sin(phi)^2),phi,0,pi/2) // = 1/sqrt(1-k2) * int(sin(phi)^2/sqrt(1-k2/kp2*sin(phi)^2,...) // = 1/kp * D(i*k/kp) // and use D(k) = RD(0, kp2, 1) / 3 // so Hc = 1/kp * RD(0, 1/kp2, 1) / 3 // = kp2 * RD(0, 1, kp2) / 3 // using https://dlmf.nist.gov/19.20.E18 // Equivalently // RF(x, 1) - RD(0, x, 1)/3 = x * RD(0, 1, x)/3 for x > 0 // For k2 = 1 and alpha2 = 0, we have // Hc = int(cos(phi),...) = 1 _Hc = _kp2 != 0 ? _kp2 * RD(0, 1, _kp2) / 3 : 1; } } /* * 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 { // Bulirsch's sncndn routine, p 89. static const real tolJAC = sqrt(numeric_limits::epsilon() * real(0.01)); if (_kp2 != 0) { real mc = _kp2, d = 0; if (_kp2 < 0) { d = 1 - mc; mc /= -d; d = sqrt(d); x *= d; } real c = 0; // To suppress warning about uninitialized variable real m[num_], n[num_]; unsigned l = 0; for (real a = 1; l < num_ || GEOGRAPHICLIB_PANIC; ++l) { // This converges quadratically. 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; a = c; } x *= c; sn = sin(x); cn = cos(x); dn = 1; if (sn != 0) { real a = cn / sn; c *= a; while (l--) { real b = m[l]; a *= c; c *= dn; dn = (n[l] + a) / (b + a); a = c / b; } a = 1 / sqrt(c*c + 1); sn = sn < 0 ? -a : a; cn = c * sn; if (_kp2 < 0) { swap(cn, dn); sn /= d; } } } else { sn = tanh(x); dn = cn = 1 / cosh(x); } } Math::real EllipticFunction::F(real sn, real cn, real dn) const { // Carlson, eq. 4.5 and // https://dlmf.nist.gov/19.25.E5 real cn2 = cn*cn, dn2 = dn*dn, fi = cn2 != 0 ? abs(sn) * RF(cn2, dn2, 1) : K(); // Enforce usual trig-like symmetries if (cn < 0) fi = 2 * K() - fi; return copysign(fi, sn); } Math::real EllipticFunction::E(real sn, real cn, real dn) const { real cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn, ei = cn2 != 0 ? abs(sn) * ( _k2 <= 0 ? // Carlson, eq. 4.6 and // https://dlmf.nist.gov/19.25.E9 RF(cn2, dn2, 1) - _k2 * sn2 * RD(cn2, dn2, 1) / 3 : ( _kp2 >= 0 ? // https://dlmf.nist.gov/19.25.E10 _kp2 * RF(cn2, dn2, 1) + _k2 * _kp2 * sn2 * RD(cn2, 1, dn2) / 3 + _k2 * abs(cn) / dn : // https://dlmf.nist.gov/19.25.E11 - _kp2 * sn2 * RD(dn2, 1, cn2) / 3 + dn / abs(cn) ) ) : E(); // Enforce usual trig-like symmetries if (cn < 0) ei = 2 * E() - ei; return copysign(ei, sn); } Math::real EllipticFunction::D(real sn, real cn, real dn) const { // Carlson, eq. 4.8 and // https://dlmf.nist.gov/19.25.E13 real cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn, di = cn2 != 0 ? abs(sn) * sn2 * RD(cn2, dn2, 1) / 3 : D(); // Enforce usual trig-like symmetries if (cn < 0) di = 2 * D() - di; return copysign(di, sn); } Math::real EllipticFunction::Pi(real sn, real cn, real dn) const { // Carlson, eq. 4.7 and // https://dlmf.nist.gov/19.25.E14 real cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn, pii = cn2 != 0 ? abs(sn) * (RF(cn2, dn2, 1) + _alpha2 * sn2 * RJ(cn2, dn2, 1, cn2 + _alphap2 * sn2) / 3) : Pi(); // Enforce usual trig-like symmetries if (cn < 0) pii = 2 * Pi() - pii; return copysign(pii, sn); } Math::real EllipticFunction::G(real sn, real cn, real dn) const { real cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn, gi = cn2 != 0 ? abs(sn) * (RF(cn2, dn2, 1) + (_alpha2 - _k2) * sn2 * RJ(cn2, dn2, 1, cn2 + _alphap2 * sn2) / 3) : G(); // Enforce usual trig-like symmetries if (cn < 0) gi = 2 * G() - gi; return copysign(gi, sn); } Math::real EllipticFunction::H(real sn, real cn, real dn) const { real cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn, // WARNING: large cancellation if k2 = 1, alpha2 = 0, and phi near pi/2 hi = cn2 != 0 ? abs(sn) * (RF(cn2, dn2, 1) - _alphap2 * sn2 * RJ(cn2, dn2, 1, cn2 + _alphap2 * sn2) / 3) : H(); // Enforce usual trig-like symmetries if (cn < 0) hi = 2 * H() - hi; return copysign(hi, sn); } Math::real EllipticFunction::deltaF(real sn, real cn, real dn) const { // Function is periodic with period pi if (cn < 0) { cn = -cn; sn = -sn; } return F(sn, cn, dn) * (Math::pi()/2) / K() - atan2(sn, cn); } Math::real EllipticFunction::deltaE(real sn, real cn, real dn) const { // Function is periodic with period pi if (cn < 0) { cn = -cn; sn = -sn; } return E(sn, cn, dn) * (Math::pi()/2) / E() - atan2(sn, cn); } Math::real EllipticFunction::deltaPi(real sn, real cn, real dn) const { // Function is periodic with period pi if (cn < 0) { cn = -cn; sn = -sn; } return Pi(sn, cn, dn) * (Math::pi()/2) / Pi() - atan2(sn, cn); } Math::real EllipticFunction::deltaD(real sn, real cn, real dn) const { // Function is periodic with period pi if (cn < 0) { cn = -cn; sn = -sn; } return D(sn, cn, dn) * (Math::pi()/2) / D() - atan2(sn, cn); } Math::real EllipticFunction::deltaG(real sn, real cn, real dn) const { // Function is periodic with period pi if (cn < 0) { cn = -cn; sn = -sn; } return G(sn, cn, dn) * (Math::pi()/2) / G() - atan2(sn, cn); } Math::real EllipticFunction::deltaH(real sn, real cn, real dn) const { // Function is periodic with period pi if (cn < 0) { cn = -cn; sn = -sn; } return H(sn, cn, dn) * (Math::pi()/2) / H() - atan2(sn, cn); } Math::real EllipticFunction::F(real phi) const { real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn); return abs(phi) < Math::pi() ? F(sn, cn, dn) : (deltaF(sn, cn, dn) + phi) * K() / (Math::pi()/2); } Math::real EllipticFunction::E(real phi) const { real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn); return abs(phi) < Math::pi() ? E(sn, cn, dn) : (deltaE(sn, cn, dn) + phi) * E() / (Math::pi()/2); } Math::real EllipticFunction::Ed(real ang) const { real n = ceil(ang/360 - real(0.5)); ang -= 360 * n; real sn, cn; Math::sincosd(ang, sn, cn); return E(sn, cn, Delta(sn, cn)) + 4 * E() * n; } Math::real EllipticFunction::Pi(real phi) const { real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn); return abs(phi) < Math::pi() ? Pi(sn, cn, dn) : (deltaPi(sn, cn, dn) + phi) * Pi() / (Math::pi()/2); } Math::real EllipticFunction::D(real phi) const { real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn); return abs(phi) < Math::pi() ? D(sn, cn, dn) : (deltaD(sn, cn, dn) + phi) * D() / (Math::pi()/2); } Math::real EllipticFunction::G(real phi) const { real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn); return abs(phi) < Math::pi() ? G(sn, cn, dn) : (deltaG(sn, cn, dn) + phi) * G() / (Math::pi()/2); } Math::real EllipticFunction::H(real phi) const { real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn); return abs(phi) < Math::pi() ? H(sn, cn, dn) : (deltaH(sn, cn, dn) + phi) * H() / (Math::pi()/2); } Math::real EllipticFunction::Einv(real x) const { static const real tolJAC = sqrt(numeric_limits::epsilon() * real(0.01)); real n = floor(x / (2 * _Ec) + real(0.5)); x -= 2 * _Ec * n; // x now in [-ec, ec) // Linear approximation real phi = Math::pi() * x / (2 * _Ec); // phi in [-pi/2, pi/2) // First order correction phi -= _eps * sin(2 * phi) / 2; // For kp2 close to zero use asin(x/_Ec) or // J. P. Boyd, Applied Math. and Computation 218, 7005-7013 (2012) // https://doi.org/10.1016/j.amc.2011.12.021 for (int i = 0; i < num_ || GEOGRAPHICLIB_PANIC; ++i) { real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn), err = (E(sn, cn, dn) - x)/dn; phi -= err; if (!(abs(err) > tolJAC)) break; } return n * Math::pi() + phi; } Math::real EllipticFunction::deltaEinv(real stau, real ctau) const { // Function is periodic with period pi if (ctau < 0) { ctau = -ctau; stau = -stau; } real tau = atan2(stau, ctau); return Einv( tau * E() / (Math::pi()/2) ) - tau; } } // namespace GeographicLib GeographicLib-1.52/src/GARS.cpp0000644000771000077100000001023614064202371016046 0ustar ckarneyckarney/** * \file GARS.cpp * \brief Implementation for GeographicLib::GARS class * * Copyright (c) Charles Karney (2015-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include namespace GeographicLib { using namespace std; const char* const GARS::digits_ = "0123456789"; const char* const GARS::letters_ = "ABCDEFGHJKLMNPQRSTUVWXYZ"; void GARS::Forward(real lat, real lon, int prec, string& gars) { using std::isnan; // Needed for Centos 7, ubuntu 14 if (abs(lat) > 90) throw GeographicErr("Latitude " + Utility::str(lat) + "d not in [-90d, 90d]"); if (isnan(lat) || isnan(lon)) { gars = "INVALID"; return; } lon = Math::AngNormalize(lon); if (lon == 180) lon = -180; // lon now in [-180,180) if (lat == 90) lat *= (1 - numeric_limits::epsilon() / 2); prec = max(0, min(int(maxprec_), prec)); int x = int(floor(lon * m_)) - lonorig_ * m_, y = int(floor(lat * m_)) - latorig_ * m_, ilon = x * mult1_ / m_, ilat = y * mult1_ / m_; x -= ilon * m_ / mult1_; y -= ilat * m_ / mult1_; char gars1[maxlen_]; ++ilon; for (int c = lonlen_; c--;) { gars1[c] = digits_[ ilon % baselon_]; ilon /= baselon_; } for (int c = latlen_; c--;) { gars1[lonlen_ + c] = letters_[ilat % baselat_]; ilat /= baselat_; } if (prec > 0) { ilon = x / mult3_; ilat = y / mult3_; gars1[baselen_] = digits_[mult2_ * (mult2_ - 1 - ilat) + ilon + 1]; if (prec > 1) { ilon = x % mult3_; ilat = y % mult3_; gars1[baselen_ + 1] = digits_[mult3_ * (mult3_ - 1 - ilat) + ilon + 1]; } } gars.resize(baselen_ + prec); copy(gars1, gars1 + baselen_ + prec, gars.begin()); } void GARS::Reverse(const string& gars, real& lat, real& lon, int& prec, bool centerp) { int len = int(gars.length()); if (len >= 3 && toupper(gars[0]) == 'I' && toupper(gars[1]) == 'N' && toupper(gars[2]) == 'V') { lat = lon = Math::NaN(); return; } if (len < baselen_) throw GeographicErr("GARS must have at least 5 characters " + gars); if (len > maxlen_) throw GeographicErr("GARS can have at most 7 characters " + gars); int prec1 = len - baselen_; int ilon = 0; for (int c = 0; c < lonlen_; ++c) { int k = Utility::lookup(digits_, gars[c]); if (k < 0) throw GeographicErr("GARS must start with 3 digits " + gars); ilon = ilon * baselon_ + k; } if (!(ilon >= 1 && ilon <= 720)) throw GeographicErr("Initial digits in GARS must lie in [1, 720] " + gars); --ilon; int ilat = 0; for (int c = 0; c < latlen_; ++c) { int k = Utility::lookup(letters_, gars[lonlen_ + c]); if (k < 0) throw GeographicErr("Illegal letters in GARS " + gars.substr(3,2)); ilat = ilat * baselat_ + k; } if (!(ilat < 360)) throw GeographicErr("GARS letters must lie in [AA, QZ] " + gars); real unit = mult1_, lat1 = ilat + latorig_ * unit, lon1 = ilon + lonorig_ * unit; if (prec1 > 0) { int k = Utility::lookup(digits_, gars[baselen_]); if (!(k >= 1 && k <= mult2_ * mult2_)) throw GeographicErr("6th character in GARS must [1, 4] " + gars); --k; unit *= mult2_; lat1 = mult2_ * lat1 + (mult2_ - 1 - k / mult2_); lon1 = mult2_ * lon1 + (k % mult2_); if (prec1 > 1) { k = Utility::lookup(digits_, gars[baselen_ + 1]); if (!(k >= 1 /* && k <= mult3_ * mult3_ */)) throw GeographicErr("7th character in GARS must [1, 9] " + gars); --k; unit *= mult3_; lat1 = mult3_ * lat1 + (mult3_ - 1 - k / mult3_); lon1 = mult3_ * lon1 + (k % mult3_); } } if (centerp) { unit *= 2; lat1 = 2 * lat1 + 1; lon1 = 2 * lon1 + 1; } lat = lat1 / unit; lon = lon1 / unit; prec = prec1; } } // namespace GeographicLib GeographicLib-1.52/src/GeoCoords.cpp0000644000771000077100000001441114064202371017175 0ustar ckarneyckarney/** * \file GeoCoords.cpp * \brief Implementation for GeographicLib::GeoCoords class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include #include #include namespace GeographicLib { using namespace std; void GeoCoords::Reset(const std::string& s, bool centerp, bool longfirst) { 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, longfirst); _long = Math::AngNormalize(_long); 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) = Utility::val(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 longfirst) const { using std::isnan; // Needed for Centos 7, ubuntu 14 prec = max(0, min(9 + Math::extra_digits(), prec) + 5); ostringstream os; os << fixed << setprecision(prec); real a = longfirst ? _long : _lat; real b = longfirst ? _lat : _long; if (!isnan(a)) os << a; else os << "nan"; os << " "; if (!isnan(b)) os << b; else os << "nan"; return os.str(); } string GeoCoords::DMSRepresentation(int prec, bool longfirst, char dmssep) const { prec = max(0, min(10 + Math::extra_digits(), prec) + 5); return DMS::Encode(longfirst ? _long : _lat, unsigned(prec), longfirst ? DMS::LONGITUDE : DMS::LATITUDE, dmssep) + " " + DMS::Encode(longfirst ? _lat : _long, unsigned(prec), longfirst ? DMS::LATITUDE : DMS::LONGITUDE, dmssep); } string GeoCoords::MGRSRepresentation(int prec) const { // Max precision is um prec = max(-1, 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(-1, 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, bool northp, real easting, real northing, int prec, bool abbrev, string& utm) { ostringstream os; prec = max(-5, min(9 + Math::extra_digits(), prec)); // Need extra real because, since C++11, pow(float, int) returns double real scale = prec < 0 ? real(pow(real(10), -prec)) : real(1); os << UTMUPS::EncodeZone(zone, northp, abbrev) << fixed << setfill('0'); if (isfinite(easting)) { os << " " << Utility::str(easting / scale, max(0, prec)); if (prec < 0 && abs(easting / scale) > real(0.5)) os << setw(-prec) << 0; } else os << " nan"; if (isfinite(northing)) { os << " " << Utility::str(northing / scale, max(0, prec)); if (prec < 0 && abs(northing / scale) > real(0.5)) os << setw(-prec) << 0; } else os << " nan"; utm = os.str(); } string GeoCoords::UTMUPSRepresentation(int prec, bool abbrev) const { string utm; UTMUPSString(_zone, _northp, _easting, _northing, prec, abbrev, utm); return utm; } string GeoCoords::UTMUPSRepresentation(bool northp, int prec, bool abbrev) const { real e, n; int z; UTMUPS::Transfer(_zone, _northp, _easting, _northing, _zone, northp, e, n, z); string utm; UTMUPSString(_zone, northp, e, n, prec, abbrev, utm); return utm; } string GeoCoords::AltUTMUPSRepresentation(int prec, bool abbrev) const { string utm; UTMUPSString(_alt_zone, _northp, _alt_easting, _alt_northing, prec, abbrev, utm); return utm; } string GeoCoords::AltUTMUPSRepresentation(bool northp, int prec, bool abbrev) const { real e, n; int z; UTMUPS::Transfer(_alt_zone, _northp, _alt_easting, _alt_northing, _alt_zone, northp, e, n, z); string utm; UTMUPSString(_alt_zone, northp, e, n, prec, abbrev, utm); return utm; } void GeoCoords::FixHemisphere() { using std::isnan; // Needed for Centos 7, ubuntu 14 if (_lat == 0 || (_northp && _lat >= 0) || (!_northp && _lat < 0) || 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.52/src/Geocentric.cpp0000644000771000077100000001525414064202371017401 0ustar ckarneyckarney/** * \file Geocentric.cpp * \brief Implementation for GeographicLib::Geocentric class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { using namespace std; Geocentric::Geocentric(real a, real f) : _a(a) , _f(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 (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_f) && _f < 1)) throw GeographicErr("Polar semi-axis is not positive"); } const Geocentric& Geocentric::WGS84() { static const Geocentric wgs84(Constants::WGS84_a(), Constants::WGS84_f()); return wgs84; } void Geocentric::IntForward(real lat, real lon, real h, real& X, real& Y, real& Z, real M[dim2_]) const { real sphi, cphi, slam, clam; Math::sincosd(Math::LatFix(lat), sphi, cphi); Math::sincosd(lon, slam, clam); real n = _a/sqrt(1 - _e2 * Math::sq(sphi)); 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 { real R = hypot(X, Y), slam = R != 0 ? Y / R : 0, clam = R != 0 ? X / R : 1; h = 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 = hypot(X/2, Y/2); slam = R != 0 ? (Y/2) / R : 0; clam = R != 0 ? (X/2) / R : 1; real H = 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 = 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 = 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 = hypot(Z/k1, R/k2); sphi = (Z/k1) / H; cphi = (R/k2) / H; h = (1 - _e2m/k1) * 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 = 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 = Math::atan2d(sphi, cphi); lon = Math::atan2d(slam, clam); if (M) Rotation(sphi, cphi, slam, clam, M); } void Geocentric::Rotation(real sphi, real cphi, real slam, real clam, real M[dim2_]) { // 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.52/src/Geodesic.cpp0000644000771000077100000022071314064202371017037 0ustar ckarneyckarney/** * \file Geodesic.cpp * \brief Implementation for GeographicLib::Geodesic class * * Copyright (c) Charles Karney (2009-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * 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 #if defined(_MSC_VER) // Squelch warnings about potentially uninitialized local variables and // constant conditional expressions # pragma warning (disable: 4701 4127) #endif namespace GeographicLib { using namespace std; Geodesic::Geodesic(real a, real f) : maxit2_(maxit1_ + Math::digits() + 10) // Underflow guard. We require // tiny_ * epsilon() > 0 // tiny_ + epsilon() == epsilon() , tiny_(sqrt(numeric_limits::min())) , 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) , tol1_(200 * tol0_) , tol2_(sqrt(tol0_)) , tolb_(tol0_ * tol2_) // Check on bisection interval , xthresh_(1000 * tol2_) , _a(a) , _f(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 : Math::eatanhe(real(1), (_f < 0 ? -1 : 1) * sqrt(abs(_e2))) / _e2)) / 2) // authalic radius squared // The sig12 threshold for "really short". Using the auxiliary sphere // solution with dnm computed at (bet1 + bet2) / 2, the relative error in // the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. // (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a // given f and sig12, the max error occurs for lines near the pole. If // the old rule for computing dnm = (dn1 + dn2)/2 is used, then the error // increases by a factor of 2.) Setting this equal to epsilon gives // sig12 = etol2. Here 0.1 is a safety factor (error decreased by 100) // and max(0.001, abs(f)) stops etol2 getting too large in the nearly // spherical case. , _etol2(real(0.1) * tol2_ / sqrt( max(real(0.001), abs(_f)) * min(real(1), 1 - _f/2) / 2 )) { if (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_b) && _b > 0)) throw GeographicErr("Polar semi-axis is not positive"); A3coeff(); C3coeff(); C4coeff(); } const Geodesic& Geodesic::WGS84() { static const Geodesic wgs84(Constants::WGS84_a(), Constants::WGS84_f()); return wgs84; } Math::real Geodesic::SinCosSeries(bool sinp, real sinx, real cosx, const real c[], int 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 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 { 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 { // Automatically supply DISTANCE_IN if necessary if (!arcmode) outmask |= DISTANCE_IN; return GeodesicLine(*this, lat1, lon1, azi1, outmask) . // Note the dot! GenPosition(arcmode, s12_a12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12); } GeodesicLine Geodesic::GenDirectLine(real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned caps) const { azi1 = Math::AngNormalize(azi1); real salp1, calp1; // Guard against underflow in salp0. Also -0 is converted to +0. Math::sincosd(Math::AngRound(azi1), salp1, calp1); // Automatically supply DISTANCE_IN if necessary if (!arcmode) caps |= DISTANCE_IN; return GeodesicLine(*this, lat1, lon1, azi1, salp1, calp1, caps, arcmode, s12_a12); } GeodesicLine Geodesic::DirectLine(real lat1, real lon1, real azi1, real s12, unsigned caps) const { return GenDirectLine(lat1, lon1, azi1, false, s12, caps); } GeodesicLine Geodesic::ArcDirectLine(real lat1, real lon1, real azi1, real a12, unsigned caps) const { return GenDirectLine(lat1, lon1, azi1, true, a12, caps); } Math::real Geodesic::GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real& s12, real& salp1, real& calp1, real& salp2, real& calp2, real& m12, real& M12, real& M21, real& S12) const { // Compute longitude difference (AngDiff does this carefully). Result is // in [-180, 180] but -180 is only for west-going geodesics. 180 is for // east-going and meridional geodesics. real lon12s, lon12 = Math::AngDiff(lon1, lon2, lon12s); // Make longitude difference positive. int lonsign = lon12 >= 0 ? 1 : -1; // If very close to being on the same half-meridian, then make it so. lon12 = lonsign * Math::AngRound(lon12); lon12s = Math::AngRound((180 - lon12) - lonsign * lon12s); real lam12 = lon12 * Math::degree(), slam12, clam12; if (lon12 > 90) { Math::sincosd(lon12s, slam12, clam12); clam12 = -clam12; } else Math::sincosd(lon12, slam12, clam12); // If really close to the equator, treat as on equator. lat1 = Math::AngRound(Math::LatFix(lat1)); lat2 = Math::AngRound(Math::LatFix(lat2)); // Swap points so that point with higher (abs) latitude is point 1. // If one latitude is a nan, then it becomes lat1. 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 sbet1, cbet1, sbet2, cbet2, s12x, m12x; Math::sincosd(lat1, sbet1, cbet1); sbet1 *= _f1; // Ensure cbet1 = +epsilon at poles; doing the fix on beta means that sig12 // will be <= 2*tiny for two points at the same pole. Math::norm(sbet1, cbet1); cbet1 = max(tiny_, cbet1); Math::sincosd(lat2, sbet2, cbet2); sbet2 *= _f1; // Ensure cbet2 = +epsilon at poles Math::norm(sbet2, cbet2); cbet2 = max(tiny_, 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 dn1 = sqrt(1 + _ep2 * Math::sq(sbet1)), dn2 = sqrt(1 + _ep2 * Math::sq(sbet2)); real a12, sig12; // index zero element of this array is unused real Ca[nC_]; 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(real(0), csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); { real dummy; Lengths(_n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | DISTANCE | REDUCEDLENGTH, s12x, m12x, dummy, M12, M21, Ca); } // Add the check for sig12 since zero length geodesics might yield m12 < // 0. Test case was // // echo 20.001 0 20.001 0 | GeodSolve -i // // In fact, we will have sig12 > pi/2 for meridional geodesic which is // not a shortest path. // TODO: investigate m12 < 0 result for aarch/ppc (with -f -p 20) // 20.001000000000001 0.000000000000000 180.000000000000000 // 20.001000000000001 0.000000000000000 180.000000000000000 // 0.0000000002 0.000000000000001 -0.0000000001 // 0.99999999999999989 0.99999999999999989 0.000 if (sig12 < 1 || m12x >= 0) { // Need at least 2, to handle 90 0 90 180 if (sig12 < 3 * tiny_ || // Prevent negative s12 or m12 for short lines (sig12 < tol0_ && (s12x < 0 || m12x < 0))) sig12 = m12x = s12x = 0; m12x *= _b; s12x *= _b; a12 = sig12 / Math::degree(); } else // m12 < 0, i.e., prolate and too close to anti-podal meridian = false; } // somg12 > 1 marks that it needs to be calculated real omg12 = 0, somg12 = 2, comg12 = 0; if (!meridian && sbet1 == 0 && // and sbet2 == 0 (_f <= 0 || lon12s >= _f * 180)) { // Geodesic runs along equator calp1 = calp2 = 0; salp1 = salp2 = 1; s12x = _a * lam12; sig12 = omg12 = lam12 / _f1; m12x = _b * sin(sig12); if (outmask & GEODESICSCALE) M12 = M21 = cos(sig12); a12 = lon12 / _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 real dnm; sig12 = InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, salp1, calp1, salp2, calp2, dnm, Ca); if (sig12 >= 0) { // Short lines (InverseStart sets salp2, calp2, dnm) s12x = sig12 * _b * dnm; m12x = Math::sq(dnm) * _b * sin(sig12 / dnm); if (outmask & GEODESICSCALE) M12 = M21 = cos(sig12 / dnm); a12 = sig12 / Math::degree(); omg12 = lam12 / (_f1 * dnm); } else { // Newton's method. This is a straightforward solution of f(alp1) = // lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one // root in the interval (0, pi) and its derivative is positive at the // root. Thus f(alp) is positive for alp > alp1 and negative for alp < // alp1. During the course of the iteration, a range (alp1a, alp1b) is // maintained which brackets the root and with each evaluation of // f(alp) the range is shrunk, if possible. Newton's method is // restarted whenever the derivative of f is negative (because the new // value of alp1 is then further from the solution) or if the new // estimate of alp1 lies outside (0,pi); in this case, the new starting // guess is taken to be (alp1a + alp1b) / 2. // // initial values to suppress warnings (if loop is executed 0 times) real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0, domg12 = 0; unsigned numit = 0; // Bracketing range real salp1a = tiny_, calp1a = 1, salp1b = tiny_, calp1b = -1; for (bool tripn = false, tripb = false; numit < maxit2_ || GEOGRAPHICLIB_PANIC; ++numit) { // the WGS84 test set: mean = 1.47, sd = 1.25, max = 16 // WGS84 and random input: mean = 2.85, sd = 0.60 real dv; real v = Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps, domg12, numit < maxit1_, dv, Ca); // Reversed test to allow escape with NaNs if (tripb || !(abs(v) >= (tripn ? 8 : 1) * tol0_)) break; // Update bracketing values if (v > 0 && (numit > maxit1_ || calp1/salp1 > calp1b/salp1b)) { salp1b = salp1; calp1b = calp1; } else if (v < 0 && (numit > maxit1_ || calp1/salp1 < calp1a/salp1a)) { salp1a = salp1; calp1a = calp1; } if (numit < maxit1_ && dv > 0) { real dalp1 = -v/dv; real sdalp1 = sin(dalp1), cdalp1 = cos(dalp1), nsalp1 = salp1 * cdalp1 + calp1 * sdalp1; if (nsalp1 > 0 && abs(dalp1) < Math::pi()) { calp1 = calp1 * cdalp1 - salp1 * sdalp1; salp1 = nsalp1; Math::norm(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). tripn = abs(v) <= 16 * tol0_; continue; } } // Either dv was not positive or updated value was outside legal // range. Use the midpoint of the bracket as the next estimate. // This mechanism is not needed for the WGS84 ellipsoid, but it does // catch problems with more eccentric ellipsoids. Its efficacy is // such for the WGS84 test set with the starting guess set to alp1 = // 90deg: // the WGS84 test set: mean = 5.21, sd = 3.93, max = 24 // WGS84 and random input: mean = 4.74, sd = 0.99 salp1 = (salp1a + salp1b)/2; calp1 = (calp1a + calp1b)/2; Math::norm(salp1, calp1); tripn = false; tripb = (abs(salp1a - salp1) + (calp1a - calp1) < tolb_ || abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_); } { real dummy; // Ensure that the reduced length and geodesic scale are computed in // a "canonical" way, with the I2 integral. unsigned lengthmask = outmask | (outmask & (REDUCEDLENGTH | GEODESICSCALE) ? DISTANCE : NONE); Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, lengthmask, s12x, m12x, dummy, M12, M21, Ca); } m12x *= _b; s12x *= _b; a12 = sig12 / Math::degree(); if (outmask & AREA) { // omg12 = lam12 - domg12 real sdomg12 = sin(domg12), cdomg12 = cos(domg12); somg12 = slam12 * cdomg12 - clam12 * sdomg12; comg12 = clam12 * cdomg12 + slam12 * sdomg12; } } } 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 = 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, eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2), // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = Math::sq(_a) * calp0 * salp0 * _e2; Math::norm(ssig1, csig1); Math::norm(ssig2, csig2); C4f(eps, Ca); real B41 = SinCosSeries(false, ssig1, csig1, Ca, nC4_), B42 = SinCosSeries(false, ssig2, csig2, Ca, nC4_); S12 = A4 * (B42 - B41); } else // Avoid problems with indeterminate sig1, sig2 on equator S12 = 0; if (!meridian && somg12 > 1) { somg12 = sin(omg12); comg12 = cos(omg12); } if (!meridian && // omg12 < 3/4 * pi comg12 > -real(0.7071) && // Long difference not too big sbet2 - sbet1 < real(1.75)) { // Lat difference not 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 domg12 = 1 + comg12, 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; // Returned value in [0, 180] return a12; } 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 { outmask &= OUT_MASK; real salp1, calp1, salp2, calp2, a12 = GenInverse(lat1, lon1, lat2, lon2, outmask, s12, salp1, calp1, salp2, calp2, m12, M12, M21, S12); if (outmask & AZIMUTH) { azi1 = Math::atan2d(salp1, calp1); azi2 = Math::atan2d(salp2, calp2); } return a12; } GeodesicLine Geodesic::InverseLine(real lat1, real lon1, real lat2, real lon2, unsigned caps) const { real t, salp1, calp1, salp2, calp2, a12 = GenInverse(lat1, lon1, lat2, lon2, // No need to specify AZIMUTH here 0u, t, salp1, calp1, salp2, calp2, t, t, t, t), azi1 = Math::atan2d(salp1, calp1); // Ensure that a12 can be converted to a distance if (caps & (OUT_MASK & DISTANCE_IN)) caps |= DISTANCE; return GeodesicLine(*this, lat1, lon1, azi1, salp1, calp1, caps, true, a12); } void Geodesic::Lengths(real eps, real sig12, real ssig1, real csig1, real dn1, real ssig2, real csig2, real dn2, real cbet1, real cbet2, unsigned outmask, real& s12b, real& m12b, real& m0, real& M12, real& M21, // Scratch area of the right size real Ca[]) const { // Return m12b = (reduced length)/_b; also calculate s12b = distance/_b, // and m0 = coefficient of secular term in expression for reduced length. outmask &= OUT_MASK; // outmask & DISTANCE: set s12b // outmask & REDUCEDLENGTH: set m12b & m0 // outmask & GEODESICSCALE: set M12 & M21 real m0x = 0, J12 = 0, A1 = 0, A2 = 0; real Cb[nC2_ + 1]; if (outmask & (DISTANCE | REDUCEDLENGTH | GEODESICSCALE)) { A1 = A1m1f(eps); C1f(eps, Ca); if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) { A2 = A2m1f(eps); C2f(eps, Cb); m0x = A1 - A2; A2 = 1 + A2; } A1 = 1 + A1; } if (outmask & DISTANCE) { real B1 = SinCosSeries(true, ssig2, csig2, Ca, nC1_) - SinCosSeries(true, ssig1, csig1, Ca, nC1_); // Missing a factor of _b s12b = A1 * (sig12 + B1); if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) { real B2 = SinCosSeries(true, ssig2, csig2, Cb, nC2_) - SinCosSeries(true, ssig1, csig1, Cb, nC2_); J12 = m0x * sig12 + (A1 * B1 - A2 * B2); } } else if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) { // Assume here that nC1_ >= nC2_ for (int l = 1; l <= nC2_; ++l) Cb[l] = A1 * Ca[l] - A2 * Cb[l]; J12 = m0x * sig12 + (SinCosSeries(true, ssig2, csig2, Cb, nC2_) - SinCosSeries(true, ssig1, csig1, Cb, nC2_)); } if (outmask & REDUCEDLENGTH) { m0 = m0x; // Missing a factor of _b. // Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure // accurate cancellation in the case of coincident points. m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12; } if (outmask & GEODESICSCALE) { real csig12 = csig1 * csig2 + ssig1 * ssig2; real t = _ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2); M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1; M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2; } } Math::real Geodesic::Astroid(real x, real 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. 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 discriminant 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 = 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 dn1, real sbet2, real cbet2, real dn2, real lam12, real slam12, real clam12, real& salp1, real& calp1, // Only updated if return val >= 0 real& salp2, real& calp2, // Only updated for short lines real& dnm, // Scratch area of the right size real Ca[]) const { // 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; real sbet12a = sbet2 * cbet1 + cbet2 * sbet1; bool shortline = cbet12 >= 0 && sbet12 < real(0.5) && cbet2 * lam12 < real(0.5); real somg12, comg12; if (shortline) { real sbetm2 = Math::sq(sbet1 + sbet2); // sin((bet1+bet2)/2)^2 // = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) sbetm2 /= sbetm2 + Math::sq(cbet1 + cbet2); dnm = sqrt(1 + _ep2 * sbetm2); real omg12 = lam12 / (_f1 * dnm); somg12 = sin(omg12); comg12 = cos(omg12); } else { somg12 = slam12; comg12 = clam12; } salp1 = cbet2 * somg12; calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * Math::sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * Math::sq(somg12) / (1 - comg12); real ssig12 = hypot(salp1, calp1), csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12; if (shortline && ssig12 < _etol2) { // really short lines salp2 = cbet1 * somg12; calp2 = sbet12 - cbet1 * sbet2 * (comg12 >= 0 ? Math::sq(somg12) / (1 + comg12) : 1 - comg12); Math::norm(salp2, calp2); // Set return value sig12 = atan2(ssig12, csig12); } else if (abs(_n) > real(0.1) || // Skip astroid calc if too eccentric csig12 >= 0 || ssig12 >= 6 * abs(_n) * 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 GEOGRAPHICLIB_VOLATILE real x; real lam12x = atan2(-slam12, -clam12); // lam12 - pi 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 = lam12x / lamscale; y = sbet12a / betscale; } else { // _f < 0 // x = dlat, y = dlong real cbet12a = cbet2 * cbet1 - sbet2 * sbet1, bet12a = atan2(sbet12a, cbet12a); real m12b, m0, dummy; // In the case of lon12 = 180, this repeats a calculation made in // Inverse. Lengths(_n, Math::pi() + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, REDUCEDLENGTH, dummy, m12b, m0, dummy, dummy, Ca); x = -1 + m12b / (cbet1 * cbet2 * m0 * Math::pi()); betscale = x < -real(0.01) ? sbet12a / x : -_f * Math::sq(cbet1) * Math::pi(); lamscale = betscale / cbet1; y = lam12x / lamscale; } if (y > -tol1_ && x > -1 - xthresh_) { // strip near cut // Need real(x) here to cast away the volatility of x for min/max 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); } } // Sanity check on starting guess. Backwards check allows NaN through. if (!(salp1 <= 0)) Math::norm(salp1, calp1); else { salp1 = 1; calp1 = 0; } return sig12; } Math::real Geodesic::Lambda12(real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real salp1, real calp1, real slam120, real clam120, real& salp2, real& calp2, real& sig12, real& ssig1, real& csig1, real& ssig2, real& csig2, real& eps, real& domg12, bool diffp, real& dlam12, // Scratch area of the right size real Ca[]) const { 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 = hypot(calp1, salp1 * sbet1); // calp0 > 0 real somg1, comg1, somg2, comg2, somg12, comg12, 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; Math::norm(ssig1, csig1); // Math::norm(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; Math::norm(ssig2, csig2); // Math::norm(somg2, comg2); -- don't need to normalize! // sig12 = sig2 - sig1, limit to [0, pi] sig12 = atan2(max(real(0), csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); // omg12 = omg2 - omg1, limit to [0, pi] somg12 = max(real(0), comg1 * somg2 - somg1 * comg2); comg12 = comg1 * comg2 + somg1 * somg2; // eta = omg12 - lam120 real eta = atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120); real B312; real k2 = Math::sq(calp0) * _ep2; eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2); C3f(eps, Ca); B312 = (SinCosSeries(true, ssig2, csig2, Ca, nC3_-1) - SinCosSeries(true, ssig1, csig1, Ca, nC3_-1)); domg12 = -_f * A3f(eps) * salp0 * (sig12 + B312); lam12 = eta + domg12; if (diffp) { if (calp2 == 0) dlam12 = - 2 * _f1 * dn1 / sbet1; else { real dummy; Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, REDUCEDLENGTH, dummy, dlam12, dummy, dummy, dummy, Ca); dlam12 *= _f1 / (calp2 * cbet2); } } return lam12; } Math::real Geodesic::A3f(real eps) const { // Evaluate A3 return Math::polyval(nA3_ - 1, _A3x, eps); } void Geodesic::C3f(real eps, real c[]) const { // Evaluate C3 coeffs // Elements c[1] thru c[nC3_ - 1] are set real mult = 1; int o = 0; for (int l = 1; l < nC3_; ++l) { // l is index of C3[l] int m = nC3_ - l - 1; // order of polynomial in eps mult *= eps; c[l] = mult * Math::polyval(m, _C3x + o, eps); o += m + 1; } // Post condition: o == nC3x_ } void Geodesic::C4f(real eps, real c[]) const { // Evaluate C4 coeffs // Elements c[0] thru c[nC4_ - 1] are set real mult = 1; int o = 0; for (int l = 0; l < nC4_; ++l) { // l is index of C4[l] int m = nC4_ - l - 1; // order of polynomial in eps c[l] = mult * Math::polyval(m, _C4x + o, eps); o += m + 1; mult *= eps; } // Post condition: o == nC4x_ } // The static const coefficient arrays in the following functions are // generated by Maxima and give the coefficients of the Taylor expansions for // the geodesics. The convention on the order of these coefficients is as // follows: // // ascending order in the trigonometric expansion, // then powers of eps in descending order, // finally powers of n in descending order. // // (For some expansions, only a subset of levels occur.) For each polynomial // of order n at the lowest level, the (n+1) coefficients of the polynomial // are followed by a divisor which is applied to the whole polynomial. In // this way, the coefficients are expressible with no round off error. The // sizes of the coefficient arrays are: // // A1m1f, A2m1f = floor(N/2) + 2 // C1f, C1pf, C2f, A3coeff = (N^2 + 7*N - 2*floor(N/2)) / 4 // C3coeff = (N - 1) * (N^2 + 7*N - 2*floor(N/2)) / 8 // C4coeff = N * (N + 1) * (N + 5) / 6 // // where N = GEOGRAPHICLIB_GEODESIC_ORDER // = nA1 = nA2 = nC1 = nC1p = nA3 = nC4 // The scale factor A1-1 = mean value of (d/dsigma)I1 - 1 Math::real Geodesic::A1m1f(real eps) { // Generated by Maxima on 2015-05-05 18:08:12-04:00 #if GEOGRAPHICLIB_GEODESIC_ORDER/2 == 1 static const real coeff[] = { // (1-eps)*A1-1, polynomial in eps2 of order 1 1, 0, 4, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 2 static const real coeff[] = { // (1-eps)*A1-1, polynomial in eps2 of order 2 1, 16, 0, 64, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 3 static const real coeff[] = { // (1-eps)*A1-1, polynomial in eps2 of order 3 1, 4, 64, 0, 256, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 4 static const real coeff[] = { // (1-eps)*A1-1, polynomial in eps2 of order 4 25, 64, 256, 4096, 0, 16384, }; #else #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == nA1_/2 + 2, "Coefficient array size mismatch in A1m1f"); int m = nA1_/2; real t = Math::polyval(m, coeff, Math::sq(eps)) / coeff[m + 1]; return (t + eps) / (1 - eps); } // The coefficients C1[l] in the Fourier expansion of B1 void Geodesic::C1f(real eps, real c[]) { // Generated by Maxima on 2015-05-05 18:08:12-04:00 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3 static const real coeff[] = { // C1[1]/eps^1, polynomial in eps2 of order 1 3, -8, 16, // C1[2]/eps^2, polynomial in eps2 of order 0 -1, 16, // C1[3]/eps^3, polynomial in eps2 of order 0 -1, 48, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4 static const real coeff[] = { // C1[1]/eps^1, polynomial in eps2 of order 1 3, -8, 16, // C1[2]/eps^2, polynomial in eps2 of order 1 1, -2, 32, // C1[3]/eps^3, polynomial in eps2 of order 0 -1, 48, // C1[4]/eps^4, polynomial in eps2 of order 0 -5, 512, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5 static const real coeff[] = { // C1[1]/eps^1, polynomial in eps2 of order 2 -1, 6, -16, 32, // C1[2]/eps^2, polynomial in eps2 of order 1 1, -2, 32, // C1[3]/eps^3, polynomial in eps2 of order 1 9, -16, 768, // C1[4]/eps^4, polynomial in eps2 of order 0 -5, 512, // C1[5]/eps^5, polynomial in eps2 of order 0 -7, 1280, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6 static const real coeff[] = { // C1[1]/eps^1, polynomial in eps2 of order 2 -1, 6, -16, 32, // C1[2]/eps^2, polynomial in eps2 of order 2 -9, 64, -128, 2048, // C1[3]/eps^3, polynomial in eps2 of order 1 9, -16, 768, // C1[4]/eps^4, polynomial in eps2 of order 1 3, -5, 512, // C1[5]/eps^5, polynomial in eps2 of order 0 -7, 1280, // C1[6]/eps^6, polynomial in eps2 of order 0 -7, 2048, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7 static const real coeff[] = { // C1[1]/eps^1, polynomial in eps2 of order 3 19, -64, 384, -1024, 2048, // C1[2]/eps^2, polynomial in eps2 of order 2 -9, 64, -128, 2048, // C1[3]/eps^3, polynomial in eps2 of order 2 -9, 72, -128, 6144, // C1[4]/eps^4, polynomial in eps2 of order 1 3, -5, 512, // C1[5]/eps^5, polynomial in eps2 of order 1 35, -56, 10240, // C1[6]/eps^6, polynomial in eps2 of order 0 -7, 2048, // C1[7]/eps^7, polynomial in eps2 of order 0 -33, 14336, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8 static const real coeff[] = { // C1[1]/eps^1, polynomial in eps2 of order 3 19, -64, 384, -1024, 2048, // C1[2]/eps^2, polynomial in eps2 of order 3 7, -18, 128, -256, 4096, // C1[3]/eps^3, polynomial in eps2 of order 2 -9, 72, -128, 6144, // C1[4]/eps^4, polynomial in eps2 of order 2 -11, 96, -160, 16384, // C1[5]/eps^5, polynomial in eps2 of order 1 35, -56, 10240, // C1[6]/eps^6, polynomial in eps2 of order 1 9, -14, 4096, // C1[7]/eps^7, polynomial in eps2 of order 0 -33, 14336, // C1[8]/eps^8, polynomial in eps2 of order 0 -429, 262144, }; #else #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == (nC1_*nC1_ + 7*nC1_ - 2*(nC1_/2)) / 4, "Coefficient array size mismatch in C1f"); real eps2 = Math::sq(eps), d = eps; int o = 0; for (int l = 1; l <= nC1_; ++l) { // l is index of C1p[l] int m = (nC1_ - l) / 2; // order of polynomial in eps^2 c[l] = d * Math::polyval(m, coeff + o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } // Post condition: o == sizeof(coeff) / sizeof(real) } // The coefficients C1p[l] in the Fourier expansion of B1p void Geodesic::C1pf(real eps, real c[]) { // Generated by Maxima on 2015-05-05 18:08:12-04:00 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3 static const real coeff[] = { // C1p[1]/eps^1, polynomial in eps2 of order 1 -9, 16, 32, // C1p[2]/eps^2, polynomial in eps2 of order 0 5, 16, // C1p[3]/eps^3, polynomial in eps2 of order 0 29, 96, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4 static const real coeff[] = { // C1p[1]/eps^1, polynomial in eps2 of order 1 -9, 16, 32, // C1p[2]/eps^2, polynomial in eps2 of order 1 -37, 30, 96, // C1p[3]/eps^3, polynomial in eps2 of order 0 29, 96, // C1p[4]/eps^4, polynomial in eps2 of order 0 539, 1536, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5 static const real coeff[] = { // C1p[1]/eps^1, polynomial in eps2 of order 2 205, -432, 768, 1536, // C1p[2]/eps^2, polynomial in eps2 of order 1 -37, 30, 96, // C1p[3]/eps^3, polynomial in eps2 of order 1 -225, 116, 384, // C1p[4]/eps^4, polynomial in eps2 of order 0 539, 1536, // C1p[5]/eps^5, polynomial in eps2 of order 0 3467, 7680, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6 static const real coeff[] = { // C1p[1]/eps^1, polynomial in eps2 of order 2 205, -432, 768, 1536, // C1p[2]/eps^2, polynomial in eps2 of order 2 4005, -4736, 3840, 12288, // C1p[3]/eps^3, polynomial in eps2 of order 1 -225, 116, 384, // C1p[4]/eps^4, polynomial in eps2 of order 1 -7173, 2695, 7680, // C1p[5]/eps^5, polynomial in eps2 of order 0 3467, 7680, // C1p[6]/eps^6, polynomial in eps2 of order 0 38081, 61440, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7 static const real coeff[] = { // C1p[1]/eps^1, polynomial in eps2 of order 3 -4879, 9840, -20736, 36864, 73728, // C1p[2]/eps^2, polynomial in eps2 of order 2 4005, -4736, 3840, 12288, // C1p[3]/eps^3, polynomial in eps2 of order 2 8703, -7200, 3712, 12288, // C1p[4]/eps^4, polynomial in eps2 of order 1 -7173, 2695, 7680, // C1p[5]/eps^5, polynomial in eps2 of order 1 -141115, 41604, 92160, // C1p[6]/eps^6, polynomial in eps2 of order 0 38081, 61440, // C1p[7]/eps^7, polynomial in eps2 of order 0 459485, 516096, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8 static const real coeff[] = { // C1p[1]/eps^1, polynomial in eps2 of order 3 -4879, 9840, -20736, 36864, 73728, // C1p[2]/eps^2, polynomial in eps2 of order 3 -86171, 120150, -142080, 115200, 368640, // C1p[3]/eps^3, polynomial in eps2 of order 2 8703, -7200, 3712, 12288, // C1p[4]/eps^4, polynomial in eps2 of order 2 1082857, -688608, 258720, 737280, // C1p[5]/eps^5, polynomial in eps2 of order 1 -141115, 41604, 92160, // C1p[6]/eps^6, polynomial in eps2 of order 1 -2200311, 533134, 860160, // C1p[7]/eps^7, polynomial in eps2 of order 0 459485, 516096, // C1p[8]/eps^8, polynomial in eps2 of order 0 109167851, 82575360, }; #else #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == (nC1p_*nC1p_ + 7*nC1p_ - 2*(nC1p_/2)) / 4, "Coefficient array size mismatch in C1pf"); real eps2 = Math::sq(eps), d = eps; int o = 0; for (int l = 1; l <= nC1p_; ++l) { // l is index of C1p[l] int m = (nC1p_ - l) / 2; // order of polynomial in eps^2 c[l] = d * Math::polyval(m, coeff + o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } // Post condition: o == sizeof(coeff) / sizeof(real) } // The scale factor A2-1 = mean value of (d/dsigma)I2 - 1 Math::real Geodesic::A2m1f(real eps) { // Generated by Maxima on 2015-05-29 08:09:47-04:00 #if GEOGRAPHICLIB_GEODESIC_ORDER/2 == 1 static const real coeff[] = { // (eps+1)*A2-1, polynomial in eps2 of order 1 -3, 0, 4, }; // count = 3 #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 2 static const real coeff[] = { // (eps+1)*A2-1, polynomial in eps2 of order 2 -7, -48, 0, 64, }; // count = 4 #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 3 static const real coeff[] = { // (eps+1)*A2-1, polynomial in eps2 of order 3 -11, -28, -192, 0, 256, }; // count = 5 #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 4 static const real coeff[] = { // (eps+1)*A2-1, polynomial in eps2 of order 4 -375, -704, -1792, -12288, 0, 16384, }; // count = 6 #else #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == nA2_/2 + 2, "Coefficient array size mismatch in A2m1f"); int m = nA2_/2; real t = Math::polyval(m, coeff, Math::sq(eps)) / coeff[m + 1]; return (t - eps) / (1 + eps); } // The coefficients C2[l] in the Fourier expansion of B2 void Geodesic::C2f(real eps, real c[]) { // Generated by Maxima on 2015-05-05 18:08:12-04:00 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3 static const real coeff[] = { // C2[1]/eps^1, polynomial in eps2 of order 1 1, 8, 16, // C2[2]/eps^2, polynomial in eps2 of order 0 3, 16, // C2[3]/eps^3, polynomial in eps2 of order 0 5, 48, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4 static const real coeff[] = { // C2[1]/eps^1, polynomial in eps2 of order 1 1, 8, 16, // C2[2]/eps^2, polynomial in eps2 of order 1 1, 6, 32, // C2[3]/eps^3, polynomial in eps2 of order 0 5, 48, // C2[4]/eps^4, polynomial in eps2 of order 0 35, 512, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5 static const real coeff[] = { // C2[1]/eps^1, polynomial in eps2 of order 2 1, 2, 16, 32, // C2[2]/eps^2, polynomial in eps2 of order 1 1, 6, 32, // C2[3]/eps^3, polynomial in eps2 of order 1 15, 80, 768, // C2[4]/eps^4, polynomial in eps2 of order 0 35, 512, // C2[5]/eps^5, polynomial in eps2 of order 0 63, 1280, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6 static const real coeff[] = { // C2[1]/eps^1, polynomial in eps2 of order 2 1, 2, 16, 32, // C2[2]/eps^2, polynomial in eps2 of order 2 35, 64, 384, 2048, // C2[3]/eps^3, polynomial in eps2 of order 1 15, 80, 768, // C2[4]/eps^4, polynomial in eps2 of order 1 7, 35, 512, // C2[5]/eps^5, polynomial in eps2 of order 0 63, 1280, // C2[6]/eps^6, polynomial in eps2 of order 0 77, 2048, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7 static const real coeff[] = { // C2[1]/eps^1, polynomial in eps2 of order 3 41, 64, 128, 1024, 2048, // C2[2]/eps^2, polynomial in eps2 of order 2 35, 64, 384, 2048, // C2[3]/eps^3, polynomial in eps2 of order 2 69, 120, 640, 6144, // C2[4]/eps^4, polynomial in eps2 of order 1 7, 35, 512, // C2[5]/eps^5, polynomial in eps2 of order 1 105, 504, 10240, // C2[6]/eps^6, polynomial in eps2 of order 0 77, 2048, // C2[7]/eps^7, polynomial in eps2 of order 0 429, 14336, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8 static const real coeff[] = { // C2[1]/eps^1, polynomial in eps2 of order 3 41, 64, 128, 1024, 2048, // C2[2]/eps^2, polynomial in eps2 of order 3 47, 70, 128, 768, 4096, // C2[3]/eps^3, polynomial in eps2 of order 2 69, 120, 640, 6144, // C2[4]/eps^4, polynomial in eps2 of order 2 133, 224, 1120, 16384, // C2[5]/eps^5, polynomial in eps2 of order 1 105, 504, 10240, // C2[6]/eps^6, polynomial in eps2 of order 1 33, 154, 4096, // C2[7]/eps^7, polynomial in eps2 of order 0 429, 14336, // C2[8]/eps^8, polynomial in eps2 of order 0 6435, 262144, }; #else #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == (nC2_*nC2_ + 7*nC2_ - 2*(nC2_/2)) / 4, "Coefficient array size mismatch in C2f"); real eps2 = Math::sq(eps), d = eps; int o = 0; for (int l = 1; l <= nC2_; ++l) { // l is index of C2[l] int m = (nC2_ - l) / 2; // order of polynomial in eps^2 c[l] = d * Math::polyval(m, coeff + o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } // Post condition: o == sizeof(coeff) / sizeof(real) } // The scale factor A3 = mean value of (d/dsigma)I3 void Geodesic::A3coeff() { // Generated by Maxima on 2015-05-05 18:08:13-04:00 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3 static const real coeff[] = { // A3, coeff of eps^2, polynomial in n of order 0 -1, 4, // A3, coeff of eps^1, polynomial in n of order 1 1, -1, 2, // A3, coeff of eps^0, polynomial in n of order 0 1, 1, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4 static const real coeff[] = { // A3, coeff of eps^3, polynomial in n of order 0 -1, 16, // A3, coeff of eps^2, polynomial in n of order 1 -1, -2, 8, // A3, coeff of eps^1, polynomial in n of order 1 1, -1, 2, // A3, coeff of eps^0, polynomial in n of order 0 1, 1, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5 static const real coeff[] = { // A3, coeff of eps^4, polynomial in n of order 0 -3, 64, // A3, coeff of eps^3, polynomial in n of order 1 -3, -1, 16, // A3, coeff of eps^2, polynomial in n of order 2 3, -1, -2, 8, // A3, coeff of eps^1, polynomial in n of order 1 1, -1, 2, // A3, coeff of eps^0, polynomial in n of order 0 1, 1, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6 static const real coeff[] = { // A3, coeff of eps^5, polynomial in n of order 0 -3, 128, // A3, coeff of eps^4, polynomial in n of order 1 -2, -3, 64, // A3, coeff of eps^3, polynomial in n of order 2 -1, -3, -1, 16, // A3, coeff of eps^2, polynomial in n of order 2 3, -1, -2, 8, // A3, coeff of eps^1, polynomial in n of order 1 1, -1, 2, // A3, coeff of eps^0, polynomial in n of order 0 1, 1, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7 static const real coeff[] = { // A3, coeff of eps^6, polynomial in n of order 0 -5, 256, // A3, coeff of eps^5, polynomial in n of order 1 -5, -3, 128, // A3, coeff of eps^4, polynomial in n of order 2 -10, -2, -3, 64, // A3, coeff of eps^3, polynomial in n of order 3 5, -1, -3, -1, 16, // A3, coeff of eps^2, polynomial in n of order 2 3, -1, -2, 8, // A3, coeff of eps^1, polynomial in n of order 1 1, -1, 2, // A3, coeff of eps^0, polynomial in n of order 0 1, 1, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8 static const real coeff[] = { // A3, coeff of eps^7, polynomial in n of order 0 -25, 2048, // A3, coeff of eps^6, polynomial in n of order 1 -15, -20, 1024, // A3, coeff of eps^5, polynomial in n of order 2 -5, -10, -6, 256, // A3, coeff of eps^4, polynomial in n of order 3 -5, -20, -4, -6, 128, // A3, coeff of eps^3, polynomial in n of order 3 5, -1, -3, -1, 16, // A3, coeff of eps^2, polynomial in n of order 2 3, -1, -2, 8, // A3, coeff of eps^1, polynomial in n of order 1 1, -1, 2, // A3, coeff of eps^0, polynomial in n of order 0 1, 1, }; #else #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == (nA3_*nA3_ + 7*nA3_ - 2*(nA3_/2)) / 4, "Coefficient array size mismatch in A3f"); int o = 0, k = 0; for (int j = nA3_ - 1; j >= 0; --j) { // coeff of eps^j int m = min(nA3_ - j - 1, j); // order of polynomial in n _A3x[k++] = Math::polyval(m, coeff + o, _n) / coeff[o + m + 1]; o += m + 2; } // Post condition: o == sizeof(coeff) / sizeof(real) && k == nA3x_ } // The coefficients C3[l] in the Fourier expansion of B3 void Geodesic::C3coeff() { // Generated by Maxima on 2015-05-05 18:08:13-04:00 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3 static const real coeff[] = { // C3[1], coeff of eps^2, polynomial in n of order 0 1, 8, // C3[1], coeff of eps^1, polynomial in n of order 1 -1, 1, 4, // C3[2], coeff of eps^2, polynomial in n of order 0 1, 16, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4 static const real coeff[] = { // C3[1], coeff of eps^3, polynomial in n of order 0 3, 64, // C3[1], coeff of eps^2, polynomial in n of order 1 // This is a case where a leading 0 term has been inserted to maintain the // pattern in the orders of the polynomials. 0, 1, 8, // C3[1], coeff of eps^1, polynomial in n of order 1 -1, 1, 4, // C3[2], coeff of eps^3, polynomial in n of order 0 3, 64, // C3[2], coeff of eps^2, polynomial in n of order 1 -3, 2, 32, // C3[3], coeff of eps^3, polynomial in n of order 0 5, 192, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5 static const real coeff[] = { // C3[1], coeff of eps^4, polynomial in n of order 0 5, 128, // C3[1], coeff of eps^3, polynomial in n of order 1 3, 3, 64, // C3[1], coeff of eps^2, polynomial in n of order 2 -1, 0, 1, 8, // C3[1], coeff of eps^1, polynomial in n of order 1 -1, 1, 4, // C3[2], coeff of eps^4, polynomial in n of order 0 3, 128, // C3[2], coeff of eps^3, polynomial in n of order 1 -2, 3, 64, // C3[2], coeff of eps^2, polynomial in n of order 2 1, -3, 2, 32, // C3[3], coeff of eps^4, polynomial in n of order 0 3, 128, // C3[3], coeff of eps^3, polynomial in n of order 1 -9, 5, 192, // C3[4], coeff of eps^4, polynomial in n of order 0 7, 512, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6 static const real coeff[] = { // C3[1], coeff of eps^5, polynomial in n of order 0 3, 128, // C3[1], coeff of eps^4, polynomial in n of order 1 2, 5, 128, // C3[1], coeff of eps^3, polynomial in n of order 2 -1, 3, 3, 64, // C3[1], coeff of eps^2, polynomial in n of order 2 -1, 0, 1, 8, // C3[1], coeff of eps^1, polynomial in n of order 1 -1, 1, 4, // C3[2], coeff of eps^5, polynomial in n of order 0 5, 256, // C3[2], coeff of eps^4, polynomial in n of order 1 1, 3, 128, // C3[2], coeff of eps^3, polynomial in n of order 2 -3, -2, 3, 64, // C3[2], coeff of eps^2, polynomial in n of order 2 1, -3, 2, 32, // C3[3], coeff of eps^5, polynomial in n of order 0 7, 512, // C3[3], coeff of eps^4, polynomial in n of order 1 -10, 9, 384, // C3[3], coeff of eps^3, polynomial in n of order 2 5, -9, 5, 192, // C3[4], coeff of eps^5, polynomial in n of order 0 7, 512, // C3[4], coeff of eps^4, polynomial in n of order 1 -14, 7, 512, // C3[5], coeff of eps^5, polynomial in n of order 0 21, 2560, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7 static const real coeff[] = { // C3[1], coeff of eps^6, polynomial in n of order 0 21, 1024, // C3[1], coeff of eps^5, polynomial in n of order 1 11, 12, 512, // C3[1], coeff of eps^4, polynomial in n of order 2 2, 2, 5, 128, // C3[1], coeff of eps^3, polynomial in n of order 3 -5, -1, 3, 3, 64, // C3[1], coeff of eps^2, polynomial in n of order 2 -1, 0, 1, 8, // C3[1], coeff of eps^1, polynomial in n of order 1 -1, 1, 4, // C3[2], coeff of eps^6, polynomial in n of order 0 27, 2048, // C3[2], coeff of eps^5, polynomial in n of order 1 1, 5, 256, // C3[2], coeff of eps^4, polynomial in n of order 2 -9, 2, 6, 256, // C3[2], coeff of eps^3, polynomial in n of order 3 2, -3, -2, 3, 64, // C3[2], coeff of eps^2, polynomial in n of order 2 1, -3, 2, 32, // C3[3], coeff of eps^6, polynomial in n of order 0 3, 256, // C3[3], coeff of eps^5, polynomial in n of order 1 -4, 21, 1536, // C3[3], coeff of eps^4, polynomial in n of order 2 -6, -10, 9, 384, // C3[3], coeff of eps^3, polynomial in n of order 3 -1, 5, -9, 5, 192, // C3[4], coeff of eps^6, polynomial in n of order 0 9, 1024, // C3[4], coeff of eps^5, polynomial in n of order 1 -10, 7, 512, // C3[4], coeff of eps^4, polynomial in n of order 2 10, -14, 7, 512, // C3[5], coeff of eps^6, polynomial in n of order 0 9, 1024, // C3[5], coeff of eps^5, polynomial in n of order 1 -45, 21, 2560, // C3[6], coeff of eps^6, polynomial in n of order 0 11, 2048, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8 static const real coeff[] = { // C3[1], coeff of eps^7, polynomial in n of order 0 243, 16384, // C3[1], coeff of eps^6, polynomial in n of order 1 10, 21, 1024, // C3[1], coeff of eps^5, polynomial in n of order 2 3, 11, 12, 512, // C3[1], coeff of eps^4, polynomial in n of order 3 -2, 2, 2, 5, 128, // C3[1], coeff of eps^3, polynomial in n of order 3 -5, -1, 3, 3, 64, // C3[1], coeff of eps^2, polynomial in n of order 2 -1, 0, 1, 8, // C3[1], coeff of eps^1, polynomial in n of order 1 -1, 1, 4, // C3[2], coeff of eps^7, polynomial in n of order 0 187, 16384, // C3[2], coeff of eps^6, polynomial in n of order 1 69, 108, 8192, // C3[2], coeff of eps^5, polynomial in n of order 2 -2, 1, 5, 256, // C3[2], coeff of eps^4, polynomial in n of order 3 -6, -9, 2, 6, 256, // C3[2], coeff of eps^3, polynomial in n of order 3 2, -3, -2, 3, 64, // C3[2], coeff of eps^2, polynomial in n of order 2 1, -3, 2, 32, // C3[3], coeff of eps^7, polynomial in n of order 0 139, 16384, // C3[3], coeff of eps^6, polynomial in n of order 1 -1, 12, 1024, // C3[3], coeff of eps^5, polynomial in n of order 2 -77, -8, 42, 3072, // C3[3], coeff of eps^4, polynomial in n of order 3 10, -6, -10, 9, 384, // C3[3], coeff of eps^3, polynomial in n of order 3 -1, 5, -9, 5, 192, // C3[4], coeff of eps^7, polynomial in n of order 0 127, 16384, // C3[4], coeff of eps^6, polynomial in n of order 1 -43, 72, 8192, // C3[4], coeff of eps^5, polynomial in n of order 2 -7, -40, 28, 2048, // C3[4], coeff of eps^4, polynomial in n of order 3 -7, 20, -28, 14, 1024, // C3[5], coeff of eps^7, polynomial in n of order 0 99, 16384, // C3[5], coeff of eps^6, polynomial in n of order 1 -15, 9, 1024, // C3[5], coeff of eps^5, polynomial in n of order 2 75, -90, 42, 5120, // C3[6], coeff of eps^7, polynomial in n of order 0 99, 16384, // C3[6], coeff of eps^6, polynomial in n of order 1 -99, 44, 8192, // C3[7], coeff of eps^7, polynomial in n of order 0 429, 114688, }; #else #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == ((nC3_-1)*(nC3_*nC3_ + 7*nC3_ - 2*(nC3_/2)))/8, "Coefficient array size mismatch in C3coeff"); int o = 0, k = 0; for (int l = 1; l < nC3_; ++l) { // l is index of C3[l] for (int j = nC3_ - 1; j >= l; --j) { // coeff of eps^j int m = min(nC3_ - j - 1, j); // order of polynomial in n _C3x[k++] = Math::polyval(m, coeff + o, _n) / coeff[o + m + 1]; o += m + 2; } } // Post condition: o == sizeof(coeff) / sizeof(real) && k == nC3x_ } void Geodesic::C4coeff() { // Generated by Maxima on 2015-05-05 18:08:13-04:00 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3 static const real coeff[] = { // C4[0], coeff of eps^2, polynomial in n of order 0 -2, 105, // C4[0], coeff of eps^1, polynomial in n of order 1 16, -7, 35, // C4[0], coeff of eps^0, polynomial in n of order 2 8, -28, 70, 105, // C4[1], coeff of eps^2, polynomial in n of order 0 -2, 105, // C4[1], coeff of eps^1, polynomial in n of order 1 -16, 7, 315, // C4[2], coeff of eps^2, polynomial in n of order 0 4, 525, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4 static const real coeff[] = { // C4[0], coeff of eps^3, polynomial in n of order 0 11, 315, // C4[0], coeff of eps^2, polynomial in n of order 1 -32, -6, 315, // C4[0], coeff of eps^1, polynomial in n of order 2 -32, 48, -21, 105, // C4[0], coeff of eps^0, polynomial in n of order 3 4, 24, -84, 210, 315, // C4[1], coeff of eps^3, polynomial in n of order 0 -1, 105, // C4[1], coeff of eps^2, polynomial in n of order 1 64, -18, 945, // C4[1], coeff of eps^1, polynomial in n of order 2 32, -48, 21, 945, // C4[2], coeff of eps^3, polynomial in n of order 0 -8, 1575, // C4[2], coeff of eps^2, polynomial in n of order 1 -32, 12, 1575, // C4[3], coeff of eps^3, polynomial in n of order 0 8, 2205, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5 static const real coeff[] = { // C4[0], coeff of eps^4, polynomial in n of order 0 4, 1155, // C4[0], coeff of eps^3, polynomial in n of order 1 -368, 121, 3465, // C4[0], coeff of eps^2, polynomial in n of order 2 1088, -352, -66, 3465, // C4[0], coeff of eps^1, polynomial in n of order 3 48, -352, 528, -231, 1155, // C4[0], coeff of eps^0, polynomial in n of order 4 16, 44, 264, -924, 2310, 3465, // C4[1], coeff of eps^4, polynomial in n of order 0 4, 1155, // C4[1], coeff of eps^3, polynomial in n of order 1 80, -99, 10395, // C4[1], coeff of eps^2, polynomial in n of order 2 -896, 704, -198, 10395, // C4[1], coeff of eps^1, polynomial in n of order 3 -48, 352, -528, 231, 10395, // C4[2], coeff of eps^4, polynomial in n of order 0 -8, 1925, // C4[2], coeff of eps^3, polynomial in n of order 1 384, -88, 17325, // C4[2], coeff of eps^2, polynomial in n of order 2 320, -352, 132, 17325, // C4[3], coeff of eps^4, polynomial in n of order 0 -16, 8085, // C4[3], coeff of eps^3, polynomial in n of order 1 -256, 88, 24255, // C4[4], coeff of eps^4, polynomial in n of order 0 64, 31185, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6 static const real coeff[] = { // C4[0], coeff of eps^5, polynomial in n of order 0 97, 15015, // C4[0], coeff of eps^4, polynomial in n of order 1 1088, 156, 45045, // C4[0], coeff of eps^3, polynomial in n of order 2 -224, -4784, 1573, 45045, // C4[0], coeff of eps^2, polynomial in n of order 3 -10656, 14144, -4576, -858, 45045, // C4[0], coeff of eps^1, polynomial in n of order 4 64, 624, -4576, 6864, -3003, 15015, // C4[0], coeff of eps^0, polynomial in n of order 5 100, 208, 572, 3432, -12012, 30030, 45045, // C4[1], coeff of eps^5, polynomial in n of order 0 1, 9009, // C4[1], coeff of eps^4, polynomial in n of order 1 -2944, 468, 135135, // C4[1], coeff of eps^3, polynomial in n of order 2 5792, 1040, -1287, 135135, // C4[1], coeff of eps^2, polynomial in n of order 3 5952, -11648, 9152, -2574, 135135, // C4[1], coeff of eps^1, polynomial in n of order 4 -64, -624, 4576, -6864, 3003, 135135, // C4[2], coeff of eps^5, polynomial in n of order 0 8, 10725, // C4[2], coeff of eps^4, polynomial in n of order 1 1856, -936, 225225, // C4[2], coeff of eps^3, polynomial in n of order 2 -8448, 4992, -1144, 225225, // C4[2], coeff of eps^2, polynomial in n of order 3 -1440, 4160, -4576, 1716, 225225, // C4[3], coeff of eps^5, polynomial in n of order 0 -136, 63063, // C4[3], coeff of eps^4, polynomial in n of order 1 1024, -208, 105105, // C4[3], coeff of eps^3, polynomial in n of order 2 3584, -3328, 1144, 315315, // C4[4], coeff of eps^5, polynomial in n of order 0 -128, 135135, // C4[4], coeff of eps^4, polynomial in n of order 1 -2560, 832, 405405, // C4[5], coeff of eps^5, polynomial in n of order 0 128, 99099, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7 static const real coeff[] = { // C4[0], coeff of eps^6, polynomial in n of order 0 10, 9009, // C4[0], coeff of eps^5, polynomial in n of order 1 -464, 291, 45045, // C4[0], coeff of eps^4, polynomial in n of order 2 -4480, 1088, 156, 45045, // C4[0], coeff of eps^3, polynomial in n of order 3 10736, -224, -4784, 1573, 45045, // C4[0], coeff of eps^2, polynomial in n of order 4 1664, -10656, 14144, -4576, -858, 45045, // C4[0], coeff of eps^1, polynomial in n of order 5 16, 64, 624, -4576, 6864, -3003, 15015, // C4[0], coeff of eps^0, polynomial in n of order 6 56, 100, 208, 572, 3432, -12012, 30030, 45045, // C4[1], coeff of eps^6, polynomial in n of order 0 10, 9009, // C4[1], coeff of eps^5, polynomial in n of order 1 112, 15, 135135, // C4[1], coeff of eps^4, polynomial in n of order 2 3840, -2944, 468, 135135, // C4[1], coeff of eps^3, polynomial in n of order 3 -10704, 5792, 1040, -1287, 135135, // C4[1], coeff of eps^2, polynomial in n of order 4 -768, 5952, -11648, 9152, -2574, 135135, // C4[1], coeff of eps^1, polynomial in n of order 5 -16, -64, -624, 4576, -6864, 3003, 135135, // C4[2], coeff of eps^6, polynomial in n of order 0 -4, 25025, // C4[2], coeff of eps^5, polynomial in n of order 1 -1664, 168, 225225, // C4[2], coeff of eps^4, polynomial in n of order 2 1664, 1856, -936, 225225, // C4[2], coeff of eps^3, polynomial in n of order 3 6784, -8448, 4992, -1144, 225225, // C4[2], coeff of eps^2, polynomial in n of order 4 128, -1440, 4160, -4576, 1716, 225225, // C4[3], coeff of eps^6, polynomial in n of order 0 64, 315315, // C4[3], coeff of eps^5, polynomial in n of order 1 1792, -680, 315315, // C4[3], coeff of eps^4, polynomial in n of order 2 -2048, 1024, -208, 105105, // C4[3], coeff of eps^3, polynomial in n of order 3 -1792, 3584, -3328, 1144, 315315, // C4[4], coeff of eps^6, polynomial in n of order 0 -512, 405405, // C4[4], coeff of eps^5, polynomial in n of order 1 2048, -384, 405405, // C4[4], coeff of eps^4, polynomial in n of order 2 3072, -2560, 832, 405405, // C4[5], coeff of eps^6, polynomial in n of order 0 -256, 495495, // C4[5], coeff of eps^5, polynomial in n of order 1 -2048, 640, 495495, // C4[6], coeff of eps^6, polynomial in n of order 0 512, 585585, }; #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8 static const real coeff[] = { // C4[0], coeff of eps^7, polynomial in n of order 0 193, 85085, // C4[0], coeff of eps^6, polynomial in n of order 1 4192, 850, 765765, // C4[0], coeff of eps^5, polynomial in n of order 2 20960, -7888, 4947, 765765, // C4[0], coeff of eps^4, polynomial in n of order 3 12480, -76160, 18496, 2652, 765765, // C4[0], coeff of eps^3, polynomial in n of order 4 -154048, 182512, -3808, -81328, 26741, 765765, // C4[0], coeff of eps^2, polynomial in n of order 5 3232, 28288, -181152, 240448, -77792, -14586, 765765, // C4[0], coeff of eps^1, polynomial in n of order 6 96, 272, 1088, 10608, -77792, 116688, -51051, 255255, // C4[0], coeff of eps^0, polynomial in n of order 7 588, 952, 1700, 3536, 9724, 58344, -204204, 510510, 765765, // C4[1], coeff of eps^7, polynomial in n of order 0 349, 2297295, // C4[1], coeff of eps^6, polynomial in n of order 1 -1472, 510, 459459, // C4[1], coeff of eps^5, polynomial in n of order 2 -39840, 1904, 255, 2297295, // C4[1], coeff of eps^4, polynomial in n of order 3 52608, 65280, -50048, 7956, 2297295, // C4[1], coeff of eps^3, polynomial in n of order 4 103744, -181968, 98464, 17680, -21879, 2297295, // C4[1], coeff of eps^2, polynomial in n of order 5 -1344, -13056, 101184, -198016, 155584, -43758, 2297295, // C4[1], coeff of eps^1, polynomial in n of order 6 -96, -272, -1088, -10608, 77792, -116688, 51051, 2297295, // C4[2], coeff of eps^7, polynomial in n of order 0 464, 1276275, // C4[2], coeff of eps^6, polynomial in n of order 1 -928, -612, 3828825, // C4[2], coeff of eps^5, polynomial in n of order 2 64256, -28288, 2856, 3828825, // C4[2], coeff of eps^4, polynomial in n of order 3 -126528, 28288, 31552, -15912, 3828825, // C4[2], coeff of eps^3, polynomial in n of order 4 -41472, 115328, -143616, 84864, -19448, 3828825, // C4[2], coeff of eps^2, polynomial in n of order 5 160, 2176, -24480, 70720, -77792, 29172, 3828825, // C4[3], coeff of eps^7, polynomial in n of order 0 -16, 97461, // C4[3], coeff of eps^6, polynomial in n of order 1 -16384, 1088, 5360355, // C4[3], coeff of eps^5, polynomial in n of order 2 -2560, 30464, -11560, 5360355, // C4[3], coeff of eps^4, polynomial in n of order 3 35840, -34816, 17408, -3536, 1786785, // C4[3], coeff of eps^3, polynomial in n of order 4 7168, -30464, 60928, -56576, 19448, 5360355, // C4[4], coeff of eps^7, polynomial in n of order 0 128, 2297295, // C4[4], coeff of eps^6, polynomial in n of order 1 26624, -8704, 6891885, // C4[4], coeff of eps^5, polynomial in n of order 2 -77824, 34816, -6528, 6891885, // C4[4], coeff of eps^4, polynomial in n of order 3 -32256, 52224, -43520, 14144, 6891885, // C4[5], coeff of eps^7, polynomial in n of order 0 -6784, 8423415, // C4[5], coeff of eps^6, polynomial in n of order 1 24576, -4352, 8423415, // C4[5], coeff of eps^5, polynomial in n of order 2 45056, -34816, 10880, 8423415, // C4[6], coeff of eps^7, polynomial in n of order 0 -1024, 3318315, // C4[6], coeff of eps^6, polynomial in n of order 1 -28672, 8704, 9954945, // C4[7], coeff of eps^7, polynomial in n of order 0 1024, 1640925, }; #else #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == (nC4_ * (nC4_ + 1) * (nC4_ + 5)) / 6, "Coefficient array size mismatch in C4coeff"); int o = 0, k = 0; for (int l = 0; l < nC4_; ++l) { // l is index of C4[l] for (int j = nC4_ - 1; j >= l; --j) { // coeff of eps^j int m = nC4_ - j - 1; // order of polynomial in n _C4x[k++] = Math::polyval(m, coeff + o, _n) / coeff[o + m + 1]; o += m + 2; } } // Post condition: o == sizeof(coeff) / sizeof(real) && k == nC4x_ } } // namespace GeographicLib GeographicLib-1.52/src/GeodesicExact.cpp0000644000771000077100000011126414064202371020024 0ustar ckarneyckarney/** * \file GeodesicExact.cpp * \brief Implementation for GeographicLib::GeodesicExact class * * Copyright (c) Charles Karney (2012-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * 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 #if defined(_MSC_VER) // Squelch warnings about potentially uninitialized local variables and // constant conditional expressions # pragma warning (disable: 4701 4127) #endif namespace GeographicLib { using namespace std; GeodesicExact::GeodesicExact(real a, real f) : maxit2_(maxit1_ + Math::digits() + 10) // Underflow guard. We require // tiny_ * epsilon() > 0 // tiny_ + epsilon() == epsilon() , tiny_(sqrt(numeric_limits::min())) , 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) , tol1_(200 * tol0_) , tol2_(sqrt(tol0_)) , tolb_(tol0_ * tol2_) // Check on bisection interval , xthresh_(1000 * tol2_) , _a(a) , _f(f) , _f1(1 - _f) , _e2(_f * (2 - _f)) , _ep2(_e2 / Math::sq(_f1)) // e2 / (1 - e2) , _n(_f / ( 2 - _f)) , _b(_a * _f1) // The Geodesic class substitutes atanh(sqrt(e2)) for asinh(sqrt(ep2)) in // the definition of _c2. The latter is more accurate for very oblate // ellipsoids (which the Geodesic class does not attempt to handle). Of // course, the area calculation in GeodesicExact is still based on a // series and so only holds for moderately oblate (or prolate) // ellipsoids. , _c2((Math::sq(_a) + Math::sq(_b) * (_f == 0 ? 1 : (_f > 0 ? asinh(sqrt(_ep2)) : atan(sqrt(-_e2))) / sqrt(abs(_e2))))/2) // authalic radius squared // The sig12 threshold for "really short". Using the auxiliary sphere // solution with dnm computed at (bet1 + bet2) / 2, the relative error in // the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. // (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a // given f and sig12, the max error occurs for lines near the pole. If // the old rule for computing dnm = (dn1 + dn2)/2 is used, then the error // increases by a factor of 2.) Setting this equal to epsilon gives // sig12 = etol2. Here 0.1 is a safety factor (error decreased by 100) // and max(0.001, abs(f)) stops etol2 getting too large in the nearly // spherical case. , _etol2(real(0.1) * tol2_ / sqrt( max(real(0.001), abs(_f)) * min(real(1), 1 - _f/2) / 2 )) { if (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_b) && _b > 0)) throw GeographicErr("Polar semi-axis is not positive"); C4coeff(); } const GeodesicExact& GeodesicExact::WGS84() { static const GeodesicExact wgs84(Constants::WGS84_a(), Constants::WGS84_f()); return wgs84; } Math::real GeodesicExact::CosSeries(real sinx, real cosx, const real c[], int n) { // Evaluate // y = sum(c[i] * cos((2*i+1) * x), i, 0, n-1) // using Clenshaw summation. // Approx operation count = (n + 5) mult and (2 * n + 2) add c += n ; // 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 cosx * (y0 - y1); // cos(x) * (y0 - y1) } GeodesicLineExact GeodesicExact::Line(real lat1, real lon1, real azi1, unsigned caps) const { return GeodesicLineExact(*this, lat1, lon1, azi1, caps); } Math::real GeodesicExact::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 { // Automatically supply DISTANCE_IN if necessary if (!arcmode) outmask |= DISTANCE_IN; return GeodesicLineExact(*this, lat1, lon1, azi1, outmask) . // Note the dot! GenPosition(arcmode, s12_a12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12); } GeodesicLineExact GeodesicExact::GenDirectLine(real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned caps) const { azi1 = Math::AngNormalize(azi1); real salp1, calp1; // Guard against underflow in salp0. Also -0 is converted to +0. Math::sincosd(Math::AngRound(azi1), salp1, calp1); // Automatically supply DISTANCE_IN if necessary if (!arcmode) caps |= DISTANCE_IN; return GeodesicLineExact(*this, lat1, lon1, azi1, salp1, calp1, caps, arcmode, s12_a12); } GeodesicLineExact GeodesicExact::DirectLine(real lat1, real lon1, real azi1, real s12, unsigned caps) const { return GenDirectLine(lat1, lon1, azi1, false, s12, caps); } GeodesicLineExact GeodesicExact::ArcDirectLine(real lat1, real lon1, real azi1, real a12, unsigned caps) const { return GenDirectLine(lat1, lon1, azi1, true, a12, caps); } Math::real GeodesicExact::GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real& s12, real& salp1, real& calp1, real& salp2, real& calp2, real& m12, real& M12, real& M21, real& S12) const { // Compute longitude difference (AngDiff does this carefully). Result is // in [-180, 180] but -180 is only for west-going geodesics. 180 is for // east-going and meridional geodesics. real lon12s, lon12 = Math::AngDiff(lon1, lon2, lon12s); // Make longitude difference positive. int lonsign = lon12 >= 0 ? 1 : -1; // If very close to being on the same half-meridian, then make it so. lon12 = lonsign * Math::AngRound(lon12); lon12s = Math::AngRound((180 - lon12) - lonsign * lon12s); real lam12 = lon12 * Math::degree(), slam12, clam12; if (lon12 > 90) { Math::sincosd(lon12s, slam12, clam12); clam12 = -clam12; } else Math::sincosd(lon12, slam12, clam12); // If really close to the equator, treat as on equator. lat1 = Math::AngRound(Math::LatFix(lat1)); lat2 = Math::AngRound(Math::LatFix(lat2)); // Swap points so that point with higher (abs) latitude is point 1 // If one latitude is a nan, then it becomes lat1. 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 sbet1, cbet1, sbet2, cbet2, s12x, m12x; // Initialize for the meridian. No longitude calculation is done in this // case to let the parameter default to 0. EllipticFunction E(-_ep2); Math::sincosd(lat1, sbet1, cbet1); sbet1 *= _f1; // Ensure cbet1 = +epsilon at poles; doing the fix on beta means that sig12 // will be <= 2*tiny for two points at the same pole. Math::norm(sbet1, cbet1); cbet1 = max(tiny_, cbet1); Math::sincosd(lat2, sbet2, cbet2); sbet2 *= _f1; // Ensure cbet2 = +epsilon at poles Math::norm(sbet2, cbet2); cbet2 = max(tiny_, 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 dn1 = (_f >= 0 ? sqrt(1 + _ep2 * Math::sq(sbet1)) : sqrt(1 - _e2 * Math::sq(cbet1)) / _f1), dn2 = (_f >= 0 ? sqrt(1 + _ep2 * Math::sq(sbet2)) : sqrt(1 - _e2 * Math::sq(cbet2)) / _f1); real a12, sig12; 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(real(0), csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); { real dummy; Lengths(E, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | REDUCEDLENGTH, s12x, m12x, dummy, M12, M21); } // Add the check for sig12 since zero length geodesics might yield m12 < // 0. Test case was // // echo 20.001 0 20.001 0 | GeodSolve -i // // In fact, we will have sig12 > pi/2 for meridional geodesic which is // not a shortest path. if (sig12 < 1 || m12x >= 0) { // Need at least 2, to handle 90 0 90 180 if (sig12 < 3 * tiny_ || // Prevent negative s12 or m12 for short lines (sig12 < tol0_ && (s12x < 0 || m12x < 0))) sig12 = m12x = s12x = 0; m12x *= _b; s12x *= _b; a12 = sig12 / Math::degree(); } else // m12 < 0, i.e., prolate and too close to anti-podal meridian = false; } // somg12 > 1 marks that it needs to be calculated real omg12 = 0, somg12 = 2, comg12 = 0; if (!meridian && sbet1 == 0 && // and sbet2 == 0 (_f <= 0 || lon12s >= _f * 180)) { // Geodesic runs along equator calp1 = calp2 = 0; salp1 = salp2 = 1; s12x = _a * lam12; sig12 = omg12 = lam12 / _f1; m12x = _b * sin(sig12); if (outmask & GEODESICSCALE) M12 = M21 = cos(sig12); a12 = lon12 / _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 real dnm; sig12 = InverseStart(E, sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, salp1, calp1, salp2, calp2, dnm); if (sig12 >= 0) { // Short lines (InverseStart sets salp2, calp2, dnm) s12x = sig12 * _b * dnm; m12x = Math::sq(dnm) * _b * sin(sig12 / dnm); if (outmask & GEODESICSCALE) M12 = M21 = cos(sig12 / dnm); a12 = sig12 / Math::degree(); omg12 = lam12 / (_f1 * dnm); } else { // Newton's method. This is a straightforward solution of f(alp1) = // lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one // root in the interval (0, pi) and its derivative is positive at the // root. Thus f(alp) is positive for alp > alp1 and negative for alp < // alp1. During the course of the iteration, a range (alp1a, alp1b) is // maintained which brackets the root and with each evaluation of // f(alp) the range is shrunk, if possible. Newton's method is // restarted whenever the derivative of f is negative (because the new // value of alp1 is then further from the solution) or if the new // estimate of alp1 lies outside (0,pi); in this case, the new starting // guess is taken to be (alp1a + alp1b) / 2. // // initial values to suppress warnings (if loop is executed 0 times) real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, domg12 = 0; unsigned numit = 0; // Bracketing range real salp1a = tiny_, calp1a = 1, salp1b = tiny_, calp1b = -1; for (bool tripn = false, tripb = false; numit < maxit2_ || GEOGRAPHICLIB_PANIC; ++numit) { // 1/4 meridian = 10e6 m and random input. max err is estimated max // error in nm (checking solution of inverse problem by direct // solution). iter is mean and sd of number of iterations // // max iter // log2(b/a) err mean sd // -7 387 5.33 3.68 // -6 345 5.19 3.43 // -5 269 5.00 3.05 // -4 210 4.76 2.44 // -3 115 4.55 1.87 // -2 69 4.35 1.38 // -1 36 4.05 1.03 // 0 15 0.01 0.13 // 1 25 5.10 1.53 // 2 96 5.61 2.09 // 3 318 6.02 2.74 // 4 985 6.24 3.22 // 5 2352 6.32 3.44 // 6 6008 6.30 3.45 // 7 19024 6.19 3.30 real dv; real v = Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, E, domg12, numit < maxit1_, dv); // Reversed test to allow escape with NaNs if (tripb || !(abs(v) >= (tripn ? 8 : 1) * tol0_)) break; // Update bracketing values if (v > 0 && (numit > maxit1_ || calp1/salp1 > calp1b/salp1b)) { salp1b = salp1; calp1b = calp1; } else if (v < 0 && (numit > maxit1_ || calp1/salp1 < calp1a/salp1a)) { salp1a = salp1; calp1a = calp1; } if (numit < maxit1_ && dv > 0) { real dalp1 = -v/dv; real sdalp1 = sin(dalp1), cdalp1 = cos(dalp1), nsalp1 = salp1 * cdalp1 + calp1 * sdalp1; if (nsalp1 > 0 && abs(dalp1) < Math::pi()) { calp1 = calp1 * cdalp1 - salp1 * sdalp1; salp1 = nsalp1; Math::norm(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). tripn = abs(v) <= 16 * tol0_; continue; } } // Either dv was not positive or updated value was outside legal // range. Use the midpoint of the bracket as the next estimate. // This mechanism is not needed for the WGS84 ellipsoid, but it does // catch problems with more eccentric ellipsoids. Its efficacy is // such for the WGS84 test set with the starting guess set to alp1 = // 90deg: // the WGS84 test set: mean = 5.21, sd = 3.93, max = 24 // WGS84 and random input: mean = 4.74, sd = 0.99 salp1 = (salp1a + salp1b)/2; calp1 = (calp1a + calp1b)/2; Math::norm(salp1, calp1); tripn = false; tripb = (abs(salp1a - salp1) + (calp1a - calp1) < tolb_ || abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_); } { real dummy; Lengths(E, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask, s12x, m12x, dummy, M12, M21); } m12x *= _b; s12x *= _b; a12 = sig12 / Math::degree(); if (outmask & AREA) { // omg12 = lam12 - domg12 real sdomg12 = sin(domg12), cdomg12 = cos(domg12); somg12 = slam12 * cdomg12 - clam12 * sdomg12; comg12 = clam12 * cdomg12 + slam12 * sdomg12; } } } 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 = 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, eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2), // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). A4 = Math::sq(_a) * calp0 * salp0 * _e2; Math::norm(ssig1, csig1); Math::norm(ssig2, csig2); real C4a[nC4_]; C4f(eps, C4a); real B41 = CosSeries(ssig1, csig1, C4a, nC4_), B42 = CosSeries(ssig2, csig2, C4a, nC4_); S12 = A4 * (B42 - B41); } else // Avoid problems with indeterminate sig1, sig2 on equator S12 = 0; if (!meridian) { if (somg12 > 1) { somg12 = sin(omg12); comg12 = cos(omg12); } } if (!meridian && // omg12 < 3/4 * pi comg12 > -real(0.7071) && // Long difference not too big sbet2 - sbet1 < real(1.75)) { // Lat difference not 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 domg12 = 1 + comg12, 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; // Returned value in [0, 180] return a12; } Math::real GeodesicExact::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 { outmask &= OUT_MASK; real salp1, calp1, salp2, calp2, a12 = GenInverse(lat1, lon1, lat2, lon2, outmask, s12, salp1, calp1, salp2, calp2, m12, M12, M21, S12); if (outmask & AZIMUTH) { azi1 = Math::atan2d(salp1, calp1); azi2 = Math::atan2d(salp2, calp2); } return a12; } GeodesicLineExact GeodesicExact::InverseLine(real lat1, real lon1, real lat2, real lon2, unsigned caps) const { real t, salp1, calp1, salp2, calp2, a12 = GenInverse(lat1, lon1, lat2, lon2, // No need to specify AZIMUTH here 0u, t, salp1, calp1, salp2, calp2, t, t, t, t), azi1 = Math::atan2d(salp1, calp1); // Ensure that a12 can be converted to a distance if (caps & (OUT_MASK & DISTANCE_IN)) caps |= DISTANCE; return GeodesicLineExact(*this, lat1, lon1, azi1, salp1, calp1, caps, true, a12); } void GeodesicExact::Lengths(const EllipticFunction& E, real sig12, real ssig1, real csig1, real dn1, real ssig2, real csig2, real dn2, real cbet1, real cbet2, unsigned outmask, real& s12b, real& m12b, real& m0, real& M12, real& M21) const { // Return m12b = (reduced length)/_b; also calculate s12b = distance/_b, // and m0 = coefficient of secular term in expression for reduced length. outmask &= OUT_ALL; // outmask & DISTANCE: set s12b // outmask & REDUCEDLENGTH: set m12b & m0 // outmask & GEODESICSCALE: set M12 & M21 // It's OK to have repeated dummy arguments, // e.g., s12b = m0 = M12 = M21 = dummy if (outmask & DISTANCE) // Missing a factor of _b s12b = E.E() / (Math::pi() / 2) * (sig12 + (E.deltaE(ssig2, csig2, dn2) - E.deltaE(ssig1, csig1, dn1))); if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) { real m0x = - E.k2() * E.D() / (Math::pi() / 2), J12 = m0x * (sig12 + (E.deltaD(ssig2, csig2, dn2) - E.deltaD(ssig1, csig1, dn1))); if (outmask & REDUCEDLENGTH) { m0 = m0x; // Missing a factor of _b. Add parens around (csig1 * ssig2) and // (ssig1 * csig2) to ensure accurate cancellation in the case of // coincident points. m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12; } if (outmask & GEODESICSCALE) { real csig12 = csig1 * csig2 + ssig1 * ssig2; real t = _ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2); M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1; M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2; } } } Math::real GeodesicExact::Astroid(real x, real 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. 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 discriminant 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 = 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 GeodesicExact::InverseStart(EllipticFunction& E, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real lam12, real slam12, real clam12, real& salp1, real& calp1, // Only updated if return val >= 0 real& salp2, real& calp2, // Only updated for short lines real& dnm) const { // 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; real sbet12a = sbet2 * cbet1 + cbet2 * sbet1; bool shortline = cbet12 >= 0 && sbet12 < real(0.5) && cbet2 * lam12 < real(0.5); real somg12, comg12; if (shortline) { real sbetm2 = Math::sq(sbet1 + sbet2); // sin((bet1+bet2)/2)^2 // = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) sbetm2 /= sbetm2 + Math::sq(cbet1 + cbet2); dnm = sqrt(1 + _ep2 * sbetm2); real omg12 = lam12 / (_f1 * dnm); somg12 = sin(omg12); comg12 = cos(omg12); } else { somg12 = slam12; comg12 = clam12; } salp1 = cbet2 * somg12; calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * Math::sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * Math::sq(somg12) / (1 - comg12); real ssig12 = hypot(salp1, calp1), csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12; if (shortline && ssig12 < _etol2) { // really short lines salp2 = cbet1 * somg12; calp2 = sbet12 - cbet1 * sbet2 * (comg12 >= 0 ? Math::sq(somg12) / (1 + comg12) : 1 - comg12); Math::norm(salp2, calp2); // Set return value sig12 = atan2(ssig12, csig12); } else if (abs(_n) > real(0.1) || // Skip astroid calc if too eccentric csig12 >= 0 || ssig12 >= 6 * abs(_n) * 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 GEOGRAPHICLIB_VOLATILE real x; real lam12x = atan2(-slam12, -clam12); // lam12 - pi if (_f >= 0) { // In fact f == 0 does not get here // x = dlong, y = dlat { real k2 = Math::sq(sbet1) * _ep2; E.Reset(-k2, -_ep2, 1 + k2, 1 + _ep2); lamscale = _e2/_f1 * cbet1 * 2 * E.H(); } betscale = lamscale * cbet1; x = lam12x / lamscale; y = sbet12a / betscale; } else { // _f < 0 // x = dlat, y = dlong real cbet12a = cbet2 * cbet1 - sbet2 * sbet1, bet12a = atan2(sbet12a, cbet12a); real m12b, m0, dummy; // In the case of lon12 = 180, this repeats a calculation made in // Inverse. Lengths(E, Math::pi() + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, REDUCEDLENGTH, dummy, m12b, m0, dummy, dummy); x = -1 + m12b / (cbet1 * cbet2 * m0 * Math::pi()); betscale = x < -real(0.01) ? sbet12a / x : -_f * Math::sq(cbet1) * Math::pi(); lamscale = betscale / cbet1; y = lam12x / lamscale; } if (y > -tol1_ && x > -1 - xthresh_) { // strip near cut // Need real(x) here to cast away the volatility of x for min/max 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); } } // Sanity check on starting guess. Backwards check allows NaN through. if (!(salp1 <= 0)) Math::norm(salp1, calp1); else { salp1 = 1; calp1 = 0; } return sig12; } Math::real GeodesicExact::Lambda12(real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real salp1, real calp1, real slam120, real clam120, real& salp2, real& calp2, real& sig12, real& ssig1, real& csig1, real& ssig2, real& csig2, EllipticFunction& E, real& domg12, bool diffp, real& dlam12) const { 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 = hypot(calp1, salp1 * sbet1); // calp0 > 0 real somg1, comg1, somg2, comg2, somg12, comg12, cchi1, cchi2, 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; // Without normalization we have schi1 = somg1. cchi1 = _f1 * dn1 * comg1; Math::norm(ssig1, csig1); // Math::norm(somg1, comg1); -- don't need to normalize! // Math::norm(schi1, cchi1); -- 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; // Without normalization we have schi2 = somg2. cchi2 = _f1 * dn2 * comg2; Math::norm(ssig2, csig2); // Math::norm(somg2, comg2); -- don't need to normalize! // Math::norm(schi2, cchi2); -- don't need to normalize! // sig12 = sig2 - sig1, limit to [0, pi] sig12 = atan2(max(real(0), csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); // omg12 = omg2 - omg1, limit to [0, pi] somg12 = max(real(0), comg1 * somg2 - somg1 * comg2); comg12 = comg1 * comg2 + somg1 * somg2; real k2 = Math::sq(calp0) * _ep2; E.Reset(-k2, -_ep2, 1 + k2, 1 + _ep2); // chi12 = chi2 - chi1, limit to [0, pi] real schi12 = max(real(0), cchi1 * somg2 - somg1 * cchi2), cchi12 = cchi1 * cchi2 + somg1 * somg2; // eta = chi12 - lam120 real eta = atan2(schi12 * clam120 - cchi12 * slam120, cchi12 * clam120 + schi12 * slam120); real deta12 = -_e2/_f1 * salp0 * E.H() / (Math::pi() / 2) * (sig12 + (E.deltaH(ssig2, csig2, dn2) - E.deltaH(ssig1, csig1, dn1))); lam12 = eta + deta12; // domg12 = deta12 + chi12 - omg12 domg12 = deta12 + atan2(schi12 * comg12 - cchi12 * somg12, cchi12 * comg12 + schi12 * somg12); if (diffp) { if (calp2 == 0) dlam12 = - 2 * _f1 * dn1 / sbet1; else { real dummy; Lengths(E, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, REDUCEDLENGTH, dummy, dlam12, dummy, dummy, dummy); dlam12 *= _f1 / (calp2 * cbet2); } } return lam12; } void GeodesicExact::C4f(real eps, real c[]) const { // Evaluate C4 coeffs // Elements c[0] thru c[nC4_ - 1] are set real mult = 1; int o = 0; for (int l = 0; l < nC4_; ++l) { // l is index of C4[l] int m = nC4_ - l - 1; // order of polynomial in eps c[l] = mult * Math::polyval(m, _C4x + o, eps); o += m + 1; mult *= eps; } // Post condition: o == nC4x_ if (!(o == nC4x_)) throw GeographicErr("C4 misalignment"); } } // namespace GeographicLib GeographicLib-1.52/src/GeodesicExactC4.cpp0000644000771000077100000161610614064202371020221 0ustar ckarneyckarney/** * \file GeodesicExactC4.cpp * \brief Implementation for GeographicLib::GeodesicExact::rawC4coeff * * Copyright (c) Charles Karney (2014-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * This function is split from the rest of the implementation of * GeographicLib::GeodesicExact in order to work around a problem with the * Visual Studio 12 compiler reported on 2014-07-14 * http://connect.microsoft.com/VisualStudio/feedback/details/920594 **********************************************************************/ #include namespace GeographicLib { using namespace std; // If the coefficient is greater or equal to 2^63, express it as a pair [a, // b] which is combined with a*2^52 + b. The largest coefficient is // 831281402884796906843926125 = 0x2af9eaf25d149c52a73ee6d // = 184581550685 * 2^52 + 0x149c52a73ee6d which is less than 2^90. Both a // and b are less that 2^52 and so are exactly representable by doubles; then // the computation of the full double coefficient involves only a single // rounding operation. (Actually integers up to and including 2^53 can be // represented exactly as doubles. Limiting b to 52 bits allows it to be // represented in 13 digits in hex.) // If the coefficient is less than 2^63, cast it to real if it isn't exactly // representable as a float. Thus 121722048 = 1901907*2^6 and 1901907 < 2^24 // so the cast is not needed; 21708121824 = 678378807*2^5 and 678378807 >= // 2^24 so the cast is needed. void GeodesicExact::C4coeff() { // Generated by Maxima on 2017-05-27 10:17:57-04:00 #if GEOGRAPHICLIB_GEODESICEXACT_ORDER == 24 static const real coeff[] = { // C4[0], coeff of eps^23, polynomial in n of order 0 2113,real(34165005), // C4[0], coeff of eps^22, polynomial in n of order 1 5189536,1279278,real(54629842995LL), // C4[0], coeff of eps^21, polynomial in n of order 2 real(19420000),-9609488,7145551,real(87882790905LL), // C4[0], coeff of eps^20, polynomial in n of order 3 real(223285780800LL),-real(146003016320LL),real(72167144896LL), real(17737080900LL),real(0x205dc0bcbd6d7LL), // C4[0], coeff of eps^19, polynomial in n of order 4 real(0x4114538e4c0LL),-real(0x2f55bac3db0LL),real(0x1ee26e63c60LL), -real(0xf3f108c690LL),real(777582423783LL),real(0x19244124e56e27LL), // C4[0], coeff of eps^18, polynomial in n of order 5 real(0x303f35e1bc93a0LL),-real(0x24e1f056b1d580LL), real(0x1ab9fe0d1d4d60LL),-real(0x1164c583e996c0LL), real(0x892da1e80cb20LL),real(0x2194519fdb596LL), reale(3071,0xfdd7cc41833d5LL), // C4[0], coeff of eps^17, polynomial in n of order 6 real(0x4aad22c875ed20LL),-real(0x3a4801a1c6bad0LL), real(0x2c487fb318d4c0LL),-real(0x1ff24d7cfd75b0LL), real(0x14ba39245f1460LL),-real(0xa32e190328e90LL), real(0x78c93074dfcffLL),reale(3071,0xfdd7cc41833d5LL), // C4[0], coeff of eps^16, polynomial in n of order 7 real(0x33d84b92096e100LL),-real(0x286d35d824ffe00LL), real(0x1f3d33e2e951300LL),-real(0x178f58435181400LL), real(0x10e7992a3756500LL),-real(0xaed7fa8609aa00LL), real(0x55d8ac87b09700LL),real(0x14e51e43945a10LL), reale(21503,0xf0e695ca96ad3LL), // C4[0], coeff of eps^15, polynomial in n of order 8 real(0x577cdb6aaee0d80LL),-real(0x4283c1e96325470LL), real(0x32feef20b794020LL),-real(0x26ea2e388de1a50LL), real(0x1d13f6131e5d6c0LL),-real(0x14b9aa66e270230LL), real(0xd5657196ac0560LL),-real(0x6880b0118a9810LL), real(0x4d0f1755168ee7LL),reale(21503,0xf0e695ca96ad3LL), // C4[0], coeff of eps^14, polynomial in n of order 9 real(0xa82410caed14920LL),-real(0x774e0539d2de300LL), real(0x57ddc01c62bc8e0LL),-real(0x41de50dfff43e40LL), real(0x31742450a1bdca0LL),-real(0x248524531975180LL), real(0x19d013c6e35ec60LL),-real(0x1084c003a0434c0LL), real(0x8103758ad86020LL),real(0x1f2409edf5e286LL), reale(21503,0xf0e695ca96ad3LL), // C4[0], coeff of eps^13, polynomial in n of order 10 real(0x1c6d2d6120015ca0LL),-real(0x104cedef383403b0LL), real(0xab9dd58c3e3d880LL),-real(0x78a4e83e5604750LL), real(0x57aa7cf5406e460LL),-real(0x4067a93ceeb2cf0LL), real(0x2ed62190d975c40LL),-real(0x20c076adcb21890LL), real(0x14cfa9cb9e01c20LL),-real(0xa1e25734956e30LL), real(0x76afbfe4ae6c4dLL),reale(21503,0xf0e695ca96ad3LL), // C4[0], coeff of eps^12, polynomial in n of order 11 real(0x500e39e18e75c40LL),-real(0xb866fe4aaa63680LL), real(0x4337db32e526ac0LL),-real(0x264cce8c21af200LL), real(0x18fb7ba247a4140LL),-real(0x115709558576d80LL), real(0xc5be96cd3dcfc0LL),-real(0x8cdca1395db900LL), real(0x611fe1a7e00640LL),-real(0x3d26e46827e480LL), real(0x1d93970a8fd4c0LL),real(0x70bf87cc17354LL), reale(3071,0xfdd7cc41833d5LL), // C4[0], coeff of eps^11, polynomial in n of order 12 -real(0x158a522ca96a9f40LL),real(0x14d4e49882e048f0LL), real(0x51a6258bc6026a0LL),-real(0xc07af3677bdc6b0LL), real(0x45ac09bc3b66080LL),-real(0x275e4ef59a8b450LL), real(0x195f928e5402a60LL),-real(0x114aa7eeb31a3f0LL), real(0xbf706c784da040LL),-real(0x817ec7d97ab990LL), real(0x508b8ca80cde20LL),-real(0x26b120ea091930LL), real(0x1c1ab3faf18ecdLL),reale(3071,0xfdd7cc41833d5LL), // C4[0], coeff of eps^10, polynomial in n of order 13 real(0x85cd94c7a43620LL),real(0x41534458719f180LL), -real(0x1688b497e3eabf20LL),real(0x15fa3ad6bcd8bd40LL), real(0x531c27984875fa0LL),-real(0xc9b33381ee39f00LL), real(0x485a2b8a7ad1a60LL),-real(0x286be979df41b40LL), real(0x199b6e19072f920LL),-real(0x10f769bc7a1af80LL), real(0xb2b30e0b2b83e0LL),-real(0x6d4c30bc0953c0LL), real(0x3405b9397b42a0LL),real(0xc1ffd0ada51beLL), reale(3071,0xfdd7cc41833d5LL), // C4[0], coeff of eps^9, polynomial in n of order 14 real(0x77c3b2fb788360LL),real(0x12370e8b6ebba50LL), real(0x3ce89570a2d35c0LL),real(0x1ddd463aa5801f30LL), -reale(2652,0xb61760f09fe0LL),reale(2613,0x24df88b461210LL), real(0x24dea39341926e80LL),-real(0x5ce704fae2f44110LL), real(0x20ecef343dc3cce0LL),-real(0x121947a4ab4bae30LL), real(0xb2a76f84c78e740LL),-real(0x70dd3a5c9a20950LL), real(0x43604f2667d29a0LL),-real(0x1fa7f2abdd82670LL), real(0x169d55eb03244c1LL),reale(21503,0xf0e695ca96ad3LL), // C4[0], coeff of eps^8, polynomial in n of order 15 real(0x21331eec152c80LL),real(0x3c94fa87392d00LL), real(0x7bff534019c580LL),real(0x12eee208e5fe200LL), real(0x3f965ae4945ee80LL),real(0x1f56cb06e4e85700LL), -reale(2802,0x46e8e19f880LL),reale(2796,0xadb20bd4ec00LL), real(0x251d0efe774e7080LL),-real(0x625b74d58e27ff00LL), real(0x224674d7e8ab8980LL),-real(0x1260f3bdc69c0a00LL), real(0xad7256a98d1b280LL),-real(0x63bd65ce944d500LL), real(0x2df89c0cd0d4b80LL),real(0xa46618fc50ff08LL), reale(21503,0xf0e695ca96ad3LL), // C4[0], coeff of eps^7, polynomial in n of order 16 real(0xcb641c2517300LL),real(0x1435342f6c1790LL), real(0x2223c168d902a0LL),real(0x3e90a70fac72b0LL), real(0x80a310c4f84640LL),real(0x13bcb7c20d40bd0LL), real(0x42a5540b0e391e0LL),real(0x210e40977bd376f0LL), -reale(2980,0x94d9def1cc680LL),reale(3022,0x503caf61c4810LL), real(0x24d397da2b859120LL),-real(0x68d822cc2f04ecd0LL), real(0x23a043b28810ecc0LL),-real(0x125159fafe6e93b0LL), real(0x9e1bc8a31f5a060LL),-real(0x46aed7b45d01890LL), real(0x30c71f0f146542fLL),reale(21503,0xf0e695ca96ad3LL), // C4[0], coeff of eps^6, polynomial in n of order 17 real(0x5c9c64c833ea0LL),real(0x87cba49bc6200LL),real(0xcee016a8ff560LL), real(0x14a860e941a1c0LL),real(0x231567934bf020LL), real(0x40a648fc642980LL),real(0x85b2123b2c36e0LL), real(0x14a4159e5b98140LL),real(0x462d226dee7d1a0LL), real(0x2316888f6f2f3100LL),-reale(3198,0x3491a799c37a0LL), reale(3311,0xbf8f265e6c0c0LL),real(0x2372de10575f2320LL), -real(0x70af5543c56e4780LL),real(0x24bbd6e6395ee9e0LL), -real(0x116009bab4325fc0LL),real(0x75b7dfa9c5a24a0LL), real(0x17de90e4beab49eLL),reale(21503,0xf0e695ca96ad3LL), // C4[0], coeff of eps^5, polynomial in n of order 18 real(0x6a525328e6e0LL),real(0x93f17033fb30LL),real(0xd36a04706f00LL), real(0x137db4aaadad0LL),real(0x1de17febed720LL),real(0x300ece09a4c70LL), real(0x5230537724340LL),real(0x98911a7bab410LL),real(0x13df6f0042d760LL), real(0x317f809c6f75b0LL),real(0xa9d28ba9acb780LL), real(0x55d121ad9d8f550LL),-real(0x1efee1555125f860LL), real(0x21073529064696f0LL),real(0x486394f46ccebc0LL), -real(0x11777145e6374170LL),real(0x54159fc268987e0LL), -real(0x1fa4dd5835d2fd0LL),real(0x13d87fc86cca643LL), reale(3071,0xfdd7cc41833d5LL), // C4[0], coeff of eps^4, polynomial in n of order 19 real(0x3804d31f10c0LL),real(0x4b2ec20ad280LL),real(0x66f0ea418040LL), real(0x903f2204b400LL),real(0xcfad72d447c0LL),real(0x134cb9fa41580LL), real(0x1dd70e331b740LL),real(0x306dd8a084700LL),real(0x53a0a0b201ec0LL), real(0x9cd7c33c89880LL),real(0x14a7b599a9ce40LL), real(0x340e256f2c5a00LL),real(0xb4e7d2cf7515c0LL), real(0x5cc8e678862db80LL),-real(0x22304c48df63bac0LL), real(0x25f7d3a888bb6d00LL),real(0x3210c8a6905acc0LL), -real(0x131873ea3222a180LL),real(0x4a33217f63b9c40LL), real(0xaa39109cb79b1cLL),reale(3071,0xfdd7cc41833d5LL), // C4[0], coeff of eps^3, polynomial in n of order 20 real(0x1d8a60744340LL),real(0x26a12f47d0f0LL),real(0x3353c9ffe420LL), real(0x4570fd193850LL),real(0x5fe8194aa900LL),real(0x87a7057de1b0LL), real(0xc54ab4558de0LL),real(0x12897a64b8910LL),real(0x1d013b7f18ec0LL), real(0x2fb033b96ea70LL),real(0x5384f3e45a7a0LL),real(0x9f10eb531c1d0LL), real(0x154d17c994d480LL),real(0x36ab828088cb30LL), real(0xc1d47f99841160LL),real(0x65b5717bb21c290LL), -real(0x269fd1ef6edfa5c0LL),real(0x2dc2d3f3f9f963f0LL), -real(0xf46c321c1b54e0LL),-real(0x14642b52c5fe94b0LL), real(0x6b46a122c3b5c05LL),reale(3071,0xfdd7cc41833d5LL), // C4[0], coeff of eps^2, polynomial in n of order 21 real(0x65e46db33460LL),real(0x82b39a7b3380LL),real(0xa9e8c6cf36a0LL), real(0xe0317d0fa0c0LL),real(0x12cd0399df4e0LL),real(0x19b576ed17600LL), real(0x23ecb07d1c720LL),real(0x33785d3e48b40LL),real(0x4bedad56b0560LL), real(0x73f4d1eccb880LL),real(0xb8a5a1bdc07a0LL),real(0x1359aad161d5c0LL), real(0x22a518d96d25e0LL),real(0x43a50f3643bb00LL), real(0x95133a4d60b820LL),real(0x18b02de0f4e4040LL), real(0x5ac287501571660LL),real(0x31a5fa2db58d3d80LL), -reale(5087,0xbd2e8f8d6760LL),reale(6752,0x2ce8487308ac0LL), -reale(2184,0x86ffdb3446920LL),-real(0x199994ff919cd3b6LL), reale(21503,0xf0e695ca96ad3LL), // C4[0], coeff of eps^1, polynomial in n of order 22 real(0xd0da1980ba0LL),real(0x10803fb20d70LL),real(0x151a70ced0c0LL), real(0x1b569dc61a10LL),real(0x23ecd2ce6de0LL),real(0x2ff80cba60b0LL), real(0x413672596700LL),real(0x5a7b8b75a550LL),real(0x8082f2984020LL), real(0xbb859b75abf0LL),real(0x11a6bf1637d40LL),real(0x1b9a143813890LL), real(0x2d2aacb8da260LL),real(0x4e2c5253a0f30LL),real(0x914a9e2ed3380LL), real(0x128a302f4ef3d0LL),real(0x2b2226f5e6b4a0LL), real(0x7a36190e0daa70LL),real(0x1e8d8643836a9c0LL), real(0x129e3dd12414f710LL),-reale(2184,0x86ffdb3446920LL), reale(3276,0xca7fc8ce69db0LL),-real(0x5999897e7da4e4fdLL), reale(7167,0xfaf78743878f1LL), // C4[0], coeff of eps^0, polynomial in n of order 23 real(0x71a68037fdf14LL),real(0x81ebac5d53b48LL),real(0x957440e8ac5fcLL), real(0xad1ce56088670LL),real(0xca0c260c189e4LL),real(0xedd10e292f598LL), real(0x11a912af9e18ccLL),real(0x1534f4af92bec0LL), real(0x19c5b078ed00b4LL),real(0x1fc05a701dd7e8LL), real(0x27bd1031afaf9cLL),real(0x32a7dc61183710LL), real(0x41fc58560eb384LL),real(0x583759590a1238LL), real(0x79bd058a3bfa6cLL),real(0xaecdc650561f60LL), real(0x108312ea2251254LL),real(0x1abbd57b12fd488LL), real(0x2fbd21c97d5693cLL),real(0x634bf45b6b1a7b0LL), real(0x11110dffb6688d24LL),real(0x666653fe46734ed8LL), -reale(5734,0x625f9f69393f4LL),reale(14335,0xf5ef0e870f1e2LL), reale(21503,0xf0e695ca96ad3LL), // C4[1], coeff of eps^23, polynomial in n of order 0 3401,real(512475075), // C4[1], coeff of eps^22, polynomial in n of order 1 -5479232,3837834,real(163889528985LL), // C4[1], coeff of eps^21, polynomial in n of order 2 -real(1286021216),real(571443856),real(142575393),real(0xef8343fb2e1LL), // C4[1], coeff of eps^20, polynomial in n of order 3 -real(237999188352LL),real(138477414656LL),-real(77042430080LL), real(53211242700LL),real(0x6119423638485LL), // C4[1], coeff of eps^19, polynomial in n of order 4 -real(0x2066cb6031fc0LL),real(0x14c85e7394470LL),-real(0xf6b8f35571e0LL), real(0x6ad3f08040d0LL),real(0x1aa3b2832565LL),real(0x230f8ed873f29c63LL), // C4[1], coeff of eps^18, polynomial in n of order 5 -real(0x33e9644cad5b40LL),real(0x22b6849ca6a500LL), -real(0x1ce364ad2a4ec0LL),real(0x104aaed8cf4680LL), -real(0x949f0f8a89e40LL),real(0x64bcf4df920c2LL), reale(9215,0xf98764c489b7fLL), // C4[1], coeff of eps^17, polynomial in n of order 6 -real(0x50a85b2e2e4060LL),real(0x36bb9aa442c6f0LL), -real(0x3029aafbbe0440LL),real(0x1dc29c0bd6ce90LL), -real(0x16a422844d9020LL),real(0x9763b8d8ca030LL), real(0x25b8d7edff7ebLL),reale(9215,0xf98764c489b7fLL), // C4[1], coeff of eps^16, polynomial in n of order 7 -real(0x3822c174e5c7e00LL),real(0x25fbaf973d78c00LL), -real(0x222a860fbdb7a00LL),real(0x15dabd7a0984800LL), -real(0x129f00215535600LL),real(0xa0e9e0ae9b8400LL), -real(0x5ee97a6d2d5200LL),real(0x3eaf5acabd0e30LL), reale(64511,0xd2b3c15fc4079LL), // C4[1], coeff of eps^15, polynomial in n of order 8 -real(0x5ec1dcd7666b480LL),real(0x3ed4935a3fd8cd0LL), -real(0x38014f5e5d79960LL),real(0x240af6a53256570LL), -real(0x2049d0fb0404a40LL),real(0x12efbc065d3f410LL), -real(0xee9d804d5d8320LL),real(0x5ed209adebbcb0LL), real(0x1798ea7fdd6773LL),reale(64511,0xd2b3c15fc4079LL), // C4[1], coeff of eps^14, polynomial in n of order 9 -real(0x19f69929deb8bc0LL),real(0x1054723730b1600LL), -real(0xdce6aeb616e040LL),real(0x8c0069813d6480LL), -real(0x7e59f70027c8c0LL),real(0x4bea01551feb00LL), -real(0x42bb28790cad40LL),real(0x21dd61f97d4180LL), -real(0x14f93d4343f5c0LL),real(0xd58968a8df35eLL), reale(9215,0xf98764c489b7fLL), // C4[1], coeff of eps^13, polynomial in n of order 10 -real(0x1ecd4a3794400de0LL),real(0x101df33ec1bb0110LL), -real(0xbc64ec7794b2980LL),real(0x71d5f4e2a637ff0LL), -real(0x625888ecafc7520LL),real(0x3aa6879742ff4d0LL), -real(0x3585f7f60d164c0LL),real(0x1d18174ef21abb0LL), -real(0x18117eb39416c60LL),real(0x8df7a42ab2f090LL), real(0x23413de9276581LL),reale(64511,0xd2b3c15fc4079LL), // C4[1], coeff of eps^12, polynomial in n of order 11 -real(0x113775cb09582880LL),real(0x5790112bb17c4700LL), -real(0x204e01ed2b929d80LL),real(0x1063af9e8d99cc00LL), -real(0xc3ef805036ada80LL),real(0x701a56aa2d31100LL), -real(0x63910631abdcf80LL),real(0x368e0c562512600LL), -real(0x31ed34307286c80LL),real(0x170e89cb9dd1b00LL), -real(0xf5f0efdd07a180LL),real(0x93fb623bde75e4LL), reale(64511,0xd2b3c15fc4079LL), // C4[1], coeff of eps^11, polynomial in n of order 12 real(0x13635f7860ae69c0LL),-real(0x169d904d9d4691d0LL), -real(0x2254277308cd9e0LL),real(0xd20446e8d8a9710LL), -real(0x4df2aedeefd1980LL),real(0x25e2aff2baec9f0LL), -real(0x1d3856fa2b08920LL),real(0xf7cadc640f92d0LL), -real(0xe3d2f6c9ad5cc0LL),real(0x6e412eaf297db0LL), -real(0x62000ef613c860LL),real(0x201266fb021690LL), real(0x7ee4c480c21e1LL),reale(9215,0xf98764c489b7fLL), // C4[1], coeff of eps^10, polynomial in n of order 13 -real(0x5fe482817c4c40LL),-real(0x3373730b4b79d00LL), real(0x140f919171472640LL),-real(0x17f10e5417ef9980LL), -real(0x1b454cf244cf340LL),real(0xdd42319af5c0200LL), -real(0x530205145e450c0LL),real(0x25eec00584a7d80LL), -real(0x1e9e562555aaa40LL),real(0xe85806d73b2100LL), -real(0xde44387c5bb7c0LL),real(0x581f06023d3480LL), -real(0x421ccd71c33140LL),real(0x245ff7208ef53aLL), reale(9215,0xf98764c489b7fLL), // C4[1], coeff of eps^9, polynomial in n of order 14 -real(0x47f3709eaa4320LL),-real(0xbb640bc2e1ae70LL), -real(0x2a7854a3ead7b40LL),-real(0x1701de8d91314210LL), reale(2329,0x5f8472b9624a0LL),-reale(2855,0xe7c1182872fb0LL), -real(0x785bf95be998780LL),real(0x66690260b30024b0LL), -real(0x272595745774a3a0LL),real(0x104f772bee315710LL), -real(0xe11ad02f34b53c0LL),real(0x5a192e055800370LL), -real(0x58d8bfb781fbbe0LL),real(0x17a156426e4c5d0LL), real(0x5c88907e67c575LL),reale(64511,0xd2b3c15fc4079LL), // C4[1], coeff of eps^8, polynomial in n of order 15 -real(0x1138d3e7324700LL),-real(0x210a1008a4f200LL), -real(0x47b7d2285e8500LL),-real(0xbbe3dba17a1400LL), -real(0x2aeb63e9e4cb300LL),-real(0x1781d8a9c80b7600LL), reale(2419,0xe4212c9be8f00LL),-reale(3063,0xd7c230ad9b800LL), -real(0x116171a56015f00LL),real(0x6cc31b4079da8600LL), -real(0x2af22cc657d11d00LL),real(0xf75e4ec12d0a400LL), -real(0xeb60cc0dd754b00LL),real(0x472a49a74880200LL), -real(0x4174f343c328900LL),real(0x1ed324af4f2fd18LL), reale(64511,0xd2b3c15fc4079LL), // C4[1], coeff of eps^7, polynomial in n of order 16 -real(0xd56426d4f700LL),-real(0x15fa65017d450LL), -real(0x26ba18ad11e20LL),-real(0x4a9605f1a58f0LL), -real(0xa2b494aee2940LL),-real(0x1ad07f38fd2390LL), -real(0x62deb836d71c60LL),-real(0x36d68c47bf27830LL), real(0x167d3fa4abc50480LL),-real(0x1d9b2fd161b99ad0LL), real(0x13a59aea9293560LL),real(0x10886ca52ccf3090LL), -real(0x6e8a4c27dbf8dc0LL),real(0x1f02cd8f1f8a5f0LL), -real(0x2216230a1ac48e0LL),real(0x5f13c815b08150LL), real(0x1666b06ca8f56dLL),reale(9215,0xf98764c489b7fLL), // C4[1], coeff of eps^6, polynomial in n of order 17 -real(0x2678d0ed9f140LL),-real(0x39d0dbe263c00LL), -real(0x5aa623a5216c0LL),-real(0x95d2f30c44880LL), -real(0x108ea4db631840LL),-real(0x2005d27e0acd00LL), -real(0x463ad5e0e22dc0LL),-real(0xba80ab02c40180LL), -real(0x2b67c47d5d48f40LL),-real(0x186d6a49f7da1e00LL), reale(2625,0x9832921f08b40LL),-reale(3627,0xa72ee4675a80LL), real(0x17be252bac67e9c0LL),real(0x7a8f5366d9ba1100LL), -real(0x38a15d77b043abc0LL),real(0x9cd4e0bf35fec80LL), -real(0xceae5004f176d40LL),real(0x479bb2ae3c01ddaLL), reale(64511,0xd2b3c15fc4079LL), // C4[1], coeff of eps^5, polynomial in n of order 18 -real(0x11dc9e54dea60LL),-real(0x193ec5647cdf0LL), -real(0x24bda460ceb00LL),-real(0x3760182d9a010LL), -real(0x5717ea0e54ba0LL),-real(0x907095ecddc30LL), -real(0x10063188dee040LL),-real(0x1f228e862f9650LL), -real(0x44adcde9a37ce0LL),-real(0xb7cbf8f2d0e270LL), -real(0x2b3f803c770f580LL),-real(0x18c05d008644d490LL), reale(2737,0x3ce4b1d74e1e0LL),-reale(4017,0xdf79eceb980b0LL), real(0x30ac41edd5123540LL),real(0x7e3ade121a8e0530LL), -real(0x45ec5d28a0fecf60LL),real(0x3577aaf625fa910LL), real(0x7292b77d2ccfc9LL),reale(64511,0xd2b3c15fc4079LL), // C4[1], coeff of eps^4, polynomial in n of order 19 -real(0x14469ef39280LL),-real(0x1b74a6d65900LL),-real(0x25fc6724f380LL), -real(0x35e25bf6c800LL),-real(0x4eb76c6a3c80LL),-real(0x771a92ddb700LL), -real(0xbc1644489d80LL),-real(0x13946cde25600LL), -real(0x22eaf36054680LL),-real(0x44349dbbbd500LL), -real(0x976a625a56780LL),-real(0x1989ef99e16400LL), -real(0x6150e2c16e3080LL),-real(0x38c68feccea3300LL), real(0x1963a1a8e71b2e80LL),-real(0x2849f713f5ed7200LL), real(0xd30bac57bb18580LL),real(0x105e1a36741daf00LL), -real(0xc8c696e03b05b80LL),real(0x1feab31d626d154LL), reale(9215,0xf98764c489b7fLL), // C4[1], coeff of eps^3, polynomial in n of order 20 -real(0xa4172dfa1c0LL),-real(0xd77fb109ed0LL),-real(0x11fc3eda7860LL), -real(0x1879b9235cf0LL),-real(0x2209eb95db00LL),-real(0x308bcfa5f110LL), -real(0x47510fa29da0LL),-real(0x6c88ffcf6f30LL),-real(0xac6dd3019440LL), -real(0x120fcca63eb50LL),-real(0x206b8121592e0LL), -real(0x3fc3a9ace7970LL),-real(0x8ea4f3b556d80LL), -real(0x18488ccc5b2d90LL),-real(0x5db9d9787df820LL), -real(0x37d6c7544511bb0LL),real(0x1a02f9f8abfbf940LL), -real(0x2d9fe91163ac57d0LL),real(0x18b01234447992a0LL), real(0x46ed1c414c80a10LL),-real(0x57c56c90ceabfa7LL), reale(9215,0xf98764c489b7fLL), // C4[1], coeff of eps^2, polynomial in n of order 21 -real(0x2271f7278cc0LL),-real(0x2c3f5c6ec900LL),-real(0x399dc5a18140LL), -real(0x4c2bebb96280LL),-real(0x6670101499c0LL),-real(0x8c75450f5400LL), -real(0xc4e9f8733e40LL),-real(0x11b3ff75a0580LL), -real(0x1a3e7cf3fd6c0LL),-real(0x2853a9e02df00LL), -real(0x40b8bca6ccb40LL),-real(0x6da2a9d234880LL), -real(0xc6fc7477c83c0LL),-real(0x18bdddb834aa00LL), -real(0x37ff6cf7616840LL),-real(0x9a5f4811c06b80LL), -real(0x25bde21729de0c0LL),-real(0x16ea24b2a28ff500LL), reale(2841,0x69c686bdbaac0LL),-reale(5560,0x9d73ff6dcae80LL), reale(4369,0xdffb6688d240LL),-real(0x4cccbefeb4d67b22LL), reale(64511,0xd2b3c15fc4079LL), // C4[1], coeff of eps^1, polynomial in n of order 22 -real(0xd0da1980ba0LL),-real(0x10803fb20d70LL),-real(0x151a70ced0c0LL), -real(0x1b569dc61a10LL),-real(0x23ecd2ce6de0LL),-real(0x2ff80cba60b0LL), -real(0x413672596700LL),-real(0x5a7b8b75a550LL),-real(0x8082f2984020LL), -real(0xbb859b75abf0LL),-real(0x11a6bf1637d40LL), -real(0x1b9a143813890LL),-real(0x2d2aacb8da260LL), -real(0x4e2c5253a0f30LL),-real(0x914a9e2ed3380LL), -real(0x128a302f4ef3d0LL),-real(0x2b2226f5e6b4a0LL), -real(0x7a36190e0daa70LL),-real(0x1e8d8643836a9c0LL), -real(0x129e3dd12414f710LL),reale(2184,0x86ffdb3446920LL), -reale(3276,0xca7fc8ce69db0LL),real(0x5999897e7da4e4fdLL), reale(64511,0xd2b3c15fc4079LL), // C4[2], coeff of eps^23, polynomial in n of order 0 10384,real(854125125), // C4[2], coeff of eps^22, polynomial in n of order 1 real(61416608),15713412,real(0x35f1be97217LL), // C4[2], coeff of eps^21, polynomial in n of order 2 real(1053643008),-real(709188480),real(436906360),real(0x18f301bf7f77LL), // C4[2], coeff of eps^20, polynomial in n of order 3 real(0x45823cb069c0LL),-real(0x3dc56cd10180LL),real(0x15b4532d4340LL), real(0x5946b207ad8LL),real(0xf72bf6e15a9abe5LL), // C4[2], coeff of eps^19, polynomial in n of order 4 real(0x1b1b08a8c6e00LL),-real(0x1a1dea5249180LL),real(0xc1b857255700LL), -real(0x8a94db95d080LL),real(0x5209b9749ec8LL), real(0x3a6f4368c13f04a5LL), // C4[2], coeff of eps^18, polynomial in n of order 5 real(0x13c972f90d64d60LL),-real(0x12d8369dbbbb080LL), real(0xa013fa80d7c1a0LL),-real(0x95d1a2bb4de840LL), real(0x30a495fb9aa5e0LL),real(0xc95efc891d64cLL), reale(107519,0xb480ecf4f161fLL), // C4[2], coeff of eps^17, polynomial in n of order 6 real(0x4b31e4eff4bc00LL),-real(0x4190c8b5d5de00LL), real(0x27770ac0842800LL),-real(0x270a0d33995200LL), real(0x10c9f01b859400LL),-real(0xd056352974600LL), real(0x74f9dc1f6f260LL),reale(15359,0xf536fd4790329LL), // C4[2], coeff of eps^16, polynomial in n of order 7 real(0x39908ef33285d00LL),-real(0x2a7d467835cbe00LL), real(0x1e0505551ade700LL),-real(0x1bf3204cf26d400LL), real(0xe195527d96f100LL),-real(0xe0af5ccd52ea00LL), real(0x41681113e87b00LL),real(0x1112b429bab2a0LL), reale(107519,0xb480ecf4f161fLL), // C4[2], coeff of eps^15, polynomial in n of order 8 real(0xf8fa0142055000LL),-real(0x8f8aa7832e8a00LL), real(0x7d6f3ddfb47c00LL),-real(0x62d1e182b7be00LL), real(0x3bb149eddea800LL),-real(0x3be3b3e26a7200LL), real(0x175d0d17dad400LL),-real(0x14371cfc4fa600LL), real(0xa8f8f5855a060LL),reale(15359,0xf536fd4790329LL), // C4[2], coeff of eps^14, polynomial in n of order 9 real(0x21490cd145715e0LL),-real(0xe087822f191900LL), real(0xf91f2bb3d29820LL),-real(0x949428c90dc2c0LL), real(0x7371ad50b34a60LL),-real(0x63c52e9a850c80LL), real(0x301579a22c8ca0LL),-real(0x33552a69ca1640LL), real(0xcc2c8c733bee0LL),real(0x35f5f30acfbecLL), reale(15359,0xf536fd4790329LL), // C4[2], coeff of eps^13, polynomial in n of order 10 real(0x29bb6acaa073ef00LL),-real(0xc930d526d728e80LL), real(0xf55c2b3103d0c00LL),-real(0x63b9281a5449980LL), real(0x6acdfd5dbb92900LL),-real(0x441c8fce3be0480LL), real(0x2be797a45cb8600LL),-real(0x2aec3395f438f80LL), real(0xec70ff5d376300LL),-real(0xedc27143c9fa80LL), real(0x7039bcd0124e68LL),reale(107519,0xb480ecf4f161fLL), // C4[2], coeff of eps^12, polynomial in n of order 11 -real(0x17ce935fc610ad40LL),-real(0x5d5bbde81a902580LL), real(0x2dcc12fb45c89240LL),-real(0xc1c61e98a479e00LL), real(0x10183633a5ddf1c0LL),-real(0x672de318faa1680LL), real(0x64ee85310393140LL),-real(0x481cf983db0cf00LL), real(0x2299f24f52810c0LL),-real(0x271fc56086d0780LL), real(0x79dac155045040LL),real(0x20c44d35dada38LL), reale(107519,0xb480ecf4f161fLL), // C4[2], coeff of eps^11, polynomial in n of order 12 -real(0x6b8bdbaa2666e600LL),reale(2706,0x6d4e4332c7e80LL), -real(0x201eb2939ffc7500LL),-real(0x605f6d97c740b880LL), real(0x32fb1ca66ccebc00LL),-real(0xb85f2dd585e0f80LL), real(0x10b7dbe9dec0ed00LL),-real(0x6e454f6a0fd4680LL), real(0x594f6f139205e00LL),-real(0x4c204810d601d80LL), real(0x16a875347934f00LL),-real(0x1be72589c185480LL), real(0xb5a396e2ccd788LL),reale(107519,0xb480ecf4f161fLL), // C4[2], coeff of eps^10, polynomial in n of order 13 real(0x332d666e095e20LL),real(0x205e97ebfb32780LL), -real(0xf80bf36cd359f20LL),real(0x19615ff8d71e0640LL), -real(0x61aef235a414c60LL),-real(0xe1fda0393083b00LL), real(0x83e2ad192fc7660LL),-real(0x18ece140ef0fc40LL), real(0x26bbb213037c920LL),-real(0x11a4c9418dd9d80LL), real(0x9ec708de66cbe0LL),-real(0xaee5994e9b7ec0LL), real(0x1626e135e59ea0LL),real(0x610ef2b6b35c4LL), reale(15359,0xf536fd4790329LL), // C4[2], coeff of eps^9, polynomial in n of order 14 real(0x1b709db1871200LL),real(0x51a2a024c26b00LL), real(0x157c554050bb400LL),real(0xddb41f944653d00LL), -real(0x6d182f563006aa00LL),reale(2991,0xf7eb0ae304f00LL), -real(0x387b65599c618800LL),-real(0x64242336a83ddf00LL), real(0x4282c6eaa3899a00LL),-real(0xa8fc3afb1e6cd00LL), real(0x1040dddbf0493c00LL),-real(0x9184bc07b2bfb00LL), real(0x281ea22622bde00LL),-real(0x3dc59bc648ee900LL), real(0x13fb78815b4ca90LL),reale(107519,0xb480ecf4f161fLL), // C4[2], coeff of eps^8, polynomial in n of order 15 real(0xacc0646b5180LL),real(0x1753663f74b00LL),real(0x3994d0061e480LL), real(0xadc1fbdd72e00LL),real(0x2e87a44adab780LL), real(0x1eaeb3451821100LL),-real(0xf937e414930b580LL), real(0x1c27d8b21df37400LL),-real(0xaa5908f76fee280LL), -real(0xe1c8d327ee92900LL),real(0xb2675f22d49b080LL), -real(0x19e66cd66684600LL),real(0x1f3a47aa5ea8380LL), -real(0x18da246c74e6300LL),real(0x10dd3b80dd1680LL), real(0x3f21f272d2a30LL),reale(15359,0xf536fd4790329LL), // C4[2], coeff of eps^7, polynomial in n of order 16 real(0x2957d7da1000LL),real(0x4c28ba8a3700LL),real(0x9714a6610e00LL), real(0x14a5ff52a4500LL),real(0x33af2f78d8c00LL),real(0x9e87298409300LL), real(0x2b4e15dbd10a00LL),real(0x1d4c6da210ea100LL), -real(0xf6c4a6847e2f800LL),real(0x1da98c51a6b5ef00LL), -real(0xe1270d810dcfa00LL),-real(0xd23a021f3080300LL), real(0xd3b280b26948400LL),-real(0x22fd890d309b500LL), real(0x119ef453c630200LL),-real(0x1959af9980da700LL), real(0x5959078fa70870LL),reale(15359,0xf536fd4790329LL), // C4[2], coeff of eps^6, polynomial in n of order 17 real(0x511612baa2a0LL),real(0x87a79de92a00LL),real(0xee2dd20af160LL), real(0x1bbcfaf32f4c0LL),real(0x37ba524fb5020LL),real(0x7b9b8f2a45f80LL), real(0x13a76fcf6fdee0LL),real(0x3d717a0fbe0a40LL), real(0x112dc752f02bda0LL),real(0xbfa002cc4689500LL), -real(0x694405622017f3a0LL),reale(3484,0x979f3cbb89fc0LL), -reale(2088,0x4fe2045ae14e0LL),-real(0x49f87439584d3580LL), real(0x6c3e90c1455479e0LL),-real(0x1afff07538f04ac0LL), -real(0x1a0f4cdf3b62760LL),-real(0x112f9b85f9ebf7cLL), reale(107519,0xb480ecf4f161fLL), // C4[2], coeff of eps^5, polynomial in n of order 18 real(0x181437e05500LL),real(0x25c7b1fe6a80LL),real(0x3d5ebd606800LL), real(0x67dd27f0e580LL),real(0xb8ac7d2a7b00LL),real(0x15ce71e5cc080LL), real(0x2c7c6a3654e00LL),real(0x6460c05d0bb80LL),real(0x1046637cd7a100LL), real(0x340d46956b9680LL),real(0xef5f1bde883400LL), real(0xacec6aed73c1180LL),-real(0x63ea680d7ea23900LL), reale(3605,0xecc3861a0ec80LL),-reale(2759,0xc804a6c40e600LL), -real(0x212a787bd0571880LL),real(0x70c6a0884332ed00LL), -real(0x31a5fa2db58d3d80LL),real(0x5033807138f7d98LL), reale(107519,0xb480ecf4f161fLL), // C4[2], coeff of eps^4, polynomial in n of order 19 real(0x6f3f0983c40LL),real(0xa6cf9192980LL),real(0x100e50e166c0LL), real(0x197f658cec00LL),real(0x29f706a6f140LL),real(0x480b7a0eae80LL), real(0x821ecd9c1bc0LL),real(0xfa1d1da0b100LL),real(0x2081a78802640LL), real(0x4aefd4add3380LL),real(0xc730805b650c0LL),real(0x28f491e04e7600LL), real(0xc2d07512dddb40LL),real(0x92e539684c6b880LL), -real(0x5a2096cfc695fa40LL),reale(3598,0x9cd1e91b83b00LL), -reale(3553,0x1d49601c5efc0LL),real(0x31a5fa2db58d3d80LL), real(0x3760835a5e313ac0LL),-real(0x1bed5cb9b61f7298LL), reale(107519,0xb480ecf4f161fLL), // C4[2], coeff of eps^3, polynomial in n of order 20 real(273006835200LL),real(395945493120LL),real(586817304320LL), real(891220401024LL),real(0x1440886f800LL),real(0x20a73015480LL), real(0x36a4a027900LL),real(0x5f8b4acad80LL),real(0xb01798c3a00LL), real(0x15a2eb8a6680LL),real(0x2e235b147b00LL),real(0x6d6a30f2bf80LL), real(0x12c54474b7c00LL),real(0x40129870df880LL),real(0x13e41ecc817d00LL), real(0xfcf67c8cf45180LL),-real(0xa65f288fe794200LL), real(0x1cea83a477ce0a80LL),-real(0x240239aaff748100LL), real(0x1547221396f36380LL),-real(0x4e04d247d427178LL), reale(15359,0xf536fd4790329LL), // C4[2], coeff of eps^2, polynomial in n of order 21 real(317370445920LL),real(448806691200LL),real(646426411680LL), real(950282020800LL),real(0x14ccaecc4e0LL),real(0x201acdf4e00LL), real(0x33093819720LL),real(0x53ed06eb440LL),real(0x8f8eb441960LL), real(0x1013bf0bfa80LL),real(0x1e750d7baba0LL),real(0x3dc4346800c0LL), real(0x88729901ade0LL),real(0x150e863aba700LL),real(0x3c89c1e8d8020LL), real(0xd9efed463cd40LL),real(0x47e39644808260LL), real(0x3d1b0c8706d5380LL),-real(0x2af704cef0cdeb60LL), real(0x7c1ef17245e119c0LL),-reale(2184,0x86ffdb3446920LL), real(0x333329ff2339a76cLL),reale(107519,0xb480ecf4f161fLL), // C4[3], coeff of eps^23, polynomial in n of order 0 70576,real(29211079275LL), // C4[3], coeff of eps^22, polynomial in n of order 1 -real(31178752),real(16812224),real(0x192c8c2464fLL), // C4[3], coeff of eps^21, polynomial in n of order 2 -real(135977211392LL),real(37023086848LL),real(9903771944LL), real(0xb98f5d0044051LL), // C4[3], coeff of eps^20, polynomial in n of order 3 -real(0x30f8b0f5c00LL),real(0x12d79f66800LL),-real(0x115c7023400LL), real(606224480400LL),real(0xa7c6f527b4f7c7LL), // C4[3], coeff of eps^19, polynomial in n of order 4 -real(0x3317d68847dc00LL),real(0x19fc69dd236700LL), -real(0x1c6d14df7ace00LL),real(0x6cfe4fac52d00LL), real(0x1d99f24357808LL),reale(30105,0x847604e86c8c1LL), // C4[3], coeff of eps^18, polynomial in n of order 5 -real(0x15b0eba45ef8000LL),real(0xf79bdd24a10000LL), -real(0xf32a8559288000LL),real(0x563281b24a8000LL), -real(0x5920796c2f8000LL),real(0x29f7b73471c480LL), reale(150527,0x964e188a1ebc5LL), // C4[3], coeff of eps^17, polynomial in n of order 6 -real(0x1c02d0336ef1800LL),real(0x1d91ba24525dc00LL), -real(0x163d203e4811000LL),real(0xb8e8b252aa8400LL), -real(0xd2485de6110800LL),real(0x2a40e341b4ac00LL), real(0xbb70f2cbcf360LL),reale(150527,0x964e188a1ebc5LL), // C4[3], coeff of eps^16, polynomial in n of order 7 -real(0x58b4aa16ae3000LL),real(0x7fa0a14380e000LL), -real(0x429ab6e3829000LL),real(0x383428ed0d4000LL), -real(0x32e93ebd99f000LL),real(0x108fe88bbda000LL), -real(0x13ba86ffa65000LL),real(0x868b4ab8e3340LL), reale(21503,0xf0e695ca96ad3LL), // C4[3], coeff of eps^15, polynomial in n of order 8 -real(0xaedfc7febee000LL),real(0xe403ca9386ec00LL), -real(0x5568aa53f7a800LL),real(0x76f3d9af940400LL), -real(0x475f28b7bb7000LL),real(0x29018461d69c00LL), -real(0x2ed89591f13800LL),real(0x74380445fb400LL), real(0x21274712bcba0LL),reale(21503,0xf0e695ca96ad3LL), // C4[3], coeff of eps^14, polynomial in n of order 9 -real(0x231ca125e5c8000LL),real(753027184687LL<<17), -real(0x97f88531f38000LL),real(0xee839ade908000LL), -real(0x572a9cdd748000LL),real(0x65a05d4f5f0000LL), -real(0x4ce11756538000LL),real(0x177f524c958000LL), -real(0x20e57338048000LL),real(0xc4518e260f380LL), reale(21503,0xf0e695ca96ad3LL), // C4[3], coeff of eps^13, polynomial in n of order 10 -real(0x44ebd4477ad4f200LL),real(0x9a6a6024b320f00LL), -real(0xe915ce102d6a800LL),real(0xb28d5273bcee100LL), -real(0x37fa968ec235e00LL),real(0x68974b850671300LL), -real(0x2a735b9bf505400LL),real(0x20513dd7a7f6500LL), -real(0x220360a9be2ca00LL),real(0x36d1c1a3f49700LL), real(0x10369a2227fd98LL),reale(150527,0x964e188a1ebc5LL), // C4[3], coeff of eps^12, polynomial in n of order 11 real(0x52462bb828351400LL),real(0x4a4d1c14e6172800LL), -real(0x4ced32c430d22400LL),real(0xb52b1b0c2492000LL), -real(0xd058359466b1c00LL),real(0xd07709dd3bd1800LL), -real(0x30072e56aae5400LL),real(0x605c027d5629000LL), -real(0x32e58b8ebb44c00LL),real(0x108221f23a90800LL), -real(0x1a7ac7295958400LL),real(0x836be4086f28d0LL), reale(150527,0x964e188a1ebc5LL), // C4[3], coeff of eps^11, polynomial in n of order 12 real(0x48f7bc8748dd3400LL),-reale(2561,0x7f9f9673a4700LL), real(0x601d0ed1c7f2b600LL),real(0x449204e4f86d4300LL), -real(0x56194f80f81a8800LL),real(0xea108cfa6f6ed00LL), -real(0xa7ad46bd016c600LL),real(0xef32c344e507700LL), -real(0x30a1762ff0e4400LL),real(0x4a78ea25c4fa100LL), -real(0x3c3cca9d1bd4200LL),real(0x22cbd76a022b00LL), real(0x9df3abb037278LL),reale(150527,0x964e188a1ebc5LL), // C4[3], coeff of eps^10, polynomial in n of order 13 -real(0x9607df2a17c000LL),-real(0x739371b7f3d8000LL), real(0x4688c366039fc000LL),-reale(2611,0x8a66cbfc04000LL), real(0x7056fbc7b1c24000LL),real(0x3af7506941670000LL), -real(0x601cadbaecf24000LL),real(0x14affbea17164000LL), -real(0x6daccbfd0bfc000LL),real(0x1036680bb42b8000LL), -real(0x42f04a7d6e84000LL),real(0x246d9b6ab84c000LL), -real(0x37cce3b53adc000LL),real(0xd43660c7def0c0LL), reale(150527,0x964e188a1ebc5LL), // C4[3], coeff of eps^9, polynomial in n of order 14 -real(0x115a7e31ff400LL),-real(0x3c90c47c29600LL), -real(0x1311ab10640800LL),-real(0xf2246746703a00LL), real(0x99b5e8c5c68e400LL),-real(0x179a6d9c8ead9e00LL), real(0x12bd250608495000LL),real(0x63777cc9563be00LL), -real(0xf1ef7972c204400LL),real(0x47367775d725a00LL), -real(0x63378c7bb15800LL),real(0x22d63078c5cb600LL), -real(0xf8707c83e76c00LL),-real(0xb0e06786eae00LL), -real(0x5e4438ea922f0LL),reale(21503,0xf0e695ca96ad3LL), // C4[3], coeff of eps^8, polynomial in n of order 15 -real(0x1fe011d85800LL),-real(0x4f422fb05000LL),-real(0xe40060fc8800LL), -real(0x32e664e9c2000LL),-real(0x1078ec0ef63800LL), -real(0xd864902b71f000LL),real(0x8fab71292d19800LL), -real(0x179bbec0170ac000LL),real(0x15c925f1e4f1e800LL), real(0x2c36e0d96c07000LL),-real(0x100d07856dfe4800LL), real(0x6d9c3efea16a000LL),-real(0x13ac4a3567f800LL), real(0x15b22a4de1ed000LL),-real(0x1452d18e2b42800LL), real(0x32eab893d697a0LL),reale(21503,0xf0e695ca96ad3LL), // C4[3], coeff of eps^7, polynomial in n of order 16 -real(0x5003ad66000LL),-real(0xa79ae296200LL),-real(0x17d9e9f5d400LL), -real(0x3c8762ad2600LL),-real(0xb232a56ac800LL),-real(0x28dbf6ee52a00LL), -real(0xda6199e36bc00LL),-real(0xba74c6aa46ee00LL), real(0x825959cb764d000LL),-real(0x17232e4c4e57f200LL), real(0x190bf0598fc65c00LL),-real(0x27c51cb844db600LL), -real(0xf8735fc98339800LL),real(0xa28217eef524600LL), -real(0xfc87c9cb4a8c00LL),-real(0x3228ffc0ed7e00LL), -real(0x387bf611406670LL),reale(21503,0xf0e695ca96ad3LL), // C4[3], coeff of eps^6, polynomial in n of order 17 -real(0x62d694dc000LL),-real(97716157LL<<17),-real(0x173b38f24000LL), -real(0x319b0ca1c000LL),-real(0x7361a893c000LL),-real(0x12be5bef38000LL), -real(0x38b3402cc4000LL),-real(0xd6a4403694000LL), -real(0x4a69cc1535c000LL),-real(0x42816c266fd0000LL), real(0x315cb6a39d95c000LL),-reale(2449,0xcf91c36a8c000LL), reale(3143,0x2391393fc4000LL),-real(0x466890d45f668000LL), -real(0x50368754849c4000LL),real(0x594b313771cfc000LL), -real(0x1cc16f4e99cdc000LL),real(0x1e8d8643836a9c0LL), reale(150527,0x964e188a1ebc5LL), // C4[3], coeff of eps^5, polynomial in n of order 18 -real(0x1136c8f5600LL),-real(0x1e3b013df00LL),-real(0x37550c23000LL), -real(0x6a508e10100LL),-real(0xd872daf0a00LL),-real(0x1d8dd6618300LL), -real(0x468422b6a400LL),-real(0xbc9d06f02500LL),-real(0x24d784d09be00LL), -real(0x90d122dffa700LL),-real(0x347ca809f91800LL), -real(0x31861ec3b2ac900LL),real(0x276d051382ba8e00LL), -reale(2163,0x55347fa444b00LL),reale(3319,0x8d7da907400LL), -reale(2191,0xdbae56666ed00LL),-real(0x47e396448082600LL), real(0x3577aaf625fa9100LL),-real(0x1449fb28d544cb98LL), reale(150527,0x964e188a1ebc5LL), // C4[3], coeff of eps^4, polynomial in n of order 19 -real(58538142720LL),-real(97662466048LL),-real(168340530176LL), -real(301206585344LL),-real(562729180160LL),-real(0x1017e988800LL), -real(0x21987b95400LL),-real(0x4b78a99d000LL),-real(0xb9ccd9f8c00LL), -real(0x202de3701800LL),-real(0x68b6655d0400LL),-real(0x1af3df037e000LL), -real(0xa515b5f563c00LL),-real(0xa65924698da800LL), real(0x8fc72c890104c00LL),-real(0x226e597c6e0df000LL), real(0x3ee7237bf0721400LL),-real(0x3d1b0c8706d53800LL), real(0x1e8d8643836a9c00LL),-real(0x634bf45b6b1a7b0LL), reale(50175,0xdcc4b2d8b4e97LL), // C4[3], coeff of eps^3, polynomial in n of order 20 -real(16545868800LL),-real(26558972160LL),-real(43799006720LL), -real(74458311424LL),-real(131016159232LL),-real(239806362880LL), -real(459418505728LL),-real(928488660736LL),-real(0x1d19ea9f400LL), -real(0x43b761f2900LL),-real(0xad7cf6b5600LL),-real(0x1f71d9841300LL), -real(0x6bcf7c0df800LL),-real(0x1d7abbebd1d00LL), -real(0xc1b8d2e919a00LL),-real(0xd3e226aef40700LL), real(0xc94a0b2634a0400LL),-real(0x3577aaf625fa9100LL), real(0x6aef55ec4bf52200LL),-real(0x634bf45b6b1a7b00LL), real(0x22221bff6cd11a48LL),reale(150527,0x964e188a1ebc5LL), // C4[4], coeff of eps^23, polynomial in n of order 0 567424,real(87633237825LL), // C4[4], coeff of eps^22, polynomial in n of order 1 real(2135226368),real(598833664),real(0x1358168b64fd9LL), // C4[4], coeff of eps^21, polynomial in n of order 2 real(23101878272LL),-real(26986989568LL),real(11760203136LL), real(0x4f869592664b5LL), // C4[4], coeff of eps^20, polynomial in n of order 3 real(0xa4d4b674a00LL),-real(0xbdc38ed8400LL),real(0x20274dfee00LL), real(635330794560LL),real(0x436914c918b5d6dLL), // C4[4], coeff of eps^19, polynomial in n of order 4 real(0x481bf9079c000LL),-real(0x3c015f7917000LL),real(0x133447522e000LL), -real(0x195b19983d000LL),real(0xa0f15f7a8700LL), reale(3518,0xd3a367a37a66dLL), // C4[4], coeff of eps^18, polynomial in n of order 5 real(0x1e9f26efa689000LL),-real(0x100c94382c2c000LL), real(0xabead3c2e1f000LL),-real(0xc04c79a6f96000LL), real(0x18fb8548735000LL),real(0x76d40a3ef6c00LL), reale(193535,0x781b441f4c16bLL), // C4[4], coeff of eps^17, polynomial in n of order 6 real(0x780536a0606000LL),-real(0x28779739e97000LL), real(0x3a9fdf130c4000LL),-real(0x2860390cb81000LL), real(0xcce73d3902000LL),-real(0x1322aa5844b000LL), real(0x6bd0a3ad69900LL),reale(27647,0xec962e4d9d27dLL), // C4[4], coeff of eps^16, polynomial in n of order 7 real(0x45af61c2ad1f800LL),-real(0x1b140a5252fd000LL), real(0x348e789bd7f6800LL),-real(0x137ac7aed3be000LL), real(0x11da35dc2ded800LL),-real(0x12097ef153ff000LL), real(0x186b19645c4800LL),real(0x7935fe20ccb00LL), reale(193535,0x781b441f4c16bLL), // C4[4], coeff of eps^15, polynomial in n of order 8 real(0x788485be348000LL),-real(0xbf417480965000LL), real(0xbdad05e3bd6000LL),-real(0x306dcc448df000LL), real(0x6c08266aea4000LL),-real(0x364dbd52879000LL), real(0x13468d692f2000LL),-real(0x1f6575294f3000LL), real(0x97982d7211100LL),reale(27647,0xec962e4d9d27dLL), // C4[4], coeff of eps^14, polynomial in n of order 9 real(0x99754be5293000LL),-real(0x273b2ae73028000LL), real(0xa610233e31d000LL),-real(0x8ee7336f99e000LL), real(0xd7a1a110827000LL),-real(0x2f0d74b9c14000LL), real(0x4f375451ab1000LL),-real(0x4002b6db48a000LL), real(0x20d804cbbb000LL),real(0xa41d3b221400LL), reale(27647,0xec962e4d9d27dLL), // C4[4], coeff of eps^13, polynomial in n of order 10 real(0x6016f6408271a000LL),-real(0x1e7546e7a0d1b000LL), real(0x18e4e98f72c8000LL),-real(0x113f96068e695000LL), real(0x6af41cd57176000LL),-real(0x2590480c1d6f000LL), real(0x61253410a664000LL),-real(0x1c92661c6269000LL), real(0xfa686d5b4d2000LL),-real(0x188238347643000LL), real(0x60544135abb900LL),reale(193535,0x781b441f4c16bLL), // C4[4], coeff of eps^12, polynomial in n of order 11 -reale(2096,0xf9dac0e4d8600LL),-real(0xa96847f4d191400LL), real(0x644f115411ee9e00LL),-real(0x2912ee32dfa61000LL), -real(0x81eeabcb01be00LL),-real(0xfba8345c9670c00LL), real(0x9bbda8340726600LL),-real(0x11537009b3f0800LL), real(0x51c2ea8aa8c0a00LL),-real(0x2bb89caf7310400LL), -real(0x162bd9b163d200LL),-real(0xac0895744a3c0LL), reale(193535,0x781b441f4c16bLL), // C4[4], coeff of eps^11, polynomial in n of order 12 -real(0x296aa6e320b86000LL),real(0x7d9f9f72af514800LL), -reale(2284,0xfefdd7e855000LL),real(0x8d22edc50949800LL), real(0x6581767b41ffc000LL),-real(0x371ad32683bb1800LL), -real(0x915b5d6cd33000LL),-real(0xbce7db3a027c800LL), real(0xd0ebaf65b57e000LL),-real(0x1274db255bb7800LL), real(0x2970a5137d6f000LL),-real(0x30b8535f9002800LL), real(0x8fa21d365c3780LL),reale(193535,0x781b441f4c16bLL), // C4[4], coeff of eps^10, polynomial in n of order 13 real(0x73aaee373e800LL),real(0x6d942f05126000LL), -real(0x55d059f7fa72800LL),real(0x114ee97e0f335000LL), -real(0x16053fa9ce763800LL),real(0x4d23952dbcc4000LL), real(0xdda0de6f17eb800LL),-real(0xa56bf33e63ad000LL), real(0x90dadc83efa800LL),-real(0xbf52dd8df9e000LL), real(0x2172ab2d7549800LL),-real(0x85ae20f708f000LL), -real(0x10c904999a7800LL),-real(0xae78582fbfa00LL), reale(27647,0xec962e4d9d27dLL), // C4[4], coeff of eps^9, polynomial in n of order 14 real(0x19fde85a2f000LL),real(0x6b4aa2bef4800LL),real(0x28c46a7eab6000LL), real(0x2827ed076a87800LL),-real(0x210a7394d5283000LL), real(0x72396f4bbfb2a800LL),-reale(2620,0x4dc0771ddc000LL), real(0x40dce91ee367d800LL),real(0x52592d2deb84b000LL), -real(0x5a9bf1fdd05df800LL),real(0x10e48562d1f92000LL), real(0x1d4b91258bb3800LL),real(0xaa81c5529799000LL), -real(0x6eadf18b1729800LL),real(0xd0db43634fa080LL), reale(193535,0x781b441f4c16bLL), // C4[4], coeff of eps^8, polynomial in n of order 15 real(0x45bda664400LL),real(0xc8c97088800LL),real(0x2a5a46b84c00LL), real(0xb467fe915000LL),real(0x471c8a3c15400LL),real(0x49361b74ae1800LL), -real(0x3fb304ab7e4a400LL),real(0xedcc81cc3d0e000LL), -real(0x1834aac92fbf9c00LL),real(0xe864613c6aba800LL), real(0x759492ec34a6c00LL),-real(0xea1e49c1b0f9000LL), real(0x5db63d617b37400LL),real(0x31083890113800LL), -real(0xa60c227ea8400LL),-real(0x3b3da9a3dab180LL), reale(27647,0xec962e4d9d27dLL), // C4[4], coeff of eps^7, polynomial in n of order 16 real(469241266176LL),real(0x10545cac800LL),real(0x2adf04bd000LL), real(0x7eec6985800LL),real(0x1ba16d402000LL),real(0x7a072d7ae800LL), real(0x322ca20e07000LL),real(0x3657aa17207800LL), -real(0x3263434d5c54000LL),real(0xcd0703e8db70800LL), -real(0x17ea571d4aa2f000LL),real(0x141161dbf7ec9800LL), -real(0x57d62fedaaa000LL),-real(0xce7cd449810d800LL), real(0x99132fccc31b000LL),-real(0x27598ad75934800LL), real(0x18a5cd1eccf980LL),reale(27647,0xec962e4d9d27dLL), // C4[4], coeff of eps^6, polynomial in n of order 17 real(341540329472LL),real(727668064256LL),real(0x180da872800LL), real(0x3b0b3acd000LL),real(0x9f94c3e7800LL),real(0x1e8177ec2000LL), real(0x6e3ee471c800LL),real(0x1fbe99a5b7000LL),real(0xdb641b5c91800LL), real(0xfc08a38932c000LL),-real(0xfb6a7929bd39800LL), real(0x466e762d282a1000LL),-reale(2430,0x8d7c552bc4800LL), reale(2721,0xe81cb8f96000LL),-real(0x4dc0eea70f08f800LL), -real(0x1b9eda123c275000LL),real(0x2eba54dfb9ee5800LL), -real(0xf46c321c1b54e00LL),reale(193535,0x781b441f4c16bLL), // C4[4], coeff of eps^5, polynomial in n of order 18 real(31160807424LL),real(61322082304LL),real(3864763LL<<15), real(276675840000LL),real(646157094912LL),real(0x17cd936d800LL), real(0x429614e2000LL),real(0xd3b41886800LL),real(0x31f7c0917000LL), real(0xf21fb6ecf800LL),real(0x6ee892beec000LL),real(0x889688d5b28800LL), -real(0x944ac482b6bf000LL),real(0x2e4469f00aa71800LL), -real(0x73c7760d5050a000LL),reale(2642,0x7d1cf3a18a800LL), -reale(2185,0x6d0b55a915000LL),real(0x3d1b0c8706d53800LL), -real(0xb7512595147fa80LL),reale(193535,0x781b441f4c16bLL), // C4[4], coeff of eps^4, polynomial in n of order 19 real(1806732800),real(3354817536LL),real(6474635776LL), real(13058088960LL),real(27705484800LL),real(62364503040LL), real(150565728768LL),real(395569133568LL),real(0x10ca075be00LL), real(0x37f6c332400LL),real(0xdf0e61c4a00LL),real(0x47dfa8095000LL), real(0x236014b495600LL),real(0x2f60ae04237c00LL), -real(0x38c125ca4a81e00LL),real(0x13dd33a066e0a800LL), -real(0x389cd322becd1200LL),real(0x5ba892ca8a3fd400LL), -real(0x4c61cfa8c88a8600LL),real(0x18d2fd16dac69ec0LL), reale(193535,0x781b441f4c16bLL), // C4[5], coeff of eps^23, polynomial in n of order 0 14777984,real(0xd190230980fLL), // C4[5], coeff of eps^22, polynomial in n of order 1 -real(104833024),real(39440128),real(0x62c2748ec71LL), // C4[5], coeff of eps^21, polynomial in n of order 2 -real(45133008896LL),real(5079242752LL),real(1557031040), real(0x4f869592664b5LL), // C4[5], coeff of eps^20, polynomial in n of order 3 -real(0xecd417f0000LL),real(40869997LL<<17),-real(0x78cb3050000LL), real(0x28d58610800LL),real(0x5263fcf5c8de3f7LL), // C4[5], coeff of eps^19, polynomial in n of order 4 -real(0xf4977948ac000LL),real(0xfebd5b2ac3000LL), -real(0xf90c852576000LL),real(0x1257a8b1e1000LL),real(0x5e1a6b95fb00LL), reale(21503,0xf0e695ca96ad3LL), // C4[5], coeff of eps^18, polynomial in n of order 5 -real(0x25dd48c154000LL),real(0x596953f850000LL), -real(0x2b40cdd44c000LL),real(8741106765LL<<15),-real(0x1ab27f0a04000LL), real(0x7e701f145600LL),reale(3071,0xfdd7cc41833d5LL), // C4[5], coeff of eps^17, polynomial in n of order 6 -real(0x4776cd8c606000LL),real(0x6d8a47bfe9f000LL), -real(0x187da0ea944000LL),real(0x2b758d37739000LL), -real(0x22fd5e6d302000LL),real(0x107133def3000LL),real(0x56ef801cd100LL), reale(33791,0xe845c6d0a3a27LL), // C4[5], coeff of eps^16, polynomial in n of order 7 -real(0x6b41dfbb0208000LL),real(0x3281e67a9bd0000LL), -real(0x11e76a3ab618000LL),real(0x2fa8791e0ae0000LL), -real(0xef00faafea8000LL),real(0x82642584ff0000LL), -real(0xce6c8b206b8000LL),real(0x33a2c6e1f0cc00LL), reale(236543,0x59e86fb479711LL), // C4[5], coeff of eps^15, polynomial in n of order 8 -real(0xd8a9f7e5e7f8000LL),real(0x75ff062faeb000LL), -real(0x57d41a79bb5a000LL),real(0x470a22b15ed1000LL), -real(0x941305430fc000LL),real(0x2571b5b524d7000LL), -real(0x15ee8622281e000LL),-real(0x810fd11a43000LL), -real(0x3b143f8fcc100LL),reale(236543,0x59e86fb479711LL), // C4[5], coeff of eps^14, polynomial in n of order 9 -real(0x11e2c065bec000LL),real(597104820847LL<<17), -real(0x2505ead2add4000LL),real(0x375d7cf9da8000LL), -real(0x7d85d31b2fc000LL),real(0xc6e2597bcf0000LL), -real(0x1c3d1fca5e4000LL),real(0x26eff911138000LL), -real(0x32d040ac10c000LL),real(0xa3358a5620200LL), reale(33791,0xe845c6d0a3a27LL), // C4[5], coeff of eps^13, polynomial in n of order 10 -real(0x4e0fa2600780a000LL),real(0x4e911c6aabd6b000LL), -real(0x693532675088000LL),real(0x218ccc46e845000LL), -real(0x117da33185e06000LL),real(0x4517905378bf000LL), -real(0x10ba1c1d3344000LL),real(0x5399b73b0419000LL), -real(0x1d57ddd62302000LL),-real(0x2b67cba006d000LL), -real(0x17851f6bed3f00LL),reale(236543,0x59e86fb479711LL), // C4[5], coeff of eps^12, polynomial in n of order 11 reale(2256,0x5da9961330000LL),-real(0x4ad304d1312a0000LL), -real(0x4061e93f2b8f0000LL),real(0xb6157e3bfe7LL<<19), -real(0x11e106d1afa10000LL),-real(0x36aeeaeb6e60000LL), -real(0xfcdce3949630000LL),real(0x8af39fd661c0000LL), real(0x3d8b99e8cb0000LL),real(0x2f252d98fde0000LL), -real(0x29a890537770000LL),real(0x62af9738c95800LL), reale(236543,0x59e86fb479711LL), // C4[5], coeff of eps^11, polynomial in n of order 12 real(0x2c14f5cef5da000LL),-real(0xb44f7f3a7637800LL), real(0x144dd8529649b000LL),-real(0xdf6b3f6a9dda800LL), -real(0x611b67a2b3c4000LL),real(0xe4e2f0fafbb2800LL), -real(0x51c03e2adea3000LL),-real(0xd7c7b9cb0f0800LL), -real(0x16096a592762000LL),real(0x1c9393e7a4dc800LL), -real(0x381de14f961000LL),-real(0xdc6f16ca46800LL), -real(0xd4311572ebf80LL),reale(33791,0xe845c6d0a3a27LL), // C4[5], coeff of eps^10, polynomial in n of order 13 -real(0x1f7df788da000LL),-real(0x249f1260a08000LL), real(0x2485dbf6336a000LL),-real(0x9fd55d1961bc000LL), real(0x13ee6db114d4e000LL),-real(0x114ab28a688b0000LL), -real(0x1759d6f434ee000LL),real(0xe5435dae775c000LL), -real(0x883ae4654d0a000LL),real(0x6d085594a8000LL), -real(0x3b594ff4c6000LL),real(0x18b250a1c574000LL), -real(0xc2af3f725e2000LL),real(0x11b5d0e5824b00LL), reale(33791,0xe845c6d0a3a27LL), // C4[5], coeff of eps^9, polynomial in n of order 14 -real(0x45be4df1f000LL),-real(0x154928d5d8800LL), -real(0x9c093f54d6000LL),-real(0xbe1dac855c3800LL), real(0xc8c35d9371b3000LL),-real(0x3b27b3be7f71e800LL), reale(2105,0xa27ce5e51c000LL),-reale(2266,0x2251e75549800LL), real(0x215c4ca42d605000LL),real(0x52b0fbc40a45b800LL), -real(0x52abb6acf6af2000LL),real(0x14cab8bdb5a70800LL), real(0x422bb90412d7000LL),real(0xaa8f3f42195800LL), -real(0x18c864fb5207380LL),reale(236543,0x59e86fb479711LL), // C4[5], coeff of eps^8, polynomial in n of order 15 -real(0x323b5354000LL),-real(0xa77c1e58000LL),-real(0x297150a3c000LL), -real(0xd25b36ef0000LL),-real(0x64c6f9d464000LL), -real(0x816d981c288000LL),real(0x91bbe6aceeb4000LL), -real(0x2ea0d03ef98a0000LL),real(0x748c356a9df8c000LL), -reale(2463,0x44f7c770b8000LL),real(0x55038197b9ea4000LL), real(0x24c2f502435b0000LL),-real(0x557a28e333384000LL), real(0x319d6c472db18000LL),-real(0xa981b88bf66c000LL), real(0x2452a78bb4ce00LL),reale(236543,0x59e86fb479711LL), // C4[5], coeff of eps^7, polynomial in n of order 16 -real(864347LL<<15),-real(77318326272LL),-real(233990443008LL), -real(807704598528LL),-real(0x306255a2000LL),-real(0x100b9fcf2800LL), -real(0x8171cf3d7000LL),-real(0xb08a440213800LL), real(0xd5be3a4ba94000LL),-real(0x4af12ff99ea4800LL), real(0xd4237986197f000LL),-real(0x15530c89262c5800LL), real(0x12c48ba350cca000LL),-real(0x590f07b7ee96800LL), -real(0x53e376c2a7ab000LL),real(0x5b3d559eedc8800LL), -real(0x1b37127cacfe280LL),reale(33791,0xe845c6d0a3a27LL), // C4[5], coeff of eps^6, polynomial in n of order 17 -real(10859667456LL),-real(199353LL<<17),-real(67565166592LL), -real(190510645248LL),-real(597656199168LL),-real(65543051LL<<15), -real(0x869fe272000LL),-real(0x2f027b014000LL),-real(0x19275e39a6000LL), -real(0x24c57351390000LL),real(0x305c8c1f55c6000LL), -real(0x12c56d86cea0c000LL),real(0x3c958c9a69892000LL), -real(0x75427b7d716c8000LL),reale(2264,0x2021045b7e000LL), -real(0x686da1b1a7d04000LL),real(0x2b2226f5e6b4a000LL), -real(0x7a36190e0daa700LL),reale(236543,0x59e86fb479711LL), // C4[5], coeff of eps^5, polynomial in n of order 18 -real(392933376),-real(865908736),-real(61523<<15),-real(5002905600LL), -real(13385551872LL),-real(39200544768LL),-real(128292691968LL), -real(483473385472LL),-real(0x1ffab8af000LL),-real(0xbdf5200f800LL), -real(0x6d0cb854c000LL),-real(0xacf22c5668800LL), real(0xfa276dd8697000LL),-real(0x6c92e41ed151800LL), real(0x18f8d3300c4da000LL),-real(0x382fdb2c1baea800LL), real(0x4f13f21826f5d000LL),-real(0x3d1b0c8706d53800LL), real(0x131873ea3222a180LL),reale(236543,0x59e86fb479711LL), // C4[6], coeff of eps^23, polynomial in n of order 0 real(20016128),real(0x45dab658805LL), // C4[6], coeff of eps^22, polynomial in n of order 1 real(12387831808LL),real(4069857792LL),real(0x1b45118f2c973bLL), // C4[6], coeff of eps^21, polynomial in n of order 2 real(828267LL<<17),-real(2724645LL<<16),real(52104335360LL), real(0x22cae1700cc0f3LL), // C4[6], coeff of eps^20, polynomial in n of order 3 real(0x94a2566a8000LL),-real(0x7736ce990000LL),real(0x345f5a38000LL), real(0x11f45dc9000LL),real(0x36c560e36413be89LL), // C4[6], coeff of eps^19, polynomial in n of order 4 real(6043548407LL<<18),-real(7867012491LL<<16),real(0xfe56696e0000LL), -real(6798211929LL<<16),real(0x66855efe5000LL), reale(3630,0x89164e7bf8313LL), // C4[6], coeff of eps^18, polynomial in n of order 5 real(0x588efe4c176000LL),-real(0xcc317e9b08000LL), real(0x2e65271667a000LL),-real(0x1cb46908f84000LL), -real(0x7bc8d2682000LL),-real(0x36524dd3a400LL), reale(39935,0xe3f55f53aa1d1LL), // C4[6], coeff of eps^17, polynomial in n of order 6 real(0x2dbd6ef2050000LL),-real(0x356ee7ee5e8000LL), real(0x65e2c9482e0000LL),-real(0x1247a684858000LL), real(84899613015LL<<16),-real(0x1b548eba6c8000LL), real(0x5c900466be800LL),reale(39935,0xe3f55f53aa1d1LL), // C4[6], coeff of eps^16, polynomial in n of order 7 -real(0x3fff5b5aa54000LL),-real(0x6a2cbaeaf348000LL), real(0x2b55e8782dc4000LL),-real(0x69f22faba30000LL), real(0x26e11f54b9dc000LL),-real(0x105d41b83118000LL), -real(0x12eb1ab4e0c000LL),-real(0x9530f9646a800LL), reale(279551,0x3bb59b49a6cb7LL), // C4[6], coeff of eps^15, polynomial in n of order 8 real(0xf488f4012440000LL),-real(0xb16a4f02dfc8000LL), -real(0x103bba4a90d0000LL),-real(0x4da08c72a3d8000LL), real(0x45a11acaf220000LL),-real(0x25f21bc63e8000LL), real(0x12fccd9d4510000LL),-real(0x13e0eb3687f8000LL), real(0x356c2e9517d800LL),reale(279551,0x3bb59b49a6cb7LL), // C4[6], coeff of eps^14, polynomial in n of order 9 real(0x28c5c3199aad2000LL),real(0x80d5fb17a810000LL), real(0x9c623a70694e000LL),-real(0xf23c0600f3f4000LL), real(0x6928769f1ca000LL),-real(0x1e8f96869bf8000LL), real(0x4f9253e0b846000LL),-real(0x11e4e806cbfc000LL), -real(0x2dad19c0f3e000LL),-real(0x1f2fac1e88dc00LL), reale(279551,0x3bb59b49a6cb7LL), // C4[6], coeff of eps^13, polynomial in n of order 10 -real(0xdb139b99ca0000LL),-real(0x5dbaf74a92790000LL), real(0x76a096067dfLL<<19),real(0x39f346109690000LL), real(964470918621LL<<17),-real(0x10aa5a9917350000LL), real(0x49bc5039b7c0000LL),real(0x92ae304aad0000LL), real(0x32f3e8ddd3e0000LL),-real(0x233311e51f10000LL), real(0x4483a6a16dd000LL),reale(279551,0x3bb59b49a6cb7LL), // C4[6], coeff of eps^12, polynomial in n of order 11 -real(0xfbf5c5edd078000LL),real(0x1202fde81d5f0000LL), -real(0x454a07e84fa8000LL),-real(0xbd470dafdb40000LL), real(0xb3ba7d182928000LL),-real(0x155dacd6cc70000LL), -real(0xdc21a82d608000LL),-real(0xe96f98256dLL<<17), real(0x167a9a9742c8000LL),-real(0x7d81f52ed0000LL), -real(0x7ffde3fc68000LL),-real(0xe287c62fa3000LL), reale(39935,0xe3f55f53aa1d1LL), // C4[6], coeff of eps^11, polynomial in n of order 12 -real(283480971297LL<<18),real(0x5885fb25bf70000LL), -real(0xe5dec7019ee0000LL),real(0x13305b31e4ed0000LL), -real(0x9278e6008580000LL),-real(0x855a0cffe9d0000LL), real(0xd3d848f453e0000LL),-real(0x4a9f485fda70000LL), -real(0xfb7b0fc02c0000LL),-real(0x691c2e87310000LL), real(806997945397LL<<17),-real(0x9585db4a3b0000LL), real(0xa77dc54c8f000LL),reale(39935,0xe3f55f53aa1d1LL), // C4[6], coeff of eps^10, polynomial in n of order 13 real(0x6d0001099000LL),real(0x9a74d7ec5c000LL),-real(0xc18676170e1000LL), real(0x45ad31c7f8a2000LL),-real(0xc7369375e55b000LL), real(0x1364b97f822e8000LL),-real(0xe19539447ad5000LL), -real(0x26bf9b041ad2000LL),real(0xce71cc8200b1000LL), -real(0x8c822446468c000LL),real(0x12e554ec5f37000LL), real(0xa6c4f3e59ba000LL),real(0x30bb36a52bd000LL), -real(0x34440d2d335600LL),reale(39935,0xe3f55f53aa1d1LL), // C4[6], coeff of eps^9, polynomial in n of order 14 real(0x8fcb3bf8000LL),real(0x33bb5d994000LL),real(7630295323LL<<16), real(0x2a77da91fcc000LL),-real(0x38ac5a4a0098000LL), real(0x160f7571fbc04000LL),-real(0x45e92df7f7ee0000LL), real(0x7f01d3c372a3c000LL),-real(0x7edcf27daed28000LL), real(0x27dfe4585e674000LL),real(0x38a548f303090000LL), -real(0x4b87231069354000LL),real(0x24d2adef05648000LL), -real(0x6a5625dbc71c000LL),-real(0x18371a5d233400LL), reale(279551,0x3bb59b49a6cb7LL), // C4[6], coeff of eps^8, polynomial in n of order 15 real(257397153792LL),real(991547604992LL),real(0x42cbc6ea000LL), real(843451707LL<<15),real(0xe8a206ec6000LL),real(0x170dd449e34000LL), -real(0x2102346c3b5e000LL),real(0xe0052eca6690000LL), -real(0x318a0eacb0b82000LL),real(0x690a1407d3eec000LL), -reale(2182,0xb601e615a6000LL),real(0x61bf435eea348000LL), -real(0xe133a8622dca000LL),-real(0x2748b26bf705c000LL), real(0x220d7d12f9812000LL),-real(0x98dbd66bee38400LL), reale(279551,0x3bb59b49a6cb7LL), // C4[6], coeff of eps^7, polynomial in n of order 16 real(9867LL<<18),real(8045019136LL),real(854413LL<<15), real(6856031LL<<14),real(8304289LL<<16),real(0x3232f0a4000LL), real(0x1ec960fb8000LL),real(0x3439f07dcc000LL),-real(0x50f0148aea0000LL), real(0x25bf6de530f4000LL),-real(0x9635a567bcf8000LL), real(0x1735ee17e1e1c000LL),-real(0x25a38fef60750000LL), real(0x2834884b55944000LL),-real(0x1b3dfda8c79a8000LL), real(0xa981b88bf66c000LL),-real(0x1cc16f4e99cdc00LL), reale(93183,0xbe91de6de243dLL), // C4[6], coeff of eps^6, polynomial in n of order 17 real(169275392),real(7007<<16),real(1348931584),real(4358086656LL), real(15819288576LL),real(66522136576LL),real(339738054656LL), real(0x214230b6000LL),real(0x15d36ff77000LL),real(0x2803a29af8000LL), -real(0x43d629aab87000LL),real(0x232131018d3a000LL), -real(0x9e155c86fb85000LL),real(0x1c3aabf38857c000LL), -real(0x361b1ee81aa83000LL),real(0x44dcb2f8dc1be000LL), -real(0x325282c98d281000LL),real(0xf46c321c1b54e00LL), reale(279551,0x3bb59b49a6cb7LL), // C4[7], coeff of eps^23, polynomial in n of order 0 real(383798272),real(0x7ee24536c1115LL), // C4[7], coeff of eps^22, polynomial in n of order 1 -real(127523LL<<20),real(34096398336LL),real(0x1f771442bd4c09LL), // C4[7], coeff of eps^21, polynomial in n of order 2 -real(197998999LL<<19),-real(4877411LL<<18),-real(541336621056LL), real(0x3b1ebd1165abdce9LL), // C4[7], coeff of eps^20, polynomial in n of order 3 -real(72076029LL<<20),real(33625235LL<<21),-real(96370351LL<<20), real(0x142b356fa000LL),real(0x3f32837c872a7963LL), // C4[7], coeff of eps^19, polynomial in n of order 4 -real(2249063181LL<<20),real(51883720989LL<<18),-real(12233087197LL<<19), -real(1430728833LL<<18),-real(0x9e5c3c48b000LL), reale(46079,0xdfa4f7d6b097bLL), // C4[7], coeff of eps^18, polynomial in n of order 5 -real(19747083035LL<<20),real(5938781185LL<<22),-real(1899464157LL<<20), real(2895955713LL<<21),-real(6730130079LL<<20),real(0x490d94cd2c000LL), reale(46079,0xdfa4f7d6b097bLL), // C4[7], coeff of eps^17, polynomial in n of order 6 -real(0xf7ed31ddbc0000LL),real(90436020675LL<<17), -real(11671406741LL<<19),real(0x58222c9a6a0000LL), -real(28407954085LL<<18),-real(6936211449LL<<17), -real(0x1e088e877c800LL),reale(46079,0xdfa4f7d6b097bLL), // C4[7], coeff of eps^16, polynomial in n of order 7 -real(688523975841LL<<19),-real(83606333811LL<<20), -real(805224840035LL<<19),real(106897379463LL<<21), real(22163836107LL<<19),real(88997602799LL<<20), -real(151227539575LL<<19),real(0x28435aa5d4b000LL), reale(322559,0x1d82c6ded425dLL), // C4[7], coeff of eps^15, polynomial in n of order 8 real(557482450381LL<<20),real(0xfbb72a664ee0000LL), -real(0xa9b81eb4ea40000LL),-real(914196917515LL<<17), -real(409568792563LL<<19),real(0x4780d431da60000LL), -real(0x94b9eca98c0000LL),-real(82946761135LL<<17), -real(0x238b221440f800LL),reale(322559,0x1d82c6ded425dLL), // C4[7], coeff of eps^14, polynomial in n of order 9 -real(0x59ec90b7ba5LL<<20),real(233491821731LL<<23), real(762388756437LL<<20),real(284558585577LL<<21), -real(0xf0573a4eb1LL<<20),real(25275836579LL<<22), real(22761999561LL<<20),real(112734627747LL<<21), -real(126941809085LL<<20),real(0x2fd680f7c84000LL), reale(322559,0x1d82c6ded425dLL), // C4[7], coeff of eps^13, polynomial in n of order 10 real(0xaca84931355LL<<19),real(0x66fb36095adLL<<18), -real(0x2e7424117bfLL<<21),real(0xcac2488dd23LL<<18), real(762738574899LL<<19),-real(579380269895LL<<18), -real(968587667327LL<<20),real(0x73cbed27abc0000LL), real(75006191505LL<<19),-real(0xdb0f0aaec0000LL), -real(0x63c3eeba719000LL),reale(322559,0x1d82c6ded425dLL), // C4[7], coeff of eps^12, polynomial in n of order 11 real(626455667783LL<<20),-real(567623567285LL<<21), real(0xf5d2e8872dLL<<20),-real(13896712169LL<<23), -real(798923144989LL<<20),real(364556664237LL<<21), -real(129034049335LL<<20),-real(20826366601LL<<22), -real(51607570881LL<<20),real(46156477135LL<<21), -real(30888509275LL<<20),real(0x6042659ec2000LL), reale(46079,0xdfa4f7d6b097bLL), // C4[7], coeff of eps^11, polynomial in n of order 12 real(20777559885LL<<20),-real(569775860071LL<<18), real(0xe9ac41f6dbLL<<19),-real(0xef8ba34c8740000LL), real(598911876783LL<<21),-real(0x7cf99a74ecc0000LL), -real(957375911139LL<<19),real(0xc30e342965c0000LL), -real(423483761553LL<<20),real(35714168193LL<<18), real(79169625311LL<<19),real(68905136075LL<<18), -real(0x2f872ef9963000LL),reale(46079,0xdfa4f7d6b097bLL), // C4[7], coeff of eps^10, polynomial in n of order 13 -real(18988489LL<<20),-real(129894471LL<<22),real(12886996881LL<<20), -real(47548938145LL<<21),real(367560238059LL<<20), -real(106884143981LL<<23),real(0x11c056e4d45LL<<20), -real(470740881351LL<<21),real(64061082015LL<<20), real(158992278163LL<<22),-real(634972709127LL<<20), real(135054066707LL<<21),-real(41343081645LL<<20), -real(0x7382e0581c000LL),reale(46079,0xdfa4f7d6b097bLL), // C4[7], coeff of eps^9, polynomial in n of order 14 -real(7074089LL<<17),-real(95481295LL<<16),-real(249804765LL<<18), -real(0x6befb7d790000LL),real(0xb301172bea0000LL), -real(0x5978c2137030000LL),real(0x2fbc3e73e21LL<<19), -real(0x3f35c80b0f2d0000LL),real(0x6ce3ff0d91260000LL), -real(0x7761d1ce42b70000LL),real(0x468057c8ed840000LL), real(0x1bcb7dfb99f0000LL),-real(0x26d98474089e0000LL), real(0x1d375a3e49150000LL),-real(0x7d9dd8c3269dc00LL), reale(322559,0x1d82c6ded425dLL), // C4[7], coeff of eps^8, polynomial in n of order 15 -real(47805LL<<18),-real(105987LL<<19),-real(1141959LL<<18), -real(2026311LL<<20),-real(89791009LL<<18),-real(1389164665LL<<19), real(79467759189LL<<18),-real(86766818957LL<<21), real(0xbfc5c91f6ec0000LL),-real(0x487b27f822fLL<<19), real(0x4a699e0854c40000LL),-real(0x69d85e75b6dLL<<20), real(0x66f7a9fb575c0000LL),-real(0x828d4038ea5LL<<19), real(0x60dc69748cdLL<<18),-real(0x3f90a5347c68800LL), reale(322559,0x1d82c6ded425dLL), // C4[7], coeff of eps^7, polynomial in n of order 16 -real(143<<20),-real(8085<<16),-real(16121<<17),-real(9810411520LL), -real(212205LL<<18),-real(6380297LL<<16),-real(37701755LL<<17), -real(0x95a9db330000LL),real(9764754545LL<<19),-real(0xaf0fe765fd0000LL), real(0x3a2548493060000LL),-real(0xc8bdaa520270000LL), real(0x7871cc979b1LL<<18),-real(0x3353672f26710000LL), real(0x3c89c1e8d8020000LL),-real(0x2a606e22fd9b0000LL), real(0xc94a0b2634a0400LL),reale(322559,0x1d82c6ded425dLL), // C4[8], coeff of eps^23, polynomial in n of order 0 real(7579<<15),real(0x4f56c0c24f87LL), // C4[8], coeff of eps^22, polynomial in n of order 1 -real(1660549LL<<21),-real(23648625LL<<16),real(0x38232f25bccb5275LL), // C4[8], coeff of eps^21, polynomial in n of order 2 real(9646043LL<<20),-real(24019457LL<<19),real(74048359LL<<15), real(0x99262e0aeeff091LL), // C4[8], coeff of eps^20, polynomial in n of order 3 real(183351957435LL<<19),-real(32827160863LL<<20), -real(6509093591LL<<19),-real(0x6677b4e9b0000LL), reale(365566,0xff4ff27401803LL), // C4[8], coeff of eps^19, polynomial in n of order 4 real(67207908275LL<<21),-real(201042891LL<<19),real(44011096899LL<<20), -real(85786308153LL<<19),real(0x195ba7c1ef8000LL), reale(365566,0xff4ff27401803LL), // C4[8], coeff of eps^18, polynomial in n of order 5 -real(13677739LL<<21),-real(1155605701LL<<23),real(11263093395LL<<21), -real(1170886701LL<<22),-real(422863935LL<<21),-real(9609473031LL<<16), reale(52223,0xdb549059b7125LL), // C4[8], coeff of eps^17, polynomial in n of order 6 -real(105328611LL<<20),-real(0xe3d4e1d7080000LL),real(9484526351LL<<21), real(4879307961LL<<19),real(13462873311LL<<20),-real(19014362253LL<<19), real(0x45bace6718000LL),reale(52223,0xdb549059b7125LL), // C4[8], coeff of eps^16, polynomial in n of order 7 real(0x4802f7e045bLL<<18),-real(787109524929LL<<19), -real(616781829503LL<<18),-real(267630157067LL<<20), real(0xf57f439a67LL<<18),-real(26811748075LL<<19), -real(29646920051LL<<18),-real(0x25c0cef2988000LL), reale(365566,0xff4ff27401803LL), // C4[8], coeff of eps^15, polynomial in n of order 8 real(61397460605LL<<22),real(0x9d011c37ef80000LL), real(907553463943LL<<20),-real(0xc0a473ee4980000LL), -real(21778698179LL<<21),-real(22179652453LL<<19), real(224024408237LL<<20),-real(212571195095LL<<19), real(0x216a7bfadc8000LL),reale(365566,0xff4ff27401803LL), // C4[8], coeff of eps^14, polynomial in n of order 9 real(304663697949LL<<21),-real(51558232553LL<<24), real(126037118963LL<<21),real(28559389965LL<<22),real(12939195833LL<<21), -real(17167224841LL<<23),real(24466781775LL<<21),real(2302458607LL<<22), real(456812693LL<<21),-real(0xde9c5a4230000LL), reale(52223,0xdb549059b7125LL), // C4[8], coeff of eps^13, polynomial in n of order 10 -real(0x71eca5b57e5LL<<20),real(0x8d98ab5c54bLL<<19), real(497026592783LL<<22),-real(0xacc7c9e1d9bLL<<19), real(0x35a7c7b51ddLL<<20),-real(81233361377LL<<19), -real(253988603057LL<<21),-real(954606696519LL<<19), real(577751554079LL<<20),-real(333997527437LL<<19), real(0x1689b847558000LL),reale(365566,0xff4ff27401803LL), // C4[8], coeff of eps^12, polynomial in n of order 11 -real(0x367f7beda59LL<<19),real(0x45996b8ba21LL<<20), -real(0xdceb5493fc3LL<<19),real(0x18843cb160dLL<<22), -real(0x21789a51fedLL<<19),-real(0x41cde5aa8b9LL<<20), real(0x95638f58ea9LL<<19),-real(984566251123LL<<21), -real(435207598721LL<<19),real(219309948781LL<<20), real(274765170197LL<<19),-real(0x12cf88fa6ff0000LL), reale(365566,0xff4ff27401803LL), // C4[8], coeff of eps^11, polynomial in n of order 12 -real(2296713447LL<<21),real(78660216877LL<<19), -real(180155131441LL<<20),real(0xeee01825bfLL<<19), -real(237440161933LL<<22),real(0x2042cbdcd31LL<<19), -real(652079196855LL<<20),-real(325903664957LL<<19), real(324695717299LL<<21),-real(0xf97e21ed4bLL<<19), real(203483994947LL<<20),-real(52367903417LL<<19), -real(0x8a9d0d3688000LL),reale(52223,0xdb549059b7125LL), // C4[8], coeff of eps^10, polynomial in n of order 13 real(1140139LL<<21),real(9315711LL<<23),-real(1126319139LL<<21), real(5199009105LL<<22),-real(52132384161LL<<21),real(20770352565LL<<24), -real(357583911087LL<<21),real(262213551639LL<<22), -real(498523677485LL<<21),real(60302341333LL<<23), real(57310064901LL<<21),-real(90954779619LL<<22), real(124029244935LL<<21),-real(0xf0a5fe0ce50000LL), reale(52223,0xdb549059b7125LL), // C4[8], coeff of eps^9, polynomial in n of order 14 real(54009LL<<20),real(849303LL<<19),real(2623117LL<<21), real(364892913LL<<19),-real(5919882885LL<<20),real(0xdd0128d3580000LL), -real(81910832913LL<<22),real(0x2229f5f9745LL<<19), -real(0x2a9587ee883LL<<20),real(0x982f47b44bfLL<<19), -real(0x30e1739ffd1LL<<21),real(0xb09887dee19LL<<19), -real(0x35101f0ee01LL<<20),real(0x25e6f19ce93LL<<19), -real(0x306e34ba4668000LL),reale(365566,0xff4ff27401803LL), // C4[8], coeff of eps^8, polynomial in n of order 15 real(2295<<17),real(5831<<18),real(72709LL<<17),real(151011LL<<19), real(7936467LL<<17),real(147906885LL<<18),-real(0x4d5c1f23e0000LL), real(14228642337LL<<20),-real(697203474513LL<<17), real(0x51fe4e56b0c0000LL),-real(0xeb59f3d2e860000LL), real(0x3e0c14100a1LL<<19),-real(0x305340db42ea0000LL), real(0xd6c75923d41LL<<18),-real(0x2452a78bb4ce0000LL), real(0xa981b88bf66c000LL),reale(365566,0xff4ff27401803LL), // C4[9], coeff of eps^23, polynomial in n of order 0 -real(45613<<15),real(0xa0b835899f381LL), // C4[9], coeff of eps^22, polynomial in n of order 1 -real(4663637LL<<21),real(25498473LL<<16),real(0x8f68f0ea15ed989LL), // C4[9], coeff of eps^21, polynomial in n of order 2 -real(313787291LL<<20),-real(89546863LL<<19),-real(880826107LL<<15), reale(5306,0x2ad1d52b570cdLL), // C4[9], coeff of eps^20, polynomial in n of order 3 real(1691751267LL<<22),real(5868457511LL<<23),-real(9710518895LL<<22), real(43389881073LL<<17),reale(408574,0xe11d1e092eda9LL), // C4[9], coeff of eps^19, polynomial in n of order 4 -real(45668361181LL<<21),real(290185772373LL<<19), -real(19310638221LL<<20),-real(10267037529LL<<19), -real(0x11435a10568000LL),reale(408574,0xe11d1e092eda9LL), // C4[9], coeff of eps^18, polynomial in n of order 5 -real(206915608111LL<<21),real(8005795847LL<<23),real(6676372983LL<<21), real(24266221119LL<<22),-real(29173391667LL<<21),real(99595856143LL<<16), reale(408574,0xe11d1e092eda9LL), // C4[9], coeff of eps^17, polynomial in n of order 6 -real(15515879355LL<<20),-real(36184750873LL<<19), -real(22177807609LL<<21),real(62194714929LL<<19),real(693176727LL<<20), -real(1189966821LL<<19),-real(0x5829503048000LL), reale(58367,0xd70428dcbd8cfLL), // C4[9], coeff of eps^16, polynomial in n of order 7 real(38512528273LL<<23),real(67772681235LL<<24),-real(74410968653LL<<23), -real(3984568679LL<<25),-real(6152374683LL<<23),real(13551170801LL<<24), -real(11115057401LL<<23),real(24916219839LL<<18), reale(408574,0xe11d1e092eda9LL), // C4[9], coeff of eps^15, polynomial in n of order 8 -real(162298412813LL<<22),real(0xff4317f5080000LL), real(119179074953LL<<20),real(0xf6d36e74980000LL), -real(63634032589LL<<21),real(61952932453LL<<19),real(10785104899LL<<20), real(4191026519LL<<19),-real(0xd59ae9d0e8000LL), reale(58367,0xd70428dcbd8cfLL), // C4[9], coeff of eps^14, polynomial in n of order 9 real(162971496591LL<<21),real(33816350309LL<<24), -real(394783736543LL<<21),real(85862751303LL<<22), real(32462900611LL<<21),-real(6369607931LL<<23),-real(39152071083LL<<21), real(18189729581LL<<22),-real(9249690569LL<<21),real(6171570141LL<<16), reale(58367,0xd70428dcbd8cfLL), // C4[9], coeff of eps^13, polynomial in n of order 10 real(0x52d38896f8bLL<<20),-real(0xd3acdf03195LL<<19), real(0x1195b2a1cffLL<<22),real(0xca9586e4a280000LL), -real(0x486f0b6e413LL<<20),real(0x7ca2ce8a83fLL<<19), -real(610236546241LL<<21),-real(717677267559LL<<19), real(159176229583LL<<20),real(291633515411LL<<19), -real(0x110150274e88000LL),reale(408574,0xe11d1e092eda9LL), // C4[9], coeff of eps^12, polynomial in n of order 11 real(143956869023LL<<22),-real(243108013001LL<<23), real(0x101d5eb1615LL<<22),-real(213537904349LL<<25), real(0x183f300cffbLL<<22),-real(350529456991LL<<23), -real(545724783247LL<<22),real(274121340227LL<<24), -real(785966166377LL<<22),real(135225754699LL<<23), -real(28607511667LL<<22),-real(0x3ee3b308260000LL), reale(408574,0xe11d1e092eda9LL), // C4[9], coeff of eps^11, polynomial in n of order 12 real(2520290511LL<<21),-real(0xc4ddd05ba80000LL), real(304931349961LL<<20),-real(0x21230116cd7LL<<19), real(735928623493LL<<22),-real(0x9d254a11d99LL<<19), real(0x6510e717cdfLL<<20),-real(0xa95d67804fbLL<<19), real(0x1055dd17e45LL<<21),real(0x239bcd685c3LL<<19), -real(0x22ba072788bLL<<20),real(0x2c142a0db61LL<<19), -real(0x59b3a2379f58000LL),reale(408574,0xe11d1e092eda9LL), // C4[9], coeff of eps^10, polynomial in n of order 13 -real(29393LL<<21),-real(283917LL<<23),real(41246777LL<<21), -real(233407875LL<<22),real(2943398547LL<<21),-real(1525553871LL<<24), real(35837133917LL<<21),-real(38620600629LL<<22), real(123783976375LL<<21),-real(36640057007LL<<23), real(124599494337LL<<21),-real(35830670759LL<<22), real(24805848987LL<<21),-real(0x1ce0b816070000LL), reale(19455,0xf256b84994845LL), // C4[9], coeff of eps^9, polynomial in n of order 14 -real(1615<<20),-real(29393LL<<19),-real(106267LL<<21), -real(17534055LL<<19),real(342711075LL<<20),-real(8430692445LL<<19), real(7306600119LL<<22),-real(270344204403LL<<19), real(450573674005LL<<20),-real(0x20c896b3e69LL<<19), real(0xfa29e850f7LL<<21),-real(0x5aaf3103bffLL<<19), real(0x3002653e387LL<<20),-real(0x3f2b92b02f5LL<<19), real(0x914a9e2ed338000LL),reale(408574,0xe11d1e092eda9LL), // C4[10], coeff of eps^23, polynomial in n of order 0 real(137<<21),real(0x8757c14b789bLL), // C4[10], coeff of eps^22, polynomial in n of order 1 -real(1152691LL<<20),-real(6743919LL<<17),real(0x9e817610332f06fLL), // C4[10], coeff of eps^21, polynomial in n of order 2 real(79722199LL<<23),-real(113766289LL<<22),real(225212673LL<<18), reale(5864,0xb6105765cc00bLL), // C4[10], coeff of eps^20, polynomial in n of order 3 real(64857768639LL<<21),-real(2220489243LL<<22),-real(2012833515LL<<21), -real(19551629405LL<<18),reale(451582,0xc2ea499e5c34fLL), // C4[10], coeff of eps^19, polynomial in n of order 4 real(656353407LL<<24),real(1031809317LL<<22),real(12215335391LL<<23), -real(12759999497LL<<22),real(18944346729LL<<18), reale(451582,0xc2ea499e5c34fLL), // C4[10], coeff of eps^18, polynomial in n of order 5 -real(62867132873LL<<20),-real(83127481829LL<<22), real(173460262689LL<<20),real(8415873627LL<<21),-real(1024568181LL<<20), -real(82657907689LL<<17),reale(451582,0xc2ea499e5c34fLL), // C4[10], coeff of eps^17, polynomial in n of order 6 real(69839518785LL<<24),-real(46975322289LL<<23),-real(5175253237LL<<25), -real(10608265143LL<<23),real(12870275691LL<<24),-real(9303053053LL<<23), real(8528136981LL<<19),reale(451582,0xc2ea499e5c34fLL), // C4[10], coeff of eps^16, polynomial in n of order 7 -real(12671764325LL<<22),real(11821938135LL<<23),real(23903917953LL<<22), -real(7023725731LL<<24),real(4254825447LL<<22),real(1372261021LL<<23), real(755775181LL<<22),-real(6809268397LL<<19), reale(64511,0xd2b3c15fc4079LL), // C4[10], coeff of eps^15, polynomial in n of order 8 real(10583074157LL<<26),-real(84530118029LL<<23),real(12150058407LL<<24), real(12380362825LL<<23),-real(838454291LL<<25),-real(10410407457LL<<23), real(3974759309LL<<24),-real(1799658059LL<<23),real(156358707LL<<19), reale(64511,0xd2b3c15fc4079LL), // C4[10], coeff of eps^14, polynomial in n of order 9 -real(922119298407LL<<20),real(52944024001LL<<23), real(329638564983LL<<20),-real(354979062141LL<<21), real(493120994773LL<<20),-real(24099541823LL<<22), -real(59503561293LL<<20),real(7459230081LL<<21),real(21243323153LL<<20), -real(75576440907LL<<17),reale(64511,0xd2b3c15fc4079LL), // C4[10], coeff of eps^13, polynomial in n of order 10 -real(328595996641LL<<23),real(0x1245cb281e3LL<<22), -real(207527442829LL<<25),real(0x13d84cf39cdLL<<22), -real(169653271431LL<<23),-real(705690429577LL<<22), real(256163704307LL<<24),-real(657414782367LL<<22), real(103463476179LL<<23),-real(17233182197LL<<22), -real(65863805931LL<<18),reale(451582,0xc2ea499e5c34fLL), // C4[10], coeff of eps^12, polynomial in n of order 11 -real(60530460661LL<<21),real(129708905557LL<<22), -real(783916037751LL<<21),real(215690023633LL<<24), -real(0x287cc397f79LL<<21),real(0x174d319d033LL<<22), -real(0x22bf2de15fbLL<<21),real(172524970961LL<<23), real(736992166659LL<<21),-real(554058611183LL<<22), real(665956259969LL<<21),-real(0x4d7d212a0a40000LL), reale(451582,0xc2ea499e5c34fLL), // C4[10], coeff of eps^11, polynomial in n of order 12 -real(31220211LL<<24),real(1576100141LL<<22),-real(5588687797LL<<23), real(52675808031LL<<22),-real(22267080913LL<<25), real(449824279121LL<<22),-real(432213499347LL<<23), real(0x1275ac4a843LL<<22),-real(351080482641LL<<24), real(0x10853170e75LL<<22),-real(314682628337LL<<23), real(212227819111LL<<22),-real(520922828727LL<<18), reale(451582,0xc2ea499e5c34fLL), // C4[10], coeff of eps^10, polynomial in n of order 13 real(46189LL<<20),real(522291LL<<22),-real(90008149LL<<20), real(613691925LL<<21),-real(9499950999LL<<20),real(6182507793LL<<23), -real(187536069721LL<<20),real(270344204403LL<<21), -real(0x11a7161219bLL<<20),real(533756506129LL<<22), -real(0x2a7db4d305dLL<<20),real(0x159e458acd1LL<<21), -real(0x1bcb7dfb99fLL<<20),real(0x7e5725605ea0000LL), reale(451582,0xc2ea499e5c34fLL), // C4[11], coeff of eps^23, polynomial in n of order 0 -real(7309LL<<21),real(0x2c95e8ad321065LL), // C4[11], coeff of eps^22, polynomial in n of order 1 -real(118877LL<<30),real(1675947LL<<23),real(0x7759dcb5574d50a7LL), // C4[11], coeff of eps^21, polynomial in n of order 2 -real(9105745LL<<24),-real(49846181LL<<23),-real(2866583251LL<<18), reale(70655,0xce6359e2ca823LL), // C4[11], coeff of eps^20, polynomial in n of order 3 -real(239228553LL<<25),real(1509768547LL<<26),-real(1393694995LL<<25), real(7195205325LL<<19),reale(494590,0xa4b77533898f5LL), // C4[11], coeff of eps^19, polynomial in n of order 4 -real(10520646403LL<<25),real(16651704531LL<<23),real(1510969677LL<<24), real(227849937LL<<23),-real(40629886913LL<<18), reale(494590,0xa4b77533898f5LL), // C4[11], coeff of eps^18, polynomial in n of order 5 -real(737236949LL<<28),-real(83959015LL<<31),-real(449296547LL<<28), real(188420603LL<<30),-real(243597193LL<<28),real(1420486123LL<<21), reale(494590,0xa4b77533898f5LL), // C4[11], coeff of eps^17, polynomial in n of order 6 real(1797306345LL<<25),real(7110272827LL<<24),-real(1494242189LL<<26), real(407981949LL<<24),real(324085539LL<<25),real(232922271LL<<24), -real(6431919403LL<<19),reale(70655,0xce6359e2ca823LL), // C4[11], coeff of eps^16, polynomial in n of order 7 -real(59422002475LL<<26),real(4462082415LL<<27),real(11958968063LL<<26), -real(116564371LL<<28),-real(9243946887LL<<26),real(3024840805LL<<27), -real(1229077213LL<<26),-real(836978961LL<<20), reale(494590,0xa4b77533898f5LL), // C4[11], coeff of eps^15, polynomial in n of order 8 real(1450234755LL<<27),real(28955596425LL<<24),-real(20916501415LL<<25), real(24148276875LL<<24),-real(639979965LL<<26),-real(3796939603LL<<24), real(257117683LL<<25),real(1321384367LL<<24),-real(17153469915LL<<19), reale(70655,0xce6359e2ca823LL), // C4[11], coeff of eps^14, polynomial in n of order 9 real(2991071409LL<<28),-real(215656441LL<<32),real(2375561279LL<<28), -real(29715609LL<<30),-real(1772722171LL<<28),real(262089343LL<<31), -real(1227751437LL<<28),real(88909853LL<<30),-real(21460999LL<<28), -real(1112906091LL<<21),reale(70655,0xce6359e2ca823LL), // C4[11], coeff of eps^13, polynomial in n of order 10 real(48251719021LL<<24),-real(247802667483LL<<23), real(59903451769LL<<26),-real(693923403733LL<<23), real(362458490331LL<<24),-real(482970502063LL<<23), real(22585671353LL<<25),real(201583163607LL<<23), -real(128100703031LL<<24),real(147544368125LL<<23), -real(0x43bae67ca340000LL),reale(494590,0xa4b77533898f5LL), // C4[11], coeff of eps^12, polynomial in n of order 11 real(488107587LL<<25),-real(1288790349LL<<26),real(9866997217LL<<25), -real(3570890001LL<<28),real(64004720367LL<<25),-real(56017267579LL<<26), real(152843494797LL<<25),-real(39981841137LL<<27), real(123894347227LL<<25),-real(33286009449LL<<26), real(21954601977LL<<25),-real(212227819111LL<<19), reale(494590,0xa4b77533898f5LL), // C4[11], coeff of eps^11, polynomial in n of order 12 real(735471LL<<25),-real(44046541LL<<23),real(188198857LL<<24), -real(2177729631LL<<23),real(1156078693LL<<26),-real(30163144081LL<<23), real(38781185247LL<<24),-real(159433761571LL<<23), real(65649195941LL<<25),-real(342066863061LL<<23), real(168318615157LL<<24),-real(212227819111LL<<23), real(0x6f2df7ee67c0000LL),reale(494590,0xa4b77533898f5LL), // C4[12], coeff of eps^23, polynomial in n of order 0 real(173LL<<24),real(0x88d5e64011771LL), // C4[12], coeff of eps^22, polynomial in n of order 1 -real(163369LL<<28),-real(266903LL<<29),reale(14529,0xb09bccfe817bfLL), // C4[12], coeff of eps^21, polynomial in n of order 2 real(26283479LL<<29),-real(21738605LL<<28),real(24285135LL<<24), reale(76799,0xca12f265d0fcdLL), // C4[12], coeff of eps^20, polynomial in n of order 3 real(6122492151LL<<24),real(880448149LL<<25),real(269123645LL<<24), -real(4943792525LL<<21),reale(537598,0x8684a0c8b6e9bLL), // C4[12], coeff of eps^19, polynomial in n of order 4 -real(616982441LL<<28),-real(2168310039LL<<26),real(1398586567LL<<27), -real(817632445LL<<26),real(450511215LL<<22), reale(537598,0x8684a0c8b6e9bLL), // C4[12], coeff of eps^18, polynomial in n of order 5 real(1912616275LL<<26),-real(308159801LL<<28),-real(17594779LL<<26), real(72918855LL<<27),real(66311031LL<<26),-real(47313631LL<<26), reale(76799,0xca12f265d0fcdLL), // C4[12], coeff of eps^17, polynomial in n of order 6 real(9134109LL<<27),real(1642561735LL<<26),real(58767343LL<<28), -real(1299624495LL<<26),real(374812639LL<<27),-real(137300677LL<<26), -real(61400001LL<<22),reale(76799,0xca12f265d0fcdLL), // C4[12], coeff of eps^16, polynomial in n of order 7 real(118127909265LL<<25),-real(66457563795LL<<26), real(64469127555LL<<25),-real(134108625LL<<27),-real(12700511691LL<<25), real(295233743LL<<26),real(4531750951LL<<25),-real(13670656363LL<<22), reale(537598,0x8684a0c8b6e9bLL), // C4[12], coeff of eps^15, polynomial in n of order 8 -real(10859744975LL<<29),real(49132517315LL<<26),real(5188275715LL<<27), -real(52074703975LL<<26),real(13295845745LL<<28), -real(28808201009LL<<26),real(3853119361LL<<27),-real(278992987LL<<26), -real(3626908831LL<<22),reale(537598,0x8684a0c8b6e9bLL), // C4[12], coeff of eps^14, polynomial in n of order 9 -real(5262740745LL<<26),real(1142543055LL<<29),-real(12070462215LL<<26), real(5779723245LL<<27),-real(6878321925LL<<26),real(125534415LL<<28), real(3745400061LL<<26),-real(2112375473LL<<27),real(2351512319LL<<26), -real(573315259LL<<26),reale(76799,0xca12f265d0fcdLL), // C4[12], coeff of eps^13, polynomial in n of order 10 -real(345262775LL<<27),real(2254590065LL<<26),-real(721021595LL<<29), real(11719656095LL<<26),-real(9489736865LL<<27),real(24346633325LL<<26), -real(6069982555LL<<28),real(18134544155LL<<26),-real(4742880779LL<<27), real(3068922857LL<<26),-real(7318200659LL<<22), reale(179199,0x822c35983cf89LL), // C4[12], coeff of eps^12, polynomial in n of order 11 -real(58429085LL<<24),real(185910725LL<<25),-real(1747560815LL<<24), real(794345825LL<<27),-real(18392161025LL<<24),real(21545102915LL<<25), -real(82378334675LL<<24),real(32084193505LL<<26), -real(160420967525LL<<24),real(76723071425LL<<25), -real(95136608567LL<<24),real(212227819111LL<<21), reale(537598,0x8684a0c8b6e9bLL), // C4[13], coeff of eps^23, polynomial in n of order 0 -real(34717LL<<24),real(0x4013d857859e5adLL), // C4[13], coeff of eps^22, polynomial in n of order 1 -real(52837LL<<30),real(101283LL<<25),real(0x39b1009e5dec691dLL), // C4[13], coeff of eps^21, polynomial in n of order 2 real(58223275LL<<29),real(25058159LL<<28),-real(597584743LL<<24), reale(580606,0x6851cc5de4441LL), // C4[13], coeff of eps^20, polynomial in n of order 3 -real(38160201LL<<32),real(20133099LL<<33),-real(10736915LL<<32), real(8118075LL<<27),reale(580606,0x6851cc5de4441LL), // C4[13], coeff of eps^19, polynomial in n of order 4 -real(246943573LL<<28),-real(102114339LL<<26),real(63266747LL<<27), real(72037887LL<<26),-real(711672919LL<<22), reale(82943,0xc5c28ae8d7777LL), // C4[13], coeff of eps^18, polynomial in n of order 5 real(362438863LL<<28),real(29917105LL<<30),-real(313139991LL<<28), real(81176473LL<<29),-real(26857069LL<<28),-real(40519029LL<<23), reale(82943,0xc5c28ae8d7777LL), // C4[13], coeff of eps^17, polynomial in n of order 6 -real(4194208665LL<<27),real(3411193933LL<<26),real(92059229LL<<28), -real(832792389LL<<26),-real(13821619LL<<27),real(313960329LL<<26), -real(1784908801LL<<22),reale(82943,0xc5c28ae8d7777LL), // C4[13], coeff of eps^16, polynomial in n of order 7 real(4206195495LL<<29),real(1286394165LL<<30),-real(6553065099LL<<29), real(1494451903LL<<31),-real(3024727629LL<<29),real(374117415LL<<30), -real(7540351LL<<29),-real(836978961LL<<24), reale(580606,0x6851cc5de4441LL), // C4[13], coeff of eps^15, polynomial in n of order 8 real(8293864515LL<<29),-real(80835230175LL<<26),real(35736027705LL<<27), -real(37780361325LL<<26),-real(587595645LL<<28),real(26485772901LL<<26), -real(13655575661LL<<27),real(14786628311LL<<26), -real(57193562335LL<<22),reale(580606,0x6851cc5de4441LL), // C4[13], coeff of eps^14, polynomial in n of order 9 real(2173316805LL<<28),-real(627936225LL<<31),real(9404910795LL<<28), -real(7129362555LL<<29),real(17350941825LL<<28),-real(4150093185LL<<30), real(12011779143LL<<28),-real(3068922857LL<<29),real(1952950909LL<<28), -real(9206768571LL<<23),reale(580606,0x6851cc5de4441LL), // C4[13], coeff of eps^13, polynomial in n of order 10 real(79676025LL<<27),-real(638856855LL<<26),real(256634805LL<<29), -real(5389330905LL<<26),real(5842215855LL<<27),-real(21011478075LL<<26), real(7804263285LL<<28),-real(37664053245LL<<26),real(17576558181LL<<27), -real(21482459999LL<<26),real(95136608567LL<<22), reale(580606,0x6851cc5de4441LL), // C4[14], coeff of eps^23, polynomial in n of order 0 real(433LL<<27),real(0x16f0fb486be35c9LL), // C4[14], coeff of eps^22, polynomial in n of order 1 real(938669LL<<29),-real(8460179LL<<26),reale(36683,0x318959e11f277LL), // C4[14], coeff of eps^21, polynomial in n of order 2 real(1085551LL<<33),-real(531601LL<<32),real(109557LL<<28), reale(36683,0x318959e11f277LL), // C4[14], coeff of eps^20, polynomial in n of order 3 -real(34899909LL<<31),real(11630633LL<<32),real(16602985LL<<31), -real(73138345LL<<28),reale(623614,0x4a1ef7f3119e7LL), // C4[14], coeff of eps^19, polynomial in n of order 4 real(2603869LL<<34),-real(18588201LL<<32),real(4394077LL<<33), -real(1312099LL<<32),-real(1449057LL<<28),reale(89087,0xc172236bddf21LL), // C4[14], coeff of eps^18, polynomial in n of order 5 real(1218191717LL<<27),real(79106081LL<<29),-real(371875421LL<<27), -real(20795103LL<<28),real(151229409LL<<27),-real(409250479LL<<24), reale(89087,0xc172236bddf21LL), // C4[14], coeff of eps^17, polynomial in n of order 6 real(249532965LL<<30),-real(917899213LL<<29),real(191097911LL<<31), -real(363925371LL<<29),real(41606327LL<<30),real(1574359LL<<29), -real(54936843LL<<25),reale(89087,0xc172236bddf21LL), // C4[14], coeff of eps^16, polynomial in n of order 7 -real(19067218845LL<<28),real(7820446095LL<<29),-real(7262714151LL<<28), -real(421931643LL<<30),real(6566089551LL<<28),-real(3155926907LL<<29), real(3340375493LL<<28),-real(6416838701LL<<25), reale(623614,0x4a1ef7f3119e7LL), // C4[14], coeff of eps^15, polynomial in n of order 8 -real(353006415LL<<32),real(4931374455LL<<29),-real(3531935085LL<<30), real(8211223125LL<<29),-real(1894184271LL<<31),real(5332188211LL<<29), -real(1334642127LL<<30),real(836978961LL<<29),-real(1952950909LL<<25), reale(623614,0x4a1ef7f3119e7LL), // C4[14], coeff of eps^14, polynomial in n of order 9 -real(436268025LL<<27),real(158349135LL<<30),-real(3064521495LL<<27), real(3110604525LL<<28),-real(10615555125LL<<27),real(3784676175LL<<29), -real(17712284499LL<<27),real(8090796623LL<<28),-real(9764754545LL<<27), real(21482459999LL<<24),reale(623614,0x4a1ef7f3119e7LL), // C4[15], coeff of eps^23, polynomial in n of order 0 -real(11003LL<<27),real(0x6a44bb11ad2310dLL), // C4[15], coeff of eps^22, polynomial in n of order 1 -real(28003LL<<36),real(3549LL<<30),reale(39213,0x11a47a8f8b3bdLL), // C4[15], coeff of eps^21, polynomial in n of order 2 real(1243LL<<38),real(2249LL<<37),-real(577583LL<<28), reale(5601,0xddf2ecefef51bLL), // C4[15], coeff of eps^20, polynomial in n of order 3 -real(28101LL<<40),real(24493LL<<39),-real(1645LL<<40), -real(318801LL<<29),reale(39213,0x11a47a8f8b3bdLL), // C4[15], coeff of eps^19, polynomial in n of order 4 real(1359187LL<<38),-real(4447191LL<<36),-real(433293LL<<37), real(1982883LL<<36),-real(164770109LL<<28), reale(666622,0x2bec23883ef8dLL), // C4[15], coeff of eps^18, polynomial in n of order 5 -real(6907451LL<<36),real(1332757LL<<38),-real(2401277LL<<36), real(253189LL<<37),real(26273LL<<36),-real(1574359LL<<30), reale(95231,0xbd21bbeee46cbLL), // C4[15], coeff of eps^17, polynomial in n of order 6 real(60642045LL<<33),-real(48519929LL<<32),-real(5596337LL<<34), real(57431697LL<<32),-real(26089089LL<<33),real(27095547LL<<32), -real(828361417LL<<25),reale(95231,0xbd21bbeee46cbLL), // C4[15], coeff of eps^16, polynomial in n of order 7 real(53036505LL<<34),-real(36153285LL<<35),real(80745483LL<<34), -real(18042031LL<<36),real(49556941LL<<34),-real(12180567LL<<35), real(7540351LL<<34),-real(278992987LL<<26), reale(222207,0x63f9612d6a52fLL), // C4[15], coeff of eps^15, polynomial in n of order 8 real(5892945LL<<35),-real(106383165LL<<32),real(102040995LL<<33), -real(332742375LL<<32),real(114463377LL<<34),-real(521444273LL<<32), real(233750881LL<<33),-real(278992987LL<<32),real(9764754545LL<<25), reale(666622,0x2bec23883ef8dLL), // C4[16], coeff of eps^23, polynomial in n of order 0 -real(1LL<<31),real(0x5f43434b6401e1LL), // C4[16], coeff of eps^22, polynomial in n of order 1 real(4571LL<<36),-real(33945LL<<32),reale(5963,0x471b5f51fec25LL), // C4[16], coeff of eps^21, polynomial in n of order 2 real(24269LL<<36),-real(5831LL<<35),-real(11703LL<<31), reale(5963,0x471b5f51fec25LL), // C4[16], coeff of eps^20, polynomial in n of order 3 -real(224895LL<<36),-real(32277LL<<37),real(111531LL<<36), -real(139825LL<<34),reale(41742,0xf1bf9b3df7503LL), // C4[16], coeff of eps^19, polynomial in n of order 4 real(978405LL<<37),-real(1674813LL<<35),real(162197LL<<36), real(29281LL<<35),-real(297087LL<<31),reale(41742,0xf1bf9b3df7503LL), // C4[16], coeff of eps^18, polynomial in n of order 5 -real(15263501LL<<36),-real(3038189LL<<38),real(24413445LL<<36), -real(10587549LL<<37),real(10822455LL<<36),-real(41181917LL<<32), reale(709630,0xdb94f1d6c533LL), // C4[16], coeff of eps^17, polynomial in n of order 6 -real(7565085LL<<36),real(16306961LL<<35),-real(3541967LL<<37), real(9518487LL<<35),-real(2301919LL<<36),real(1408637LL<<35), -real(3231579LL<<31),reale(101375,0xb8d15471eae75LL), // C4[16], coeff of eps^16, polynomial in n of order 7 -real(57998985LL<<33),real(52955595LL<<34),-real(165927531LL<<33), real(55309177LL<<35),-real(246030477LL<<33),real(108465049LL<<34), -real(128185967LL<<33),real(278992987LL<<30), reale(709630,0xdb94f1d6c533LL), // C4[17], coeff of eps^23, polynomial in n of order 0 -real(1121LL<<31),real(0x6ef59e61feaaea7LL), // C4[17], coeff of eps^22, polynomial in n of order 1 -real(59LL<<37),-real(309LL<<32),real(0x14ce0db25fc00bf5LL), // C4[17], coeff of eps^21, polynomial in n of order 2 -real(10703LL<<36),real(30413LL<<35),-real(148003LL<<31), reale(6324,0xb043d1b40e32fLL), // C4[17], coeff of eps^20, polynomial in n of order 3 -real(177777LL<<38),real(15715LL<<39),real(4277LL<<38), -real(68103LL<<33),reale(44272,0xd1dabbec63649LL), // C4[17], coeff of eps^19, polynomial in n of order 4 -real(407783LL<<37),real(2775087LL<<35),-real(1157751LL<<36), real(1167621LL<<35),-real(4428011LL<<31),reale(44272,0xd1dabbec63649LL), // C4[17], coeff of eps^18, polynomial in n of order 5 real(1580535LL<<37),-real(334719LL<<39),real(882049LL<<37), -real(210231LL<<38),real(127323LL<<37),-real(580027LL<<32), reale(44272,0xd1dabbec63649LL), // C4[17], coeff of eps^17, polynomial in n of order 6 real(801009LL<<36),-real(2422805LL<<35),real(785323LL<<37), -real(3419955LL<<35),real(1485435LL<<36),-real(1740081LL<<35), real(7540351LL<<31),reale(44272,0xd1dabbec63649LL), // C4[18], coeff of eps^23, polynomial in n of order 0 -real(89LL<<35),real(0x3351994085c8a607LL), // C4[18], coeff of eps^22, polynomial in n of order 1 real(763LL<<36),-real(1809LL<<33),real(0x15fe66403955fe03LL), // C4[18], coeff of eps^21, polynomial in n of order 2 real(91LL<<39),real(35LL<<38),-real(235LL<<34), real(0x15fe66403955fe03LL), // C4[18], coeff of eps^20, polynomial in n of order 3 real(667755LL<<37),-real(269591LL<<38),real(268793LL<<37), -real(508305LL<<34),reale(46802,0xb1f5dc9acf78fLL), // C4[18], coeff of eps^19, polynomial in n of order 4 -real(51319LL<<40),real(132867LL<<38),-real(31255LL<<39), real(18753LL<<38),-real(42441LL<<34),reale(15600,0xe5fc9ede45285LL), // C4[18], coeff of eps^18, polynomial in n of order 5 -real(1198615LL<<36),real(378917LL<<38),-real(1619009LL<<36), real(693861LL<<37),-real(806379LL<<36),real(1740081LL<<33), reale(46802,0xb1f5dc9acf78fLL), // C4[19], coeff of eps^23, polynomial in n of order 0 -real(983LL<<35),real(0x3617bd362c26857dLL), // C4[19], coeff of eps^22, polynomial in n of order 1 real(1LL<<46),-real(189LL<<37),reale(2596,0x737a284739077LL), // C4[19], coeff of eps^21, polynomial in n of order 2 -real(473LL<<40),real(467LL<<39),-real(3525LL<<34), real(0x172ebece12ebf011LL), // C4[19], coeff of eps^20, polynomial in n of order 3 real(2379LL<<41),-real(553LL<<42),real(329LL<<41),-real(2961LL<<35), reale(2596,0x737a284739077LL), // C4[19], coeff of eps^19, polynomial in n of order 4 real(2405LL<<41),-real(10101LL<<39),real(4277LL<<40),-real(4935LL<<39), real(42441LL<<34),reale(2596,0x737a284739077LL), // C4[20], coeff of eps^23, polynomial in n of order 0 -real(1LL<<38),real(0x1f5feefdb1f0c4fLL), // C4[20], coeff of eps^22, polynomial in n of order 1 real(379LL<<42),-real(357LL<<40),reale(2729,0x9a383778d2ed9LL), // C4[20], coeff of eps^21, polynomial in n of order 2 -real(249LL<<43),real(147LL<<42),-real(329LL<<38), reale(2729,0x9a383778d2ed9LL), // C4[20], coeff of eps^20, polynomial in n of order 3 -real(4797LL<<40),real(2009LL<<41),-real(2303LL<<40),real(4935LL<<37), reale(2729,0x9a383778d2ed9LL), // C4[21], coeff of eps^23, polynomial in n of order 0 -real(1327LL<<38),reale(2862,0xc0f646aa6cd3bLL), // C4[21], coeff of eps^22, polynomial in n of order 1 real(11LL<<44),-real(49LL<<39),real(0x3ba4052178e24469LL), // C4[21], coeff of eps^21, polynomial in n of order 2 real(473LL<<43),-real(539LL<<42),real(2303LL<<38), reale(2862,0xc0f646aa6cd3bLL), // C4[22], coeff of eps^23, polynomial in n of order 0 -real(1LL<<41),real(0x5ac8f5f3162ebfdLL), // C4[22], coeff of eps^22, polynomial in n of order 1 -real(23LL<<43),real(49LL<<40),real(0x1105ae1d9428c3f7LL), // C4[23], coeff of eps^23, polynomial in n of order 0 real(1LL<<41),real(0xc5e28ed2c935abLL), }; // count = 2900 #elif GEOGRAPHICLIB_GEODESICEXACT_ORDER == 27 static const real coeff[] = { // C4[0], coeff of eps^26, polynomial in n of order 0 4654,real(327806325), // C4[0], coeff of eps^25, polynomial in n of order 1 -331600,247203,real(5135632425LL), // C4[0], coeff of eps^24, polynomial in n of order 2 -real(30660788480LL),real(15209307520LL),real(3757742824LL), real(0xbd65c2e6062dLL), // C4[0], coeff of eps^23, polynomial in n of order 3 -real(0x4a56872d110LL),real(0x30d818a0d20LL),-real(0x183639ebbb0LL), real(0x1207973318dLL),real(0x472c0a3d3d1ee9LL), // C4[0], coeff of eps^22, polynomial in n of order 4 -real(0x743607eea80LL),real(0x5536ade42a0LL),-real(0x37e9933c940LL), real(0x1bb15f964e0LL),real(469120197546LL),real(0x472c0a3d3d1ee9LL), // C4[0], coeff of eps^21, polynomial in n of order 5 -real(0x1a80e82073690LL),real(0x1485d9e7af5c0LL),-real(0xf039fc9e8ff0LL), real(0x9d5f26153ce0LL),-real(0x4ddf0f750f50LL),real(0x39e793daa6ebLL), real(0xadde5e94360277dLL), // C4[0], coeff of eps^20, polynomial in n of order 6 -real(0xe72f9d31220580LL),real(0xb817a196612bc0LL), -real(0x8e0a680913c900LL),real(0x67a3067b290a40LL), -real(0x43c43707776c80LL),real(0x217ef7b84400c0LL), real(0x83b895ad56e94LL),reale(16517,0x8519000aea763LL), // C4[0], coeff of eps^19, polynomial in n of order 7 -real(0x5be35cb0a188d670LL),real(0x49fb9f6e0e1fa420LL), -real(0x3a970b1601b36050LL),real(0x2d0406e3051baec0LL), -real(0x20bde41e80026c30LL),real(0x155cea808b65d160LL), -real(0xa8bc4b2c853c610LL),real(0x7d3acd77deac86fLL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^18, polynomial in n of order 8 -reale(2219,0x955c84d349100LL),real(0x6f523368eabed3a0LL), -real(0x58df9f4050ea48c0LL),real(0x45eb9b162449f0e0LL), -real(0x35736f4da3b86880LL),real(0x26bb8b2d01772220LL), -real(0x19350a3e2b857840LL),real(0xc6cd21a34a65f60LL), real(0x30a9f24aaae2862LL),reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^17, polynomial in n of order 9 -reale(3520,0x86c418e66b430LL),reale(2768,0x78979286ec480LL), -reale(2191,0xabc9bb4d59ed0LL),real(0x6c38e96882e6a560LL), -real(0x54765a5d7300bb70LL),real(0x402d11108cfc5240LL), -real(0x2e4c264c23518e10LL),real(0x1e09e0cfb5ca8720LL), -real(0xec7bce3f9449ab0LL),real(0xaf0b9139605a58dLL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^16, polynomial in n of order 10 -reale(6136,0x52223aecbfa00LL),reale(4597,0xf56d1171d1b00LL), -reale(3531,0xe10107f964800LL),reale(2747,0xc7a53bf3c9500LL), -reale(2142,0x9c25bfa8f9600LL),real(0x677abbdfa4dcef00LL), -real(0x4e0ad45efdfc2400LL),real(0x37ff2b5bd74de900LL), -real(0x2432b6ddc0003200LL),real(0x11c5dbb8178f4300LL), real(0x4536f43fdb6a550LL),reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^15, polynomial in n of order 11 -reale(13102,0xf96f6011eba70LL),reale(8724,0xbd02d5fc04060LL), -reale(6234,0x68dfd557291d0LL),reale(4636,0xd96d16348cb80LL), -reale(3525,0x47255186b7b30LL),reale(2702,0xc781c601a46a0LL), -reale(2062,0x7b91b55fb7290LL),real(0x60521f1f549575c0LL), -real(0x44a70474ce1373f0LL),real(0x2c2e0084319d1ce0LL), -real(0x15a2a473a1b17b50LL),real(0xff41fd49dab95d3LL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^14, polynomial in n of order 12 -reale(63391,0x70a4897dc9e80LL),reale(23343,0xc5a3f9fbbcce0LL), -reale(13453,0x278d24cdf3ac0LL),reale(8911,0x777a0315423a0LL), -reale(6323,0x2714f8a7fff00LL),reale(4656,0xe8c5e07109660LL), -reale(3491,0x6be5fd90e340LL),reale(2621,0xb84b17c4ad20LL), -real(0x78f908534453df80LL),real(0x55814182d129efe0LL), -real(0x36b7bc0c02deebc0LL),real(0x1ab5b755becbe6a0LL), real(0x672760e43e7e5beLL),reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^13, polynomial in n of order 13 reale(112706,0xdfd869d806ed0LL),reale(29093,0xf8d3fc140cbc0LL), -reale(65760,0x7b52c14019950LL),reale(24105,0xa651ba0482d20LL), -reale(13822,0xd4286a2c4c370LL),reale(9095,0xad3608e2bd280LL), -reale(6394,0x2414e7ceec390LL),reale(4646,0x4bdec656d47e0LL), -reale(3413,0x76099d6b04db0LL),reale(2482,0x54f2fd0561940LL), -real(0x6c7d891fb0df15d0LL),real(0x44efe2727b65d2a0LL), -real(0x2183dc0de2efcff0LL),real(0x189262ba581c6bf1LL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^12, polynomial in n of order 14 reale(22421,0x80a7495217980LL),-reale(122681,0x25b6cd6074ac0LL), reale(117806,0x7498b0aecaf00LL),reale(29700,0x9de1e174ab0c0LL), -reale(68413,0x428634ee0fb80LL),reale(24937,0xf2aac2170b440LL), -reale(14209,0x4f5514d0cb600LL),reale(9268,0x742c2dd2c8fc0LL), -reale(6433,0x2286f06b3b080LL),reale(4585,0x3348b70941340LL), -reale(3266,0x3bda622d31b00LL),reale(2252,0x1340649a90ec0LL), -real(0x589f5d02f1d02580LL),real(0x2adce3e44e715240LL), real(0xa36591ccc5a22bcLL),reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^11, polynomial in n of order 15 real(0x3845a63e874b7f90LL),reale(2990,0x790a9d44cfaa0LL), reale(23275,0xc0709755ecab0LL),-reale(127863,0x516b98584c9c0LL), reale(123656,0x74905ab09b3d0LL),reale(30291,0xc8698ff57f9e0LL), -reale(71410,0x2ebef8806f110LL),reale(25848,0x521bca14dd980LL), -reale(14605,0xac6deef7d4ff0LL),reale(9413,0x816443bfd6920LL), -reale(6415,0x315eed8f094d0LL),reale(4438,0xfed32587f3cc0LL), -reale(3002,0xabba02cdaebb0LL),real(0x74ba3cd78aa5e860LL), -real(0x3812b2b32b2f8090LL),real(0x28bab2d4ac11f317LL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^10, polynomial in n of order 16 real(0xbcd4fd6df5b2600LL),real(0x17fed2a1d906c020LL), real(0x3a338f7e05a82540LL),reale(3102,0x8ee9d52fa7060LL), reale(24235,0xac0c2ca98fc80LL),-reale(133761,0xdb81f4d32fb60LL), reale(130458,0x34533ae1a43c0LL),reale(30833,0xcd61b102f94e0LL), -reale(74830,0xb3a54c3df6d00LL),reale(26842,0xad19affdd3920LL), -reale(14996,0x635b9e8c37dc0LL),reale(9500,0x408e4569f0960LL), -reale(6294,0x8e3c24f515680LL),reale(4143,0x97d5a30101da0LL), -reale(2534,0x56aa081845f40LL),real(0x4b644b6e4da18de0LL), real(0x11925bb6ba64765aLL),reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^9, polynomial in n of order 17 real(0x3fcae6c51cf8fd0LL),real(0x6afa1c71c2ac100LL), real(0xc2892977602fa30LL),real(0x18cb840e0ff332e0LL), real(0x3c56602ddecd9290LL),reale(3228,0x26f051b5c20c0LL), reale(25324,0xf8a24438674f0LL),-reale(140558,0x5b2d711d11960LL), reale(138496,0xa2474d581bd50LL),reale(31265,0x7dd7c9350e080LL), -reale(78781,0x407f0fc917850LL),reale(27920,0xd85d0c9896a60LL), -reale(15347,0xbd51776ab0ff0LL),reale(9468,0xaa167d507e040LL), -reale(5981,0xcd152be8bed90LL),reale(3570,0xf062f37e99e20LL), -real(0x68dc53d94dbff530LL),real(0x4ae92c9a7a683bf5LL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^8, polynomial in n of order 18 real(0x1b54ebcbbde1f00LL),real(0x2947b9527677980LL), real(0x415d003e7b1b800LL),real(0x6df9566e0623680LL), real(0xc8ad7ddfed65100LL),real(0x19abdc3c4555e380LL), real(0x3eb74cbd79d9ca00LL),reale(3370,0x20d152b7a6080LL), reale(26575,0x8086d641a0300LL),-reale(148506,0xeae36b607280LL), reale(148190,0x3f5dc7314dc00LL),reale(31472,0x41aaeb33d4a80LL), -reale(83406,0xf30366e47cb00LL),reale(29065,0x630b32b837780LL), -reale(15585,0x2764a1e4e1200LL),reale(9192,0xabf11a369f480LL), -reale(5286,0x3613c4b401900LL),reale(2436,0x784ea73c0a180LL), real(0x2209232c3cc4cca8LL),reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^7, polynomial in n of order 19 real(0xd73a52d8bd1790LL),real(0x13078939da8f2e0LL), real(0x1bc62bcb4923530LL),real(0x2a1bb9d3adccf00LL), real(0x42f03cdd160e0d0LL),real(0x711670ab4ed8b20LL), real(0xcf3f2963eb3be70LL),real(0x1aa1c278c7668b40LL), real(0x416120b2cbe67210LL),reale(3532,0x3a6649f1d3360LL), reale(28031,0x35f5ca2c79fb0LL),-reale(157970,0xd11b280f51880LL), reale(160182,0x9c904f3daeb50LL),reale(31228,0xe702b02a70ba0LL), -reale(88907,0xf3445bc050710LL),reale(30210,0xe03f62b8103c0LL), -reale(15533,0x7a0f6ace49370LL),reale(8379,0xc089c57da33e0LL), -reale(3746,0x32a85741515d0LL),reale(2585,0x396e1f38f6dbbLL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^6, polynomial in n of order 20 real(0x73457ae9fefc80LL),real(0x9bfefa36a68d60LL), real(0xd7e57b2fb0d740LL),real(0x132c60dd72bf720LL), real(0x1c1d29144004a00LL),real(0x2ad464b0fcdcce0LL), real(0x446dc104a967cc0LL),real(0x7436e717eb8b6a0LL), real(0xd626d1c40bc9780LL),real(0x1badddc640275c60LL), real(0x445f879c8f67c240LL),reale(3719,0x5820c25fe6620LL), reale(29754,0xa45b204c52500LL),-reale(169504,0xe227b2d578420LL), reale(175522,0xa8a2f18c5e7c0LL),reale(30060,0x7f96216b245a0LL), -reale(95556,0xca707dfd4cd80LL),reale(31150,0x37da9e0a66b60LL), -reale(14734,0x203a74e6dd2c0LL),reale(6239,0x114e25ea99520LL), real(0x4f113ff5b79764b6LL),reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^5, polynomial in n of order 21 real(0x40c53da188eed0LL),real(0x54ed187b34c440LL), real(0x7146df082c9bb0LL),real(0x9a154e844696a0LL), real(0xd666e59b550690LL),real(0x13262a46ef0dd00LL), real(0x1c3f2cd359b1b70LL),real(0x2b4dcc62e91c360LL), real(0x45a57497f9cc650LL),real(0x771c08f5a9775c0LL), real(0xdd1a4961392f330LL),real(0x1ccccddd60de2020LL), real(0x47bbc762b5878e10LL),reale(3937,0xc2066e54dee80LL), reale(31838,0x13ce9b56b82f0LL),-reale(183990,0x8ea49a06f320LL), reale(196055,0x20a74184cbdd0LL),reale(26856,0x50de39af9a740LL), -reale(103681,0x9284ca213d550LL),reale(31195,0x5686bd94fe9a0LL), -reale(11739,0xecc6d600c4a70LL),reale(7362,0xc12f75a94f319LL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^4, polynomial in n of order 22 real(0x25018b34093680LL),real(0x2f66db340747c0LL), real(0x3d8eaf55c4d300LL),real(0x512efdf6054640LL), real(0x6cf4c335af0f80LL),real(0x952f237cecdcc0LL), real(0xd10b7e4cd0dc00LL),real(0x12cf85d69a3fb40LL), real(0x1bf83185acb2880LL),real(0x2b3ea99410c91c0LL), real(0x462f30f09fee500LL),real(0x7931c8e1f8c9040LL), real(0xe34caff0bb50180LL),real(0x1def0c2db115e6c0LL), real(0x4b7080401d466e00LL),reale(4194,0xbf682a6ae8540LL), reale(34423,0x2600aa7441a80LL),-reale(202943,0xe8d9bbd87a440LL), reale(225378,0x7bd3e279ef700LL),reale(18574,0x52c9633395a40LL), -reale(113350,0xffc66a8300c80LL),reale(27528,0x198b9d86370c0LL), reale(3947,0xb3131e15c994LL),reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^3, polynomial in n of order 23 real(0x14ba9dec234d90LL),real(0x1a15f878f54920LL), real(0x2134b5fb572db0LL),real(0x2acf89c87d75c0LL), real(0x37fb978513cbd0LL),real(0x4a626dbdd79a60LL), real(0x64a2becb8c9bf0LL),real(0x8afd5ca732eb00LL), real(0xc4970cf56e1210LL),real(0x11deb4357fc9ba0LL), real(0x1add3c5ff77a230LL),real(0x2a08c939311e040LL), real(0x451c5af5bb5c050LL),real(0x7909ad73ef1ece0LL), real(0xe685850971be070LL),real(0x1edeb97922aff580LL), real(0x4f3a8e20463e7690LL),reale(4494,0x6f4eb7a652e20LL), reale(37733,0xf376431ecf6b0LL),-reale(229273,0xd3dfdae1d3540LL), reale(271637,0x92a93446bd4d0LL),-reale(5667,0x8cc9ebb9c00a0LL), -reale(121042,0xac8f4eff17b10LL),reale(39799,0x5b8561a065b3fLL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^2, polynomial in n of order 24 real(0xab22c89592500LL),real(0xd46ccddd414a0LL),real(0x10a4eb8f1ddb40LL), real(0x15184ab619d7e0LL),real(0x1b0f2efb81a980LL), real(0x232d3128e64f20LL),real(0x2e6a3ee43c47c0LL), real(0x3e471bedb3b260LL),real(0x552919f15d6e00LL), real(0x7700089e6e39a0LL),real(0xaa7eb4de50d440LL), real(0xfb834e2f281ce0LL),real(0x1801af760623280LL), real(0x263a4a7c48d9420LL),real(0x401905d594140c0LL), real(0x72c2e250398d760LL),real(0xe012c263c05b700LL), real(0x1edcfb1205061ea0LL),real(0x51c797f92b334d40LL), reale(4810,0x460394707a1e0LL),reale(42101,0xccb76963dbb80LL), -reale(269613,0x72aa3b84666e0LL),reale(357865,0x4c16ffd0cb9c0LL), -reale(115779,0xf2f861d29c3a0LL),-reale(21708,0xbd8e92577d4aeLL), reale(1139708,0xdfbd02f131dafLL), // C4[0], coeff of eps^1, polynomial in n of order 25 real(0x16b98c18c43f0LL),real(0x1be76827efc80LL),real(0x2291674649910LL), real(0x2b3d2747a6820LL),real(0x36a8d2fdcc830LL),real(0x45e795ad137c0LL), real(0x5a8eeaa036550LL),real(0x77007a4bcbf60LL),real(0x9ee5aa2960470LL), real(0xd8045ac825300LL),real(0x12bb93df5b3990LL), real(0x1a9b1c398546a0LL),real(0x26d2a92f5c98b0LL), real(0x3a7858f998ee40LL),real(0x5b6e62f9c0b5d0LL), real(0x959d5c24529de0LL),real(0x102f2d0b50524f0LL), real(0x1e1472bfb1ba980LL),real(0x3d69bf9cb587a10LL), real(0x8ee1210e8c36520LL),real(0x194d332fe8d44930LL), real(0x6534ccbfa35124c0LL),reale(15788,0x2cc4c78572650LL), -reale(115779,0xf2f861d29c3a0LL),reale(173669,0xec7492bbea570LL), -reale(75980,0x9773003236861LL),reale(379902,0xf53f00fb109e5LL), // C4[0], coeff of eps^0, polynomial in n of order 26 real(0x104574695550b58LL),real(0x124efd1ef41bc1cLL), real(0x14b36c04f5f7ca0LL),real(0x1787788b9792f24LL), real(0x1ae5caaf52545e8LL),real(0x1ef111702bafd2cLL), real(0x23d6fb7cfc3d530LL),real(0x29d483e08118c34LL), real(0x313c47ee86cd878LL),real(0x3a800de5bbb223cLL), real(0x463f6a859617dc0LL),real(0x555ed8909112544LL), real(0x692d2b9362db308LL),real(0x83a245a495f5b4cLL), real(0xa7cc0a01a036650LL),real(0xda93e49d10b2a54LL), real(0x1243757f6f15c598LL),real(0x193422259e6ad85cLL), real(0x24309a0ea1d47ee0LL),real(0x36b22ea791accb64LL), real(0x588e3327aee70028LL),reale(2530,0x27feb6f2ec96cLL), reale(5262,0xb996ed2c7b770LL),reale(14472,0x7e5f0c3a53874LL), reale(86834,0xf63a495df52b8LL),-reale(303922,0x5dcc00c8da184LL), reale(759805,0xea7e01f6213caLL),reale(1139708,0xdfbd02f131dafLL), // C4[1], coeff of eps^26, polynomial in n of order 0 4654,real(327806325), // C4[1], coeff of eps^25, polynomial in n of order 1 real(22113584),5520955,real(0xf784431927LL), // C4[1], coeff of eps^24, polynomial in n of order 2 real(29556996608LL),-real(15922652416LL),real(11273228472LL), real(0x2383148b21287LL), // C4[1], coeff of eps^23, polynomial in n of order 3 real(0x165661ad6b70LL),-real(0x1009b31cabe0LL),real(0x7444963bdd0LL), real(0x1d0511c64f5LL),real(0x42b94999694cfa7LL), // C4[1], coeff of eps^22, polynomial in n of order 4 real(696434041088LL),-real(561462728640LL),real(334369174656LL), -real(182661157184LL),real(127941872058LL),real(0x13691a10b39411LL), // C4[1], coeff of eps^21, polynomial in n of order 5 real(0x2b50c847e5bec70LL),-real(0x25172ad2adc8640LL), real(0x187490c86e06510LL),-real(0x11cf5b364679120LL), real(0x7e9f37da26e7b0LL),real(0x1f979b01bfd5e3LL), reale(227941,0xc6590096a3923LL), // C4[1], coeff of eps^20, polynomial in n of order 6 real(0x84a641c077c100LL),-real(0x75601a6b667780LL), real(0x51157a29d94600LL),-real(0x4247925ad10480LL), real(0x269068d8c2ab00LL),-real(0x15748d5a64a980LL), real(0xed190d6b360a4LL),reale(29731,0x892d0013a607fLL), // C4[1], coeff of eps^19, polynomial in n of order 7 real(0x57e3d5e3e8a64d50LL),-real(0x4ee151925712ac60LL), real(0x379f60f9d8160ef0LL),-real(0x3036f6417460ec40LL), real(0x1eece80c1c746690LL),-real(0x16f21d696f523420LL), real(0x9ef6bfafd871830LL),real(0x27a3f6720674fabLL), reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^18, polynomial in n of order 8 reale(2128,0x469250df87e00LL),-real(0x76ff6f2ca68ee740LL), real(0x544ea56af984a280LL),-real(0x4b3b3c5b1f3b3dc0LL), real(0x324e822f05811f00LL),-real(0x29dd8ae6f4502040LL), real(0x179c3b6434632b80LL),-real(0xd7628385c5d56c0LL), real(0x91fdd6e000a7926LL),reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^17, polynomial in n of order 9 reale(3396,0xc29d3f547be10LL),-reale(2963,0x6657b77d7b180LL), reale(2082,0xa3af2d55cd2f0LL),-real(0x74e3fc23ed074b20LL), real(0x4f51e11c0cc64dd0LL),-real(0x45cc62cad46028c0LL), real(0x2b210825284d5ab0LL),-real(0x20cfde05bc67de60LL), real(0xdb6584e22cc2590LL),real(0x36aae0ede944991LL), reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^16, polynomial in n of order 10 reale(5994,0xfab7bd428a400LL),-reale(4919,0xd8955c3980a00LL), reale(3376,0x641d9d71fd000LL),-reale(2975,0x320d339261600LL), real(0x7dd1b5a4fb9ffc00LL),-real(0x712cdc1424704200LL), real(0x486493a43f86e800LL),-real(0x3daeb06e6a40ce00LL), real(0x21506b8426325400LL),-real(0x13a656589a61fa00LL), real(0xcfa4dcbf923eff0LL),reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^15, polynomial in n of order 11 reale(13117,0x6cbddabc52ed0LL),-reale(9318,0xa8f3ea9b44c20LL), reale(6040,0x7b2fdab4ba7f0LL),-reale(5022,0x22b8983435e80LL), reale(3330,0x281af37e2710LL),-reale(2968,0x456e895a2c0e0LL), real(0x7764510336be0030LL),-real(0x6af4843f7d4f5f40LL), real(0x3eba1ed514e18750LL),-real(0x31669b90045c25a0LL), real(0x13a17c0101ce1070LL),real(0x4e2a88c78d66acfLL), reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^14, polynomial in n of order 12 reale(68147,0x8cb1a33fbb300LL),-reale(25030,0x19a83b314d5c0LL), reale(13399,0xd5b954b9ffe80LL),-reale(9632,0x5ff7adc5b8740LL), reale(6058,0x6185fb910e200LL),-reale(5122,0x24f31e326fcc0LL), reale(3246,0x498e64bf8a580LL),-reale(2929,0xc60f539a7ee40LL), real(0x6e041fee5d419100LL),-real(0x60b53ba76d5f13c0LL), real(0x3113d4fc9085ec80LL),-real(0x1e6533c87b7d2540LL), real(0x1357622acbb7b13aLL),reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^13, polynomial in n of order 13 -reale(121532,0xe4514e2bd7670LL),-reale(15940,0x17553143d1340LL), reale(71019,0xc50f40d0125f0LL),-reale(26120,0x5d81b142df60LL), reale(13667,0x35bfe1bb73850LL),-reale(9984,0xe4f4c1c8f9780LL), reale(6033,0x4bb2ec6997cb0LL),-reale(5212,0x5459006443fa0LL), reale(3108,0x7a1250dedaf10LL),-reale(2836,0xbc55f0b59dbc0LL), real(0x605fcd3581f88b70LL),-real(0x4fb9f3b2da8b6fe0LL), real(0x1d6444fcd70bcdd0LL),real(0x74c81d1452803b5LL), reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^12, polynomial in n of order 14 -reale(18279,0x4105927635f00LL),reale(111436,0xf9c78acad1e80LL), -reale(127455,0xb83d096a36600LL),-reale(14599,0xb6308ef406280LL), reale(74253,0x38e0bbebab300LL),-reale(27394,0x6661a055a9b80LL), reale(13898,0x35bd350d73c00LL),-reale(10384,0x95909b51f3c80LL), reale(5941,0x73f13b5b28500LL),-reale(5277,0x6484894bf580LL), reale(2891,0x688dd5accde00LL),-reale(2646,0x1bce07b5e7680LL), real(0x4c6028727ac69700LL),-real(0x32eae1a8c2946f80LL), real(0x1ea30b56650e6834LL),reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^11, polynomial in n of order 15 -real(0x26534490cad1dfb0LL),-reale(2194,0x14a85ebaf95e0LL), -reale(18676,0x98f19d91af310LL),reale(115088,0x35b741cc34140LL), -reale(134245,0x8207aed455070LL),-reale(12735,0xf52bb5c1fbfa0LL), reale(77916,0x32c371fd8ec30LL),-reale(28918,0xb36d158cbf480LL), reale(14055,0x84fcc4e4ea6d0LL),-reale(10840,0xa60c8c5d6b960LL), reale(5745,0xafd650291c370LL),-reale(5282,0xabba6463d6a40LL), reale(2556,0x876a7d9212610LL),-reale(2272,0x615ae9eab6320LL), real(0x2e7aab3dc406b2b0LL),real(0xb7e588c69951913LL), reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^10, polynomial in n of order 16 -real(0x6ec9ec72fa83400LL),-real(0xee6121f9ed5ac40LL), -real(0x2698258da225a980LL),-reale(2223,0x82921a72280c0LL), -reale(19088,0x4fb95e6188700LL),reale(119080,0xff5c72a1c6ec0LL), -reale(142117,0x7c3deb03b7480LL),-reale(10117,0x6e8319b8485c0LL), reale(82086,0xede392256e600LL),-reale(30795,0xed5c849e10640LL), reale(14073,0x47ff3f3e080LL),-reale(11359,0x76d81b264bac0LL), reale(5387,0x791e9eab0d300LL),-reale(5153,0xcdddc38eb4b40LL), real(0x7fb4f5b53eb31580LL),-real(0x5fcfbdbbdde05fc0LL), real(0x34b713242f2d630eLL),reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^9, polynomial in n of order 17 -real(0x20f38bbaca812f0LL),-real(0x39b499036d51b00LL), -real(0x6e4d3364d687b10LL),-real(0xee56650d93fe5a0LL), -real(0x26cbb66f58b91d30LL),-reale(2250,0xe985ef9ea8440LL), -reale(19510,0x3134f0f32ad50LL),reale(123456,0xc66bc06159520LL), -reale(151362,0xfafa005fcdf70LL),-reale(6379,0xaa0075c90d80LL), reale(86843,0xd7e050f079870LL),-reale(33196,0x7f1161b25e020LL), reale(13831,0x3ac1850370650LL),-reale(11930,0x8d19c5e9856c0LL), reale(4775,0x36871b380b630LL),-reale(4708,0xdfb0fde91e560LL), real(0x4e466dbc0d5cf410LL),real(0x132845ea2b7be139LL), reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^8, polynomial in n of order 18 -real(0xcaab4ddd8d4600LL),-real(0x13c31d1cbb16d00LL), -real(0x207a98d99de3000LL),-real(0x390c3dedd68b300LL), -real(0x6d71551ca261a00LL),-real(0xed90e825b918900LL), -real(0x26e62c786e462400LL),-reale(2274,0xbbaf6c5e10f00LL), -reale(19934,0x1db266a5f6e00LL),reale(128254,0x3ade3c4739b00LL), -reale(162383,0xab3413f131800LL),-real(0x3992c873ce48ab00LL), reale(92230,0x4a4593a3dbe00LL),-reale(36418,0x345102e4b0100LL), reale(13110,0x864dfe531f400LL),-reale(12475,0xa3edd9488700LL), reale(3771,0xc13fa20286a00LL),-reale(3469,0x365d076765d00LL), real(0x661b6984b64e65f8LL),reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^7, polynomial in n of order 19 -real(0x5b1678b2b96e30LL),-real(0x83e7d604d6e1a0LL), -real(0xc5c1bd21f06210LL),-real(0x135402446a1f500LL), -real(0x1fd9e061288aff0LL),-real(0x381fb1c2d0ea860LL), -real(0x6c176a9d32ee3d0LL),-real(0xebcbb379725c7c0LL), -real(0x26dc285f96da89b0LL),-reale(2292,0x8c4f779be1f20LL), -reale(20344,0xed4bfa0642d90LL),reale(133496,0x33ba4ee858580LL), -reale(175742,0x64c709ffb5b70LL),reale(7288,0xff81f26b85a20LL), reale(98139,0x5735ff04360b0LL),-reale(41010,0x6c5dc3c9a6d40LL), reale(11505,0xfe66ab587ad0LL),-reale(12646,0x14c7a4cad9ca0LL), reale(2204,0x9aaf76ecb66f0LL),real(0x2076d1ad78dbacf7LL), reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^6, polynomial in n of order 20 -real(0x2d4d049c656700LL),-real(0x3e4af5e8d022c0LL), -real(0x57ced7fe851580LL),-real(0x7f7034131ef240LL), -real(0xbf83d85dea6c00LL),-real(0x12c465612feb5c0LL), -real(0x1f04ac518a30280LL),-real(0x36d88216b840540LL), -real(0x6a13494183c7100LL),-real(0xe8a2e478ed378c0LL), -real(0x269ca36792944f80LL),-reale(2300,0x7badf4501a840LL), -reale(20714,0x7015050283600LL),reale(139156,0x8278406ccd440LL), -reale(192233,0x29cb54965bc80LL),reale(20133,0xdb20ab18364c0LL), reale(103930,0xc444b13858500LL),-reale(48022,0x859c77e028ec0LL), reale(8312,0x1287962dbf680LL),-reale(10954,0x169105fd99e40LL), reale(3795,0x3bfe126c62e22LL),reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^5, polynomial in n of order 21 -real(0x1802918882e770LL),-real(0x1fcd949a6860c0LL), -real(0x2aeab9b7d2f010LL),-real(0x3b2acc792185e0LL), -real(0x539feddcdda2b0LL),-real(0x79b43080aca700LL), -real(0xb76e50170e2350LL),-real(0x1207f374f78a820LL), -real(0x1de74f0a09e95f0LL),-real(0x351484156246d40LL), -real(0x6722781c7da1e90LL),-real(0xe37fba15ed8da60LL), -real(0x260d3a8a453ee130LL),-reale(2292,0x258c84a62d380LL), -reale(20989,0x3411bcc4001d0LL),reale(145073,0x9b58d1932c360LL), -reale(212947,0x443e0cc67a470LL),reale(41274,0x9a63d1cc50640LL), reale(107042,0xff9bf7f6712f0LL),-reale(59294,0xf496954c0eee0LL), reale(2833,0xc664f5dce0050LL),real(0x17b85ffcea47049dLL), reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^4, polynomial in n of order 22 -real(0xd20723e198100LL),-real(0x10e999b2026480LL), -real(0x161c2993f30e00LL),-real(0x1d62585afd4f80LL), -real(0x27ca0dc8a2fb00LL),-real(0x370cc97a8ce280LL), -real(0x4e170b46a3d800LL),-real(0x7213d21df5ad80LL), -real(0xac9b82d7503500LL),-real(0x1109444f53c4080LL), -real(0x1c6019c5f02a200LL),-real(0x329a7eb49a52b80LL), -real(0x62d84097135af00LL),-real(0xdb6f2c88eb4fe80LL), -real(0x2502e63c01a3ec00LL),-reale(2256,0x8389e52b04980LL), -reale(21063,0xc2942f767e900LL),reale(150710,0x347c6ec646380LL), -reale(239155,0x111ed671c3600LL),reale(78297,0xeac3242447880LL), reale(97157,0xffcea47049d00LL),-reale(74487,0xcca6f58949a80LL), reale(11841,0x219395a415cbcLL),reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^3, polynomial in n of order 23 -real(0x7207334f38cb0LL),-real(0x8fe6a0f540760LL), -real(0xb7c4f4df6c510LL),-real(0xedcd97a176940LL), -real(0x1384e0d9162770LL),-real(0x1a108f169c7320LL), -real(0x2378674e3fafd0LL),-real(0x3154606a2c6100LL), -real(0x465a9ded7c5a30LL),-real(0x675a79a8aa6ee0LL), -real(0x9d4a8ab99e2290LL),-real(0xf9e328cb49d8c0LL), -real(0x1a2ce594ece04f0LL),-real(0x2efbcc23543daa0LL), -real(0x5c688ee5939fd50LL),-real(0xceb90d2fccdb080LL), -real(0x2331240c282307b0LL),-reale(2173,0x456299e8e9660LL), -reale(20716,0x42df2018b2010LL),reale(154405,0x43613e2a37c0LL), -reale(270827,0xec43372c34270LL),reale(146546,0xa61bf3c2f7de0LL), reale(26313,0x9ff2a1de69530LL),-reale(32563,0x1c55db833bf05LL), reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^2, polynomial in n of order 24 -real(0x39a9fc22d9600LL),-real(0x47a4ffa857140LL), -real(0x59ea353148580LL),-real(0x721982b3023c0LL), -real(0x9291e22ef9d00LL),-real(0xbeda9ea6fc240LL), -real(0xfc517cd616480LL),-real(0x1535335443d4c0LL), -real(0x1d14474c2c6400LL),-real(0x28c4706fdbe340LL), -real(0x3aa43e35a32380LL),-real(0x56eefde83775c0LL), -real(0x859522b6982b00LL),-real(0xd663f0e8861440LL), -real(0x16b2ad2884e0280LL),-real(0x2932441ccc746c0LL), -real(0x51f4ee722e73200LL),-real(0xb97e18f372a9540LL), -real(0x1ff5b9ebacd64180LL),-real(0x7d04fcecbaaf87c0LL), -reale(19431,0x998fba7cdb900LL),reale(150594,0xe619e547a59c0LL), -reale(294712,0x9903e1bb02080LL),reale(231559,0xe5f0c3a538740LL), -reale(65126,0x38abb70677e0aLL),reale(3419126,0x9f3708d39590dLL), // C4[1], coeff of eps^1, polynomial in n of order 25 -real(0x16b98c18c43f0LL),-real(0x1be76827efc80LL), -real(0x2291674649910LL),-real(0x2b3d2747a6820LL), -real(0x36a8d2fdcc830LL),-real(0x45e795ad137c0LL), -real(0x5a8eeaa036550LL),-real(0x77007a4bcbf60LL), -real(0x9ee5aa2960470LL),-real(0xd8045ac825300LL), -real(0x12bb93df5b3990LL),-real(0x1a9b1c398546a0LL), -real(0x26d2a92f5c98b0LL),-real(0x3a7858f998ee40LL), -real(0x5b6e62f9c0b5d0LL),-real(0x959d5c24529de0LL), -real(0x102f2d0b50524f0LL),-real(0x1e1472bfb1ba980LL), -real(0x3d69bf9cb587a10LL),-real(0x8ee1210e8c36520LL), -real(0x194d332fe8d44930LL),-real(0x6534ccbfa35124c0LL), -reale(15788,0x2cc4c78572650LL),reale(115779,0xf2f861d29c3a0LL), -reale(173669,0xec7492bbea570LL),reale(75980,0x9773003236861LL), reale(3419126,0x9f3708d39590dLL), // C4[2], coeff of eps^26, polynomial in n of order 0 2894476,real(0xfe89d46f33LL), // C4[2], coeff of eps^25, polynomial in n of order 1 -8609536,5603312,real(590597728875LL), // C4[2], coeff of eps^24, polynomial in n of order 2 -real(104352359168LL),real(40707880576LL),real(10376961584LL), real(0xb18f66b7a5ca3LL), // C4[2], coeff of eps^23, polynomial in n of order 3 -real(0x265f8c17d00LL),real(0x13bddd35200LL),-real(871294451456LL), real(553528081392LL),real(0xa1c12e8b2dd1e3LL), // C4[2], coeff of eps^22, polynomial in n of order 4 -real(0x46e25cf59280LL),real(0x290af5269020LL),-real(0x22f7c7b01940LL), real(0xd08f4d0d560LL),real(0x355c24081bcLL),real(0xc015674546693d9LL), // C4[2], coeff of eps^21, polynomial in n of order 5 -real(0x326f6045f923c80LL),real(0x1fb1615f9d3a600LL), -real(0x1db1797638c1780LL),real(0xe9780531c07300LL), -real(0x9d24cc38e5d280LL),real(0x60cf9034bf3868LL), reale(379902,0xf53f00fb109e5LL), // C4[2], coeff of eps^20, polynomial in n of order 6 -real(0x4837c78c0550480LL),real(0x313ba08613af040LL), -real(0x2ee33229a4bc300LL),real(0x1a152ee5f2ae9c0LL), -real(0x172de5252da0180LL),real(0x824fa762c0c340LL), real(0x2180172e018ad8LL),reale(379902,0xf53f00fb109e5LL), // C4[2], coeff of eps^19, polynomial in n of order 7 -real(0x5fc4bec46509e480LL),real(0x48096a7e75900b00LL), -real(0x41caf1fb886dd580LL),real(0x28558a32a56ef200LL), -real(0x26dce3ddd1a42680LL),real(0x120433e2d2025900LL), -real(0xce36e1803df1780LL),real(0x7a135866f905bb8LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^18, polynomial in n of order 8 -reale(2176,0xe1585afea1500LL),real(0x73bced2a00a143a0LL), -real(0x5fca97395e84bfc0LL),real(0x418b4cd8fc5e04e0LL), -real(0x3e6c34ea7ddb8a80LL),real(0x212422dcacab1620LL), -real(0x1f0466b0c7211540LL),real(0xa12130d17045760LL), real(0x29b0aa486315dbcLL),reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^17, polynomial in n of order 9 -reale(3194,0x3409f96190200LL),reale(3129,0x198ba10e3f000LL), -reale(2211,0xeca78927c1e00LL),real(0x6cf94ec7bfac7400LL), -real(0x5f04d2df84f0ba00LL),real(0x39318494ff85f800LL), -real(0x38939121c731d600LL),real(0x1854a6f7e2957c00LL), -real(0x12decef0b13a7200LL),real(0xa9861a018e14120LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^16, polynomial in n of order 10 -reale(5172,0xb8c4b33583a00LL),reale(5700,0x1d26bd0962f00LL), -reale(3248,0x8acf908fbc800LL),reale(3050,0xed985975b4100LL), -reale(2251,0xef96e32335600LL),real(0x6370a1a9e900d300LL), -real(0x5c955afee309e400LL),real(0x2eb3ea14003fe500LL), -real(0x2e844e36822a7200LL),real(0xd8a8b891f217700LL), real(0x388df4ca3a6fb20LL),reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^15, polynomial in n of order 11 -reale(11115,0xb2ff91ec6c600LL),reale(11728,0x761e1ef822c00LL), -reale(5178,0x9a27d63f52200LL),reale(5773,0x24fd2adb2f000LL), -reale(3328,0x5f0c31c71fe00LL),reale(2908,0x836ab328fb400LL), -reale(2291,0x629d070485a00LL),real(0x5681ee23b9ad7800LL), -real(0x56cafdb120433600LL),real(0x21dbd9f992213c00LL), -real(0x1d4bdf01a76d9200LL),real(0xf4e0cbd04176b20LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^14, polynomial in n of order 12 -reale(73826,0x9e48c9be75880LL),reale(32637,0x887aa6de960e0LL), -reale(10940,0x9647b1447b9c0LL),reale(12348,0xdd9347a34b3a0LL), -reale(5206,0x461aa415f3b00LL),reale(5776,0x82c559a327660LL), -reale(3445,0x2b71b5ef13c40LL),reale(2676,0xdbe2bf3d4c920LL), -reale(2313,0x6c289eed11d80LL),real(0x45af1f46068fcbe0LL), -real(0x4a646c774fde3ec0LL),real(0x127e48f8affd9ea0LL), real(0x4e336f38ab11704LL),reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^13, polynomial in n of order 13 reale(130976,0x1a84c1eb6d80LL),-reale(14597,0x4f1d8a91fc600LL), -reale(76483,0x6c58cf65980LL),reale(35388,0xd1bf338007b00LL), -reale(10663,0x1c210a8b78080LL),reale(13004,0x14f125ca37c00LL), -reale(5285,0x554d73733c780LL),reale(5660,0xa57467d557d00LL), -reale(3609,0xe9c5b2656ee80LL),reale(2326,0xf26507322be00LL), -reale(2274,0xe6ae0b8fcb580LL),real(0x30f364de4c777f00LL), -real(0x3139417308d0dc80LL),real(0x173bf41713ca3b88LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^12, polynomial in n of order 14 reale(12302,0xe52cc8d8c2180LL),-reale(90162,0x247de245423c0LL), reale(136898,0x7ace803b76f00LL),-reale(20188,0x482d40173de40LL), -reale(79167,0xe510d7fd7c380LL),reale(38835,0xfee0572864740LL), -reale(10270,0x4559a0d3b600LL),reale(13648,0x338b156f30cc0LL), -reale(5468,0x80042be36a880LL),reale(5349,0x619325bd73240LL), -reale(3821,0xffa84c59adb00LL),real(0x729df2a6c14b77c0LL), -reale(2073,0x93dcfbe928d80LL),real(0x193a4a0699e49d40LL), real(0x6c8a3fc264f2d98LL),reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^11, polynomial in n of order 15 real(0x12b65c49560e1680LL),real(0x4c91348dd4c57d00LL), reale(12186,0xb870c2ef8b380LL),-reale(91199,0x47a39f34d9e00LL), reale(143440,0xa133e98363080LL),-reale(27237,0xaf8901f443900LL), -reale(81724,0x1b06c40663280LL),reale(43231,0xcee7486ccec00LL), -reale(9771,0xb47d34b793580LL),reale(14177,0x876b1df11100LL), -reale(5844,0x5970f546f9880LL),reale(4733,0x71ff0d3b37600LL), -reale(4034,0xaeeb7c4e61b80LL),real(0x4b0e043dd17f5b00LL), -real(0x5c6dac5851097e80LL),real(0x259ade3cf4689f28LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^10, polynomial in n of order 16 real(0x285b74a086cfe00LL),real(0x61629f583f6fc20LL), real(0x11e1f0840e822e40LL),real(0x4a2acb7177936860LL), reale(12009,0x162afd0a23e80LL),-reale(92025,0x51c6b64b59b60LL), reale(150657,0xe159fc0830ec0LL),-reale(36240,0x8903bcca1af20LL), -reale(83842,0x8f32e14ed8100LL),reale(48929,0x80db803df8d20LL), -reale(9247,0x4a711a73d90c0LL),reale(14370,0x3118e0d87960LL), -reale(6545,0xcfaa0092b4080LL),reale(3681,0xa71da4ef975a0LL), -reale(4055,0x6bd2ceb58b040LL),real(0x201a58611bc4e1e0LL), real(0x8ca8a9bec5eeb0cLL),reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^9, polynomial in n of order 17 real(0x8f791b0d72f300LL),real(0x116eee5fb7db000LL), real(0x2544a69b0af6d00LL),real(0x5ae50a5c0f6ba00LL), real(0x10e6ab279c402700LL),real(0x472bda650b6c4400LL), reale(11750,0x4a89b28f5a100LL),-reale(92512,0x1ccd7f1613200LL), reale(158574,0x53a9410005b00LL),-reale(47896,0xbfb8d60312800LL), -reale(84919,0xb4a50d4cf2b00LL),reale(56401,0x32e93db7ce200LL), -reale(8956,0x3835fd4c87100LL),reale(13782,0xdee88bf296c00LL), -reale(7712,0x7aed9801af700LL),reale(2126,0x5791e5314f600LL), -reale(3273,0xe9400d1963d00LL),real(0x4230ff2c7e6defd0LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^8, polynomial in n of order 18 real(0x289b91a48ebf00LL),real(0x45ee5b14465380LL), real(0x7f92734c023800LL),real(0xfa5ad187871c80LL), real(0x21cddd2df61b100LL),real(0x5372a978dde2580LL), real(0xfbd02001ed7aa00LL),real(0x436e93187af7ee80LL), reale(11383,0x2dcd21f7ea300LL),-reale(92459,0xff89d11970880LL), reale(167131,0xf0a2167d11c00LL),-reale(63199,0x7fe973623f80LL), -reale(83766,0xa02debe66b00LL),reale(66187,0xcedf7a1cac980LL), -reale(9608,0xefbab691d7200LL),reale(11585,0x75dbe72dc9280LL), -reale(9220,0x22c92d6997900LL),real(0x18709d3bc0679b80LL), real(0x5b7e325c6742390LL),reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^7, polynomial in n of order 19 real(0xd108e5f6f6100LL),real(0x14cfb44a7f1600LL), real(0x227bc5972bab00LL),real(0x3bea4dd1053000LL), real(0x6e5f06564db500LL),real(0xdaf2ed1ea74a00LL), real(0x1dec9104c41ff00LL),real(0x4ae6e1cc221e400LL), real(0xe5bde12a5950900LL),real(0x3ec229ad8ff17e00LL), reale(10869,0xc2e1de8335300LL),-reale(91550,0xfd5202ded6800LL), reale(176075,0x65a5499a95d00LL),-reale(83531,0x98920703e4e00LL), -reale(77994,0x11133349c5900LL),reale(78539,0xb0828e93b4c00LL), -reale(12981,0x6d9e1d7114f00LL),reale(6537,0x5c156837be600LL), -reale(9404,0xf97b75bc90500LL),reale(2071,0xc05f52f113a50LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^6, polynomial in n of order 20 real(0x4748ad3ff9e80LL),real(0x6b926f7e60d60LL),real(0xa71fa4085b840LL), real(0x10c991e0a3ab20LL),real(0x1c15b3b145b200LL), real(0x314f7c7c43f8e0LL),real(0x5be1ff458cabc0LL), real(0xb89930a80796a0LL),real(0x199734a3c07c580LL), real(0x411aa25f2292460LL),real(0xcb87e4542581f40LL), real(0x38e7a442bb914220LL),reale(10156,0x20944a9a6d900LL), -reale(89265,0x51d50a4f57020LL),reale(184683,0x63f792d3912c0LL), -reale(110680,0x89cae6d0a5260LL),-reale(62727,0xfdf47fc1380LL), reale(91791,0x3f8035a7d3b60LL),-reale(22895,0xcc844c9bf79c0LL), -real(0x5652aea374b626e0LL),-real(0x38edb32bcbdda4acLL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^5, polynomial in n of order 21 real(0x185346b40be80LL),real(0x234a30239ea00LL),real(0x345f5bcfbb580LL), real(0x4fc2f91719900LL),real(0x7d257d9ac0c80LL),real(0xcb49d34f58800LL), real(0x1580c944df8380LL),real(0x263bb5e9cb7700LL), real(0x483bd94933da80LL),real(0x935c1fd3f92600LL), real(0x14c807d3436d180LL),real(0x35e9298d8a45500LL), real(0xac6bf9cef462880LL),real(0x318eb0c51232c400LL), reale(9164,0xf22328f6f9f80LL),-reale(84728,0x78acb3795cd00LL), reale(191114,0x47ac3650f680LL),-reale(146268,0x68f68696f9e00LL), -reale(28124,0xaf1a222081280LL),reale(95633,0xf3c35e98b1100LL), -reale(42101,0xccb76963dbb80LL),reale(4250,0xa99770cb50078LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^4, polynomial in n of order 22 real(0x7c86a4240e80LL),real(0xaf5db2064cc0LL),real(0xfb958bed1300LL), real(0x17080cf847940LL),real(0x2288f92359780LL),real(0x352f6beaa45c0LL), real(0x54760062cdc00LL),real(0x8b024608ff240LL),real(0xeea60450a2080LL), real(0x1af0609151bec0LL),real(0x33c8072244a500LL), real(0x6bad7af287eb40LL),real(0xf83a707fcba980LL), real(0x293d0a92ebeb7c0LL),real(0x87aa233703e6e00LL), real(0x2855283ce7ee6440LL),reale(7785,0x74e297d243280LL), -reale(76427,0xf39041d0ccf40LL),reale(190726,0x777542b243700LL), -reale(188315,0x1030e5dfaa2c0LL),reale(42101,0xccb76963dbb80LL), reale(46959,0xb31b5803129c0LL),-reale(23682,0x43272b482b978LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^3, polynomial in n of order 23 real(0x21a7e921c980LL),real(0x2e51be6e8f00LL),real(0x40c19fbec480LL), real(0x5c1e6062c200LL),real(0x8599d6a9df80LL),real(0xc60160b77500LL), real(0x12cb7c4c7da80LL),real(0x1d5985b996800LL),real(0x2f524aaed7580LL), real(0x4f30941955b00LL),real(0x8a76dd63f7080LL),real(0xff32326380e00LL), real(0x1f5b1b59928b80LL),real(0x42dd3cfeae4100LL), real(0x9e90e4efcb8680LL),real(0x1b33e235264b400LL), real(0x5cdaf2eb93f2180LL),real(0x1cd398a25fa82700LL), reale(5865,0x9368046121c80LL),-reale(61723,0xe7c88c9baa600LL), reale(171645,0xcc7599f993780LL),-reale(213747,0x992d035d6f300LL), reale(126305,0x66263c2b93280LL),-reale(28944,0xfcbe1874a70e8LL), reale(5698544,0x5eb10eb5f946bLL), // C4[2], coeff of eps^2, polynomial in n of order 24 real(0x5f08c3cb900LL),real(0x807038c0ca0LL),real(0xaffaed32440LL), real(0xf4c5be483e0LL),real(0x15a2490f6f80LL),real(0x1f28eae1cb20LL), real(0x2dce80c7fac0LL),real(0x44e60304c260LL),real(0x6a58ca3b2600LL), real(0xa90e89d449a0LL),real(0x1160126eb5140LL),real(0x1db88b51940e0LL), real(0x354168d7adc80LL),real(0x64e3bca9a8820LL),real(0xcc99ed98827c0LL), real(0x1c3fb9ad58ff60LL),real(0x45c01ca2899300LL), real(0xc88852534b86a0LL),real(0x2d1eac1f8a97e40LL), real(0xee21e1c2e9afde0LL),reale(3238,0x9997f46a24980LL), -reale(36434,0x3fed7daa1bae0LL),reale(105254,0x7fca8779a54c0LL), -reale(115779,0xf2f861d29c3a0LL),reale(43417,0x7b1d24aefa95cLL), reale(5698544,0x5eb10eb5f946bLL), // C4[3], coeff of eps^26, polynomial in n of order 0 433472,real(72882272925LL), // C4[3], coeff of eps^25, polynomial in n of order 1 real(76231168),real(19985680),real(0x958a9334879LL), // C4[3], coeff of eps^24, polynomial in n of order 2 real(969805824),-real(756467712),real(427576864),real(0x33a763b318f5LL), // C4[3], coeff of eps^23, polynomial in n of order 3 real(0xe7cfd39aa00LL),-real(0xe6239d55400LL),real(0x44ffe5cce00LL), real(0x123fa804df0LL),real(0x73400ac32a3f24fLL), // C4[3], coeff of eps^22, polynomial in n of order 4 real(633551529LL<<15),-real(0x130f2c71c000LL),real(0x7e08a8b4000LL), -real(0x69e0a004000LL),real(0x39175efa340LL),real(0x59a39697cb86721LL), // C4[3], coeff of eps^21, polynomial in n of order 5 real(0xe1a59555817c700LL),-real(0xce92ef160470400LL), real(0x6a50b28bc94d100LL),-real(0x6ec5ce0328fa200LL), real(0x1e2919432b73b00LL),real(0x81169f96b647f8LL), reale(2659320,0xb4b906dd74543LL), // C4[3], coeff of eps^20, polynomial in n of order 6 real(0x4a951ec0f743800LL),-real(0x39128060ba74400LL), real(0x258d1de3ebd5000LL),-real(0x25e6a8ece22dc00LL), real(0xe953314d336800LL),-real(0xd6fbba5b80b400LL), real(0x6d3d6d3e79ea90LL),reale(531864,0x2425015f7daa7LL), // C4[3], coeff of eps^19, polynomial in n of order 7 real(0x7366685d2da15300LL),-real(0x46390dd9eadeba00LL), real(0x3de3739917104900LL),-real(0x34e3ad131262bc00LL), real(0x1ae64995e9a59f00LL),-real(0x1d6cea9b561f3e00LL), real(0x70d3407961b9500LL),real(0x1ea45bc7b594048LL), reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^18, polynomial in n of order 8 reale(2991,8707772229LL<<17),-real(0x5c0b6a6cd5328000LL), real(0x6cf3b04ea6358000LL),-real(0x47da0c907a958000LL), real(0x334344c895550000LL),-real(0x3257cd9b75628000LL), real(0x11d874d9e96c8000LL),-real(0x1273b92365d58000LL), real(0x8b048eddb8dae80LL),reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^17, polynomial in n of order 9 reale(4599,0x20675bc677c00LL),-reale(2190,0x6a6db0c48a000LL), reale(3019,0xad2c946b04400LL),-real(0x5cc951aa5f7ff800LL), real(0x61f2b89850d68c00LL),-real(0x49aa7ace4eb85000LL), real(0x26482ceb1d4d5400LL),-real(0x2b88fb70a186a800LL), real(0x8bf6f0c9a679c00LL),real(0x26ce624431e62e0LL), reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^16, polynomial in n of order 10 real(0x383bee2531d2a000LL),-real(0x2821094d061d1000LL), real(0x2c347b321d4c8000LL),-real(0x125d6736b20ff000LL), real(0x1a6c4162f9ae6000LL),-real(0xdca07dd1a07d000LL), real(0xba2cc7913be4000LL),-real(0xa8a49fd40deb000LL), real(0x36dcb24ee422000LL),-real(0x4159df2ed6e9000LL), real(0x1bdad6784709c40LL),reale(1139708,0xdfbd02f131dafLL), // C4[3], coeff of eps^15, polynomial in n of order 11 reale(7381,0x14c34c0c1f400LL),-reale(13257,0xf5b9dadc0c800LL), reale(7086,0x404eb1053bc00LL),-reale(4054,0xe4ed62e9ea000LL), reale(5287,0x17e93cc880400LL),-real(0x7bc6aed7afe87800LL), reale(2758,0x364797381cc00LL),-real(0x676ee80244a35000LL), real(0x3b6d32d9ca041400LL),-real(0x43e3e0c280942800LL), real(0xa86d2e316b1dc00LL),real(0x300bec0027818e0LL), reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^14, polynomial in n of order 12 reale(66948,0x4f30b3f870000LL),-reale(52646,0x686a3833a8000LL), reale(7561,0xd0b8bda7a8000LL),-reale(13026,0x7d89ec00d8000LL), reale(8130,0xd3b0b583a0000LL),-reale(3523,0xd290763e28000LL), reale(5530,0x8b9708b698000LL),-real(0x7e52c154efd58000LL), reale(2356,0x7673a06ad0000LL),-real(0x6f6a34d21b028000LL), real(0x220d8444fca88000LL),-real(0x2fac85fa2e858000LL), real(0x11c823101280e280LL),reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^13, polynomial in n of order 13 -reale(129173,0x58489bc283900LL),reale(59789,0xf9dc41e63d400LL), reale(65695,0x9083acc5cc100LL),-reale(58445,0x2f2cc6e161a00LL), reale(8184,0x5e79915d1b00LL),-reale(12353,0x83a959670c800LL), reale(9463,0x4211f61d49500LL),-reale(2966,0xe12b8e3527600LL), reale(5543,0x52a28a556ef00LL),-reale(2249,0xe1f749ba16400LL), real(0x6b0d1cda5c5fe900LL),-real(0x70ab303245f3d200LL), real(0xb596d16f1a34300LL),real(0x35b4de912478078LL), reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^12, polynomial in n of order 14 -reale(6933,0xfc2bb7bd6800LL),reale(63382,0x668969a617c00LL), -reale(132589,0xf0bdf2e789000LL),reale(69768,0x70d2052fd2400LL), reale(63007,0x6d053a2cb4800LL),-reale(65233,0xb829e1b817400LL), reale(9601,0xec9983923a000LL),-reale(11042,0x4317b942ccc00LL), reale(11048,0xa50acd625f800LL),-reale(2545,0x7c97f16176400LL), reale(5107,0xc83f2d67d000LL),-reale(2697,0x85e48cc53bc00LL), real(0x36af107261fea800LL),-real(0x57b6b3b8f7f45400LL), real(0x1b355635bf037310LL),reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^11, polynomial in n of order 15 -real(0x718d19ce618f700LL),-real(0x22292bb4d2a0a600LL), -reale(6561,0x7bb8e05b06500LL),reale(61876,0xa080215cbc400LL), -reale(135759,0x6c0a25f10b300LL),reale(81504,0x4116e653fae00LL), reale(58147,0xb03676e9edf00LL),-reale(73011,0xd75b35d7e2800LL), reale(12405,0x6d2fd911f1100LL),-reale(8886,0xdfa5214b6fe00LL), reale(12677,0x826d436a8a300LL),-reale(2577,0x6d77ecdf41400LL), reale(3947,0x879d1c7c5500LL),-reale(3192,0x95f286c2eaa00LL), real(0x7343398f272e700LL),real(0x20b3728b7b6b2d8LL), reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^10, polynomial in n of order 16 -real(0xaaaed768da0000LL),-real(0x1d8d58546174000LL), -real(0x650ff776c6dc000LL),-real(0x1f0fa133b6eac000LL), -reale(6125,0x868b157bb8000LL),reale(59813,0x741ec012c000LL), -reale(138411,0xa7483b2cd4000LL),reale(95264,0x22057cd374000LL), reale(50003,0x3a5ca8a530000LL),-reale(81502,0xff7b30e274000LL), reale(17542,0xf2776c79b4000LL),-reale(5812,0xc63b637b2c000LL), reale(13748,0x38a6c4d018000LL),-reale(3547,0xbf6bf7e154000LL), real(0x78ab12d1827bc000LL),-reale(2957,0x6b24852f8c000LL), real(0x2bef42096127d7c0LL),reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^9, polynomial in n of order 17 -real(0x3cadc0edd6600LL),-real(0x8587ee4c4e000LL), -real(0x14633459f95a00LL),-real(0x397bc2059d8400LL), -real(0xc89f8adb490e00LL),-real(0x3f2a86a64b5a800LL), -real(0x32218961953c0200LL),reale(8146,0xa930f21b73400LL), -reale(20015,0x8b16989f1b600LL),reale(15890,0x8aa3fb72d9000LL), reale(5271,0xbcd5aeda65600LL),-reale(12822,0x9424c22ae1400LL), reale(3774,0x46bb658aca200LL),-real(0x148a80159bb73800LL), real(0x736580900f31ae00LL),-real(0x336f49c74ee95c00LL), -real(0x249e756eeea0600LL),-real(0x13841fc89043bb0LL), reale(1139708,0xdfbd02f131dafLL), // C4[3], coeff of eps^8, polynomial in n of order 18 -real(0x5318540751000LL),-real(0xa0702ad537800LL), -real(0x14a9549a688000LL),-real(0x2e31b9dc878800LL), -real(0x72dceb1c83f000LL),-real(0x14a6c8c8df91800LL), -real(0x49c3e43ec426000LL),-real(0x17df3e19aed32800LL), -reale(5017,0x9bceef61ed000LL),reale(53301,0x74feac5bf4800LL), -reale(140139,0x5706164944000LL),reale(129320,0x1fd8eca933800LL), reale(16403,0x87db178e25000LL),-reale(95278,0x1e65e67825800LL), reale(40665,0x6f4b03ec9e000LL),-real(0x1c82af8b65ac6800LL), reale(8049,0x334ede6a77000LL),-reale(7540,0x5b108b15f800LL), real(0x49ca297e3ffdbce0LL),reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^7, polynomial in n of order 19 -real(0x11fa490472e00LL),-real(0x1fe0e98340400LL), -real(0x3b2a552443a00LL),-real(0x73f5544ad2000LL), -real(0xf2e5765f90600LL),-real(0x2290ce0f423c00LL), -real(0x57b83400ee1200LL),-real(0x1023f65b9bfd800LL), -real(0x3b36c6db61bde00LL),-real(0x13c7b72049527400LL), -reale(4323,0x73be8c4caea00LL),reale(48359,0x7d21dc7197000LL), -reale(137343,0xc18958973b600LL),reale(148676,0xd51cb5c775400LL), -reale(14754,0xa89f0bc9ec200LL),-reale(92175,0x33d1092c54800LL), reale(60290,0x88af4d43b7200LL),-reale(5855,0x8c9719d08e400LL), -real(0x48b16aa4982d9a00LL),-real(0x51dba59b00547450LL), reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^6, polynomial in n of order 20 -real(0x3f0527da8000LL),-real(0x69410a894000LL),-real(0xb5f68cf74000LL), -real(0x14766cd18c000LL),-real(5178956321LL<<17), -real(0x4cf42ca274000LL),-real(0xa45199d7cc000LL), -real(0x17e337e696c000LL),-real(0x3e169088698000LL), -real(0xbbd1c494494000LL),-real(0x2c70014b4ca4000LL), -real(0xf67e7406420c000LL),-reale(3524,0xcb63f52610000LL), reale(41859,0x1cfdfa000c000LL),-reale(129839,0xf92d750efc000LL), reale(166586,0x5d10da3394000LL),-reale(59706,0x5fbf7c0388000LL), -reale(68020,0xa047f74594000LL),reale(75721,0x1307a9002c000LL), -reale(24384,0xc0b45d798c000LL),real(0x6534ccbfa35124c0LL), reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^5, polynomial in n of order 21 -real(0xcd30266b700LL),-real(0x147d4e1fec00LL),-real(0x21a6b4a64100LL), -real(0x390579acce00LL),-real(0x6423741d2b00LL),-real(0xb749b833f000LL), -real(0x1602ad6953500LL),-real(0x2ccfc753d1200LL), -real(0x61e5d62301f00LL),-real(0xe995b2fcff400LL), -real(0x270c826fb7a900LL),-real(0x7a09e7f3045600LL), -real(0x1dfb4c385ed9300LL),-real(0xaddceca1091f800LL), -reale(2624,0xc45e83fdb9d00LL),reale(33433,0x20d0a109f6600LL), -reale(114656,0xa3de6d0238700LL),reale(175907,0x1d4b03fe80400LL), -reale(116168,0x7b17e334f1100LL),-reale(3810,0x1e1c2e9afde00LL), reale(45340,0x664f5dce00500LL),-reale(17205,0xff74273e2678LL), reale(7977962,0x1e2b14985cfc9LL), // C4[3], coeff of eps^4, polynomial in n of order 22 -real(784468838400LL),-real(0x11a0a388400LL),-real(0x1bda05d7000LL), -real(0x2d25cb21c00LL),-real(0x4b5283d5800LL),-real(0x81d5381f400LL), -real(0xe84e582c000LL),-real(0x1b2017768c00LL),-real(0x354f35942800LL), -real(0x6f49195e6400LL),-real(0xf9ffb1d81000LL),-real(0x267769207fc00LL), -real(0x6a9801634f800LL),-real(0x15adc2fc41d400LL), -real(0x5947d2bb916000LL),-real(0x222d7eabcda6c00LL), -real(0x22707489da53c800LL),reale(7620,0x3c385d35fbc00LL), -reale(29197,0x886c2c8e2b000LL),reale(53341,0xa58a8c79e2400LL), -reale(51817,0x997f46a249800LL),reale(25908,0xccbfa35124c00LL), -reale(5262,0xb996ed2c7b770LL),reale(2659320,0xb4b906dd74543LL), // C4[3], coeff of eps^3, polynomial in n of order 23 -real(242883621120LL),-real(365079728640LL),-real(559688344320LL), -real(876931046400LL),-real(0x147bd04f500LL),-real(0x21c7b15a600LL), -real(0x396d13e6700LL),-real(0x650be18b000LL),-real(0xb8f375f7900LL), -real(0x16253c45ba00LL),-real(0x2cc1928ceb00LL),-real(0x6065d92f8400LL), -real(0xe04f74737d00LL),-real(0x23eadf138ce00LL), -real(0x682920857ef00LL),-real(0x1651f4aee45800LL), -real(0x61a68e7d270100LL),-real(0x281b43aa424e200LL), -real(0x2bddd20238857300LL),reale(10668,0x544ee8e52d400LL), -reale(45340,0x664f5dce00500LL),reale(90680,0xcc9ebb9c00a00LL), -reale(84203,0x996ed2c7b7700LL),reale(28944,0xfcbe1874a70e8LL), reale(7977962,0x1e2b14985cfc9LL), // C4[4], coeff of eps^26, polynomial in n of order 0 real(74207744),real(0x377b3e1aa351LL), // C4[4], coeff of eps^25, polynomial in n of order 1 -real(85649408),real(42776448),real(0x7a5a1b59863LL), // C4[4], coeff of eps^24, polynomial in n of order 2 -real(0x5d090f66800LL),real(0x15cb8432c00LL),real(412184096896LL), real(0x3e897844a5071ebLL), // C4[4], coeff of eps^23, polynomial in n of order 3 -real(0xbff3f70d800LL),real(0x44c7b31b000LL),-real(0x48108b34800LL), real(0x21db9c9a980LL),real(0x4fc9e010f5dcf23LL), // C4[4], coeff of eps^22, polynomial in n of order 4 -real(0xd6b769b7e000LL),real(0x72b1142e1800LL),-real(0x82aa7be7f000LL), real(0x1aa8532e0800LL),real(0x779e97cc600LL),real(0x40d4060dc7c384c7LL), // C4[4], coeff of eps^21, polynomial in n of order 5 -real(0x474af3a87693800LL),real(0x3c389a0df442000LL), -real(0x37e1a3d92db8800LL),real(0x12d1db00bd71000LL), -real(0x15fc16a85bcd800LL),real(0x99491c279c9880LL), reale(1139708,0xdfbd02f131dafLL), // C4[4], coeff of eps^20, polynomial in n of order 6 -real(0x303d69b47fe22400LL),real(0x3f4d2c93a259b200LL), -real(0x29be542895db1800LL),real(0x17eb54d9d2a59e00LL), -real(0x1b89924120220c00LL),real(0x4aa7a22c8d50a00LL), real(0x157745851f3d4c0LL),reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^19, polynomial in n of order 7 -real(0x44c3305a70de1000LL),real(0x6d1c9adfcac5e000LL), -real(0x312f88327b293000LL),real(0x3351684a1a554000LL), -real(0x2ab43a21fd0e5000LL),real(0xdaac481cc1ca000LL), -real(0x120b854707e97000LL),real(0x7289c72302f3500LL), reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^18, polynomial in n of order 8 -reale(2256,0x7b501df238000LL),reale(2620,0x5abb698ccf000LL), -real(0x3cfd86157c22a000LL),real(0x656f30f9d7a5d000LL), -real(0x3529aafa1251c000LL),real(0x23979dd758c6b000LL), -real(0x27cfd52f91a0e000LL),real(0x52c1297ffdf9000LL), real(0x1899e61f0915c00LL),reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^17, polynomial in n of order 9 -reale(5647,0x92962c0679000LL),reale(3064,0xd620df9a18000LL), -real(0x73b5708edb717000LL),reale(2782,0xf8e2a6bab2000LL), -real(0x3aa55028ed4d5000LL),real(0x54f5b0489ac0c000LL), -real(0x3a8372ad6ebf3000LL),real(0x128f31db99de6000LL), -real(0x1bbb3cddeb8b1000LL),real(0x9c3f5d344ffbb00LL), reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^16, polynomial in n of order 10 -reale(12546,0xd0659481f7000LL),reale(2321,0x6f75c5bce2800LL), -reale(5209,0xc9bfbad2ac000LL),reale(3693,0x4f3d4dd785800LL), -real(0x59b26230b2e61000LL),reale(2785,0x7ef843b608800LL), -real(0x4086b5731d656000LL),real(0x3b22d2695822b800LL), -real(0x3bbf747f663cb000LL),real(0x50e2c41c71ae800LL), real(0x19182d9cca60700LL),reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^15, polynomial in n of order 11 -reale(14655,0xa7ccf7b3e3000LL),reale(5703,0xb41e60048e000LL), -reale(13723,0x6fa2143b1000LL),reale(2794,0x80dd2a6158000LL), -reale(4434,0xbdbd659d5f000LL),reale(4398,0x1bf890b722000LL), -real(0x462f1f0759b2d000LL),reale(2504,0xfcfacf17ac000LL), -real(0x4eb2a95e9a75b000LL),real(0x1bef3eef6f4b6000LL), -real(0x2d8008caddc29000LL),real(0xdbb189dc4eba300LL), reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^14, polynomial in n of order 12 -reale(31110,0xd0a51132f4000LL),reale(76716,0x887753c58b000LL), -reale(19285,0xcfd85f57f6000LL),reale(3558,0x4fcfd1ab09000LL), -reale(14554,0xbf2d0ac9f8000LL),reale(3850,0x9631322307000LL), -reale(3313,0x90f8abbffa000LL),reale(4999,0xf3c6aed085000LL), -real(0x44308029330fc000LL),real(0x72cd2f325ae83000LL), -real(0x5cc3eeffca3fe000LL),real(0x2f990ef34001000LL), real(0xedd65cb262fc00LL),reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^13, polynomial in n of order 13 reale(109832,0xfe67f2664d000LL),-reale(101414,0x365d952fe4000LL), -reale(21578,0x2c7dffdd75000LL),reale(81484,0xfb5b01862000LL), -reale(25828,0x7adf44b697000LL),real(0x527645ab2c368000LL), -reale(14626,0xa0f5b7bcd9000LL),reale(5668,0x89f8307d6e000LL), -real(0x7c6deea8217fb000LL),reale(5148,0xb3c77272b4000LL), -real(0x5ea4f23e05fbd000LL),real(0x33d79ea3e6f7a000LL), -real(0x512f5a2dc7bdf000LL),real(0x13f171801c8d4d00LL), reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^12, polynomial in n of order 14 reale(3290,0xf070eb97f3400LL),-reale(37925,0x14cc0872bb200LL), reale(108756,0x262a302ba0800LL),-reale(111139,0xba49ef60cbe00LL), -reale(8978,0x96e5af6312400LL),reale(85061,0xe9667b666b600LL), -reale(34830,0xb50884d615000LL),-real(0x1ae66991075c5600LL), -reale(13337,0xd2d72b2557c00LL),reale(8254,0x43d2c57af1e00LL), -real(0x39646320240ca800LL),reale(4333,0x5a8eb4efe1200LL), -reale(2317,0x387052d25d400LL),-real(0x4971411b9aa7a00LL), -real(0x239dc6f1135e6c0LL),reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^11, polynomial in n of order 15 real(0x22fb18f3d6fc800LL),real(0xc812a63656dd000LL), reale(2929,0x54e6120875800LL),-reale(35121,0x48d05c62be000LL), reale(106528,0xc02be4bd3e800LL),-reale(121104,0xca8db31999000LL), reale(7480,0x3b39caec37800LL),reale(86076,0xd8784a9f2c000LL), -reale(46728,0xdb6f945bbf800LL),-real(0x1e17ea5787b8f000LL), -reale(10012,0x630283c6800LL),reale(11072,0xcb500e9316000LL), -real(0x3d2315ebbfcfd800LL),reale(2196,0x522d08f7fb000LL), -reale(2582,0x2942c8d084800LL),real(0x1dbc900c41177d80LL), reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^10, polynomial in n of order 16 real(0x2367980c018000LL),real(0x717a5d0aad6800LL), real(0x1c7a6b9a7155000LL),real(0xa7a0b73a0f93800LL), reale(2540,0xdc02459a12000LL),-reale(31836,0xf2625ff3ef800LL), reale(102741,0xc61b0075cf000LL),-reale(130713,0xb431635532800LL), reale(28618,0x913148900c000LL),reale(82224,0x225affaa4a800LL), -reale(61371,0x71836a73b7000LL),reale(3358,0xd2d9334507800LL), -reale(4436,0x51714c11fa000LL),reale(12409,0x2e12e0f984800LL), -reale(3099,0xb59c601f3d000LL),-real(0x185351aa9adbe800LL), -real(0xfcd867cd32b4e00LL),reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^9, polynomial in n of order 17 real(0x3b98569230800LL),real(0x954e9f9ae8000LL),real(0x1a387f0ed5f800LL), real(0x561911aabbb000LL),real(0x163673b1889e800LL), real(0x870aa0c397ae000LL),reale(2128,0x4412890e0d800LL), -reale(28018,0x9edd02151f000LL),reale(96862,0x40aaeaffcc800LL), -reale(138876,0x18d8a92e8c000LL),reale(55003,0xc4365147fb800LL), reale(69831,0x65a81c2787000LL),-reale(76836,0x9198c23745800LL), reale(14324,0xf9d757893a000LL),real(0x610a50cc5ec29800LL), reale(9036,0xddda1962ad000LL),-reale(5866,0x301cbcb97800LL), real(0x2b3d64f38f7c3a80LL),reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^8, polynomial in n of order 18 real(0x7c44a1c56800LL),real(0x10e1a40b9f400LL),real(0x2778995e94000LL), real(0x6511d82348c00LL),real(0x122fbee15d1800LL), real(0x3d60d47d162400LL),real(0x10572b5ec96f000LL), real(0x670e5c5512cbc00LL),real(0x6a1969ca184cc800LL), -reale(23632,0x6fc488059ac00LL),reale(88223,0x601afc7b4a000LL), -reale(143685,0x3819032af1400LL),reale(86217,0x78ea8eac47800LL), reale(43622,0x50ec504da8400LL),-reale(86857,0xe4e3b378db000LL), reale(34767,0x1af4459111c00LL),real(0x470ee9f8c8f42800LL), -real(0xf0a395fd8dd4c00LL),-real(0x55da5cd875ef3c80LL), reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^7, polynomial in n of order 19 real(0x114b06357800LL),real(0x2239f3629000LL),real(0x475e8ebd2800LL), real(0x9e5523c88000LL),real(0x17aa424dfd800LL),real(0x3e2133dde7000LL), real(0xb7f09cec78800LL),real(0x280af153ee6000LL), real(0xb0d866e91e3800LL),real(0x48b6aeda5425000LL), real(0x4ec10b7f840de800LL),-reale(18693,0xda891ccdbc000LL), reale(76065,0x2aaa760409800LL),-reale(141961,0xc3f732a21d000LL), reale(119123,0xd1c84be04800LL),-real(0x7f4b67756e45e000LL), -reale(76606,0xe7a6860690800LL),reale(56790,0xce45bec021000LL), -reale(14598,0xc436164715800LL),real(0x23b84843a30d9480LL), reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^6, polynomial in n of order 20 real(0x2492f246000LL),real(0x43b68382800LL),real(0x827fc7ff000LL), real(0x10769dabb800LL),real(0x231371038000LL),real(0x4fad3dfb4800LL), real(0xc39532c71000LL),real(0x2109cc8eed800LL),real(0x650cdd3e2a000LL), real(0x16d3054b8e6800LL),real(0x69275cf4ee3000LL), real(0x2d6bb9aa2a1f800LL),real(0x342dc9db6781c000LL), -reale(13325,0xb15a42ce7800LL),reale(59725,0xe775950b55000LL), -reale(128819,0x4abda20fae800LL),reale(144216,0xdf24ba0e000LL), -reale(65935,0x168961cdb5800LL),-reale(23422,0x325c674239000LL), reale(39625,0x392517e583800LL),-reale(12954,0x665fd1a892600LL), reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^5, polynomial in n of order 21 real(273177999360LL),real(481049600000LL),real(875104847872LL), real(0x180866df000LL),real(0x2f4b74a1800LL),real(0x61abf5b8000LL), real(0xd562fc0e800LL),real(0x1f2598191000LL),real(0x4ed8f85ab800LL), real(0xdc91252ca000LL),real(0x2bd44913d8800LL),real(0xa584ade1c3000LL), real(0x322090df0f5800LL),real(0x16f6266186dc000LL), real(0x1c472a543df62800LL),-reale(7859,0x7aaf0fd58b000LL), reale(39234,0x9eeb23497f800LL),-reale(98180,0xb70c1a0b12000LL), reale(140051,0xe6fe7071ac800LL),-reale(115827,0x9358bc0159000LL), reale(51817,0x997f46a249800LL),-reale(9715,0xccc7dd3e6dc80LL), reale(10257379,0xdda51a7ac0b27LL), // C4[4], coeff of eps^4, polynomial in n of order 22 real(18103127040LL),real(30658521600LL),real(53362944000LL), real(95756838400LL),real(177805329408LL),real(343155696128LL), real(692078714880LL),real(0x155e2e7de00LL),real(0x30194583c00LL), real(0x741fc16da00LL),real(0x131155285800LL),real(0x379d38605600LL), real(0xb96166967400LL),real(0x2e2dfa3db5200LL),real(0xee14dc9ed9000LL), real(0x752e44962ece00LL),real(0x9cf0406db58ac00LL), -reale(3007,0xfcd2e16ce3600LL),reale(16844,0xbb0354c82c800LL), -reale(48007,0x7b6318074ba00LL),reale(77726,0x663ee9f36e400LL), -reale(64771,0xffdf184adbe00LL),reale(21050,0xe65bb4b1eddc0LL), reale(10257379,0xdda51a7ac0b27LL), // C4[5], coeff of eps^26, polynomial in n of order 0 356096,real(98232628725LL), // C4[5], coeff of eps^25, polynomial in n of order 1 real(19006687232LL),real(5473719680LL),real(0x1580fd4afdbe65LL), // C4[5], coeff of eps^24, polynomial in n of order 2 real(91538057LL<<15),-real(0x378568c4000LL),real(0x16cc31e2a00LL), real(0x4c6f2137745e091LL), // C4[5], coeff of eps^23, polynomial in n of order 3 real(0xef2f223e3800LL),-real(0x110fb2e7bf000LL),real(0x282bb4606800LL), real(0xbe30d7a6780LL),reale(2828,0xfcd03d1974f5LL), // C4[5], coeff of eps^22, polynomial in n of order 4 real(0x5e4a1598000LL),-real(0x48b6e92a000LL),real(97904939LL<<14), -real(0x20e8326e000LL),real(850763001088LL),real(0x2081a7235aaf593LL), // C4[5], coeff of eps^21, polynomial in n of order 5 real(0x40db2f49b455f800LL),-real(0x1e99bb32c4c22000LL), real(0x173ba0294630c800LL),-real(0x194707e3169c1000LL), real(0x2d83efe695c9800LL),real(0xdf3e0617af3080LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^20, polynomial in n of order 6 real(0x216feaa994ce0000LL),-real(0xab5f967e8690000LL), real(0x47922226ed5LL<<18),-real(0xb74a91dab5f0000LL), real(0x3c54ceff81a0000LL),-real(0x5d7cb98f1a50000LL), real(0x1f9a69370b20800LL),reale(4178932,0x89b50ac9b6cd7LL), // C4[5], coeff of eps^19, polynomial in n of order 7 real(0x737c719d74a11000LL),-real(0x33cb00709b02e000LL), real(0x64aa4f647e063000LL),-real(0x22d04f5347fb4000LL), real(0x244213a9e6215000LL),-real(0x2372b83384fba000LL), real(0x29c5a12d1767000LL),real(0xd64e2b028e9d00LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^18, polynomial in n of order 8 real(0x4d6c482dac2a0000LL),-reale(2329,0xb1fe2723dc000LL), reale(2244,0xda129de1b8000LL),-real(0x25b9c94d1ec14000LL), real(0x5915813997350000LL),-real(0x2b18411354f8c000LL), real(0x1038d20e1fbe8000LL),-real(0x1a9977b2ea9c4000LL), real(0x7df995f732ef600LL),reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^17, polynomial in n of order 9 real(0x514388ef27d31000LL),-reale(6020,0x2be450c918000LL), real(0x6fa66bdc836df000LL),-real(0x67912be26fab2000LL), reale(2539,0xf65fb2006d000LL),-real(0x237e1033f4d8c000LL), real(0x3efb5ba75c79b000LL),-real(0x32b52fd83cbe6000LL), real(0x17d40e2c1a29000LL),real(0x7dfd16a9c2e300LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^16, polynomial in n of order 10 reale(12470,0xf777d5cb70000LL),-reale(8994,0x34ff96fbd8000LL), real(0x8b5e07446e3LL<<18),-reale(5684,0xa351b76ba8000LL), reale(2676,0xe4b7624210000LL),-real(0x3b4e8fe27b2f8000LL), reale(2525,0xe113384060000LL),-real(0x317b33e66b8c8000LL), real(0x1afebbc488cb0000LL),-real(0x2abc78cdb6418000LL), real(0xab0b32cc6da3c00LL),reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^15, polynomial in n of order 11 reale(45753,0x27312c684b000LL),real(0x6b25908081df2000LL), reale(10080,0x3e3c4e94e9000LL),-reale(11483,0x3052990658000LL), real(0x186dcc47df2a7000LL),-reale(4654,0xe97b33c9a2000LL), reale(3765,0x192eb8a145000LL),-real(0x1ea7f016e242c000LL), real(0x7c08a9e80a083000LL),-real(0x48a61c5124e36000LL), -real(0x1ab8464a6fdf000LL),-real(0xc3b3128c53f500LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^14, polynomial in n of order 12 -reale(29853,0xf97fbea090000LL),-reale(72661,0xb2e53c820c000LL), reale(55735,0xd505afdac8000LL),-real(0x19eb9cd373704000LL), reale(6447,8655275741LL<<17),-reale(13735,0x934f51ea3c000LL), real(0x503c7c1e17a78000LL),-reale(2910,0x8f0f066334000LL), reale(4611,0xa07ae6cfd0000LL),-real(0x28ec95124696c000LL), real(0x386dc5f3bf428000LL),-real(0x49a3cdb95c464000LL), real(0xec86977ad08e600LL),reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^13, polynomial in n of order 13 -reale(77964,0x27205a1bd000LL),reale(116550,0x911cc360c4000LL), -reale(45605,0xab8dec641b000LL),-reale(66195,0xc9de18da12000LL), reale(66624,0xae21593727000LL),-reale(5576,0x36f63ac28000LL), real(0x6f2264aae1649000LL),-reale(14832,0x2c940b773e000LL), reale(3661,0xe0e147ff8b000LL),-real(0x37687d20b9d14000LL), reale(4430,0xd2ef37d92d000LL),-real(0x61330ed553f6a000LL), -real(0x8fc7d2821691000LL),-real(0x4de8f81581e0b00LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^12, polynomial in n of order 14 -real(0x520b481798460000LL),reale(18997,713316873LL<<16), -reale(73060,0xebcc7589c0000LL),reale(119587,0x641c11f8f0000LL), -reale(63450,0xfff4f2db20000LL),-reale(54596,0x54a14049b0000LL), reale(77203,5136366291LL<<19),-reale(15161,0x669695c550000LL), -reale(2898,7333080783LL<<17),-reale(13401,0xbb1dc317f0000LL), reale(7364,7522322675LL<<18),real(0xcbde6dd32070000LL), reale(2498,0xb270ac8f60000LL),-reale(2207,0xe5e147ba30000LL), real(0x146e5a4ec1af3800LL),reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^11, polynomial in n of order 15 -real(0x8e2d12e55cc800LL),-real(0x3c744345ee05000LL), -real(0x436e3347c2885800LL),reale(16354,0x603aee4aee000LL), -reale(66895,0x3561b9526e800LL),reale(120525,0x7fafccca1000LL), -reale(82888,0x6ce782c3a7800LL),-reale(36026,0xb730ca850c000LL), reale(84916,0xe33bbac3af800LL),-reale(30329,0x9a1820a639000LL), -reale(5003,0x6724146c89800LL),-reale(8175,0xa51f341306000LL), reale(10601,0xdf58b3eb8d800LL),-real(0x51534d8656793000LL), -real(0x13f74fe07242b800LL),-real(0x1338322158bf8680LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^10, polynomial in n of order 16 -real(0x5e9d97de20000LL),-real(0x15f51b48a5a000LL), -real(0x679f3a6a83c000LL),-real(0x2da38dbb53ee000LL), -real(0x351287a208998000LL),reale(13549,0xfdc5cc829e000LL), -reale(59298,0x35ebc8a374000LL),reale(118312,0x8f7a13080a000LL), -reale(102644,0xbe9581710000LL),-reale(8663,0x3283e8b4ea000LL), reale(85056,0xa0c3d6fa54000LL),-reale(50541,0x58fecea57e000LL), real(0x9e0314066f78000LL),-real(0x56026edfbaf2000LL), reale(9162,0x6ada71271c000LL),-reale(4514,0x3f8f2be686000LL), real(0x19aa7dbc9bd2b100LL),reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^9, polynomial in n of order 17 -real(0x689b7f794800LL),-real(0x12aa316a68000LL), -real(0x3c5fe03b7b800LL),-real(0xe70662316b000LL), -real(0x468257445d2800LL),-real(0x204dea1c904e000LL), -real(0x275c24b79c179800LL),reale(10640,0x725f868a0f000LL), -reale(50163,0x8367062950800LL),reale(111598,0xa3db986ecc000LL), -reale(120105,0x1af4e4a837800LL),reale(28289,0xbddfd64f09000LL), reale(70122,0x41f96206f1800LL),-reale(70104,0xcd1cf1241a000LL), reale(17631,0x83f469b94a800LL),reale(3507,0xd4dd7e683000LL), real(0x234fa818af3f3800LL),-real(0x5217ce807fb7e980LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^8, polynomial in n of order 18 -real(0x8baa3048000LL),-real(0x155e3991c000LL),-real(237891401LL<<18), -real(0xa66484064000LL),-real(0x22acb24838000LL), -real(0x89475b1e6c000LL),-real(0x2b8ce25f7b0000LL), -real(0x14dd31b8f8b4000LL),-real(0x1acbb07dd4628000LL), reale(7723,0xe6c1cd6b44000LL),-reale(39540,0xb1d09a9920000LL), reale(98832,0x70f12b47fc000LL),-reale(130553,0x474c4a5618000LL), reale(72091,0x9d4697d7f4000LL),reale(31173,0xcb977f1d70000LL), -reale(72484,0xa77099aa54000LL),reale(42073,0x76abc75bf8000LL), -reale(8983,0xdb34fa045c000LL),real(0x7851cafec6ea600LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^7, polynomial in n of order 19 -real(808445556736LL),-real(0x19fd8659000LL),-real(0x3ce45316800LL), -real(0x98e89f08000LL),-real(0x1a16c5239800LL),-real(0x4ef4224b7000LL), -real(0x11089a8d8c800LL),-real(0x461e8219c6000LL), -real(0x1740d89936f800LL),-real(0xbb97ef56095000LL), -real(0xffd8608f0242800LL),reale(4956,0x2ae7ba647c000LL), -reale(27803,0x8886c0e865800LL),reale(78703,0x691d56f30d000LL), -reale(126581,0xb2ac252438800LL),reale(111405,0x65dae188be000LL), -reale(33040,0xc82f8ec41b800LL),-reale(31122,0xa51c18fcd1000LL), reale(33849,0xe315529991800LL),-reale(10096,0xcfcaaeb453f80LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^6, polynomial in n of order 20 -real(57693732864LL),-real(118378242048LL),-real(254261280768LL), -real(575562375168LL),-real(10565709LL<<17),-real(0x341c17b2000LL), -real(0x92ee7ecc000LL),-real(0x1ccf17876000LL),-real(0x6786d9e38000LL), -real(0x1bdf19e19a000LL),-real(0x9bb8377424000LL), -real(0x5352681ef5e000LL),-real(0x79ce0dfd0cd0000LL), reale(2563,0x29027cc1fe000LL),-reale(15917,0xface8c747c000LL), reale(51375,0x61bf7d963a000LL),-reale(99436,0x390f87b768000LL), reale(119998,0xa6d5e6f116000LL),-reale(88555,0x279c7be1d4000LL), reale(36577,0x210e8c3652000LL),-reale(6477,0x332fe8d449300LL), reale(12536797,0x9d1f205d24685LL), // C4[5], coeff of eps^5, polynomial in n of order 21 -real(2537256960LL),-real(4922368000LL),-real(9913649152LL), -real(20825468928LL),-real(45893163008LL),-real(3260719LL<<15), -real(265153996800LL),-real(709434249216LL),-real(0x1e3bc54b800LL), -real(0x62f2289a000LL),-real(0x174e12bf8800LL),-real(0x69ee83c3b000LL), -real(0x2753bfa335800LL),-real(0x1693a2298bc000LL), -real(0x23ce232de3a2800LL),real(0x33ca29bdcdd43000LL), -reale(5754,0x693a6155df800LL),reale(21176,0x3b8f28c122000LL), -reale(47646,0x86021bb28c800LL),reale(67058,0x11f0010e41000LL), -reale(51817,0x997f46a249800LL),reale(16192,0xfff7c612b6f80LL), reale(12536797,0x9d1f205d24685LL), // C4[6], coeff of eps^26, polynomial in n of order 0 real(71266816),real(0x75209f8d91abLL), // C4[6], coeff of eps^25, polynomial in n of order 1 -real(61697<<14),real(365122560),real(0x64173937d043LL), // C4[6], coeff of eps^24, polynomial in n of order 2 -real(0x10389da9c000LL),real(0x19e75ef2000LL),real(558875851776LL), real(0xd767bab38dc330dLL), // C4[6], coeff of eps^23, polynomial in n of order 3 -real(0x142d81502c000LL),real(0x6dee9f4b8000LL),-real(0xae181cf64000LL), real(0x39153b46b400LL),reale(3342,0x41381bc9272f3LL), // C4[6], coeff of eps^22, polynomial in n of order 4 -real(0x13480fca8c000LL),real(0x16106a2c37000LL), -real(0x1502d2e846000LL),real(0x16180c1bd000LL),real(0x74238242a00LL), reale(3342,0x41381bc9272f3LL), // C4[6], coeff of eps^21, polynomial in n of order 5 -real(0x1c0b06f2aed0000LL),real(0x44926ab731c0000LL), -real(0x2031c71e85b0000LL),real(0xca25cdaf0e0000LL), -real(0x14c7d62b6490000LL),real(0x61052e04125000LL), reale(1139708,0xdfbd02f131dafLL), // C4[6], coeff of eps^20, polynomial in n of order 6 -real(0x3c147e5183b90000LL),real(0x5c8a793ab7a08000LL), -real(0xa71b84c4013LL<<17),real(0x26583d412b938000LL), -real(0x1ec1409e52930000LL),real(0xd82d55b5068000LL), real(0x4a1c5add9a3000LL),reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^19, polynomial in n of order 7 -reale(2884,0x97776797f0000LL),real(0x5dcb94a5bbaa0000LL), -real(0x2147754a866d0000LL),real(0x59b9e153ee1c0000LL), -real(0x1d3317b06cdb0000LL),real(0xfd67f86b28e0000LL), -real(0x193b89a255c90000LL),real(0x662541f54195000LL), reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^18, polynomial in n of order 8 -reale(5404,0x5e66e1f930000LL),real(0x194c5bcfa9f36000LL), -reale(2201,0x4f230944e4000LL),reale(2053,0x73a8845e02000LL), -real(0x127ebba7aac98000LL),real(0x433c97a5782ce000LL), -real(0x29997437ffc4c000LL),-real(0xb36408ece66000LL), -real(0x4eb946c9b6ac00LL),reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^17, polynomial in n of order 9 -reale(2829,0x5744c85a98000LL),real(0x53fda6bff9540000LL), -reale(5946,0xc179df32e8000LL),real(0x424987c8bd3f0000LL), -real(0x4d6fba1e72f38000LL),reale(2362,0x7a9b39aaa0000LL), -real(0x1a7dd6520d788000LL),real(0x1ca5a49549150000LL), -real(0x279b8ad82b3d8000LL),real(0x8624b660e613800LL), reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^16, polynomial in n of order 10 reale(3052,0x1cc54fce28000LL),reale(15175,0x33b0e2aba4000LL), -reale(5744,0xc5440d7e0000LL),-real(0xd3fdde9c4364000LL), -reale(5627,0x42b2a45de8000LL),reale(2296,0xc920e17994000LL), -real(0x15ef23de88bf0000LL),reale(2060,0x9b7c8a7a8c000LL), -real(0x3634e9b2229f8000LL),-real(0x3eaac877287c000LL), -real(0x1ee323a1ca0c800LL),reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^15, polynomial in n of order 11 -reale(77304,0xeb4d9089c8000LL),reale(21636,0x8867f71d90000LL), reale(6061,8670344157LL<<15),reale(12960,6074462725LL<<18), -reale(9403,0x25b985468000LL),-real(0x35c5d916ffb10000LL), -reale(4114,0x3d13bbebb8000LL),reale(3690,0x5a8c0420a0000LL), -real(0x7db1fc00af08000LL),real(0x3ee56918f4c50000LL), -real(0x41d90b24a2658000LL),real(0xb0f65a4ddefb800LL), reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^14, polynomial in n of order 12 reale(84445,0xef949ea0f8000LL),reale(19627,0xf0e541fbce000LL), -reale(80833,0x5f741237dc000LL),reale(34575,0x1644d05d7a000LL), reale(6828,0x4cfbe5cb50000LL),reale(8288,0x561945cd26000LL), -reale(12838,0x6d3e328184000LL),real(0x15c5608ef0ed2000LL), -real(0x653ba29de4a58000LL),reale(4217,0x4b5d86267e000LL), -real(0x3b46409683b2c000LL),-real(0x974d654f27d6000LL), -real(0x674dea252558c00LL),reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^13, polynomial in n of order 13 reale(45373,0x376f121df0000LL),-reale(98871,0xe30dbcdfc0000LL), reale(96522,0x4174515a90000LL),-real(0x2d5b0f36d6d20000LL), -reale(79483,0x53270530d0000LL),reale(50297,8337588523LL<<19), reale(3071,0x5d816f2bd0000LL),real(0x5cfb30543d820000LL), -reale(14132,0x4c1b1cdf90000LL),reale(3907,0xfc9bf30ac0000LL), real(0x1e5e0fff75d10000LL),reale(2700,0x7f35ecdd60000LL), -real(0x74992b46f6e50000LL),real(0xe2f417f6bbc1000LL), reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^12, polynomial in n of order 14 real(0x1b3ddeae39bf0000LL),-reale(7839,0x62697a1358000LL), reale(39400,0x7dae3b2360000LL),-reale(93477,0x2dd7a51de8000LL), reale(106917,0x5f76290ad0000LL),-reale(25706,0x4975ab7078000LL), -reale(70221,0xf8d5dabdc0000LL),reale(66679,0x434a03a4f8000LL), -reale(7926,0xc17b4a4650000LL),-reale(5104,0x4c6b9c2d98000LL), -reale(10825,0x972fc79ee0000LL),reale(8339,0xae0935c7d8000LL), -real(0xb5e35652d770000LL),-real(0xb97cf166cab8000LL), -real(0x1484ac4370939000LL),reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^11, polynomial in n of order 15 real(0x1da928c9710000LL),real(0xef3463c3520000LL), real(0x1433e03669f30000LL),-reale(6121,0xc895edf4c0000LL), reale(32842,0x2af7b46f50000LL),-reale(85281,0xda67593ea0000LL), reale(113905,0x4294ec3770000LL),-reale(54341,1789231857LL<<19), -reale(49473,0x80d6dfd870000LL),reale(78594,0x71ba158da0000LL), -reale(27684,0xd5e2e99050000LL),-reale(5831,3589595121LL<<18), -reale(2437,0x3d76dec030000LL),reale(8713,0x93ccba19e0000LL), -reale(3467,0xfccc93810000LL),real(0xf2bb44edf33d000LL), reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^10, polynomial in n of order 16 real(0xcab3dac70000LL),real(0x3665759289000LL),real(0x12ce11eabe2000LL), real(0x9df70180dbb000LL),real(0xdfd754eb8954000LL), -reale(4487,0x5dd2369613000LL),reale(25849,0xff24cd52c6000LL), -reale(73908,0x17b3db62e1000LL),reale(115119,0x8d3c9a9638000LL), -reale(83691,0x41fe3e02af000LL),-reale(14375,0xada6f2de56000LL), reale(76590,0xeb60670083000LL),-reale(52128,0x9a91d83ce4000LL), reale(7010,0x5a128dfcb5000LL),reale(3866,0xf6d75c088e000LL), real(0x469f50315e7e7000LL),-real(0x4bbe9f188165a200LL), reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^9, polynomial in n of order 17 real(0x8ddfb274000LL),real(120826333LL<<18),real(0x6b145a40c000LL), real(0x1dc5136a58000LL),real(0xab5ca60ba4000LL),real(0x5e28748a970000LL), real(0x8cad0403953c000LL),-reale(3003,0xaeb1521f78000LL), reale(18707,0x350991ecd4000LL),-reale(59284,0x6845654460000LL), reale(107702,0xd776bbe6c000LL),-reale(107579,0xe340531948000LL), reale(33813,0xa464b8b604000LL),reale(48035,0x81a4fa0dd0000LL), -reale(64047,0xa4265c8064000LL),reale(31225,0xe027c1dce8000LL), -reale(5635,0xd5d68038cc000LL),-real(0x50368754849c400LL), reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^8, polynomial in n of order 18 real(490704814080LL),real(0x13aa0f5a000LL),real(31022013LL<<17), real(0xc68497e6000LL),real(0x2fcbb8aac000LL),real(0xdd4302e72000LL), real(0x534405e9b8000LL),real(0x30298b6eefe000LL), real(0x4c5dcf34c0c4000LL),-real(0x6d574da684a76000LL), reale(11873,5016286141LL<<16),-reale(42009,0x509c0961ea000LL), reale(89073,0x6259ee06dc000LL),-reale(115683,0xae64a27b5e000LL), reale(82889,0x8f2a67cde8000LL),-reale(11935,0xb1dc537ad2000LL), -reale(33312,0xcf05a2430c000LL),reale(28876,0xae4eda7bba000LL), -reale(8101,0x83645851a5400LL),reale(14816215,0x5c99263f881e3LL), // C4[6], coeff of eps^7, polynomial in n of order 19 real(7458340864LL),real(560703LL<<15),real(48303816704LL), real(522951LL<<18),real(426386014208LL),real(45283889LL<<15), real(0x56a252ac000LL),real(440127317LL<<16),real(0xa648bd1f4000LL), real(0x65fb114118000LL),real(0xacffeca0b3c000LL), -real(0x860da206139LL<<17),real(0x7d0a1c0732284000LL), -reale(7961,0x1b3e7a1f58000LL),reale(19682,0xa4af1c3bcc000LL), -reale(31917,0xccc8ef8390000LL),reale(34094,0x3798b7b14000LL), -reale(23101,0x583f152fc8000LL),reale(8983,0xdb34fa045c000LL), -real(0x5f40c0b45d798c00LL),reale(4938738,0x74330cbfd80a1LL), // C4[6], coeff of eps^6, polynomial in n of order 20 real(651542528),real(1480134656),real(3538968576LL),real(8971595776LL), real(371371LL<<16),real(71493373952LL),real(230978592768LL), real(838422294528LL),real(0x334e2804000LL),real(0x106060339000LL), real(0x6e2b415ae000LL),real(0x484c62e3a3000LL),real(0x848c0aa1558000LL), -real(0xe0b56a0582f3000LL),real(0x745df25523d02000LL), -reale(8378,0x6c27f21289000LL),reale(23938,0x5996b3a2ac000LL), -reale(45881,0xd660d84d1f000LL),reale(58395,0x10d8591c56000LL), -reale(42673,0x513ba394b5000LL),reale(12954,0x665fd1a892600LL), reale(14816215,0x5c99263f881e3LL), // C4[7], coeff of eps^26, polynomial in n of order 0 real(9763<<15),real(0x75209f8d91abLL), // C4[7], coeff of eps^25, polynomial in n of order 1 real(239317LL<<16),real(5250319360LL),real(0x4082f7e0f93b2fLL), // C4[7], coeff of eps^24, polynomial in n of order 2 real(179518703LL<<19),-real(591371495LL<<18),real(0x28b139bd9800LL), reale(3231,0x13f0854e6fdc3LL), // C4[7], coeff of eps^23, polynomial in n of order 3 real(0x2cef3d4baf0000LL),-real(77130417375LL<<17),real(0xef66e7c50000LL), real(0x5431e6572400LL),reale(119549,0xe1c344562ad2fLL), // C4[7], coeff of eps^22, polynomial in n of order 4 real(217227301LL<<22),-real(289844049LL<<20),real(78161061LL<<21), -real(250072603LL<<20),real(0x3ccfc393c000LL), reale(3856,0x72a333c0b70f1LL), // C4[7], coeff of eps^21, polynomial in n of order 5 real(0x4e0ae513ee240000LL),-real(827903427791LL<<20), real(0xa247f543e5fLL<<18),-real(0x3412b66b53fLL<<19), -real(88149449003LL<<18),-real(0x22c21c78f4d000LL), reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^20, polynomial in n of order 6 real(0x17d653fb3b3LL<<21),-real(0x28623ac8329LL<<20), real(0x157258d15a9LL<<22),-real(0x11bb996f2dfLL<<20), real(568501848145LL<<21),-real(0x17b5bd88f85LL<<20), real(0x53401a2130be000LL),reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^19, polynomial in n of order 7 -real(0x83a0cdc49940000LL),-reale(2692,4590415189LL<<19), real(0x5a9e6c539a840000LL),-real(834402440151LL<<20), real(0x4606e5f7741c0000LL),-real(0x420b2360847LL<<19), -real(530800397043LL<<18),-real(0xe57fab5d571000LL), reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^18, polynomial in n of order 8 reale(3472,126556531LL<<23),-reale(5076,3517313787LL<<20), -real(76794078375LL<<21),-real(0x6a9c1a13021LL<<20), reale(2051,1043338611LL<<22),-real(704701202247LL<<20), real(0xfa27346673LL<<21),-real(0x245598aac6dLL<<20), real(0x69deaea556c4000LL),reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^17, polynomial in n of order 9 reale(15000,0xe6601a91a0000LL),-real(0x261369ca72fLL<<20), real(0x42e9870754860000LL),-reale(5748,0xcbf4457740000LL), real(0x3d07c1e90b320000LL),-real(0x3f02d96efefLL<<19), real(0x7fb986a3c79e0000LL),-real(0x995e2453d1fLL<<18), -real(0x4ae4d5f0bb60000LL),-real(0x2b86668e596d800LL), reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^16, polynomial in n of order 10 -real(0x73f9d78b0d9LL<<20),real(0x9cf538ea065LL<<19), reale(15740,149203411LL<<22),-reale(4248,1728572757LL<<19), -real(0x407b444d4cfLL<<20),-reale(4968,2121468799LL<<19), reale(2638,499248115LL<<21),real(0x88c04a730380000LL), real(0x44a3b895a7bLL<<20),-real(0x74a26c7b8a3LL<<19), real(0x855f1c455087000LL),reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^15, polynomial in n of order 11 reale(61154,0xdd701642e0000LL),-reale(66911,9396541691LL<<18), reale(7800,0xcd3506c5a0000LL),reale(6879,1489841009LL<<20), reale(13340,0xebc72e5460000LL),-reale(8995,2037240317LL<<18), -real(0x58226c8c268e0000LL),-reale(2527,381291855LL<<19), reale(3789,0xabee5235e0000LL),-real(0x7b29f7fc67fLL<<18), -real(0x7ff214bf2760000LL),-real(0x75bce0e31735800LL), reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^14, polynomial in n of order 12 -reale(101656,596927171LL<<22),reale(53043,574431381LL<<20), reale(45405,240861115LL<<21),-reale(76255,2673908009LL<<20), reale(23050,192030143LL<<23),reale(9407,3846737689LL<<20), reale(7022,1974859325LL<<21),-reale(12738,252856997LL<<20), real(0x137e788e9bfLL<<22),real(0x118e235259dLL<<20), reale(2782,635761855LL<<21),-real(0x61e77094421LL<<20), real(0x9e768b34c754000LL),reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^13, polynomial in n of order 13 -reale(21345,0xc6c0a8cac0000LL),reale(63537,3528773151LL<<20), -reale(101990,1331648317LL<<18),reale(73206,6215106713LL<<19), reale(21832,587136209LL<<18),-reale(78785,930736779LL<<21), reale(42984,0xe415720fc0000LL),reale(4706,912279695LL<<19), -real(0x6fb64418f6cc0000LL),-reale(11952,1697246539LL<<20), reale(6137,3764705851LL<<18),real(0x39d9405b105LL<<19), -real(779141568695LL<<18),-real(0x14a7906c9982d000LL), reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^12, polynomial in n of order 14 -real(254469508501LL<<21),reale(2615,141135587LL<<20), -reale(16754,480949921LL<<22),reale(54113,1487459045LL<<20), -reale(98062,1801972559LL<<21),reale(91200,2801526327LL<<20), -reale(9603,108846763LL<<23),-reale(69011,498726663LL<<20), reale(62980,2002280887LL<<21),-reale(11145,4221789365LL<<20), -reale(7195,1009585291LL<<22),-reale(4457,3739558579LL<<20), reale(7974,18407933LL<<21),-reale(2668,664195297LL<<20), real(0x8b8039451326000LL),reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^11, polynomial in n of order 15 -real(5353180065LL<<18),-real(25442595013LL<<19), -real(0x4cec268118c0000LL),real(0x702c4e5b497LL<<20), -reale(12304,5733646405LL<<18),reale(43346,2744696673LL<<19), -reale(88871,6285139975LL<<18),reale(103468,468195229LL<<21), -reale(46365,0xbad7731a40000LL),-reale(41349,1257587961LL<<19), reale(72365,0x9597fe7540000LL),-reale(36580,2571848483LL<<20), real(0xc0cfef1c9f3LL<<18),reale(3419,2944620333LL<<19), real(0x5d00262e0cc40000LL),-real(0x44e0e913b4a79000LL), reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^10, polynomial in n of order 16 -real(1386231LL<<24),-real(109742265LL<<20),-real(354075457LL<<21), -real(7044729419LL<<20),-real(48190848741LL<<22), real(0x4592e53c723LL<<20),-reale(8214,1225367123LL<<21), reale(31749,3931639185LL<<20),-reale(73861,194985719LL<<23), reale(105371,3738827519LL<<20),-reale(81325,759307621LL<<21), reale(5533,2607378797LL<<20),reale(54935,128097033LL<<22), -reale(54849,213867813LL<<20),reale(23331,2117756809LL<<21), -reale(3571,955076279LL<<20),-real(0xa766ab1fb094000LL), reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^9, polynomial in n of order 17 -real(9271959LL<<16),-real(2137131LL<<20),-real(0x8adb5490000LL), -real(374926717LL<<17),-real(5060508635LL<<16),-real(0xc549443040000LL), -real(0x1658a10fa0d0000LL),real(0x250f39cc17720000LL), -reale(4742,48259999LL<<16),reale(20239,6692003029LL<<19), -reale(53602,0x26a4a24510000LL),reale(92339,8168900207LL<<17), -reale(101236,0x6fb3cfe30000LL),reale(59785,2334542613LL<<18), real(0x5c1211516deb0000LL),-reale(32944,0x86c05c8b60000LL), reale(24775,0x5aee521590000LL),-reale(6657,0xade066fea8c00LL), reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^8, polynomial in n of order 18 -real(31473LL<<19),-real(194623LL<<18),-real(41393LL<<22), -real(2533665LL<<18),-real(5617311LL<<19),-real(60523827LL<<18), -real(107394483LL<<20),-real(4758923477LL<<18),-real(73625727245LL<<19), real(0xf5289483e640000LL),-reale(2141,878914353LL<<21), reale(10163,0xf2a381edc0000LL),-reale(30731,8395289531LL<<19), reale(63101,0xdb7b98c940000LL),-reale(89756,3102076305LL<<20), reale(87316,6648120707LL<<18),-reale(55353,8132528169LL<<19), reale(20534,9081852529LL<<18),-reale(3368,0xf233ddc1a2800LL), reale(17095633,0x1c132c21ebd41LL), // C4[7], coeff of eps^7, polynomial in n of order 19 -real(4693<<16),-real(6435<<17),-real(37895LL<<16),-real(7579LL<<20), -real(428505LL<<16),-real(854413LL<<17),-real(7933835LL<<16), -real(11246865LL<<18),-real(338155741LL<<16),-real(0xee3402ee0000LL), -real(0x1efc2a618f0000LL),real(517531990885LL<<19), -real(0x243e4ae81d610000LL),reale(3081,0xb7f72703e0000LL), -reale(10639,0x4442fa8130000LL),reale(25534,4122358181LL<<18), -reale(43524,0x45cc2f5650000LL),reale(51336,0x52534b86a0000LL), -reale(35935,0x6cd3e81170000LL),reale(10668,0x544ee8e52d400LL), reale(17095633,0x1c132c21ebd41LL), // C4[8], coeff of eps^26, polynomial in n of order 0 real(1703<<17),real(0x7c72a9866ac5bLL), // C4[8], coeff of eps^25, polynomial in n of order 1 -real(177229LL<<20),real(727155LL<<16),real(0x491cf6cbc520f1LL), // C4[8], coeff of eps^24, polynomial in n of order 2 -real(9929683361LL<<18),-real(175790329LL<<17),-real(0x88fc23ec000LL), reale(40280,0xc561288d94a7fLL), // C4[8], coeff of eps^23, polynomial in n of order 3 -real(11862711753LL<<19),real(5010641713LL<<20),-real(14709027619LL<<19), real(0x62bf29e3e8000LL),reale(135489,0xddbb2b5096ef1LL), // C4[8], coeff of eps^22, polynomial in n of order 4 -real(6145646087LL<<23),real(131879372361LL<<21), -real(33613471903LL<<22),-real(3256336589LL<<21), -real(0xacc29a2990000LL),reale(1761368,0x42813317aa23dLL), // C4[8], coeff of eps^21, polynomial in n of order 5 -real(0x6a942373c4bLL<<19),real(0x26ec3bfe245LL<<21), -real(0x8f791d3a3680000LL),real(0x11c215e6335LL<<20), -real(0x2c38227cc2fLL<<19),real(0x4429220c0f48000LL), reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^20, polynomial in n of order 6 -reale(2934,444315969LL<<20),real(0x6a3b64139b1LL<<19), -real(467101336651LL<<21),real(0x8d6914ca9b7LL<<19), -real(0x1951684536bLL<<20),-real(344981960323LL<<19), -real(0x1536c8746170000LL),reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^19, polynomial in n of order 7 -reale(3511,3705843547LL<<19),-real(0x204aea957e3LL<<20), -reale(2145,1225061153LL<<19),real(0x33d58e2ac0fLL<<21), -real(10655273223LL<<19),real(0x21f191654dfLL<<20), -real(0x4229ae891cdLL<<19),real(0x53ff9bb26958000LL), reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^18, polynomial in n of order 8 reale(2327,223378273LL<<24),reale(3002,681494021LL<<21), -reale(5098,180818405LL<<22),-real(5074441169LL<<21), -real(428729715071LL<<23),real(0x3cce86cb309LL<<21), -real(434398966071LL<<22),-real(156882519885LL<<21), -real(0x33e11620e250000LL),reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^17, polynomial in n of order 9 -reale(6703,1474120015LL<<19),reale(14458,426935549LL<<22), -real(511886207649LL<<19),-real(39076914681LL<<20), -reale(5282,7254660115LL<<19),real(0x33346658ebdLL<<21), real(0xd2bcdb640d80000LL),real(0x48aecde6f2dLL<<20), -real(0x66a76bcf857LL<<19),real(0x650db91f67c8000LL), reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^16, polynomial in n of order 10 -reale(41674,2212282947LL<<19),-reale(7593,6666692295LL<<18), real(0x22d5b967639LL<<21),reale(15266,7870015191LL<<18), -reale(4856,4082442485LL<<19),-real(0x76ec691ccd2c0000LL), -reale(3302,2416313159LL<<20),reale(3252,0xd63fbdd4c0000LL), -real(0xa56dc66b5380000LL),-real(0x5b75ff5133c0000LL), -real(0x7d0ead839928000LL),reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^15, polynomial in n of order 11 reale(6774,8529353663LL<<19),reale(68916,757502869LL<<20), -reale(58358,4821135835LL<<19),reale(3030,627685345LL<<22), reale(8321,1974413611LL<<19),reale(11199,994841075LL<<20), -reale(10210,402696815LL<<19),-real(0x10cbfe9c35fLL<<21), -real(0x88d945e9f480000LL),reale(2764,2004030417LL<<20), -real(0xa3f22386a83LL<<19),real(0x6eb0baaefa68000LL), reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^14, polynomial in n of order 12 reale(80789,157273055LL<<23),-reale(92413,883895019LL<<21), reale(33037,752031121LL<<22),reale(52633,1725093895LL<<21), -reale(71257,198988971LL<<24),reale(21774,462183721LL<<21), reale(9867,923099607LL<<22),reale(2235,815700763LL<<21), -reale(11863,140786955LL<<23),reale(4226,1910142077LL<<21), real(854212143197LL<<22),real(169477509103LL<<21), -real(0x1429c96cdeb90000LL),reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^13, polynomial in n of order 13 reale(7986,2577537059LL<<19),-reale(31049,1388317679LL<<21), reale(71398,6484881669LL<<19),-reale(96607,3840488041LL<<20), reale(60036,7375804551LL<<19),reale(24533,301249307LL<<22), -reale(73258,7729848599LL<<19),reale(45499,3314021057LL<<20), -real(0x3ea6bf07b95LL<<19),-reale(6268,968456357LL<<21), -reale(5889,8030103219LL<<19),reale(7129,2010513003LL<<20), -reale(2060,6603694641LL<<19),real(0x4aa8326c4b38000LL), reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^12, polynomial in n of order 14 real(110457315575LL<<20),-real(0x55e7441aebbLL<<19), reale(5489,1587292819LL<<21),-reale(23107,1250112621LL<<19), reale(59020,876513493LL<<20),-reale(93669,6579434335LL<<19), reale(83160,151752881LL<<22),-reale(14191,6428793873LL<<19), -reale(55802,147123789LL<<20),reale(63340,7698024701LL<<19), -reale(24299,306146767LL<<21),-reale(2685,2028352693LL<<19), reale(2706,1245782417LL<<20),real(0xd3e9bdc0259LL<<19), -real(0x3e4f75bd92cb0000LL),reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^11, polynomial in n of order 15 real(349722603LL<<19),real(1945948591LL<<20),real(0xe000999c080000LL), -real(852080688837LL<<21),reale(3397,2932652343LL<<19), -reale(15561,3567671555LL<<20),reale(44311,3271472077LL<<19), -reale(82040,520836183LL<<22),reale(95750,3608174083LL<<19), -reale(56326,3054118709LL<<20),-reale(14075,6930316647LL<<19), reale(56094,1163367017LL<<21),-reale(46280,7703552945LL<<19), reale(17576,4216930841LL<<20),-reale(2261,6650055195LL<<19), -real(0xc8e19a260718000LL),reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^10, polynomial in n of order 16 real(53199LL<<25),real(4832235LL<<21),real(18086833LL<<22), real(422991569LL<<21),real(3456128781LL<<23),-real(417864400569LL<<21), real(0x1c1175e6463LL<<22),-reale(9006,876789843LL<<21), reale(28706,92601679LL<<24),-reale(61776,681174429LL<<21), reale(90600,218403669LL<<22),-reale(86125,255162935LL<<21), reale(41671,220860591LL<<23),reale(9900,1945963071LL<<21), -reale(31426,812677625LL<<22),reale(21427,717745189LL<<21), -reale(5580,0x8f2cafdf0000LL),reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^9, polynomial in n of order 17 real(47583LL<<19),real(12411LL<<23),real(964865LL<<19), real(2862477LL<<20),real(45013059LL<<19),real(139025201LL<<21), real(19339324389LL<<19),-real(313753792905LL<<20), real(0x5b827ae7827LL<<19),-reale(4043,135949957LL<<22), reale(14485,4274671945LL<<19),-reale(36111,1380328223LL<<20), reale(64526,2642754443LL<<19),-reale(82901,1325528645LL<<21), reale(74876,5403462445LL<<19),-reale(44997,1726039605LL<<20), reale(16070,4300719215LL<<19),-reale(2566,0xd0ea909388000LL), reale(19375050,0xdb8d32044f89fLL), // C4[8], coeff of eps^8, polynomial in n of order 18 real(1053<<18),real(7293<<17),real(1749LL<<21),real(121635LL<<17), real(309043LL<<18),real(3853577LL<<17),real(8003583LL<<19), real(420632751LL<<17),real(7839064905LL<<18),-real(550302356331LL<<17), real(754118043861LL<<20),-real(0x433703efa18a0000LL), reale(4345,0xa637f297c0000LL),-reale(12473,0x9f7aaa1be0000LL), reale(26308,41230677LL<<19),-reale(40979,0xc6d64da720000LL), reale(45533,1464249973LL<<18),-reale(30801,0xcafec6ea60000LL), reale(8983,0xdb34fa045c000LL),reale(19375050,0xdb8d32044f89fLL), // C4[9], coeff of eps^26, polynomial in n of order 0 real(3679<<17),real(0xf744df0e6c69LL), // C4[9], coeff of eps^25, polynomial in n of order 1 -real(48841LL<<20),-real(336765LL<<16),real(0x19892cc90d5217fLL), // C4[9], coeff of eps^24, polynomial in n of order 2 real(24659297LL<<26),-real(64440233LL<<25),real(414215087LL<<20), reale(45019,0xaf6c96bc5ad9dLL), // C4[9], coeff of eps^23, polynomial in n of order 3 real(0x55f7a92f661LL<<19),-real(0x115bb8ed6d9LL<<20), -real(198450589909LL<<19),-real(0xb7278b5afc8000LL), reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^22, polynomial in n of order 4 real(52440485279LL<<23),-real(8663417169LL<<21),real(29836121623LL<<22), -real(64017745099LL<<21),real(0x517eabcb370000LL), reale(1968588,0xe17edcf27917LL), // C4[9], coeff of eps^21, polynomial in n of order 5 real(0x29ddd14eea5LL<<19),-real(683397694747LL<<21), real(0x8a9d0ded323LL<<19),-real(0x12a27ad79ebLL<<20), -real(365440747903LL<<19),-real(0x1a278f54ba58000LL), reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^20, polynomial in n of order 6 -real(258517517319LL<<23),-reale(2449,779805879LL<<22), real(333316352075LL<<24),real(89662817151LL<<22), real(311028248083LL<<23),-real(514657501435LL<<22), real(0x42edd4687ca0000LL),reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^19, polynomial in n of order 7 reale(4708,5969586757LL<<19),-reale(3967,769306643LL<<20), -real(0x4aa5ebcacc1LL<<19),-real(0x2338c762cc1LL<<21), real(0xdfce640f299LL<<19),-real(0xee4b32a131LL<<20), -real(544152989037LL<<19),-real(0x392f1a561e88000LL), reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^18, polynomial in n of order 8 reale(10651,141986579LL<<24),reale(2483,579021431LL<<21), real(0x171656e9461LL<<22),-reale(5106,1475723195LL<<21), real(424307179891LL<<23),real(353847768099LL<<21), real(0x12b721ceb0bLL<<22),-real(0x16800175f8fLL<<21), real(0x4cd03e8801b0000LL),reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^17, polynomial in n of order 9 -reale(12598,568269079LL<<19),-reale(5705,584195995LL<<22), reale(14434,7986153127LL<<19),-real(0x53c43a7b401LL<<20), -real(0xc35a517653bLL<<19),-reale(3831,956767451LL<<21), reale(2686,1674924547LL<<19),real(257168565717LL<<20), -real(441477690591LL<<19),-real(0x7fc3df35f858000LL), reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^16, polynomial in n of order 10 reale(73082,82142393LL<<24),-reale(36372,269994261LL<<23), -reale(8446,14363443LL<<26),reale(3801,517661957LL<<23), reale(13381,17268719LL<<24),-reale(7345,464489969LL<<23), -real(211182139987LL<<25),-real(326075858199LL<<23), reale(2675,147207653LL<<24),-real(589098042253LL<<23), real(0x4cdddf4aa2c0000LL),reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^15, polynomial in n of order 11 -reale(70228,3204573753LL<<19),-reale(3665,997072835LL<<20), reale(67162,8124243837LL<<19),-reale(56077,490889175LL<<22), reale(5918,7641432915LL<<19),reale(10294,3043462539LL<<20), reale(5723,2367840009LL<<19),-reale(10993,938348055LL<<21), reale(2675,6462906463LL<<19),real(0x3a39e82b059LL<<20), real(0xb502c3128a80000LL),-real(0x1358f80d9c038000LL), reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^14, polynomial in n of order 12 -reale(45939,459571779LL<<23),reale(81202,1438384695LL<<21), -reale(84011,799287213LL<<22),reale(28155,23125821LL<<21), reale(46736,266493023LL<<24),-reale(68202,2086496557LL<<21), reale(29667,382040805LL<<22),reale(5608,647828697LL<<21), -reale(4401,355658689LL<<23),-reale(6763,1986460369LL<<21), reale(6284,996052535LL<<22),-real(0x31efd65ac4bLL<<21), real(0x21519ecdd470000LL),reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^13, polynomial in n of order 13 -reale(2321,7142809405LL<<19),reale(11407,565078561LL<<21), -reale(34996,6437021595LL<<19),reale(70236,3027507143LL<<20), -reale(89750,2730116057LL<<19),reale(59647,532152523LL<<22), reale(10736,8218389321LL<<19),-reale(61423,3588044783LL<<20), reale(52845,5572842763LL<<19),-reale(15060,1433211893LL<<21), -reale(4428,664807251LL<<19),real(0x7ac3d0f14dbLL<<20), real(0xe0ec3bda56fLL<<19),-real(0x3854598234228000LL), reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^12, polynomial in n of order 14 -real(2301546703LL<<23),real(147057720589LL<<22), -real(359161692259LL<<24),reale(7105,778398699LL<<22), -reale(23999,359671965LL<<23),reale(54661,162239065LL<<22), -reale(84322,1670081LL<<25),reale(82245,254480119LL<<22), -reale(34604,180181675LL<<23),-reale(26937,29999003LL<<22), reale(54122,167282399LL<<24),-reale(38795,392755901LL<<22), reale(13349,275194759LL<<23),-real(0x161047343cfLL<<22), -real(0xd052410afde0000LL),reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^11, polynomial in n of order 15 -real(33392709LL<<19),-real(215980657LL<<20),-real(15729792143LL<<19), real(133575397083LL<<21),-real(0x5183d845f39LL<<19), reale(3762,3694580381LL<<20),-reale(14049,8382023811LL<<19), reale(36325,545288329LL<<22),-reale(66629,6532309165LL<<19), reale(85703,4252949035LL<<20),-reale(71810,6020466679LL<<19), reale(27704,1818174537LL<<21),reale(15098,409579871LL<<19), -reale(29448,934474951LL<<20),reale(18689,3410848533LL<<19), -reale(4754,0x309583fd38000LL),reale(21654468,0x9b0737e6b33fdLL), // C4[9], coeff of eps^10, polynomial in n of order 16 -real(893LL<<25),-real(92625LL<<21),-real(399779LL<<22), -real(10904803LL<<21),-real(105333207LL<<23),real(15302554267LL<<21), -real(86594321625LL<<22),real(0xfe4052cb09LL<<21), -reale(2108,118544893LL<<24),reale(6191,505418439LL<<21), -reale(13344,231933903LL<<22),reale(21384,2064906293LL<<21), -reale(25319,426528669LL<<23),reale(21525,1826875827LL<<21), -reale(12380,255070469LL<<22),reale(4285,1002542497LL<<21), -real(0x29d9aac7ec250000LL),reale(7218156,0x33ad12a23bbffLL), // C4[9], coeff of eps^9, polynomial in n of order 17 -real(969<<19),-real(285LL<<23),-real(25175LL<<19),-real(85595LL<<20), -real(1557829LL<<19),-real(5632151LL<<21),-real(929304915LL<<19), real(18163686975LL<<20),-real(446826699585LL<<19), real(387249806307LL<<22),-real(0xd080dd307cfLL<<19), reale(5560,386556505LL<<20),-reale(13900,1932782525LL<<19), reale(26517,756597539LL<<21),-reale(38450,1381788619LL<<19), reale(40711,4015921907LL<<20),-reale(26784,1441242297LL<<19), reale(7700,0x72bfb1ba98000LL),reale(21654468,0x9b0737e6b33fdLL), // C4[10], coeff of eps^26, polynomial in n of order 0 -real(5057<<18),real(0x10edb70f760db7LL), // C4[10], coeff of eps^25, polynomial in n of order 1 -real(4901LL<<25),real(14157LL<<21),real(0x4082f7e0f93b2fLL), // C4[10], coeff of eps^24, polynomial in n of order 2 -real(8688787LL<<25),-real(2064227LL<<24),-real(9250461LL<<21), reale(7108,0x5f112546294adLL), // C4[10], coeff of eps^23, polynomial in n of order 3 real(363248763LL<<25),real(3123548769LL<<26),-real(5801671447LL<<25), real(14176223919LL<<21),reale(3419126,0x9f3708d39590dLL), // C4[10], coeff of eps^22, polynomial in n of order 4 -real(490568702783LL<<22),real(0x422ec2346b3LL<<20), -real(446296001151LL<<21),-real(174052882927LL<<20), -real(0xed1818f25bLL<<17),reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^21, polynomial in n of order 5 -reale(2585,173491781LL<<22),real(226504425479LL<<24), real(118144668093LL<<22),real(325346294119LL<<23), -real(464280225409LL<<22),real(919092918513LL<<18), reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^20, polynomial in n of order 6 -reale(2656,138725573LL<<22),-real(0x1a9c614c5c3LL<<21), -real(765139808215LL<<23),real(0x32058af918bLL<<21), -real(117685929879LL<<22),-real(106680176295LL<<21), -real(0xf144800341LL<<18),reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^19, polynomial in n of order 7 reale(3432,329072245LL<<22),reale(2930,283183745LL<<23), -reale(4577,1044295185LL<<22),real(34786730571LL<<24), real(54685893801LL<<22),real(647412775723LL<<23), -real(676279973341LL<<22),real(0xe9c610e7bdLL<<18), reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^18, polynomial in n of order 8 -reale(11084,235058537LL<<23),reale(11858,1143524977LL<<20), real(0x2545fd77485LL<<21),-real(0x307c82cee9dLL<<20), -reale(4103,193833065LL<<22),reale(2140,2163909077LL<<20), real(446041302231LL<<21),-real(54302113593LL<<20), -real(0x7f8004b3e7a0000LL),reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^17, polynomial in n of order 9 -reale(16525,309616105LL<<23),-reale(12873,31213113LL<<26), -real(811482588455LL<<23),reale(13789,37992821LL<<24), -reale(4637,221662373LL<<23),-real(274288421561LL<<25), -real(562238052579LL<<23),reale(2541,30117927LL<<24), -real(493061811809LL<<23),real(451991259993LL<<19), reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^16, polynomial in n of order 10 -reale(4541,277413243LL<<23),reale(9880,364937465LL<<22), -reale(5569,118974143LL<<25),-real(671603509225LL<<22), real(626562721155LL<<23),real(0x126f9949db5LL<<22), -real(372257463743LL<<24),real(225505748691LL<<22), real(72729834113LL<<23),real(40056084593LL<<22), -real(360891225041LL<<19),reale(3419126,0x9f3708d39590dLL), // C4[10], coeff of eps^15, polynomial in n of order 11 reale(82722,490551845LL<<23),-reale(64701,63547469LL<<24), real(116234844999LL<<23),reale(58506,49315063LL<<26), -reale(58413,433206103LL<<23),reale(16792,103491845LL<<24), reale(8555,183955915LL<<23),-reale(2317,84066185LL<<25), -reale(7194,11825619LL<<23),reale(5493,119743831LL<<24), -real(667673139889LL<<23),real(58009080297LL<<19), reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^14, polynomial in n of order 12 reale(18981,396462873LL<<22),-reale(46078,2701457279LL<<20), reale(76015,1126083519LL<<21),-reale(79652,3524648005LL<<20), reale(36586,273717939LL<<23),reale(28474,1008822389LL<<20), -reale(61326,649857063LL<<21),reale(42595,3757087663LL<<20), -reale(8326,955589709LL<<22),-reale(5139,3984305559LL<<20), real(0x284545d9df3LL<<21),real(0x72b007891a3LL<<20), -real(0x33009c87a9620000LL),reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^13, polynomial in n of order 13 real(543312976219LL<<22),-reale(3062,112501267LL<<24), reale(11988,59347917LL<<22),-reale(32439,32307605LL<<23), reale(61980,821355519LL<<22),-reale(81948,80095793LL<<25), reale(67313,1055324017LL<<22),-reale(16748,109351667LL<<23), -reale(34832,1017554013LL<<22),reale(50577,16270159LL<<24), -reale(32450,61276651LL<<22),reale(10213,501613231LL<<23), -real(913358656441LL<<22),-real(0xcb30b375e9c0000LL), reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^12, polynomial in n of order 14 real(553451171LL<<22),-real(41782403663LL<<21),real(122732484303LL<<23), -real(0x2eaf28525b9LL<<21),reale(6402,476837273LL<<22), -reale(19347,183862947LL<<21),reale(42585,247358789LL<<24), -reale(68666,1206346765LL<<21),reale(79038,878189199LL<<22), -reale(58930,1207602423LL<<21),reale(17031,374958661LL<<23), reale(18189,4759455LL<<21),-reale(27348,414989947LL<<22), reale(16435,1788023477LL<<21),-reale(4106,0xe7ddb41f40000LL), reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^11, polynomial in n of order 15 real(259293LL<<22),real(1935549LL<<23),real(164593143LL<<22), -real(1654671183LL<<24),real(83533307473LL<<22), -real(296200453241LL<<23),reale(2600,89083243LL<<22), -reale(8792,113023813LL<<25),reale(22203,397075141LL<<22), -reale(42668,107392175LL<<23),reale(62615,179754463LL<<22), -reale(69317,125076421LL<<24),reale(56036,868613689LL<<22), -reale(31065,284420581LL<<23),reale(10475,628806483LL<<22), -real(0x6470cd13038c0000LL),reale(23933886,0x5a813dc916f5bLL), // C4[10], coeff of eps^10, polynomial in n of order 16 real(133LL<<24),real(15675LL<<20),real(77539LL<<21),real(2448017LL<<20), real(27681423LL<<22),-real(4770431897LL<<20),real(32525672025LL<<21), -real(503497402947LL<<20),real(327672913029LL<<23), -reale(2314,857372269LL<<20),reale(6672,231933903LL<<21), -reale(14969,2031875351LL<<20),reale(26346,292729733LL<<22), -reale(36032,1727726401LL<<20),reale(36664,1180419909LL<<21), -reale(23570,290549227LL<<20),reale(6696,0xabcf39720000LL), reale(23933886,0x5a813dc916f5bLL), // C4[11], coeff of eps^26, polynomial in n of order 0 real(611LL<<23),real(0xe6baee73ea363LL), // C4[11], coeff of eps^25, polynomial in n of order 1 -real(76597LL<<26),-real(1573935LL<<21),real(0x477bca00497fe9bfLL), // C4[11], coeff of eps^24, polynomial in n of order 2 real(5977365LL<<29),-real(9705069LL<<28),real(85309807LL<<22), reale(54497,0x83837319e73d9LL), // C4[11], coeff of eps^23, polynomial in n of order 3 real(66340583679LL<<26),-real(4467880351LL<<27),-real(2404066379LL<<26), -real(68755156353LL<<21),reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^22, polynomial in n of order 4 real(257415529LL<<33),real(402685503LL<<30),real(652792679LL<<32), -real(1631824579LL<<30),real(23005724469LL<<23), reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^21, polynomial in n of order 5 -real(453253333179LL<<23),-real(222902987187LL<<25), real(749255628291LL<<23),-real(3378231395LL<<24), -real(18492933151LL<<23),-real(0xf79dae93c9LL<<18), reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^20, polynomial in n of order 6 reale(4082,27256381LL<<26),-reale(3843,110832251LL<<25), -real(11608614857LL<<27),-real(12679113309LL<<25), real(80017732991LL<<26),-real(73865834735LL<<25), real(381345882225LL<<19),reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^19, polynomial in n of order 7 reale(8515,117356323LL<<23),reale(2727,54002259LL<<24), real(95356337593LL<<23),-reale(4154,53817247LL<<25), real(882540340143LL<<23),real(80081392881LL<<24),real(12076046661LL<<23), -real(0x7d57ec14bd40000LL),reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^18, polynomial in n of order 8 -reale(12505,951035LL<<32),-reale(6194,13758139LL<<28), reale(12920,711829LL<<30),-reale(2328,16199449LL<<28), -reale(2121,1768403LL<<31),-real(23812716991LL<<28), reale(2380,3848439LL<<30),-real(12910651229LL<<28), real(75285764519LL<<21),reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^17, polynomial in n of order 9 reale(63004,136371221LL<<24),-reale(23253,27876759LL<<27), -reale(10033,153577157LL<<24),reale(4968,6981291LL<<25), reale(9826,264428161LL<<24),-reale(8260,44635479LL<<26), real(151361303079LL<<24),real(120235734969LL<<25), real(86414162541LL<<24),-real(0x22b971cd551LL<<19), reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^16, polynomial in n of order 10 -reale(42751,388403LL<<27),-reale(21692,36263017LL<<26), reale(62310,8348465LL<<29),-reale(46929,14252519LL<<26), reale(7047,32285691LL<<27),reale(9444,49195723LL<<26), -real(6177911663LL<<28),-reale(7300,34477811LL<<26), reale(4777,27041001LL<<27),-real(65141092289LL<<26), -real(44359884933LL<<20),reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^15, polynomial in n of order 11 -reale(54975,7679265LL<<24),reale(76586,39901517LL<<25), -reale(65943,41351227LL<<24),reale(16034,25331417LL<<27), reale(40019,7760011LL<<24),-reale(57816,89862917LL<<25), reale(33374,245812081LL<<24),-reale(3538,1406183LL<<26), -reale(5247,183755081LL<<24),real(95390660393LL<<25), real(490233600157LL<<24),-real(0x5c9b8397461LL<<19), reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^14, polynomial in n of order 12 -reale(5607,843033LL<<31),reale(17587,15869457LL<<28), -reale(40024,1555693LL<<30),reale(66142,8872067LL<<28), -reale(76302,93659LL<<32),reale(52531,9300813LL<<28), -reale(2628,1860027LL<<30),-reale(39200,13058241LL<<28), reale(46365,693773LL<<31),-reale(27149,11145943LL<<28), reale(7864,1548807LL<<30),-real(7962030629LL<<28), -real(412888159761LL<<21),reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^13, polynomial in n of order 13 -real(41790907379LL<<23),real(76324858599LL<<25), -reale(2753,104130613LL<<23),reale(9526,224954257LL<<24), -reale(24463,68256343LL<<23),reale(47309,29696781LL<<26), -reale(68504,135442201LL<<23),reale(71563,253449815LL<<24), -reale(47678,505267003LL<<23),reale(8918,86883405LL<<25), reale(19900,176522371LL<<23),-reale(25292,67707491LL<<24), reale(14565,326677345LL<<23),-reale(3589,0xb1b7cdcc40000LL), reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^12, polynomial in n of order 14 -real(2670507LL<<26),real(235653561LL<<25),-real(820617391LL<<27), real(25869702111LL<<25),-real(68305888497LL<<26), reale(3896,38584213LL<<25),-reale(11280,10173573LL<<28), reale(25274,31321979LL<<25),-reale(44240,19038327LL<<26), reale(60354,128468529LL<<25),-reale(63152,8090597LL<<27), reale(48923,66496087LL<<25),-reale(26288,683965LL<<26), reale(8669,60420749LL<<25),-real(0xa3ae57ad353LL<<19), reale(26213304,0x19fb43ab7aab9LL), // C4[11], coeff of eps^11, polynomial in n of order 15 -real(3933LL<<23),-real(33649LL<<24),-real(3312023LL<<23), real(38979963LL<<25),-real(2334466673LL<<23),real(9974539421LL<<24), -real(115419670443LL<<23),real(61272170729LL<<26), -reale(2977,381931269LL<<23),reale(7656,260966955LL<<24), -reale(15739,178079295LL<<23),reale(25923,81221929LL<<25), -reale(33768,486785817LL<<23),reale(33232,239529529LL<<24), -reale(20951,91935571LL<<23),reale(5892,8880483819LL<<18), reale(26213304,0x19fb43ab7aab9LL), // C4[12], coeff of eps^26, polynomial in n of order 0 -real(1LL<<33),real(0x2f0618f20f09a7LL), // C4[12], coeff of eps^25, polynomial in n of order 1 -real(62273LL<<28),real(123651LL<<24),real(0x19e65bbd524850fbLL), // C4[12], coeff of eps^24, polynomial in n of order 2 -real(93684917LL<<28),-real(76423549LL<<27),-real(693037063LL<<24), reale(2191747,0xd5a68f81111b3LL), // C4[12], coeff of eps^23, polynomial in n of order 3 real(311968535LL<<28),real(1760740793LL<<29),-real(1954369859LL<<28), real(3073971433LL<<24),reale(9497573,0xf32718849f75dLL), // C4[12], coeff of eps^22, polynomial in n of order 4 -real(7646768769LL<<30),real(19951096269LL<<28),real(491010815LL<<29), -real(320366609LL<<28),-real(523396783LL<<29), reale(28492721,0xd975498dde617LL), // C4[12], coeff of eps^21, polynomial in n of order 5 -reale(3026,1811699LL<<28),-real(2760169147LL<<30), -real(4156137093LL<<28),real(9751170709LL<<29),-real(8065022455LL<<28), real(9009785085LL<<24),reale(28492721,0xd975498dde617LL), // C4[12], coeff of eps^20, polynomial in n of order 6 reale(3415,105419659LL<<25),real(300203870565LL<<24), -reale(4036,50457863LL<<26),real(324492084003LL<<24), real(46663751897LL<<25),real(14263553185LL<<24), -real(262021003825LL<<21),reale(28492721,0xd975498dde617LL), // C4[12], coeff of eps^19, polynomial in n of order 7 -reale(9657,23913255LL<<26),reale(11274,14202393LL<<27), -real(33749559685LL<<26),-real(32700069373LL<<28), -real(114920432067LL<<26),reale(2209,3347763LL<<27), -real(43334519585LL<<26),real(23877094395LL<<22), reale(28492721,0xd975498dde617LL), // C4[12], coeff of eps^18, polynomial in n of order 8 -reale(10357,4316059LL<<29),-reale(12252,51976653LL<<26), real(53111513007LL<<27),reale(10573,38618953LL<<26), -reale(6814,7336347LL<<28),-real(6527663009LL<<26), real(27052895205LL<<27),real(24601392501LL<<26),-real(17553357101LL<<26), reale(28492721,0xd975498dde617LL), // C4[12], coeff of eps^17, polynomial in n of order 9 -reale(37197,16059447LL<<26),reale(60620,6214685LL<<29), -reale(35564,62593849LL<<26),real(3388754439LL<<27), reale(9080,41918565LL<<26),real(21802684253LL<<28), -reale(7184,50608669LL<<26),reale(4144,5922861LL<<27), -real(50938551167LL<<26),-real(22779400371LL<<22), reale(28492721,0xd975498dde617LL), // C4[12], coeff of eps^16, polynomial in n of order 10 reale(72847,10250567LL<<26),-reale(50730,68954325LL<<25), -real(18441684165LL<<28),reale(46646,59050757LL<<25), -reale(52485,42154095LL<<26),reale(25457,83058719LL<<25), -real(7107757125LL<<27),-reale(5015,25213703LL<<25), real(15647388379LL<<26),real(240182800403LL<<25), -real(724544787239LL<<22),reale(28492721,0xd975498dde617LL), // C4[12], coeff of eps^15, polynomial in n of order 11 reale(23399,60546659LL<<26),-reale(46215,22779895LL<<27), reale(67437,13577137LL<<26),-reale(68612,7311579LL<<29), reale(38802,65276767LL<<26),reale(8195,42655LL<<27), -reale(41126,40169811LL<<26),reale(42002,3198053LL<<28), -reale(22751,40888613LL<<26),reale(6086,3052981LL<<27), -real(14786628311LL<<26),-real(192226168043LL<<22), reale(28492721,0xd975498dde617LL), // C4[12], coeff of eps^14, polynomial in n of order 12 real(18933494775LL<<28),-reale(4401,33536241LL<<26), reale(12915,15192945LL<<27),-reale(29094,11527179LL<<26), reale(50530,7111165LL<<29),-reale(66729,34095909LL<<26), reale(63904,14901367LL<<27),-reale(38025,42880575LL<<26), reale(2775,16493565LL<<28),reale(20705,54393511LL<<26), -reale(23355,27541123LL<<27),reale(12999,62947213LL<<26), -reale(3169,31971073LL<<26),reale(28492721,0xd975498dde617LL), // C4[12], coeff of eps^13, polynomial in n of order 13 real(168754105LL<<26),-real(365884805LL<<28),real(8561579455LL<<26), -real(18298927075LL<<27),real(119493273445LL<<26), -reale(4555,4035095LL<<29),reale(9255,49236715LL<<26), -reale(14989,8672597LL<<27),reale(19228,2329233LL<<26), -reale(19175,5958615LL<<28),reale(14321,64798871LL<<26), -reale(7491,16431175LL<<27),reale(2423,48133949LL<<26), -real(387864634927LL<<22),reale(9497573,0xf32718849f75dLL), // C4[12], coeff of eps^12, polynomial in n of order 14 real(198835LL<<25),-real(20309575LL<<24),real(82800575LL<<26), -real(3096741505LL<<24),real(9853268425LL<<25),-real(92620723195LL<<24), real(42100328725LL<<27),-reale(3631,95393589LL<<24), reale(8507,100242399LL<<25),-reale(16264,217481391LL<<24), reale(25338,57859733LL<<26),-reale(31673,155080937LL<<24), reale(30296,62498037LL<<25),-reale(18783,217084003LL<<24), reale(5237,1702548307LL<<21),reale(28492721,0xd975498dde617LL), // C4[13], coeff of eps^26, polynomial in n of order 0 real(83LL<<25),real(0xb952c68e4fbe9LL), // C4[13], coeff of eps^25, polynomial in n of order 1 -real(71903LL<<28),-real(1749945LL<<24),reale(5818,0x23b391cd899edLL), // C4[13], coeff of eps^24, polynomial in n of order 2 real(16903565LL<<32),-real(16862357LL<<31),real(47373573LL<<26), reale(789029,0x386f296be7703LL), // C4[13], coeff of eps^23, polynomial in n of order 3 real(16624462311LL<<28),real(913717761LL<<29),-real(74700691LL<<28), -real(16672249061LL<<24),reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^22, polynomial in n of order 4 -real(876500127LL<<32),-real(1654287687LL<<30),real(2350551113LL<<31), -real(1761427069LL<<30),real(3376471371LL<<25), reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^21, polynomial in n of order 5 real(32655563463LL<<28),-reale(3801,39657LL<<30),real(14063722833LL<<28), real(3085833575LL<<29),real(1328082427LL<<28),-real(31671991379LL<<24), reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^20, polynomial in n of order 6 reale(9254,348341LL<<33),real(891770565LL<<32),-real(427379969LL<<34), -real(2022490653LL<<32),real(1067054247LL<<33),-real(569056495LL<<32), real(430257975LL<<27),reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^19, polynomial in n of order 7 -reale(12155,12992869LL<<26),-real(50480950653LL<<27), reale(10690,33612001LL<<26),-reale(5460,12466223LL<<28), -real(37884419769LL<<26),real(23471963137LL<<27),real(26726056077LL<<26), -real(264030652949LL<<22),reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^18, polynomial in n of order 8 reale(55507,1702051LL<<31),-reale(25284,15301089LL<<28), -reale(4552,6848911LL<<29),reale(8014,12209149LL<<28), reale(2646,1117571LL<<30),-reale(6924,9493077LL<<28), reale(3590,1368763LL<<29),-real(9963972599LL<<28), -real(15032559759LL<<23),reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^17, polynomial in n of order 9 -reale(35540,37090525LL<<26),-reale(14632,1678969LL<<29), reale(49583,4861453LL<<26),-reale(46373,31739579LL<<27), reale(18858,13991831LL<<26),real(34153973959LL<<28), -reale(4603,63875327LL<<26),-real(5127820649LL<<27), real(116479282059LL<<26),-real(662201165171LL<<22), reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^16, polynomial in n of order 10 -reale(50761,3025121LL<<30),reale(66355,4425085LL<<29), -reale(59858,324757LL<<32),reale(26575,1103635LL<<29), reale(16255,479225LL<<30),-reale(41402,7301831LL<<29), reale(37768,714123LL<<31),-reale(19110,4265457LL<<29), reale(4727,1747987LL<<30),-real(399638603LL<<29), -real(44359884933LL<<24),reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^15, polynomial in n of order 11 -reale(6366,57157311LL<<26),reale(16360,10192555LL<<27), -reale(33060,46450725LL<<26),reale(52401,3371487LL<<29), -reale(63840,37321515LL<<26),reale(56445,29554125LL<<27), -reale(29837,31975057LL<<26),-real(31142569185LL<<28), reale(20917,29855465LL<<26),-reale(21569,9966225LL<<27), reale(11677,61095555LL<<26),-reale(2823,85634603LL<<22), reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^14, polynomial in n of order 12 -real(583637535LL<<30),real(11022475035LL<<28), -reale(2387,6604529LL<<29),reale(6865,10202825LL<<28), -reale(15869,914837LL<<31),reale(29710,9184775LL<<28), -reale(45043,8145271LL<<29),reale(54812,7153333LL<<28), -reale(52441,1442741LL<<30),reale(37945,12833459LL<<28), -reale(19389,6190909LL<<29),reale(6169,7752673LL<<28), -real(487958734263LL<<23),reale(30772139,0x98ef4f7042175LL), // C4[13], coeff of eps^13, polynomial in n of order 13 -real(23263695LL<<26),real(59053995LL<<28),-real(1639451385LL<<26), real(4222829325LL<<27),-real(33859413315LL<<26),real(13601644665LL<<29), -reale(4256,19212781LL<<26),reale(9227,30696251LL<<27), -reale(16594,3848759LL<<26),reale(24654,470841LL<<28), -reale(29745,41662305LL<<26),reale(27762,19442409LL<<27), -reale(16966,1393323LL<<26),reale(4695,1022390371LL<<22), reale(30772139,0x98ef4f7042175LL), // C4[14], coeff of eps^26, polynomial in n of order 0 -real(6781LL<<26),real(0x5fa345ccc643905LL), // C4[14], coeff of eps^25, polynomial in n of order 1 -real(5869LL<<31),real(7353LL<<27),real(0x148e6926290dbdd9LL), // C4[14], coeff of eps^24, polynomial in n of order 2 real(299903009LL<<31),real(37927009LL<<30),-real(2056312073LL<<27), reale(33051557,0x58695552a5cd3LL), // C4[14], coeff of eps^23, polynomial in n of order 3 -real(368055047LL<<31),real(374500339LL<<32),-real(256592557LL<<31), real(207940889LL<<27),reale(11017185,0xc8231c70e1ef1LL), // C4[14], coeff of eps^22, polynomial in n of order 4 -reale(3490,1015519LL<<31),real(4441335459LL<<29),real(1543166497LL<<30), real(845740769LL<<29),-real(7622621279LL<<26), reale(33051557,0x58695552a5cd3LL), // C4[14], coeff of eps^21, polynomial in n of order 5 real(1872610391LL<<32),-real(324912469LL<<34),-reale(2076,886527LL<<32), real(978081451LL<<33),-real(478972501LL<<32),real(98710857LL<<28), reale(33051557,0x58695552a5cd3LL), // C4[14], coeff of eps^20, polynomial in n of order 6 -reale(4075,185993LL<<32),reale(10359,933297LL<<31), -reale(4245,239235LL<<33),-real(1849695177LL<<31),real(616423549LL<<32), real(879958205LL<<31),-real(3876332285LL<<28), reale(33051557,0x58695552a5cd3LL), // C4[14], coeff of eps^19, polynomial in n of order 7 -reale(16507,1038671LL<<32),-reale(7426,284587LL<<33), reale(6609,461219LL<<32),reale(3685,34759LL<<34), -reale(6576,786795LL<<32),reale(3109,191175LL<<33), -real(486788729LL<<32),-real(537600147LL<<28), reale(33051557,0x58695552a5cd3LL), // C4[14], coeff of eps^18, polynomial in n of order 8 -reale(24788,2034733LL<<30),reale(49876,16016773LL<<27), -reale(40130,10305415LL<<28),reale(13469,4482399LL<<27), reale(3498,5005267LL<<29),-reale(4111,23511239LL<<27), -real(7714983213LL<<28),real(56106110739LL<<27), -real(151831927709LL<<24),reale(33051557,0x58695552a5cd3LL), // C4[14], coeff of eps^17, polynomial in n of order 9 reale(63443,3600701LL<<29),-reale(50757,496203LL<<32), reale(16003,4273171LL<<29),reale(22072,52127LL<<30), -reale(40595,5066263LL<<29),reale(33806,1004469LL<<31), -reale(16095,1666881LL<<29),reale(3680,908597LL<<30), real(584087189LL<<29),-real(20381568753LL<<25), reale(33051557,0x58695552a5cd3LL), // C4[14], coeff of eps^16, polynomial in n of order 10 reale(19689,3969453LL<<29),-reale(36282,12968943LL<<28), reale(53123,80009LL<<31),-reale(60234,3770241LL<<28), reale(49410,2521755LL<<29),-reale(22943,4183315LL<<28), -reale(5331,2542455LL<<30),reale(20742,9731931LL<<28), -reale(19939,3671159LL<<29),reale(10552,6717897LL<<28), -reale(2533,118946129LL<<25),reale(33051557,0x58695552a5cd3LL), // C4[14], coeff of eps^15, polynomial in n of order 11 real(8533174455LL<<29),-reale(3246,843591LL<<30), reale(8406,531117LL<<29),-reale(17842,647003LL<<32), reale(31156,7375267LL<<29),-reale(44630,771985LL<<30), reale(51879,2231193LL<<29),-reale(47870,1100123LL<<31), reale(33689,2160271LL<<29),-reale(16864,3290075LL<<30), reale(5288,925829LL<<29),-real(103506398177LL<<25), reale(33051557,0x58695552a5cd3LL), // C4[14], coeff of eps^14, polynomial in n of order 12 real(66723345LL<<29),-real(1495097175LL<<27),real(3274386375LL<<28), -real(23122205325LL<<27),real(8392504155LL<<30), -reale(4840,16188355LL<<27),reale(9826,9115409LL<<28), -reale(16767,17260281LL<<27),reale(23911,7831387LL<<29), -reale(27976,32288815LL<<27),reale(25559,3357275LL<<28), -reale(15423,21986149LL<<27),reale(4241,135611051LL<<24), reale(33051557,0x58695552a5cd3LL), // C4[15], coeff of eps^26, polynomial in n of order 0 real(71LL<<30),real(0x2213ecbbb96785dLL), // C4[15], coeff of eps^25, polynomial in n of order 1 real(6799LL<<34),-real(2467695LL<<27),reale(43244,0xc47e8e0e2a501LL), // C4[15], coeff of eps^24, polynomial in n of order 2 real(1754601LL<<37),-real(1107369LL<<36),real(11866753LL<<28), reale(1859525,0x141dc611b72bLL), // C4[15], coeff of eps^23, polynomial in n of order 3 real(72562737LL<<34),real(46462031LL<<35),real(31074907LL<<34), -real(3658156407LL<<27),reale(35330975,0x17e35b3509831LL), // C4[15], coeff of eps^22, polynomial in n of order 4 -real(13531387LL<<38),-reale(2167,14381LL<<36),real(55828981LL<<37), -real(25230703LL<<36),real(3197649LL<<30), reale(35330975,0x17e35b3509831LL), // C4[15], coeff of eps^21, polynomial in n of order 5 reale(9732,8631LL<<37),-reale(3185,3623LL<<39),-real(35580543LL<<37), real(7839601LL<<38),real(14184443LL<<37),-real(3642815981LL<<28), reale(35330975,0x17e35b3509831LL), // C4[15], coeff of eps^20, polynomial in n of order 6 -reale(8973,2493LL<<39),reale(5093,1677LL<<40),reale(4452,53LL<<40), -reale(6181,1625LL<<40),reale(2693,7137LL<<39),-real(1482145LL<<40), -real(287239701LL<<29),reale(35330975,0x17e35b3509831LL), // C4[15], coeff of eps^19, polynomial in n of order 7 reale(48363,42681LL<<36),-reale(34138,1171LL<<37), reale(9135,63227LL<<36),reale(4396,12847LL<<38),-reale(3596,33667LL<<36), -real(22964529LL<<37),real(105092799LL<<36),-real(8732815777LL<<28), reale(35330975,0x17e35b3509831LL), // C4[15], coeff of eps^18, polynomial in n of order 8 -reale(41806,3793LL<<39),reale(7070,18565LL<<36), reale(26107,27709LL<<37),-reale(39103,10113LL<<36), reale(30179,111LL<<38),-reale(13593,42919LL<<36),reale(2866,20031LL<<37), real(9747283LL<<36),-real(584087189LL<<30), reale(35330975,0x17e35b3509831LL), // C4[15], coeff of eps^17, polynomial in n of order 9 -reale(38751,968439LL<<32),reale(52907,129341LL<<35), -reale(56213,262777LL<<32),reale(42911,476327LL<<33), -reale(17166,1038043LL<<32),-reale(7920,60547LL<<34), reale(20320,95267LL<<32),-reale(18461,171251LL<<33), reale(9586,798401LL<<32),-reale(2289,97706315LL<<25), reale(35330975,0x17e35b3509831LL), // C4[15], coeff of eps^16, polynomial in n of order 10 -real(182681295LL<<35),reale(3304,139139LL<<34),-reale(6521,16667LL<<37), reale(10722,226797LL<<34),-reale(14618,113609LL<<35), reale(16325,9799LL<<34),-reale(14590,57403LL<<36), reale(10019,97137LL<<34),-reale(4925,40451LL<<35),real(399638603LL<<34), -real(14786628311LL<<26),reale(11776991,0xb2a11e67032bbLL), // C4[15], coeff of eps^15, polynomial in n of order 11 -real(76608285LL<<32),real(147323625LL<<33),-real(936978255LL<<32), reale(2382,112581LL<<35),-reale(5377,114593LL<<32), reale(10315,142015LL<<33),-reale(16818,394707LL<<32), reale(23142,22533LL<<34),-reale(26356,277413LL<<32), reale(23629,395541LL<<33),-reale(14101,658135LL<<32), reale(3855,122649445LL<<25),reale(35330975,0x17e35b3509831LL), // C4[16], coeff of eps^26, polynomial in n of order 0 -real(22951LL<<32),reale(14038,0xf79362a6f2da9LL), // C4[16], coeff of eps^25, polynomial in n of order 1 -real(9017LL<<35),real(4815LL<<31),reale(9206,0xf354c01a236f3LL), // C4[16], coeff of eps^24, polynomial in n of order 2 real(1146319LL<<36),real(916151LL<<35),-real(5763591LL<<32), reale(1979494,0x5c2d55f3c2615LL), // C4[16], coeff of eps^23, polynomial in n of order 3 -real(15250071LL<<35),real(5353311LL<<36),-real(2240893LL<<35), -real(332469LL<<31),reale(1979494,0x5c2d55f3c2615LL), // C4[16], coeff of eps^22, polynomial in n of order 4 -reale(2280,6539LL<<38),-real(78951693LL<<36),real(12301989LL<<37), real(28829297LL<<36),-real(214091115LL<<32), reale(37610392,0xd75d61176d38fLL), // C4[16], coeff of eps^21, polynomial in n of order 5 reale(3604,40151LL<<35),reale(4989,25591LL<<37),-reale(5766,5439LL<<35), reale(2335,38023LL<<36),-real(36776117LL<<35),-real(73810821LL<<31), reale(37610392,0xd75d61176d38fLL), // C4[16], coeff of eps^20, polynomial in n of order 6 -reale(28603,8635LL<<37),reale(5695,63155LL<<36),reale(4892,14039LL<<38), -reale(3091,58619LL<<36),-real(29081577LL<<37),real(100489431LL<<36), -real(125982325LL<<34),reale(37610392,0xd75d61176d38fLL), // C4[16], coeff of eps^19, polynomial in n of order 7 -real(44186749LL<<35),reale(28752,63675LL<<36),-reale(37202,72039LL<<35), reale(26902,18169LL<<37),-reale(11512,105649LL<<35), reale(2229,59753LL<<36),real(26382181LL<<35),-real(267675387LL<<31), reale(37610392,0xd75d61176d38fLL), // C4[16], coeff of eps^18, polynomial in n of order 8 reale(51956,3503LL<<39),-reale(52000,65291LL<<36), reale(36995,30461LL<<37),-reale(12343,54705LL<<36), -reale(9828,2065LL<<38),reale(19743,35337LL<<36), -reale(17124,20865LL<<37),reale(8752,19043LL<<36), -reale(2081,554945LL<<32),reale(37610392,0xd75d61176d38fLL), // C4[16], coeff of eps^17, polynomial in n of order 9 reale(11351,15263LL<<35),-reale(21031,10301LL<<38), reale(32809,38737LL<<35),-reale(42826,1799LL<<36), reale(46156,123299LL<<35),-reale(40102,7421LL<<37), reale(26942,16853LL<<35),-reale(13031,12333LL<<36), reale(3987,20263LL<<35),-real(1198915809LL<<31), reale(37610392,0xd75d61176d38fLL), // C4[16], coeff of eps^16, polynomial in n of order 10 real(100180065LL<<34),-real(583401555LL<<33),reale(2759,6541LL<<36), -reale(5863,45661LL<<33),reale(10706,132871LL<<34), -reale(16773,276519LL<<33),reale(22364,92173LL<<35), -reale(24871,48433LL<<33),reale(21929,91821LL<<34), -reale(12958,132347LL<<33),reale(3525,1706711LL<<30), reale(37610392,0xd75d61176d38fLL), // C4[17], coeff of eps^26, polynomial in n of order 0 real(1LL<<32),real(0x62a61c3e4dd975LL), // C4[17], coeff of eps^25, polynomial in n of order 1 real(4057LL<<35),-real(45015LL<<31),reale(8569,0x3d59f665e75a3LL), // C4[17], coeff of eps^24, polynomial in n of order 2 real(43463LL<<40),-real(16895LL<<39),-real(11395LL<<34), reale(299923,0x634cafeea1549LL), // C4[17], coeff of eps^23, polynomial in n of order 3 -real(1242717LL<<35),real(138325LL<<36),real(435713LL<<35), -real(3030063LL<<31),reale(299923,0x634cafeea1549LL), // C4[17], coeff of eps^22, polynomial in n of order 4 real(2302621LL<<39),-real(9225219LL<<37),real(1747781LL<<38), -real(372113LL<<37),-real(1948863LL<<32), reale(2099463,0xb718cf86694ffLL), // C4[17], coeff of eps^21, polynomial in n of order 5 reale(2996,69763LL<<35),reale(5105,30307LL<<37),-reale(2616,23051LL<<35), -real(67503821LL<<36),real(191814791LL<<35),-real(933454921LL<<31), reale(39889810,0x96d766f9d0eedLL), // C4[17], coeff of eps^20, polynomial in n of order 6 reale(30327,1293LL<<39),-reale(35084,3299LL<<38),reale(23968,2311LL<<40), -reale(9776,7093LL<<38),real(14159215LL<<39),real(3853577LL<<38), -real(61360803LL<<33),reale(39889810,0x96d766f9d0eedLL), // C4[17], coeff of eps^19, polynomial in n of order 7 -reale(47757,47889LL<<35),reale(31664,61447LL<<36), -reale(8326,73443LL<<35),-reale(11212,17667LL<<37), reale(19076,23915LL<<35),-reale(15916,62675LL<<36), reale(8026,42649LL<<35),-real(3989637911LL<<31), reale(39889810,0x96d766f9d0eedLL), // C4[17], coeff of eps^18, polynomial in n of order 8 -reale(22252,923LL<<40),reale(33139,2449LL<<37),-reale(41618,6905LL<<38), reale(43458,30291LL<<37),-reale(36814,1531LL<<39), reale(24253,3845LL<<37),-reale(11561,2707LL<<38),reale(3500,30023LL<<37), -real(522604327LL<<32),reale(39889810,0x96d766f9d0eedLL), // C4[17], coeff of eps^17, polynomial in n of order 9 -real(175857885LL<<35),reale(3123,8343LL<<38),-reale(6297,123891LL<<35), reale(11012,26677LL<<36),-reale(16654,74217LL<<35), reale(21593,16599LL<<37),-reale(23509,7807LL<<35),reale(20422,743LL<<36), -reale(11961,60789LL<<35),reale(3239,1180923LL<<31), reale(39889810,0x96d766f9d0eedLL), // C4[18], coeff of eps^26, polynomial in n of order 0 -real(56087LL<<33),reale(47221,0xfaefc0318df67LL), // C4[18], coeff of eps^25, polynomial in n of order 1 -real(19981LL<<39),-real(10755LL<<35),reale(443886,0x9d340e9e9cd95LL), // C4[18], coeff of eps^24, polynomial in n of order 2 real(84155LL<<39),real(380011LL<<38),-real(1249051LL<<35), reale(2219433,0x12044919103e9LL), // C4[18], coeff of eps^23, polynomial in n of order 3 -real(2130987LL<<39),real(379583LL<<40),-real(70649LL<<39), -real(240567LL<<35),reale(2219433,0x12044919103e9LL), // C4[18], coeff of eps^22, polynomial in n of order 4 real(4417441LL<<38),-real(7513869LL<<36),-real(1960735LL<<37), real(4812241LL<<36),-real(11409363LL<<33), reale(2219433,0x12044919103e9LL), // C4[18], coeff of eps^21, polynomial in n of order 5 -real(28350547LL<<38),real(4603793LL<<40),-real(7176677LL<<38), real(573937LL<<39),real(220745LL<<38),-real(1482145LL<<34), reale(2219433,0x12044919103e9LL), // C4[18], coeff of eps^20, polynomial in n of order 6 reale(26896,5159LL<<38),-reale(4987,8879LL<<37),-reale(12193,6323LL<<39), reale(18360,26775LL<<37),-reale(14825,8691LL<<38), reale(7390,26973LL<<37),-real(457982805LL<<34), reale(42169228,0x56516cdc34a4bLL), // C4[18], coeff of eps^19, polynomial in n of order 7 reale(11070,12259LL<<38),-reale(13431,6105LL<<39), reale(13633,4633LL<<38),-reale(11288,2771LL<<40),reale(7306,11663LL<<38), -reale(3437,4851LL<<39),real(16896453LL<<38),-real(38239341LL<<34), reale(14056409,0x721b244966e19LL), // C4[18], coeff of eps^18, polynomial in n of order 8 reale(3471,5433LL<<39),-reale(6682,62369LL<<36),reale(11244,10859LL<<37), -reale(16478,49907LL<<36),reale(20837,10809LL<<38), -reale(22258,26821LL<<36),reale(19078,20857LL<<37), -reale(11086,15383LL<<36),reale(2990,191861LL<<33), reale(42169228,0x56516cdc34a4bLL), // C4[19], coeff of eps^26, polynomial in n of order 0 -real(113LL<<37),reale(16591,0x81ae2ec54d8dfLL), // C4[19], coeff of eps^25, polynomial in n of order 1 real(94099LL<<40),-real(1178305LL<<35),reale(2339402,0x6cefc2abb72d3LL), // C4[19], coeff of eps^24, polynomial in n of order 2 real(41263LL<<43),-real(6583LL<<42),-real(117501LL<<36), reale(2339402,0x6cefc2abb72d3LL), // C4[19], coeff of eps^23, polynomial in n of order 3 -real(384159LL<<40),-real(130977LL<<41),real(286571LL<<40), -real(2657049LL<<35),reale(2339402,0x6cefc2abb72d3LL), // C4[19], coeff of eps^22, polynomial in n of order 4 real(64121LL<<46),-real(23919LL<<46),real(6837LL<<45),real(901LL<<46), -real(170289LL<<37),reale(2339402,0x6cefc2abb72d3LL), // C4[19], coeff of eps^21, polynomial in n of order 5 -real(955747LL<<39),-real(1386619LL<<41),real(7599723LL<<39), -real(2983211LL<<40),real(2945369LL<<39),-real(22232175LL<<34), reale(2339402,0x6cefc2abb72d3LL), // C4[19], coeff of eps^20, polynomial in n of order 6 -real(2096679LL<<42),real(4148625LL<<41),-real(841269LL<<43), real(2143479LL<<41),-real(498253LL<<42),real(296429LL<<41), -real(2667861LL<<35),reale(2339402,0x6cefc2abb72d3LL), // C4[19], coeff of eps^19, polynomial in n of order 7 -real(3026933LL<<39),real(2460315LL<<40),-real(7010575LL<<39), real(2166905LL<<41),-real(9101001LL<<39),real(3853577LL<<40), -real(4446435LL<<39),real(38239341LL<<34), reale(2339402,0x6cefc2abb72d3LL), // C4[20], coeff of eps^26, polynomial in n of order 0 -real(34781LL<<40),reale(2459371,0xc7db3c3e5e1bdLL), // C4[20], coeff of eps^25, polynomial in n of order 1 -real(4771LL<<42),-real(28479LL<<38),reale(2459371,0xc7db3c3e5e1bdLL), // C4[20], coeff of eps^24, polynomial in n of order 2 -real(68467LL<<42),real(136501LL<<41),-real(310209LL<<38), reale(2459371,0xc7db3c3e5e1bdLL), // C4[20], coeff of eps^23, polynomial in n of order 3 -real(327189LL<<42),real(20533LL<<43),real(14681LL<<42), -real(78387LL<<38),reale(2459371,0xc7db3c3e5e1bdLL), // C4[20], coeff of eps^22, polynomial in n of order 4 -real(179129LL<<44),real(910389LL<<42),-real(348793LL<<43), real(341479LL<<42),-real(321657LL<<40),reale(2459371,0xc7db3c3e5e1bdLL), // C4[20], coeff of eps^21, polynomial in n of order 5 real(1952379LL<<42),-real(388557LL<<44),real(975677LL<<42), -real(224349LL<<43),real(132447LL<<42),-real(296429LL<<38), reale(2459371,0xc7db3c3e5e1bdLL), // C4[20], coeff of eps^20, polynomial in n of order 6 real(1242423LL<<41),-real(3451175LL<<40),real(1045213LL<<42), -real(4322097LL<<40),real(1810109LL<<41),-real(2075003LL<<40), real(4446435LL<<37),reale(2459371,0xc7db3c3e5e1bdLL), // C4[21], coeff of eps^26, polynomial in n of order 0 -real(199LL<<39),reale(37381,0xc16e795c129fbLL), // C4[21], coeff of eps^25, polynomial in n of order 1 real(65027LL<<42),-real(290455LL<<38),reale(2579341,0x22c6b5d1050a7LL), // C4[21], coeff of eps^24, polynomial in n of order 2 real(1883LL<<46),real(1837LL<<45),-real(18073LL<<40), reale(2579341,0x22c6b5d1050a7LL), // C4[21], coeff of eps^23, polynomial in n of order 3 real(871509LL<<42),-real(326909LL<<43),real(317735LL<<42), -real(1195627LL<<38),reale(2579341,0x22c6b5d1050a7LL), // C4[21], coeff of eps^22, polynomial in n of order 4 -real(29971LL<<46),real(74261LL<<44),-real(16907LL<<45),real(9911LL<<44), -real(44149LL<<39),reale(859780,0x60ece745ac58dLL), // C4[21], coeff of eps^21, polynomial in n of order 5 -real(848003LL<<42),real(252109LL<<44),-real(1027829LL<<42), real(426173LL<<43),-real(485639LL<<42),real(2075003LL<<38), reale(2579341,0x22c6b5d1050a7LL), // C4[22], coeff of eps^26, polynomial in n of order 0 -real(2963LL<<40),reale(117361,0x5360ca6881e97LL), // C4[22], coeff of eps^25, polynomial in n of order 1 real(79LL<<45),-real(363LL<<41),reale(117361,0x5360ca6881e97LL), // C4[22], coeff of eps^24, polynomial in n of order 2 -real(76751LL<<45),real(74129LL<<44),-real(139337LL<<41), reale(2699310,0x7db22f63abf91LL), // C4[22], coeff of eps^23, polynomial in n of order 3 real(102051LL<<45),-real(23023LL<<46),real(13409LL<<45), -real(29733LL<<41),reale(2699310,0x7db22f63abf91LL), // C4[22], coeff of eps^22, polynomial in n of order 4 real(121647LL<<45),-real(489555LL<<43),real(201135LL<<44), -real(227953LL<<43),real(485639LL<<40),reale(2699310,0x7db22f63abf91LL), // C4[23], coeff of eps^26, polynomial in n of order 0 -real(1LL<<45),reale(5837,0x4b04b152e489LL), // C4[23], coeff of eps^25, polynomial in n of order 1 real(377LL<<47),-real(5665LL<<41),reale(122577,0x627628bccbf3dLL), // C4[23], coeff of eps^24, polynomial in n of order 2 -real(57LL<<50),real(33LL<<49),-real(583LL<<42), reale(122577,0x627628bccbf3dLL), // C4[23], coeff of eps^23, polynomial in n of order 3 -real(1269LL<<47),real(517LL<<48),-real(583LL<<47),real(9911LL<<41), reale(122577,0x627628bccbf3dLL), // C4[24], coeff of eps^26, polynomial in n of order 0 -real(83LL<<47),reale(127793,0x718b871115fe3LL), // C4[24], coeff of eps^25, polynomial in n of order 1 real(5LL<<50),-real(11LL<<46),reale(42597,0xd083d7b05caa1LL), // C4[24], coeff of eps^24, polynomial in n of order 2 real(245LL<<49),-real(275LL<<48),real(583LL<<45), reale(127793,0x718b871115fe3LL), // C4[25], coeff of eps^26, polynomial in n of order 0 -real(1LL<<47),reale(8867,0x4cd786c27dde7LL), // C4[25], coeff of eps^25, polynomial in n of order 1 -real(13LL<<50),real(55LL<<46),reale(26601,0xe6869447799b5LL), // C4[26], coeff of eps^26, polynomial in n of order 0 real(1LL<<48),reale(2126,0x8c0e9e949456fLL), }; // count = 4032 #elif GEOGRAPHICLIB_GEODESICEXACT_ORDER == 30 static const real coeff[] = { // C4[0], coeff of eps^29, polynomial in n of order 0 3361,real(109067695), // C4[0], coeff of eps^28, polynomial in n of order 1 real(121722048),real(30168404),real(0x269c465a0c9LL), // C4[0], coeff of eps^27, polynomial in n of order 2 real(21708121824LL),-real(10786479696LL),real(8048130587LL), real(0xbfa33c13e963LL), // C4[0], coeff of eps^26, polynomial in n of order 3 real(0x738319564e0LL),-real(0x4c2475635c0LL),real(0x25d0be52da0LL), real(643173496654LL),real(0xa0f21774b90225LL), // C4[0], coeff of eps^25, polynomial in n of order 4 real(0x7a99ea0a52f40LL),-real(0x5a5f53e2c3b50LL),real(0x3b83d2c0c8da0LL), -real(0x1d8a81cb5cc70LL),real(0x1605bd50459c1LL), real(0x6fb2ae4757107d03LL), // C4[0], coeff of eps^24, polynomial in n of order 5 real(0x2507d929b7f89580LL),-real(0x1ce7bf02c3715a00LL), real(0x15463c23456c8680LL),-real(0xdfecff0050dfd00LL), real(0x6f141ba97196780LL),real(0x1b71ab9c78b8b48LL), reale(1520879,0x957266bcf90f9LL), // C4[0], coeff of eps^23, polynomial in n of order 6 reale(5214,0xb54b8c26f5620LL),-reale(4202,0x4ae5f5bcbf950LL), reale(3272,0xab988a50dfac0LL),-reale(2404,0x84ae60c9e7b30LL), real(0x62be65b26227b760LL),-real(0x30f2645200be8b10LL), real(0x2472ebc3f09ad327LL),reale(9429453,0x6b5ee3606e93bLL), // C4[0], coeff of eps^22, polynomial in n of order 7 reale(213221,0x21fe88963f0e0LL),-reale(174746,0x12fe03af82e40LL), reale(140344,0xd3dfad978d4a0LL),-reale(109009,0x13ee03d15f180LL), reale(79932,0x9fff01479b460LL),-reale(52447,0x53ea945b584c0LL), reale(25976,0xa5a6ee990f820LL),reale(6403,0x87dc4a069efc6LL), reale(273454149,0x29bfc1ec86bafLL), // C4[0], coeff of eps^21, polynomial in n of order 8 reale(1513769,0x9572babb99080LL),-reale(1247902,0x66609b16e1250LL), reale(1017692,0x228016ac84e60LL),-reale(814136,0x86ec313455df0LL), reale(630421,0xa88f591713840LL),-reale(461205,0x487f023b60f90LL), reale(302134,0x36942691aea20LL),-reale(149503,0x5a1d9af94cb30LL), reale(111169,0xb14ab93d4ba6dLL),reale(1367270745,0xd0bec99ea1a6bLL), // C4[0], coeff of eps^20, polynomial in n of order 9 reale(2196138,0xe1b60fe1808c0LL),-reale(1802572,0x3b4b1c2a34200LL), reale(1475191,0x47b8ccbe8340LL),-reale(1196055,0x2e2a401c46980LL), reale(952413,0x117e9e1fb75c0LL),-reale(734856,0x2e19f1e7be100LL), reale(536171,0x8daa599335040LL),-reale(350594,0xa58d466a3880LL), reale(173293,0x7b19cdc9682c0LL),reale(42591,0xb005bdeb82d74LL), reale(1367270745,0xd0bec99ea1a6bLL), // C4[0], coeff of eps^19, polynomial in n of order 10 reale(9954363,0x5ecc5371ca720LL),-reale(8035921,0x7cc90565e0670LL), reale(6522783,0x32e1ec30d1a80LL),-reale(5291286,0x4172ef2beb090LL), reale(4260231,0x65c388ed45de0LL),-reale(3373847,0x4da61e8c704b0LL), reale(2592185,0xcd194d02dbd40LL),-reale(1885401,0xa08c9a20ef6d0LL), reale(1230164,0x4c527bc6a84a0LL),-reale(607279,0x24d6e51bd7af0LL), reale(450701,0xae98337b7d081LL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^18, polynomial in n of order 11 reale(16160603,0x85a3ec5761ce0LL),-reale(12587219,0x97b7f7c505ac0LL), reale(9979192,0xa0e43863a93a0LL),-reale(7988280,0xcfaf566027f00LL), reale(6410314,0xbffc30c12660LL),-reale(5117692,0xfd9318db4c340LL), reale(4026292,0x94c482b815d20LL),-reale(3077917,0x9c480ad851f80LL), reale(2230377,0x99db799d8bfe0LL),-reale(1451530,0xb0005d9658bc0LL), reale(715485,0xdbe6a2ef6d6a0LL),reale(175141,0x3547b8669b9beLL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^17, polynomial in n of order 12 reale(30091817,0x8745c27487540LL),-reale(21716256,0x7a4bb1495e170LL), reale(16366670,0xd4e8bc19a0660LL),-reale(12670374,0x9eda0f5df2ed0LL), reale(9963727,0x5ae4f6d3c8380LL),-reale(7887824,0x191034733ae30LL), reale(6231873,0x96448488ef0a0LL),-reale(4863678,0x67c3c74b1b90LL), reale(3695513,0x2e7ae0f4851c0LL),-reale(2665992,0xe6864878c32f0LL), reale(1729741,0xf881cba41aae0LL),-reale(851104,0x888fd5b7ab050LL), reale(629987,0x9ea5a19626943LL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^16, polynomial in n of order 13 reale(79181861,0x46beef62ca900LL),-reale(45969492,0x85a19d8425400LL), reale(30736937,0x10d9a95bb4f00LL),-reale(22084618,0xaf3a6659fa600LL), reale(16548053,0x58583f22e9500LL),-reale(12711232,0x3d7f1b1be3800LL), reale(9889259,0xbbf5d84b2bb00LL),-reale(7711253,0x36b17889dca00LL), reale(5958759,0x73d1ebe040100LL),-reale(4493987,0xfa374abbe1c00LL), reale(3224517,0x29027e04ea700LL),-reale(2084431,0x8d77e42beee00LL), reale(1023433,0xbf113370eed00LL),reale(249103,0x93cdbdabe0fb0LL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^15, polynomial in n of order 14 reale(100415733,0x1c7e0d98777e0LL),-reale(220472579,0x196c2a7ff77f0LL), reale(81497972,0xcf48e14d7b2c0LL),-reale(47157604,0xb4c79beff0c90LL), reale(31400333,0x3ade51fc905a0LL),-reale(22437640,0x62c8445afeb30LL), reale(16688020,0xb49b2cc64ec80LL),-reale(12687475,0x35a524f08d7d0LL), reale(9727302,0xc96eb1166e360LL),-reale(7422875,0x3574dc9ff9670LL), reale(5546536,0x3897621326640LL),-reale(3953280,0x7a61d237aeb10LL), reale(2544043,0x942757fc8f120LL),-reale(1245848,0x5f59e2e2499b0LL), reale(918672,0xb7e149f3f515dLL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^14, polynomial in n of order 15 -reale(410150575,0x33edeefdadd60LL),reale(389451478,0x4a8eb37cf8e40LL), reale(102537774,0xdf54e754057e0LL),-reale(228145792,0x9928ef6984980LL), reale(84014235,0x8c476a1354120LL),-reale(48417903,0x9486b64af140LL), reale(32072368,0xac5157de0d660LL),-reale(22757026,0x6fd3c1d71f100LL), reale(16760216,0x75de552320fa0LL),-reale(12564203,0xce657c7ead0c0LL), reale(9433140,0xee7b325fde4e0LL),-reale(6966096,0xc0a9d97231880LL), reale(4923714,0x7fe1a8c934e20LL),-reale(3150864,0xcacdc5bf45040LL), reale(1538058,0xc6e75548f4360LL),reale(371250,0x9b28ca926da22LL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^13, polynomial in n of order 16 reale(10071346,0xbead2787bab00LL),reale(77935892,0xc8037e807a610LL), -reale(424974584,0x95c58aa2abc60LL),reale(405632040,0xf37804095de30LL), reale(104709205,0x2c34dddf07040LL),-reale(236671973,0xc06ad427a5bb0LL), reale(86756233,0x36f6256b264e0LL),-reale(49748360,0xa42ca4c379390LL), reale(32735340,0x1aa6eba145580LL),-reale(23012513,0x41e6e60af5570LL), reale(16722020,0xa0e65eb557620LL),-reale(12285046,0x712c138942d50LL), reale(8933912,0x44131ea6cfac0LL),-reale(6247309,0xac4879043a730LL), reale(3969671,0x8774cc7c1760LL),-reale(1929932,0x2a739696c4f10LL), reale(1414943,0x9f9bcb791811fLL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^12, polynomial in n of order 17 reale(1301009,0x7885767b34dc0LL),reale(3139452,0x6299dbe8eac00LL), reale(10399899,0xe9c2f692aa40LL),reale(80694987,0xafcfc919b1e80LL), -reale(441529449,0x34f14f083e140LL),reale(423985433,0x2e9be95704100LL), reale(106892519,0x9a909730adb40LL),-reale(246219322,0x3cc21ecefbc80LL), reale(89751674,0x8e9ea1f760fc0LL),-reale(51139306,0x4d1fa35b2aa00LL), reale(33357165,0x391836578ec40LL),-reale(23152852,0x670df382e5780LL), reale(16502135,0xfb453b1baa0c0LL),-reale(11755175,0x732a395d89500LL), reale(8105218,0xa64658fb65d40LL),-reale(5103238,0xc9c658d3f3280LL), reale(2468214,0x7d6aacb2351c0LL),reale(588064,0xecbdce72e5104LL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^11, polynomial in n of order 18 reale(365173,0x141eb92882aa0LL),reale(660579,0x721db1cc80890LL), reale(1339643,0x6f3cff39e7d00LL),reale(3240370,0xc29100e665970LL), reale(10762711,0xac38fa6376f60LL),reale(83769430,0x6edf90fa38050LL), -reale(460180081,0xa7a2c15d05240LL),reale(445039582,0xb96af8d66e930LL), reale(109020126,0x840edc5d1e420LL),-reale(257005247,0x2ec795996fff0LL), reale(93028106,0x54adfb574be80LL),-reale(52565819,0x1d828e2b6cf10LL), reale(33879206,0x109475f98e8e0LL),-reale(23088279,0x158dbde3c1830LL), reale(15975944,0x7a6ca24c70f40LL),-reale(10806612,0x3c0d699b76f50LL), reale(6721635,0xd5a36326ddda0LL),-reale(3228909,0xe44dc20d06870LL), reale(2345355,0x81bdf10588059LL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^10, polynomial in n of order 19 reale(142358,0x43f28ef2bce60LL),reale(224104,0xc49bf70fb8540LL), reale(374789,0x29edb81ed2220LL),reale(679606,0x56dce126b3a00LL), reale(1381751,0x3315a15e701e0LL),reale(3351469,0xe4cb186e3aec0LL), reale(11166107,0x295c18ed1d5a0LL),reale(87224183,0xbf27e3cc5cb80LL), -reale(481408924,0xf800e4fbbfaa0LL),reale(469519077,0x9e18ca33e7840LL), reale(110970854,0x606788cedf920LL),-reale(269315695,0x90dadb20d6300LL), reale(96606791,0x8c213171618e0LL),-reale(53972000,0xd509f5454de40LL), reale(34191407,0x9021dc5d4cca0LL),-reale(22654105,0x9f8b9187f1180LL), reale(14912791,0x946e9b2907c60LL),-reale(9121084,0x6067cd3f714c0LL), reale(4341360,0x73b562399020LL),reale(1011849,0x75de66a5bdb46LL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^9, polynomial in n of order 20 reale(66631,0x784cbdfb1b2c0LL),reale(96606,0x3419bb8e05f90LL), reale(145459,0xb79bffbfb42e0LL),reale(229589,0x824d22506cd30LL), reale(385010,0x35e34fd0f4f00LL),reale(700134,0x4df5413db48d0LL), reale(1427794,0x581b23c083b20LL),reale(3474469,0x224df4c0f7670LL), reale(11618119,0x6c8cba4306b40LL),reale(91144571,0x713d14f45fa10LL), -reale(505869523,0xd3d937aa3bca0LL),reale(498449385,0x686859af477b0LL), reale(112524504,0x2ca5b0e042780LL),-reale(283533725,0xba4eec11a6cb0LL), reale(100487121,0xc424152de7ba0LL),-reale(55236514,0x8c4dd4ee50f10LL), reale(34077723,0x322bbe9b9a3c0LL),-reale(21528502,0x2ca44d130cb70LL), reale(12851809,0x7f1d30d5603e0LL),-reale(6038295,0xecbfc0da7fdd0LL), reale(4313665,0xa0fbedf62e95bLL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^8, polynomial in n of order 21 reale(34939,0x4781a8598a880LL),reale(47986,0x870a153a0ba00LL), reale(67643,0xf93c5a3d5fb80LL),reale(98366,0xdef5527b5d100LL), reale(148567,0x565e4f7b51e80LL),reale(235242,0x766e64b79c800LL), reale(395796,0x5614c84bc3180LL),reale(722239,0xc9f1a6fcbf00LL), reale(1478257,0xd3352c2795480LL),reale(3611438,0xfdbc40cced600LL), reale(12129091,0x5ec9e3d72a780LL),reale(95645231,0xe79e249b02d00LL), -reale(534473300,0x6333290e9b580LL),reale(533336700,0xd7635e240e400LL), reale(113268651,0x31e09daaa5d80LL),-reale(300181610,0x6cd38634ee500LL), reale(104606327,0x6a6e0bd3d0080LL),-reale(56090968,0xcfc000b8f0e00LL), reale(33084425,0x428f85e945380LL),-reale(19025074,0x3fea5ea1f7700LL), reale(8768855,0x59c11511e7680LL),reale(1959911,0x57aea52b92dd8LL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^7, polynomial in n of order 22 reale(19712,0xac93bc6991f60LL),reale(26064,0x47e63bb6f7b10LL), reale(35129,0x85349dd791940LL),reale(48412,0xcf2b50a5e4170LL), reale(68486,0xf23457a2e7b20LL),reale(99959,0x1aee9379bdd0LL), reale(151547,0xc976e86422100LL),reale(240911,0x67a8290f88c30LL), reale(407002,0x79f859786e6e0LL),reale(745880,0xf6e3b80f24890LL), reale(1533569,0xcfffb4a9fa8c0LL),reale(3764807,0xab1a08cbd8ef0LL), reale(12712489,0x4098eb8542a0LL),reale(100884327,0x9a754746dfb50LL), -reale(568536969,0xbcc82f5b36f80LL),reale(576497219,0x10ca042b229b0LL), reale(112392819,0xaecaa4a6c6e60LL),-reale(319979712,0xfe05e4aae49f0LL), reale(108728942,0x9b1cd9ac3b840LL),-reale(55904982,0xfebe8a174c390LL), reale(30158727,0xd0df7149f4a20LL),-reale(13482566,0x2ca2af46da730LL), reale(9304222,0x6328f1d67a7f5LL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^6, polynomial in n of order 23 reale(11639,0x4298ebe4bc020LL),reale(14966,0xe9089607c0a40LL), reale(19534,0x1996a62965260LL),reale(25928,0xdcaffa7bfcb80LL), reale(35089,0x59fa64f7d88a0LL),reale(48563,0x32ed377221cc0LL), reale(69004,0xe5c9403173ae0LL),reale(101181,0xf483b00105600LL), reale(154143,0xf39432e434120LL),reale(246274,0xfc90899a3cf40LL), reale(418255,0xdad9486cf7360LL),reale(770731,0xbf0321b55e080LL), reale(1593877,0xd61fe95ba9a0LL),reale(3937200,0x3820413b3e1c0LL), reale(13385919,0xf48ca237dbbe0LL),reale(107086956,0x9d1b10f932b00LL), -reale(610048075,0x6c1b2715a7de0LL),reale(631706048,0xcac1d46451440LL), reale(108187733,0xaf9fd1440d460LL),-reale(343908890,0x37b3c0b50a80LL), reale(112109635,0x3a73d439f8aa0LL),-reale(53028119,0x15d1799f5d940LL), reale(22454404,0x49a70d2177ce0LL),reale(4553016,0x22f700960daaaLL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^5, polynomial in n of order 24 reale(7030,0x634f92bbfec80LL),reale(8852,0x183ea9c784b10LL), reale(11280,0x864427e0ea420LL),reale(14569,0x4ed71f4155e30LL), reale(19103,0x13b2c1ad2ffc0LL),reale(25480,0x35983eb20bf50LL), reale(34659,0x18ad59c5f9360LL),reale(48227,0x95f2c0574270LL), reale(68917,0x8c5b3ac32f300LL),reale(101660,0x272f49f96bb90LL), reale(155850,0xbc628b339b2a0LL),reale(250657,0x122490d07feb0LL), reale(428675,0x21f5a97506640LL),reale(795748,0x8d9dd2ee8dfd0LL), reale(1658420,0x22b44d2c5a1e0LL),reale(4130702,0x814b60cb632f0LL), reale(14171990,0xb8691b29bf980LL),reale(114585240,0x7599d8275cc10LL), -reale(662180135,0x55c1167b3fee0LL),reale(705602404,0xf6219ee07f30LL), reale(96655880,0xe42cfbbc64cc0LL),-reale(373149978,0xd8d5a94d3dfb0LL), reale(112272021,0x704341a757060LL),-reale(42251989,0xbf5a94cca7c90LL), reale(26498553,0xea37274059c77LL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^4, polynomial in n of order 25 reale(4244,0x3972351df5940LL),reale(5257,0xaa8f87b5d5600LL), reale(6578,0xed6cb3b3fa2c0LL),reale(8324,0xb4008d853180LL), reale(10662,0x703b07259b440LL),reale(13846,0x8f2f6ca125d00LL), reale(18261,0x3a455b4269dc0LL),reale(24508,0x5045fb81ae880LL), reale(33557,0x1b3e945f36f40LL),reale(47022,0x9499ec44e400LL), reale(67699,0x7a940285938c0LL),reale(100662,0x403646e1e5f80LL), reale(155637,0xf20897fb50a40LL),reale(252593,0x7106d86756b00LL), reale(436178,0xe720d891ff3c0LL),reale(818051,0x1d79595b01680LL), reale(1723706,0xc365c92e70540LL),reale(4344105,0xb055b91247200LL), reale(15096896,0xe96c54f834ec0LL),reale(123888911,0x435c586708d80LL), -reale(730395130,0x8d07d85ee1fc0LL),reale(811137162,0xd7ccf03d27900LL), reale(66848989,0xdd39a234bc9c0LL),-reale(407950245,0xd67367b7fbb80LL), reale(99073631,0x21cb91dfe1b40LL),reale(14205410,0x589c3f44ce7acLL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^3, polynomial in n of order 26 reale(2481,0x8d2c27b46b620LL),reale(3034,0xe44720f3fdf90LL), reale(3743,0xf82fc54a92780LL),reale(4662,0xb922ac44f6b70LL), reale(5867,0xae02c805f08e0LL),reale(7469,0x40a687e9b4d50LL), reale(9629,0xbb2099bca6640LL),reale(12592,0xa0727e14e5130LL), reale(16731,0xdc4cfea134ba0LL),reale(22636,0xbf84f9dc44310LL), reale(31263,0xfe99294d5c500LL),reale(44220,0x78f2e666feef0LL), reale(64313,0xe77c1f84fde60LL),reale(96684,0x43c9282e120d0LL), reale(151281,0x84eb0984fa3c0LL),reale(248729,0xa2c4a502aa4b0LL), reale(435615,0xd80deb212120LL),reale(829647,0x194fc60e84690LL), reale(1777619,0x17dfea7bc6280LL),reale(4562307,0x417bb8824d270LL), reale(16175470,0xd3a7db47373e0LL),reale(135804489,0xbb999e2601450LL), -reale(825156505,0xa8162cc9f9ec0LL),reale(977623624,0xd8c5ee7f4d830LL), -reale(20397512,0x4ab8f862cc960LL),-reale(435632583,0xf2b7943e115f0LL), reale(143237887,0xa8277df5ccab1LL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^2, polynomial in n of order 27 real(0x52cac993243497e0LL),real(0x6437dfaee57b9d40LL), real(0x7a3f9cad4d2f48a0LL),reale(2405,0xee01eec3f2b00LL), reale(2986,0x65a22988df560LL),reale(3743,0xe8ba104bd58c0LL), reale(4745,0x82561551e620LL),reale(6086,0xa7581d3ddee80LL), reale(7912,0x8561dfdd262e0LL),reale(10440,0x7aa2aab74b440LL), reale(14008,0x9b1a2c148b3a0LL),reale(19155,0xcd3b8407d7200LL), reale(26767,0x9792b4f9c2060LL),reale(38350,0xb50c17257efc0LL), reale(56574,0xaf828f4edf120LL),reale(86399,0xb1bc40483f580LL), reale(137581,0x7d29442656de0LL),reale(230687,0xc9059cc5d4b40LL), reale(413025,0xcba5d91bbdea0LL),reale(806439,0xbad85d457b900LL), reale(1777226,0xdb254a1088b60LL),reale(4709200,0x187f6563b06c0LL), reale(17312174,0x4c53d944cbc20LL),reale(151524377,0x682a2ddefc80LL), -reale(970338799,0x73aba5c04720LL),reale(1287957204,0xb756685e76240LL), -reale(416692036,0xd1e73fe253660LL),-reale(78129756,0xe75b5bfa6fa32LL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[0], coeff of eps^1, polynomial in n of order 28 real(0xb4c355cd41c92c0LL),real(0xd8fea3a41cc7830LL), real(0x1064f0c6b9a6ad20LL),real(0x13f7a88902ef1b10LL), real(0x1884a414973fcb80LL),real(0x1e5fa2ae5243d7f0LL), real(0x25fe0bb384ddd9e0LL),real(0x3006f6e3e0e25ad0LL), real(0x3d6c2c13c34ec440LL),real(0x4f91f34825bd4fb0LL), real(0x688ffb74f98676a0LL),reale(2233,0xdec33bb086290LL), reale(3036,0xe53843c2cdd00LL),reale(4213,0xb13e1137e3f70LL), reale(5984,0xaa1cca8abe360LL),reale(8732,0xb9880d6c69250LL), reale(13152,0x1eadcfcfd75c0LL),reale(20566,0x4e1752c3c0730LL), reale(33653,0xf4262a5798020LL),reale(58247,0x3a420e3524a10LL), reale(108257,0x7934f39e3ee80LL),reale(221025,0xaccc1c0dc06f0LL), reale(514222,0xffbb852faace0LL),reale(1456965,0x29e8a4070e9d0LL), reale(5827860,0xa7a2901c3a740LL),reale(56821641,0x6270fd1339eb0LL), -reale(416692036,0xd1e73fe253660LL),reale(625038055,0x3adadfd37d190LL), -reale(273454149,0x29bfc1ec86bafLL),reale(1367270745,0xd0bec99ea1a6bLL), // C4[0], coeff of eps^0, polynomial in n of order 29 reale(42171,0xbca3d5a569b4LL),reale(46862,0xd0a41cdef9cf0LL), reale(52277,0xa2d5316ac1b2cLL),reale(58560,0x6f94d669a7a28LL), reale(65892,0x788629d238da4LL),reale(74502,0x6b99bdf690d60LL), reale(84681,0x87b277eadbb1cLL),reale(96804,0x8c76c6701c898LL), reale(111359,0x1427f62cd3d94LL),reale(128987,0x59921e2221dd0LL), reale(150546,0xaa0136eb20f0cLL),reale(177198,0x7742592373f08LL), reale(210542,0x4360b9bd64984LL),reale(252821,0x8a8c09196de40LL), reale(307248,0x66986780ae6fcLL),reale(378530,0x79d0ac77ed78LL), reale(473750,0x5114d83948174LL),reale(603901,0x80acdb5cb5eb0LL), reale(786661,0x2afc1dbf812ecLL),reale(1051686,0xda8ab314e3e8LL), reale(1451326,0xc0ede2017b564LL),reale(2083956,0x5d3b51a63af20LL), reale(3149615,0xde5c8fc3f62dcLL),reale(5099378,0x12ae3e18b3258LL), reale(9106032,0x45ee012c1b554LL),reale(18940547,0x20d0545bbdf90LL), reale(52086504,0x9a3ce7fc4a6ccLL),reale(312519027,0x9d6d6fe9be8c8LL), -reale(1093816596,0xa6ff07b21aebcLL), reale(2734541491LL,0xa17d933d434d6LL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[1], coeff of eps^29, polynomial in n of order 0 917561,real(273868982145LL), // C4[1], coeff of eps^28, polynomial in n of order 1 -real(125915776),real(90505212),real(0x73d4d30e25bLL), // C4[1], coeff of eps^27, polynomial in n of order 2 -real(0x2f7e4f2fca0LL),real(0x161b06db8f0LL),real(379339642199LL), real(0x145a25f15d59339LL), // C4[1], coeff of eps^26, polynomial in n of order 3 -real(0x780f9f651c0LL),real(0x49cd6538080LL),-real(0x275396e6f40LL), real(0x1c1406225eaLL),real(0x1e2d6465e2b066fLL), // C4[1], coeff of eps^25, polynomial in n of order 4 -real(0x226e68a74f6c2c0LL),real(0x178fbd94c6e4130LL), -real(0x10bafa7048ffb60LL),real(0x7b204e43552d10LL), real(0x1ebd785c76c649LL),reale(369943,0xaebaf6655156dLL), // C4[1], coeff of eps^24, polynomial in n of order 5 -real(0x26adfa4c2bcf8500LL),real(0x1be7e116f09bc400LL), -real(0x1641521374362300LL),real(0xd7dd4a2b1831200LL), -real(0x7449d087ac65100LL),real(0x525502d56a2a1d8LL), reale(4562638,0xc0573436eb2ebLL), // C4[1], coeff of eps^23, polynomial in n of order 6 -reale(27299,0x1e7fae46f2ae0LL),reale(20250,0xb050f61211530LL), -reale(17170,0x1ccacfb407b40LL),reale(11560,0x5557506ac7a50LL), -reale(8300,0x1ee1dfec0f3a0LL),reale(3760,0xc5da39149a170LL), real(0x3aaaad07e2dbe15fLL),reale(141441801,0x4a8f52a67aa75LL), // C4[1], coeff of eps^22, polynomial in n of order 7 -reale(223720,0xada70de871dc0LL),reale(168212,0x95f7a36b8e780LL), -reale(147708,0x4639d71413140LL),reale(104570,0x398040c96dd00LL), -reale(84304,0x27ca2fe2f28c0LL),reale(50205,0xd862a9f308280LL), -reale(27426,0xbe7e08935dc40LL),reale(19210,0x9794de13dcf52LL), reale(820362447,0x7d3f45c59430dLL), // C4[1], coeff of eps^21, polynomial in n of order 8 -reale(1591044,0x45108afb80980LL),reale(1200725,0xfaaefe8d2aff0LL), -reale(1074110,0x244b18cc1fd20LL),reale(779463,0x6e55e2794e4d0LL), -reale(667443,0x7f273db50d4c0LL),reale(440073,0xbd38cdf5ffbb0LL), -reale(320490,0xb0902bc064460LL),reale(142410,0x1eb038cc00090LL), reale(35531,0x5cce3f7afbb81LL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[1], coeff of eps^20, polynomial in n of order 9 -reale(6932123,0xff59c6bb56f80LL),reale(5207764,0x9d4c81592dc00LL), -reale(4682178,0xdef9cf054a880LL),reale(3431350,0xdcd7f0ab97d00LL), -reale(3036244,0xeb9781cfe3980LL),reale(2097463,0x35c6f48ae00LL), -reale(1714507,0xab45478b85280LL),reale(997568,0xe75b4df283f00LL), -reale(555001,0x356f72a492380LL),reale(383325,0x3033ad4799914LL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^19, polynomial in n of order 10 -reale(10475274,0x80e3f984eb560LL),reale(7761418,0x6cb2d37d31d50LL), -reale(6912729,0x2574b8548f80LL),reale(5061056,0xbff13b9f8e7b0LL), -reale(4542234,0x9c8561f8559a0LL),reale(3202970,0x45874de1c0010LL), -reale(2776395,0x2331e9957c0LL),reale(1780809,0x24244086de270LL), -reale(1321308,0xb7d4404aacde0LL),reale(572110,0xf0d923e3d0ad0LL), reale(142666,0x15ad08c690505LL),reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^18, polynomial in n of order 11 -reale(16991539,0x3bfa3a952a5c0LL),reale(12232630,0xc216625651e80LL), -reale(10582386,0xca84c044c7740LL),reale(7659664,0x22fef68736200LL), -reale(6852368,0xbf4b993050cc0LL),reale(4854746,0x78ae9dfa88580LL), -reale(4332124,0x5850c11d91e40LL),reale(2896859,0x8330e6242d100LL), -reale(2410777,0x3c4e4b27563c0LL),reale(1359574,0x6f5bc7e308c80LL), -reale(775169,0xf705a84369540LL),reale(525423,0x9fd72933d2d3aLL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^17, polynomial in n of order 12 -reale(31605635,0x9b2a6245129c0LL),reale(21349095,0xec111ef51efd0LL), -reale(17343382,0xc6b59d854f620LL),reale(12224940,0xad54b9902f0LL), -reale(10665275,0xcb2c9d1586680LL),reale(7495419,0x2bbe593f97c10LL), -reale(6731026,0x5bd11498926e0LL),reale(4567553,0xbb95797dfef30LL), -reale(4019270,0xe17fb3dce340LL),reale(2483542,0x18261977df050LL), -reale(1889445,0x252a3b83f47a0LL),reale(789608,0x3727b34041370LL), reale(196748,0x5030b26b63d7fLL),reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^16, polynomial in n of order 13 -reale(83651327,0x7df35b769ce00LL),reale(46183264,0x6a662d0fec800LL), -reale(32523895,0xbf44a3e60200LL),reale(21575930,0xbd1dba7599c00LL), -reale(17706525,0xdbcb8c6749600LL),reale(12151631,0x7c587583d3000LL), -reale(10707728,0xa79806e6f4a00LL),reale(7245171,0x8aa6d7e27c400LL), -reale(6517082,0x9ff2c462fde00LL),reale(4168671,0x7a21919979800LL), -reale(3551918,0x26047c5101200LL),reale(1918361,0x786d4fd8aec00LL), -reale(1131511,0x7e7a26769a600LL),reale(747310,0xbb693903a2f10LL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^15, polynomial in n of order 14 -reale(63372442,0x2cb5338504ea0LL),reale(236021120,0xed659df2db350LL), -reale(86667901,0x5273be9be40LL),reale(47209611,0xc1161d91d1e30LL), -reale(33537857,0x3d1f3cdba35e0LL),reale(21739691,0xd5c3b2c9df710LL), -reale(18074666,0x2123c601d8980LL),reale(11984705,0x3d2e52a8729f0LL), -reale(10682808,0x1cfcfab158d20LL),reale(6875060,0xeec2e9924a2d0LL), -reale(6158904,0xf3892aedc14c0LL),reale(3612073,0x775a08e9d4db0LL), -reale(2844696,0x4fdad4b74f460LL),reale(1130419,0xe52285ff91690LL), reale(281319,0xf8ed6ce679421LL),reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^14, polynomial in n of order 15 reale(377918798,0xab0ca9f0672c0LL),-reale(418618018,0x8099eba53f80LL), -reale(60854873,0x3eafa33f453c0LL),reale(245263030,0xf5560cf897d00LL), -reale(90083330,0xb4182a1e90640LL),reale(48226005,0xa87e22e4ae980LL), -reale(34666917,0x2b03feac26cc0LL),reale(21804113,0xa9bac4593e00LL), -reale(18434597,0x75e58711b4f40LL),reale(11683388,0x18da60c9eb280LL), -reale(10544255,0x717858fde75c0LL),reale(6335167,0xce8110cc57f00LL), -reale(5568830,0x1a6ca9ba6a840LL),reale(2826076,0xf4ab3cac7db80LL), -reale(1750284,0x2ff80145eaec0LL),reale(1113751,0xd17a5fb748e66LL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^13, polynomial in n of order 16 -reale(7676111,0x5b2a6c5f6c100LL),-reale(64415807,0x4cf1fd08a9430LL), reale(389009273,0x614b445047d20LL),-reale(437396877,0xd309fa5941090LL), -reale(57368388,0x6af986a1a0c0LL),reale(255600151,0x61702d3245910LL), -reale(94005962,0x2924b0b2256a0LL),reale(49188288,0xa4967a4d0acb0LL), -reale(35935634,0xccf0586b2e080LL),reale(21713831,0x3869a07cfee50LL), -reale(18759173,0xcf3c8197a7a60LL),reale(11187408,0x277eed08021f0LL), -reale(10209411,0xbc33094486040LL),reale(5549613,0x5f33e35304b90LL), -reale(4590963,0x90f6e6e49ce20LL),reale(1692490,0x5de933ef26f30LL), reale(420297,0x50d0b3d8c1d9bLL),reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^12, polynomial in n of order 17 -reale(852919,0x6a82cfa963080LL),-reale(2188759,0x20ca5d762f800LL), -reale(7786929,0x3421dcca91f80LL),-reale(65787035,0x1d560be049100LL), reale(401061675,0x8c48395cfc980LL),-reale(458713135,0x22175c326fa00LL), -reale(52544362,0x54a9b8a28c580LL),reale(267237346,0x9f71e62ba7d00LL), -reale(98592445,0x567d144d01c80LL),reale(50019657,0x7efcd81e48400LL), -reale(37374118,0xabf7952238b80LL),reale(21383288,0xfc61768bbcb00LL), -reale(18992011,0x5234632e06280LL),reale(10406178,0xe1fef86250200LL), -reale(9523344,0xe57e66503f180LL),reale(4398013,0x8a16c0de4d900LL), -reale(2932033,0xa738784cb8880LL),reale(1764194,0xc6396b58af30cLL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^11, polynomial in n of order 18 -reale(210362,0x76b369d3025e0LL),-reale(399459,0x1eaf9acef0ab0LL), -reale(856141,0xe229f972ba700LL),-reale(2206922,0xef935c87bb50LL), -reale(7896496,0x6b0bc697c0820LL),-reale(67217074,0x2cc6331df1df0LL), reale(414202467,0x2b5605d0252c0LL),-reale(483149583,0xa02db175d690LL), -reale(45836711,0xc18042256fa60LL),reale(280420397,0xa9af8baa076d0LL), -reale(104078404,0x7a91f5b525380LL),reale(50585814,0x9d940e3bb2630LL), -reale(39015494,0x6a69555b81ca0LL),reale(20678727,0x5f0f1f3a9390LL), -reale(19012332,0x416957968b9c0LL),reale(9200947,0xc21b589061af0LL), -reale(8178296,0xad1e8ab768ee0LL),reale(2676456,0xd6956da2a1850LL), reale(661843,0xede00571b821dLL),reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^10, polynomial in n of order 19 -reale(73282,0x88acf774cdcc0LL),-reale(119856,0xfafc4232d6980LL), -reale(209310,0xc95dad3d9d040LL),-reale(398728,0xc3246fdb30c00LL), -reale(857927,0x8ca89fdf097c0LL),-reale(2222415,0x7f22a8f79ee80LL), -reale(8002412,0xa401cae100b40LL),-reale(68698832,0xcf05dd2d1e900LL), reale(428572510,0x4af905b8fd40LL),-reale(511480829,0xaa7af93dad380LL), -reale(36412636,0xa51695c145640LL),reale(295430858,0x62539c3ab7a00LL), -reale(110834541,0xf7ac6a286ddc0LL),reale(50648730,0xf42d6a1912780LL), -reale(40882711,0xc825af61d7140LL),reale(19389515,0xc578a6be65d00LL), -reale(18548541,0x30b0433e6e8c0LL),reale(7353872,0xa4f0c77ab4280LL), -reale(5517208,0xc642445621c40LL),reale(3035548,0x619b33f1391d2LL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^9, polynomial in n of order 20 -reale(31116,0x5ced59f2a6a40LL),-reale(46466,0x39ef1648a3c30LL), -reale(72339,0x13bec712995a0LL),-reale(118591,0xe96704ee23c10LL), -reale(207681,0xf3272ddf69500LL),-reale(396975,0x5586a3fda15f0LL), -reale(857776,0x96a9e394d3460LL),-reale(2234014,0x9c760527155d0LL), -reale(8101033,0x1f3b77f93fc0LL),-reale(70217181,0xc7476a97287b0LL), reale(444320933,0x84d59896b7ce0LL),-reale(544755366,0x60ab42e093790LL), -reale(22958170,0x5fc77e584ca80LL),reale(312550991,0xea91e4bc80e90LL), -reale(119474190,0x655c7a979e1e0LL),reale(49778595,0x69cfb591beb0LL), -reale(42938053,0xad555dfab9540LL),reale(17185991,0x9567a8e814cd0LL), -reale(16947236,0xc941a0517b0a0LL),reale(4507394,0xb6bfddcb2cf0LL), reale(1103154,0xee71952935057LL),reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^8, polynomial in n of order 21 -reale(15013,0x669ca85dbff00LL),-reale(21081,0x7f4d799198400LL), -reale(30470,0xbdb587d74d900LL),-reale(45587,0xe4badb51b1a00LL), -reale(71124,0x646ea35b6300LL),-reale(116891,0x8adb62aa4d000LL), -reale(205315,0x1aa2ab2ec7d00LL),-reale(393884,0x4b8d8eda78600LL), -reale(855000,0x2faa553050700LL),-reale(2239966,0xb31164c141c00LL), -reale(8186764,0x97347e701e100LL),-reale(71742883,0x7f111739b7200LL), reale(461586973,0x9a516d5401500LL),-reale(584418823,0xe1245bd6e6800LL), -reale(3315305,0x14110f9c0500LL),reale(331936814,0x28269ca022200LL), -reale(131069117,0x7ee7ad0730f00LL),reale(47184778,0x227a729454c00LL), -reale(44897669,0x9cd1b2a1e900LL),reale(13574545,0xcd96a182a3600LL), -reale(12485695,0x45db16a057300LL),reale(5879734,0x70bef82b8988LL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^7, polynomial in n of order 22 -reale(7900,0x638c66d8a8320LL),-reale(10613,0xf2ac3092c9cb0LL), -reale(14565,0xe107ae27501c0LL),-reale(20489,0xead89ce414d0LL), -reale(29670,0x849ce08edf860LL),-reale(44482,0xeb1f022729ef0LL), -reale(69562,0xbdfcfee35b00LL),-reale(114632,0x975e8fa16f10LL), -reale(201989,0x9411d71111da0LL),-reale(389021,0x33d7ff034b930LL), -reale(848628,0xc0285ec233440LL),-reale(2237713,0xb97d9ca55b150LL), -reale(8250880,0x9132887d792e0LL),-reale(73221392,0xf1ffe05c8b70LL), reale(480452831,0x383b5471fd280LL),-reale(632496874,0xca3591eba7b90LL), reale(26233104,0x13df159bb07e0LL),reale(353203487,0x101c2c33c4a50LL), -reale(147596513,0x7a337ff05e6c0LL),reale(41406718,0x88562e0e69230LL), -reale(45513246,0x22b5bfcbced60LL),reale(7934370,0xa8c8e9d8c2810LL), reale(1869414,0xdc5c61854a479LL),reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^6, polynomial in n of order 23 -reale(4406,0xf939ae5c97c40LL),-reale(5729,0xf863eba5bf80LL), -reale(7570,0xa927e082c4c0LL),-reale(10189,0xdc3d2b5930900LL), -reale(14011,0xfd72406188940LL),-reale(19751,0x4ee9330f94280LL), -reale(28665,0xa6c18d00fb1c0LL),-reale(43078,0xe8ed052a45400LL), -reale(67543,0xd4150add2640LL),-reale(111634,0xb28e55bb02580LL), -reale(197389,0xccdd68505cec0LL),-reale(381765,0x22e00b9b89f00LL), -reale(837258,0xa000eefe9340LL),-reale(2223425,0xd3d15b309a880LL), -reale(8279438,0xc28db224c5bc0LL),-reale(74551261,0xb7816e54f2a00LL), reale(500824278,0x3891b999befc0LL),-reale(691847154,0x918a2dd450b80LL), reale(72461747,0xa045596356740LL),reale(374046829,0x41b777218cb00LL), -reale(172833056,0x62b9485f4dd40LL),reale(29915148,0x80284d25e7180LL), -reale(39423763,0x40d338467c5c0LL),reale(13659048,0x68e501c228ffeLL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^5, polynomial in n of order 24 -reale(2545,0x1363104362d80LL),-reale(3226,0xe67b1424a4830LL), -reale(4144,0x8c711302fa660LL),-reale(5400,0xc1bfe2853af90LL), -reale(7153,0xb2c26c1682b40LL),-reale(9653,0x9e8ef4e7cf0f0LL), -reale(13308,0xeb09aee491820LL),-reale(18810,0x561040fe22850LL), -reale(27375,0xc35e0fb3fc900LL),-reale(41260,0x7d7f41fc271b0LL), -reale(64893,0xc7a96414399e0LL),-reale(107622,0xe02e2157de910LL), -reale(191035,0x6ce8a0a1be6c0LL),-reale(371181,0x96988a373aa70LL), -reale(818768,0xa91a46aa60ba0LL),-reale(2191167,0x9fde37effd1d0LL), -reale(8249435,0xe27cdc35b6480LL),-reale(75540143,0x55cc77d97b30LL), reale(522119910,0xf5aa540a8b2a0LL),-reale(766397212,0x64559a510c290LL), reale(148547296,0x8152775e2ddc0LL),reale(385247751,0x81b301a133c10LL), -reale(213402544,0x90fce845e3f20LL),reale(10198756,0x255c7c31664b0LL), reale(1365904,0xd74a19c69db33LL),reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^4, polynomial in n of order 25 -real(0x5cd20bbc3c672180LL),-real(0x73720b2d98187c00LL), -reale(2321,0xc4eb857568680LL),-reale(2952,0xb2617088c8f00LL), -reale(3804,0x417bd8fa2e380LL),-reale(4973,0x5ec86f601d200LL), -reale(6609,0x998272f30a880LL),-reale(8950,0x197c7ab46b500LL), -reale(12382,0xcc481e2a44580LL),-reale(17565,0x5f7861969a800LL), -reale(25660,0x4a6f330e22a80LL),-reale(38825,0xe447100991b00LL), -reale(61313,0x47573aa0ec780LL),-reale(102123,0xa55bb6037e00LL), -reale(182121,0xfb4d0590e8c80LL),-reale(355742,0x340be91b74100LL), -reale(789743,0xf318e4285e980LL),-reale(2131260,0x2c59b0f82d400LL), -reale(8121193,0x3f9cc7c594e80LL),-reale(75808472,0x814742dd4a700LL), reale(542406027,0xe15955752d480LL),-reale(860719085,0xb088c959b2a00LL), reale(281794203,0x6d691a09a0f80LL),reale(349671639,0x4a19c69db3300LL), -reale(268081590,0x1f35e51280d80LL),reale(42616231,0x9d4bdce6b704LL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^3, polynomial in n of order 26 -real(0x34f88b61ee2c2e60LL),-real(0x40e8b73250ad02b0LL), -real(0x50402824a1190680LL),-real(0x643133a56bf6de50LL), -real(0x7e70b50d7e53aea0LL),-reale(2583,0x89ee9103c6bf0LL), -reale(3343,0x2d56b6f20aac0LL),-reale(4390,0x9150bee746f90LL), -reale(5862,0xecb9ee1767ee0LL),-reale(7978,0x9b4551158ad30LL), -reale(11096,0x13774a5e7af00LL),-reale(15825,0x3f23db737e8d0LL), -reale(23248,0xf45a340cbf20LL),-reale(35380,0xaf4478627e670LL), -reale(56209,0x8a81f32e3340LL),-reale(94205,0x2f98ae2576a10LL), -reale(169093,0xeae4ad4ee8f60LL),-reale(332577,0xf0ed8664037b0LL), -reale(743995,0x906300fb45780LL),-reale(2026493,0x9c6e844791350LL), -reale(7821602,0x7531c16940fa0LL),-reale(74557824,0x1ed43b2e7c0f0LL), reale(555703654,0x34418f385c440LL),-reale(974709694,0x84f4a67130490LL), reale(527421389,0x42f7f1faaa020LL),reale(94702735,0xa411a5cab5dd0LL), -reale(117194635,0x5b0909f7a774bLL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^2, polynomial in n of order 27 -real(0x1bd57a8f504dd3c0LL),-real(0x21b6ff10b9172180LL), -real(0x292825cda3a88940LL),-real(0x32aacbfadedfca00LL), -real(0x3ef38a62fa0322c0LL),-real(0x4f013a1cfd80d280LL), -real(0x64414a4729c69840LL),-reale(2060,0x90ead26a03300LL), -reale(2683,0x237c6d92be1c0LL),-reale(3547,0x3d9a05c33e380LL), -reale(4770,0x6ec9da59bf740LL),-reale(6541,0x1657e411dc00LL), -reale(9170,0x1a8b4944fd0c0LL),-reale(13190,0xb069410801480LL), -reale(19554,0x9e393a3b06640LL),-reale(30047,0xba30505448500LL), -reale(48224,0x707d4f4f6afc0LL),-reale(81689,0xf05ca40b52580LL), -reale(148265,0xab90de58ba540LL),-reale(294962,0x64373b047ee00LL), -reale(667587,0xc0c688fa83ec0LL),-reale(1840377,0xc842d822d680LL), -reale(7199121,0xfc41489b57440LL),-reale(69934327,0xdb9ec152bd700LL), reale(541991040,0xe60e5a413c240LL),-reale(1060670639,0x2d9274118e780LL), reale(833384073,0xa3ce7fc4a6cc0LL),-reale(234389270,0xb61213ef4ee96LL), reale(12305436712LL,0x56b51693aedc3LL), // C4[1], coeff of eps^1, polynomial in n of order 28 -real(0xb4c355cd41c92c0LL),-real(0xd8fea3a41cc7830LL), -real(0x1064f0c6b9a6ad20LL),-real(0x13f7a88902ef1b10LL), -real(0x1884a414973fcb80LL),-real(0x1e5fa2ae5243d7f0LL), -real(0x25fe0bb384ddd9e0LL),-real(0x3006f6e3e0e25ad0LL), -real(0x3d6c2c13c34ec440LL),-real(0x4f91f34825bd4fb0LL), -real(0x688ffb74f98676a0LL),-reale(2233,0xdec33bb086290LL), -reale(3036,0xe53843c2cdd00LL),-reale(4213,0xb13e1137e3f70LL), -reale(5984,0xaa1cca8abe360LL),-reale(8732,0xb9880d6c69250LL), -reale(13152,0x1eadcfcfd75c0LL),-reale(20566,0x4e1752c3c0730LL), -reale(33653,0xf4262a5798020LL),-reale(58247,0x3a420e3524a10LL), -reale(108257,0x7934f39e3ee80LL),-reale(221025,0xaccc1c0dc06f0LL), -reale(514222,0xffbb852faace0LL),-reale(1456965,0x29e8a4070e9d0LL), -reale(5827860,0xa7a2901c3a740LL),-reale(56821641,0x6270fd1339eb0LL), reale(416692036,0xd1e73fe253660LL),-reale(625038055,0x3adadfd37d190LL), reale(273454149,0x29bfc1ec86bafLL), reale(12305436712LL,0x56b51693aedc3LL), // C4[2], coeff of eps^29, polynomial in n of order 0 185528,real(30429886905LL), // C4[2], coeff of eps^28, polynomial in n of order 1 real(17366491968LL),real(4404238552LL),real(0x74e318fa9c07fLL), // C4[2], coeff of eps^27, polynomial in n of order 2 real(412763643136LL),-real(248137794944LL),real(164642704408LL), real(0x4d882f0532d9e9LL), // C4[2], coeff of eps^26, polynomial in n of order 3 real(0x11462b92d913a0LL),-real(0xdd4620ebadc40LL), real(0x5974730e46be0LL),real(0x16bcec57851ccLL), reale(33547,0x1cf91962af003LL), // C4[2], coeff of eps^25, polynomial in n of order 4 real(0xc83679b433c00LL),-real(0xb29b6d58dfb00LL),real(0x5f4e3bdd4de00LL), -real(0x3affd9960e900LL),real(0x2665fb625f490LL), reale(15809,0x8f200ee7e2a7dLL), // C4[2], coeff of eps^24, polynomial in n of order 5 real(0x67b92a8524a18e80LL),-real(0x609d7d3ca356ae00LL), real(0x39db180d1b52d580LL),-real(0x2fa1e9183dec9700LL), real(0x1294d8f2627edc80LL),real(0x4bc94ddbc9bad70LL), reale(22813193,0xc1b4051297e97LL), // C4[2], coeff of eps^23, polynomial in n of order 6 reale(24830,0x3d0fb879bb600LL),-reale(23212,0xa100635ccdb00LL), reale(14957,0x147cd156ba400LL),-reale(13653,0x51ea4b9c89d00LL), reale(7024,0x2535370909200LL),-reale(4511,0x3af63b60c9f00LL), reale(2865,0xf50f5adcce1f0LL),reale(235736335,0x7c44346acc6c3LL), // C4[2], coeff of eps^22, polynomial in n of order 7 reale(1046092,0x25a6222f26060LL),-reale(949436,0x14a3a722f1840LL), reale(652845,0xb96689ab42720LL),-reale(615919,0x6f1345ab50580LL), reale(356624,0x982d38f2a9de0LL),-reale(303839,0x22c37d5c832c0LL), reale(113262,0x286189b57e4a0LL),reale(28978,0x12ae8b059bc84LL), reale(6836353729LL,0x13b9f01928417LL), // C4[2], coeff of eps^21, polynomial in n of order 8 reale(4643688,0x71b79cbf7cc00LL),-reale(3959056,0x83e38a4f9d180LL), reale(2926140,0x6f81ce5fc3900LL),-reale(2722736,0xdd03df5282c80LL), reale(1710940,0xc70403130e600LL),-reale(1602990,0x9ebb76967a780LL), reale(787738,0x6bf60987b1300LL),-reale(530212,0xcde2a88ab0280LL), reale(326645,0xab9033855e368LL),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^20, polynomial in n of order 9 reale(2366152,0x4fc26559c91c0LL),-reale(1830925,0x4d73259824200LL), reale(1477489,0x62c9a90a52a40LL),-reale(1299560,0xe7bf798235180LL), reale(885946,0x5cb0a99f5e2c0LL),-reale(843740,0x47153eb842100LL), reale(469359,0x79db9d7cfb40LL),-reale(417111,0x1a4c5e2477080LL), reale(146559,0x51b0aa3dcb3c0LL),reale(37677,0x6dd5ee66abd48LL), reale(6836353729LL,0x13b9f01928417LL), // C4[2], coeff of eps^19, polynomial in n of order 10 reale(11390177,0xa8f910291300LL),-reale(7729638,0x6f23cf47c2480LL), reale(6929266,0x5fb765e065c00LL),-reale(5514735,0x5eb0876136380LL), reale(4148166,0x27d6c40aa500LL),-reale(3788609,0xfef33001c8280LL), reale(2322601,0x1de03c2bc2e00LL),-reale(2237878,0x77b7642b94180LL), reale(1037457,0x571c66f013700LL),-reale(742165,0x8c39e6d5b6080LL), reale(439349,0xf7cfa6e796fc8LL),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^18, polynomial in n of order 11 reale(19643005,0x3eb0d373a0e0LL),-reale(11359402,0x98e8f09139c0LL), reale(11381255,0xacc1b03fd73a0LL),-reale(7834592,0x92741bdd3b00LL), reale(6664656,0xa317edb25b660LL),-reale(5516050,0x3ff87cc43bc40LL), reale(3774293,0xd5e83edc68920LL),-reale(3594547,0xbec9f61701d80LL), reale(1908400,0x61c5f793c0be0LL),-reale(1786093,0xfaf3f7a19bec0LL), reale(579905,0x9d50696085ea0LL),reale(150042,0xa9efa9004c604LL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^17, polynomial in n of order 12 reale(38321815,0x1e48683dc9800LL),-reale(18616913,0x727791f8dfa00LL), reale(20113440,0xb841223d75400LL),-reale(11495937,0x9838f29931e00LL), reale(11261630,0x21fd3747b1000LL),-reale(7960716,0x75135ee9c200LL), reale(6275150,0xa8a2fa972cc00LL),-reale(5471565,0x945df446e600LL), reale(3293426,0x6eab44c698800LL),-reale(3257897,0x559df659f8a00LL), reale(1401057,0x756ea738a4400LL),-reale(1086629,0xf49cb94a8ae00LL), reale(610116,0x479bdc6c290e0LL),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^16, polynomial in n of order 13 reale(102781113,0x98fe5a9192500LL),-reale(40336104,0xccc089a851400LL), reale(40165652,0x6e617f3b73300LL),-reale(18616625,0x95536d5576600LL), reale(20514709,0xd39b96f5ec100LL),-reale(11691503,0x7c1154bb0b800LL), reale(10980290,0x40d1adbe6cf00LL),-reale(8104717,0x4a433bfb60a00LL), reale(5726151,0xc3b2b2965d00LL),-reale(5331323,0xa4559d80c5c00LL), reale(2689333,0x7cf2f82446b00LL),-reale(2678624,0x7904ff2b8ae00LL), reale(779755,0xfacbca777f900LL),reale(203539,0xb4670b88476e0LL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^15, polynomial in n of order 14 -reale(23295494,0x8be82e34e6400LL),-reale(256522224,0x1264f586eb600LL), reale(109420782,0x9692235ce1800LL),-reale(40005401,0x76f47ac799a00LL), reale(42210732,0x9175627089400LL),-reale(18637789,0x360d04338fe00LL), reale(20777547,0x32d7f69c1000LL),-reale(11978808,0x3c6fce691e200LL), reale(10467739,0x890cbd2438c00LL),-reale(8246695,0x5d95a89294600LL), reale(4981450,0x2e83f5dba0800LL),-reale(4997884,0x48d2490e42a00LL), reale(1949724,0xd6b9d613a8400LL),-reale(1687002,0x42840cd678e00LL), reale(881316,0x5154c853b06e0LL),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^14, polynomial in n of order 15 -reale(315852553,0x127aa1fb9560LL),reale(452067016,0x32f06289dc340LL), -reale(36389203,0xc905d2dd0bc20LL),-reale(265701999,0x414c3c9652f80LL), reale(117462481,0xb44ff33f8ed20LL),-reale(39375172,0xb9e521c5c6240LL), reale(44443567,0x98c20ae94660LL),-reale(18737379,0x9088d09ce7500LL), reale(20789662,0x74772cb6e2fa0LL),-reale(12399165,0xc39cbc16e07c0LL), reale(9634015,0x48be8ec7788e0LL),-reale(8326007,0x8f1246dddba80LL), reale(4012687,0x8a9763f933220LL),-reale(4283805,0xe15bd5742d40LL), reale(1064918,0x3e0322e890b60LL),reale(281445,0x189dacfa2913cLL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^13, polynomial in n of order 16 reale(4607575,0xc9d7900c88800LL),reale(44527228,0x61b96ac1eb380LL), -reale(320302478,0xa276d3450e900LL),reale(471382647,0x4d0623cc86a80LL), -reale(52535715,0x404f1a5b09a00LL),-reale(275262322,0xf3348bb543e80LL), reale(127364360,0xbf0504ec13500LL),-reale(38376532,0x74833ebc78780LL), reale(46801690,0x6a3245e5c4400LL),-reale(19021914,0x3bda110f1b080LL), reale(20372666,0xf7fc04d85300LL),-reale(12992077,0x825700022f980LL), reale(8374681,0xba502a56d2200LL),-reale(8187369,0x8d48a8bba280LL), reale(2818780,0x7113503f27100LL),-reale(2834494,0xf2038f04beb80LL), reale(1337917,0xc906f381aecf8LL),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^12, polynomial in n of order 17 reale(388658,0x19c7c6f8ea2c0LL),reale(1117971,0xaadcbdb38ac00LL), reale(4519560,0xaee28ee393540LL),reale(44278119,0xe09b9f50af680LL), -reale(324493551,0x5c00bae29840LL),reale(492697628,0x7d1cc3fd18100LL), -reale(72657626,0xb42806bf185c0LL),-reale(284925253,0x57cc84a557480LL), reale(139770748,0x33e950dc3acc0LL),-reale(36961790,0xef70c005baa00LL), reale(49119876,0xa052562f03f40LL),-reale(19681131,0xbaa50226adf80LL), reale(19252422,0xc3af9265b71c0LL),-reale(13755373,0x2f0960c0cd500LL), reale(6600104,0x6565773f88440LL),-reale(7462805,0xbfb982e534a80LL), reale(1452711,0x6b2cd84feb6c0LL),reale(390635,0x965de9321fbe8LL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^11, polynomial in n of order 18 reale(73868,0xf53613318fd00LL),reale(155158,0x6bea1fc037e80LL), reale(370865,0xe686995a3a800LL),reale(1077531,0xb6b00d00e5180LL), reale(4409046,0x1d5f244685300LL),reale(43860006,0xf94485a638480LL), -reale(328226208,0x254b380304200LL),reale(516242826,0x48cfde1d3d780LL), -reale(98028430,0xc7227901d5700LL),-reale(294125055,0xf41dd5cbff580LL), reale(155591277,0xc58331ae9d400LL),-reale(35168366,0x6c3820d072280LL), reale(51023141,0xfcae9f00dff00LL),-reale(21033813,0x6b0840ce0ef80LL), reale(17035669,0xa0ab037f7ea00LL),-reale(14520825,0x209891efc9c80LL), reale(4321952,0xda1143d705500LL),-reale(5322397,0x9ed9b44796980LL), reale(2165443,0xa5af00ad58358LL),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^10, polynomial in n of order 19 reale(19809,0x63304b335a660LL),reale(35566,0xcb4164f348e40LL), reale(68577,0xe86c972757e20LL),reale(145245,0xbc9cc7446e200LL), reale(350489,0x7e29a3d4285e0LL),reale(1029750,0x45087f82835c0LL), reale(4270842,0x2203011585da0LL),reale(43220702,0xa65b618eca980LL), -reale(331199124,0xa89ccd5235aa0LL),reale(542217711,0x200e3727c5d40LL), -reale(130429686,0x3b8b1d50d02e0LL),-reale(301749371,0x2c4d836f88f00LL), reale(176097282,0x8ddfe73d104e0LL),-reale(33280999,0x8c12e2a85fb40LL), reale(51717673,0x23cc103525ca0LL),-reale(23558374,0x76fe0e70fc780LL), reale(13250268,0x69c1c450ca460LL),-reale(14595460,0xd8a80a3d5d3c0LL), reale(1848614,0x7d3564e37c20LL),reale(506231,0x2a6100a6a6db4LL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^9, polynomial in n of order 20 reale(6397,0xfcd62c9faa400LL),reale(10440,0x3fc8ff8e75700LL), reale(17841,0xb7bede1dba00LL),reale(32272,0x7935213063d00LL), reale(62742,0x8933a9bfd5000LL),reale(134128,0x223daf23d6300LL), reale(327129,0xfca43cca0e600LL),reale(973230,0x31dda9e44900LL), reale(4098328,0x3528b970ffc00LL),reale(42289297,0xe5d54d5326f00LL), -reale(332951092,0xecfda756dee00LL),reale(570709002,0x2878cf4ff5500LL), -reale(172380399,0x5788b53115800LL),-reale(305626020,0x9c65fcc7d8500LL), reale(202987914,0xbd0aab0ad3e00LL),-reale(32233434,0x3f0406dec9f00LL), reale(49604551,0xc747777555400LL),-reale(27757216,0x323bffb167900LL), reale(7652705,0x1c15203ae6a00LL),-reale(11782806,0x2b7827f239300LL), reale(3811565,0x362856b8e6d30LL),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^8, polynomial in n of order 21 reale(2297,0xe5959dcaf9680LL),reale(3515,0xaf44e93439a00LL), reale(5557,0xf844363205d80LL),reale(9134,0x3148872cf3100LL), reale(15730,0x1f27208afe480LL),reale(28695,0xbe2e993314800LL), reale(56314,0x2c7b05479ab80LL),reale(121661,0x287926e675f00LL), reale(300328,0xfc8a376113280LL),reale(906274,0xf1fb199eef600LL), reale(3883000,0x5f528c391f980LL),reale(40968060,0xe6e08c5558d00LL), -reale(332763533,0x8282a4a507f80LL),reale(601507851,0xf6ba284c8a400LL), -reale(227453313,0x642fd223ab880LL),-reale(301473974,0xbe5976c5a4500LL), reale(238209921,0x57c5b91e6ce80LL),-reale(34582562,0x41ecac4f5ae00LL), reale(41696071,0xee870caef9580LL),-reale(33183269,0xa456f79c1700LL), reale(1407347,0x27b05f0931c80LL),reale(329283,0x26010fabff570LL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^7, polynomial in n of order 22 real(0x367dbe5da7953e00LL),real(0x4f9a921ac6fb1900LL), real(0x773454548df74400LL),reale(2938,0xbc18faed4af00LL), reale(4681,0x407a350a64a00LL),reale(7756,0xa0ed83ee90500LL), reale(13477,0x2fbfd87edd000LL),reale(24826,0x9ea174e739b00LL), reale(49249,0xd3391f1d95600LL),reale(107696,0xcac2013cff100LL), reale(269571,0xe064d3a745c00LL),reale(826840,0x70825da398700LL), reale(3613882,0x7ef0aa40a6200LL),reale(39120270,0xc5673698bdd00LL), -reale(329492011,0x53f65ac991800LL),reale(633695353,0xfeb5c44027300LL), -reale(300630213,0xecf09fbea9200LL),-reale(280700646,0xcee0a2073700LL), reale(282664342,0x7b726e8a17400LL),-reale(46720160,0x11dfe8c55a100LL), reale(23527957,0x90f427ad67a00LL),-reale(33848503,0x5eac35f0d4b00LL), reale(7456233,0x7c1f0b332cab0LL),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^6, polynomial in n of order 23 real(0x14f52a063dc5fc20LL),real(0x1d93a1e9ceb48740LL), real(0x2a911c303b723a60LL),real(0x3ea26bba66a54980LL), real(0x5e84fad71b3608a0LL),reale(2349,0x85d3117e94bc0LL), reale(3776,0x1c9d51cf2c6e0LL),reale(6317,0x5193932d16e00LL), reale(11091,0xc7716ff97d520LL),reale(20667,0xe33c2c4a29040LL), reale(41523,0x1a30a42ae9360LL),reale(92100,0xbd0a1f1419280LL), reale(234309,0x70b77706661a0LL),reale(732507,0x72fafb4df54c0LL), reale(3276808,0xe462aef209fe0LL),reale(36551902,0x4c4d10a4b700LL), -reale(321265885,0x720bf168351e0LL),reale(664675522,0x65892c55e9940LL), -reale(398339257,0x2b82ef41c13a0LL),-reale(225754486,0xf240500d62480LL), reale(330356701,0xbb7252695baa0LL),-reale(82401980,0x37f104ae0a240LL), -reale(4970822,0x52bf5cccc8720LL),-reale(3278171,0x9e4b710fe0e14LL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^5, polynomial in n of order 24 real(0x7d5242068d47400LL),real(0xac3832c9e621080LL), real(0xf0840d5e59cf500LL),real(0x155fabefd3362980LL), real(0x1f01ffac4c30b600LL),real(0x2e0489bbd6aca280LL), real(0x461560bdbc05f700LL),real(0x6df6210d29c3bb80LL), reale(2857,0xf2e1b87d2f800LL),reale(4836,0xd8d8f4249b480LL), reale(8600,0x17271d36df900LL),reale(16248,0x163bc1ffccd80LL), reale(33146,0xc23750bad3a00LL),reale(74792,0x260310eab4680LL), reale(194024,0xef2cdae46fb00LL),reale(620545,0xfcf47db535f80LL), reale(2853712,0x7228ad7b17c00LL),reale(32984640,0x1c4ce82435880LL), -reale(304937768,0x83ef272fd0300LL),reale(687819348,0xf9e0f9c397180LL), -reale(526420007,0xa1ce2482e4200LL),-reale(101220737,0xb065c6f7c1580LL), reale(344186593,0xf79ee4a13ff00LL),-reale(151524377,0x682a2ddefc80LL), reale(15298134,0x380aba4a19708LL),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^4, polynomial in n of order 25 real(0x2b077c634ede840LL),real(0x39e80232e455600LL), real(0x4f004399e9803c0LL),real(0x6d6a8dd96e7d980LL), real(0x9a16639c690ff40LL),real(0xdd0eb6a29ee1d00LL), real(0x143ca2e567649ac0LL),real(0x1e583a687f6ce080LL), real(0x2ebb5ae27bca9640LL),real(0x4a366ef6d0a8e400LL), real(0x7a244f6987aeb1c0LL),reale(3355,0xff6a995ee780LL), reale(6059,0x95d9afc38ad40LL),reale(11647,0x91c4ac30bab00LL), reale(24220,0xbe377a4d448c0LL),reale(55835,0xd9394a033ee80LL), reale(148417,0x27a782b394440LL),reale(488256,0xe5126fdac7200LL), reale(2322515,0xb040a0735fc0LL),reale(28019858,0x3d9464fe1f580LL), -reale(275064197,0x290d46715a4c0LL),reale(686424553,0x6984a82213900LL), -reale(677745912,0x9f6fb36960940LL),reale(151524377,0x682a2ddefc80LL), reale(169007958,0xfd6a53329f240LL),-reale(85232462,0x13a97b9cd6e08LL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^3, polynomial in n of order 26 real(0xc4c78b5f73e700LL),real(0x1046756e5efb980LL), real(0x15cbc98d9fba400LL),real(0x1d9279681ffce80LL), real(0x28b2f34344c6100LL),real(0x38e6214caec8380LL), real(0x50f0f0d0c655e00LL),real(0x7563dc0de2d1880LL), real(0xadfad5eb325db00LL),real(0x1083ab8775a8cd80LL), real(0x19c9d8efc1ad1800LL),real(0x29945e7f0056e280LL), real(0x4594bf2102ba5500LL),real(0x79a9d12705de9780LL), reale(3587,0xb2b264e0cd200LL),reale(7053,0x1d58043372c80LL), reale(15040,0x44c8073c3cf00LL),reale(35667,0x702872e47e180LL), reale(97902,0x6929355be8c00LL),reale(334186,0x1d1de4e87f680LL), reale(1659947,0xed2beccfc4900LL),reale(21110207,0x53559189eab80LL), -reale(222144335,0x8c70c0703ba00LL),reale(617753229,0x694fabb034080LL), -reale(769277606,0x6fd24e8e23d00LL),reale(454573131,0x1387e899cf580LL), -reale(104173009,0x3479cff894d98LL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[2], coeff of eps^2, polynomial in n of order 27 real(0x24546bc28a93e0LL),real(0x2f6c4d745b8e40LL), real(0x3e90f252c210a0LL),real(0x5380c389acd700LL), real(0x70da9adde57d60LL),real(0x9aa08aca5a9fc0LL), real(0xd7127fe199fa20LL),real(0x130248120008880LL), real(0x1b6103e1c56a6e0LL),real(0x283fa247b6e3140LL), real(0x3c89da46fe8a3a0LL),real(0x5d71643158b3a00LL), real(0x948b363af771060LL),real(0xf445a32263b42c0LL), real(0x1a1d56e9fe070d20LL),real(0x2ecb290f0241eb80LL), real(0x58a5da95527fb9e0LL),reale(2876,0x680343126d440LL), reale(6354,0x3e35c062e36a0LL),reale(15689,0x7d2910c199d00LL), reale(45107,0x47d6102c9a360LL),reale(162386,0x35cf6d6d5e5c0LL), reale(857038,0x54e3334f72020LL),reale(11655721,0x4f45203874e80LL), -reale(131126864,0xbbc9aa7b23320LL),reale(378810942,0x9046972ad7740LL), -reale(416692036,0xd1e73fe253660LL),reale(156259513,0xceb6b7f4df464LL), reale(20509061187LL,0x3b2dd04b78c45LL), // C4[3], coeff of eps^29, polynomial in n of order 0 594728,real(456448303575LL), // C4[3], coeff of eps^28, polynomial in n of order 1 -real(3245452288LL),real(1965206256),real(0x17609e98859b3LL), // C4[3], coeff of eps^27, polynomial in n of order 2 -real(0x15f49b7dd3600LL),real(0x7876e24c6900LL),real(0x1f5dd75c0b28LL), reale(4837,0x68f14547adebLL), // C4[3], coeff of eps^26, polynomial in n of order 3 -real(0x33418e8004000LL),real(0x17b00d59dc000LL), -real(0x11669ade1c000LL),real(0xa37322475bc0LL), reale(6709,0x6c31d1e089667LL), // C4[3], coeff of eps^25, polynomial in n of order 4 -real(0xc3e38d2fc36800LL),real(0x6a604d6faf7a00LL), -real(0x650b3de948f400LL),real(0x20a6596010be00LL), real(0x88f534a1fae70LL),reale(275086,0x53fa9cf60167fLL), // C4[3], coeff of eps^24, polynomial in n of order 5 -real(0xdd5f9d233a5800LL),real(0x8b724926c9e000LL), -real(0x8af41510346800LL),real(0x3d05686ce77000LL), -real(0x2f9901c72df800LL),real(0x1ae74f29ea4ce0LL), reale(223345,0xf3eec944ed143LL), // C4[3], coeff of eps^23, polynomial in n of order 6 -reale(81630,0xcf55ff9c68c00LL),reale(60811,0x59dd5ef6a6e00LL), -reale(57592,0x6457f059a8800LL),reale(30387,0x2572e53b9c200LL), -reale(30167,0xe11b4690d8400LL),reale(9044,0xd72699d03d600LL), reale(2392,0x21f43a8f7f830LL),reale(990092609,0x9eb428d5a933LL), // C4[3], coeff of eps^22, polynomial in n of order 7 -reale(3070961,0xf14af9164000LL),reale(2767073,0x4d2d51bbc4000LL), -reale(2322170,0xf623e90f3c000LL),reale(1476552,0x4ed8bf53f8000LL), -reale(1490469,0x7e13eaba44000LL),reale(616004,0x8b84c9ea6c000LL), -reale(517487,0xf3178ed39c000LL),reale(279040,0x23dc4dd774ec0LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^21, polynomial in n of order 8 -reale(3998482,0x374a7520d6800LL),reale(4351696,0x89a9dbf785900LL), -reale(3077852,0x4b8dc9fbd6e00LL),reale(2436308,0x9b47462d3fb00LL), -reale(2230379,0xda399323b400LL),reale(1147885,0x7a5199072bd00LL), -reale(1196012,0x91bb473d37a00LL),reale(325643,0x5e75ef9e35f00LL), reale(87110,0x728c765d95698LL),reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^20, polynomial in n of order 9 -reale(5536106,0x41a6dc97e5400LL),reale(6819318,0x7020ae33aa000LL), -reale(3996497,0x7d04a5d65ec00LL),reale(4026336,0x4a526eb153800LL), -reale(3081046,0x922df73cac400LL),reale(2027203,0x8c3cc70035000LL), -reale(2046086,0x4cc9bc51b5c00LL),reale(787253,0x8fa9057e6800LL), -reale(725367,0x21dd9ffc63400LL),reale(368582,0x69a43eb914890LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^19, polynomial in n of order 10 -reale(8942538,0x3b8622ae62a00LL),reale(10481872,0x1e7c948175300LL), -reale(5381394,0x830498d800800LL),reale(6645195,0x535f47efddd00LL), -reale(4043713,0x9ba9cf138e600LL),reale(3563786,0x6253b3df24700LL), -reale(3045580,0xe2f1f7a110400LL),reale(1548984,0x4828fbf665100LL), -reale(1694435,0x63dcfc138a200LL),reale(406057,0xe76a74dc3bb00LL), reale(110280,0xa64ca1bbeb438LL),reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^18, polynomial in n of order 11 -reale(18204995,0x3f490d6ed8000LL),reale(15367333,0xa666c37198000LL), -reale(8424707,0xb9613a5da8000LL),reale(10765521,3190860555LL<<17), -reale(5300295,0xd300940f58000LL),reale(6273886,0xba1b2aa228000LL), -reale(4137511,0x6a32b5bc28000LL),reale(2951915,0x3ffeb65fb0000LL), -reale(2898950,0x38c8743c58000LL),reale(1027617,0x2c3889c5b8000LL), -reale(1062542,0x7c8a4a4828000LL),reale(500325,0x147f19cd83980LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^17, polynomial in n of order 12 -reale(46659673,0x7940546261000LL),reale(20576887,0xb72d09f420c00LL), -reale(17371112,0xc460beb873800LL),reale(16552256,0x8d133b2d84400LL), -reale(7883306,0x3c181b1016000LL),reale(10867815,0x95ba8c80bfc00LL), -reale(5343012,0x31a34980f8800LL),reale(5640245,0x12558783a3400LL), -reale(4241979,0x47a64b12cb000LL),reale(2204426,0xf7d60f21fec00LL), -reale(2506924,0x6e46ed413d800LL),reale(503732,0xa322eb69a2400LL), reale(139663,0x777cb98300b20LL),reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^16, polynomial in n of order 13 -reale(156865464,0x9b4a437ced000LL),reale(26751997,0x84cabd1d8c000LL), -reale(47510066,0xf418e3e50b000LL),reale(22667291,0xeea5410a3a000LL), -reale(16175537,0xc4ceea20b9000LL),reale(17818506,0xfb6c54d608000LL), -reale(7402653,0x2459922697000LL),reale(10650742,0xeb52d29456000LL), -reale(5558253,0xfdda6aad45000LL),reale(4690304,0xc3737ed884000LL), -reale(4248624,0xb4bb4dab63000LL),reale(1382140,0xc755b095f2000LL), -reale(1646389,0x4c787b5791000LL),reale(701746,0xdc0286e009640LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^15, polynomial in n of order 14 reale(158569992,0x763cf17d39800LL),reale(242045827,0xf358b9d531400LL), -reale(171801710,0xfbdaa54751000LL),reale(26564510,0xe59a1e6b54c00LL), -reale(47715397,0x8fdbdb93bb800LL),reale(25503418,0x124aa89300400LL), -reale(14593564,0x65519680b6000LL),reale(19028249,0x27fd86c303c00LL), -reale(7127523,0x40a42052f0800LL),reale(9926805,0x1876eddc2f400LL), -reale(5956098,0xfb7e2f3f1b000LL),reale(3422018,0xde3cf0f552c00LL), -reale(3909386,0x4ce6da2de5800LL),reale(606166,0xec68c0e73e400LL), reale(172919,0x9ad62b665b520LL),reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^14, polynomial in n of order 15 reale(234628808,0x48818da828000LL),-reale(452308383,0x26baa88038000LL), reale(184630907,0xde7b734758000LL),reale(240946965,0x4db221ae90000LL), -reale(189474421,0xed4c1e36d8000LL),reale(27214973,0x55324802d8000LL), -reale(46882338,0xe5fcdfdca8000LL),reale(29262846,2319362995LL<<17), -reale(12682237,0x3cee53d458000LL),reale(19904432,0x70537f02e8000LL), -reale(7274198,0xbf917ba828000LL),reale(8480909,0x438c3da230000LL), -reale(6415713,0xc95c9b8258000LL),reale(1960896,0x685dc04df8000LL), -reale(2745254,0xf883406d28000LL),reale(1023946,0x4eef421f04580LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^13, polynomial in n of order 16 -reale(2272755,0x57fd708a77000LL),-reale(26091168,0x1366cec7d9d00LL), reale(231976719,0xafe6927fcde00LL),-reale(464894868,0x24c5c39795700LL), reale(215184123,0xaf8273d716c00LL),reale(236438336,0xab29f0bfd4f00LL), -reale(210344218,0x367ffa8b78600LL),reale(29454299,0x2f129bee9500LL), -reale(44460297,0xf9cfdfb8bb800LL),reale(34058265,0xda8305b9abb00LL), -reale(10677799,0x93543d448ea00LL),reale(19950418,0xbb16c712a0100LL), -reale(8097327,0xc3857f1ecdc00LL),reale(6164437,0x8a1d8a85ca700LL), -reale(6487914,0xa92c56ec54e00LL),reale(653539,0x4a58f163aed00LL), reale(193289,0xc4fa7fb371708LL),reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^12, polynomial in n of order 17 -reale(136365,0x73a1fcfe6ac00LL),-reale(450638,0xd074750f34000LL), -reale(2128024,0x54e7feac4d400LL),-reale(24952088,0x92a9c1fc91800LL), reale(228113259,0x85d44607e4400LL),-reale(477191195,0x7e69e50f07000LL), reale(251096618,0x1896eb4cd1c00LL),reale(226763725,0xac7cda7d93800LL), -reale(234776156,0x14cc4b0edcc00LL),reale(34557325,0x4230b4bd66000LL), -reale(39741101,0x3a85821c7f400LL),reale(39764072,0x42dd69fc98800LL), -reale(9161206,0x9c1a792d6dc00LL),reale(18380268,0xf302f56753000LL), -reale(9708385,0x581708d300400LL),reale(3148914,0x8380fab1bd800LL), -reale(5050904,0x8a565e3e8ec00LL),reale(1566765,0x6fd98617e9df0LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^11, polynomial in n of order 18 -reale(18810,0x4977f6cdda600LL),-reale(44617,0xf507aa2256700LL), -reale(121680,0x26c8d0378b000LL),-reale(408670,0xadcc6d8f87900LL), -reale(1967116,0xd731d207dba00LL),-reale(23614778,0x5c1a1fadbeb00LL), reale(222693980,0x695506ba87c00LL),-reale(488598159,0xe2ab67bc47d00LL), reale(293333811,0x10f016a3f3200LL),reale(209273530,0x4db1c2b811100LL), -reale(262769616,0x9b49f60945800LL),reale(44647130,0x3acb33bfff00LL), -reale(31983858,0x227f1389ce200LL),reale(45626356,0x9e16c6ccb8d00LL), -reale(9276161,0xf8fb16a652c00LL),reale(14205372,0x289c377eefb00LL), -reale(11490116,0xc948e407f600LL),reale(414830,0x163387d5d8900LL), reale(117690,0xc756ec17c4aa8LL),reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^10, polynomial in n of order 19 -reale(3667,0x8ba48fb7ec000LL),-reale(7355,0xde5d961edc000LL), -reale(15963,0x138d280434000LL),-reale(38393,53315683LL<<17), -reale(106358,0x1cca460dcc000LL),-reale(363723,0x77fed5aee4000LL), -reale(1788619,0xb46088e414000LL),-reale(22045766,0x7d53064fc8000LL), reale(215267089,0x7c4e47994000LL),-reale(498143540,0xc077eb386c000LL), reale(342855614,0x4b25e0bbcc000LL),reale(179961617,0x7ca6ea4dd0000LL), -reale(293329289,0xb4e43f9ccc000LL),reale(63137066,0xbcee02f98c000LL), -reale(20920174,0xdceb909f94000LL),reale(49479848,0x7088e98168000LL), -reale(12768344,0x1ee1d8cbec000LL),reale(6948560,0xd8f6969c04000LL), -reale(10643749,0x466c677134000LL),reale(2529930,0x161dcdf222440LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^9, polynomial in n of order 20 -real(0x354d49acec3dd800LL),-real(0x606a7d34c50a0200LL), -reale(2939,0xdc47a7c209c00LL),-reale(5971,0x671f2d9dad600LL), -reale(13140,0xcdf9f327fe000LL),-reale(32101,0x6baea5bb9ea00LL), -reale(90511,0x408ba9a232400LL),-reale(315893,0xc97e5e852be00LL), -reale(1591343,0xfce30d8d1e800LL),-reale(20207205,0x8b4272e60d200LL), reale(205238828,0x21c1cf60c5400LL),-reale(504251582,0xb2b181bcfa600LL), reale(400330413,0xa384192d01000LL),reale(132810886,0x4094526254600LL), -reale(323039224,0xd5680dd0e3400LL),reale(95085342,0xbfbbc74d27200LL), -reale(8279837,0x6ce790195f800LL),reale(46514941,0x8e0e73ffc5e00LL), -reale(20732718,0x38ef4b2eebc00LL),-reale(922541,0xf2a1d94487600LL), -reale(491669,0x5bd07d195db30LL),reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^8, polynomial in n of order 21 -real(0xd828cefda55a800LL),-real(0x16c6eac98e7b6000LL), -real(0x27e1e798049c9800LL),-real(0x490330552dbbf000LL), -reale(2255,0x88ea2b8740800LL),-reale(4647,0x88c66c31f8000LL), -reale(10390,0xd13f35560f800LL),-reale(25836,0xfcd55e2db1000LL), -reale(74324,0xc0bfff0e86800LL),-reale(265480,0xf5ce67923a000LL), -reale(1374647,0xa0b10ca8f5800LL),-reale(18058373,0x723761b2e3000LL), reale(191831943,0xc85920c253800LL),-reale(504361484,0x6e935002fc000LL), reale(465423127,0xbaa71ebb04800LL),reale(59036306,0xf120275a2b000LL), -reale(342905949,0x5a93131732800LL),reale(146354899,0x9f9c2b8142000LL), -reale(1641748,0x1e8ba62ca1800LL),reale(28969072,0x51c8dabef9000LL), -reale(27136540,0x3d9359d98800LL),reale(4249105,0xd55e5a0325120LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^7, polynomial in n of order 22 -real(0x38123cee860f400LL),-real(0x59d375c04e8be00LL), -real(0x942bf86bd4c1800LL),-real(0xfcbda8858afb200LL), -real(0x1c02af2dc3443c00LL),-real(0x33fc822f8d2b6600LL), -real(0x65e35fc07de4e000LL),-reale(3414,0xc7eb297eb5a00LL), -reale(7775,0x1c0e884298400LL),-reale(19731,0x6a31912ef0e00LL), -reale(58089,0x9471e600da800LL),-reale(213111,0x15a6331c60200LL), -reale(1139019,0x77ee6ce2ccc00LL),-reale(15560104,0x33d66a0afb600LL), reale(174045800,0x2f0a20e9d9000LL),-reale(494300177,0xd9e4761bbaa00LL), reale(535087920,0xe9f8f195ec00LL),-reale(53102016,0x93f6bbbe95e00LL), -reale(331738553,0x77bff637f3800LL),reale(216985631,0x987f3afb7ae00LL), -reale(21074121,0x8043eaffd5c00LL),-reale(4185955,0xa3ff769180600LL), -reale(4713710,0xd2e19a34f30b0LL),reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^6, polynomial in n of order 23 -real(0xe0ca252d14c000LL),-real(0x15a70af15f24000LL), -real(0x222b3f817554000LL),-real(0x375f97b48cd8000LL), -real(0x5c7b9631f8ac000LL),-real(0x9fe2527c7fcc000LL), -real(0x11face3d5ef34000LL),-real(0x21e77d8dabde0000LL), -real(0x439dcbf7fdccc000LL),-reale(2310,0x1731d0ccf4000LL), -reale(5373,0x35ee2c1554000LL),-reale(13965,0xf39edc32e8000LL), -reale(42247,0xa0aa0b1cac000LL),-reale(159930,0xa2319a759c000LL), -reale(887131,0xc123fa86b4000LL),-reale(12685735,0x6243721af0000LL), reale(150650948,0x968da6a8b4000LL),-reale(467294064,0x1610ada8c4000LL), reale(599544322,0x5feb9b1dac000LL),-reale(214883240,0x150075a4f8000LL), -reale(244806233,0x53bd4b2bac000LL),reale(272520146,0x88b0e96a94000LL), -reale(87760725,0x27ae1fc734000LL),reale(5827860,0xa7a2901c3a740LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^5, polynomial in n of order 24 -real(0x32b69e04189800LL),-real(0x4bd39320660300LL), -real(0x73a508e7ef1600LL),-real(0xb44a7ec206b900LL), -real(0x1200d9d52c6d400LL),-real(0x1d916a5ad4bcf00LL), -real(0x321a3f994641200LL),-real(0x57fce6d660f8500LL), -real(0xa10c564a22b1000LL),-real(0x1356fa3ebba41b00LL), -real(0x275fd13435900e00LL),-real(0x5604e2d76283d100LL), -reale(3283,0xdf8f52c874c00LL),-reale(8783,0x8ddc09700e700LL), -reale(27451,0x143e179f50a00LL),-reale(107903,0xe48c7d6f59d00LL), -reale(625732,0xe2abef41d8800LL),-reale(9446536,0xacc19c0743300LL), reale(120325828,0x5507fb0eafa00LL),-reale(412649247,0xc3fe82376e900LL), reale(633089704,0xd19d26ed03c00LL),-reale(418090362,0x84d33548fff00LL), -reale(13712613,0x4e3334f720200LL),reale(163180098,0x55c7c31664b00LL), -reale(61921019,0x751f3b2bed108LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[3], coeff of eps^4, polynomial in n of order 25 -real(0x30fab48eb2c00LL),-real(0x4779db0cde000LL), -real(0x6a1a5308c1400LL),-real(0xa07c7893bf800LL), -real(0xf7d15b087bc00LL),-real(0x1878e181999000LL), -real(0x27ab652bf7a400LL),-real(0x422ed0b6682800LL), -real(0x721448fff54c00LL),-real(0xcc1e5699294000LL), -real(0x17d5829db9a3400LL),-real(0x2ed74923dde5800LL), -real(0x61c84aba5ffdc00LL),-real(0xdbaa1b53c88f000LL), -real(0x21cc8beefe3fc400LL),-real(0x5da8efb832aa8800LL), -reale(4876,0x5d83861736c00LL),-reale(20082,0x8bb9af0c4a000LL), -reale(123005,0x97d1502b45400LL),-reale(1983151,0x65e045fd8b800LL), reale(27425226,0x9c6669ee40400LL),-reale(105081920,0xe8c662ae85000LL), reale(191976586,0x46cce583c1c00LL),-reale(186491540,0xf45203874e800LL), reale(93245770,0x7a2901c3a7400LL),-reale(18940547,0x20d0545bbdf90LL), reale(9570895220LL,0xb53783566b8edLL), // C4[3], coeff of eps^3, polynomial in n of order 26 -real(0x10330cb256200LL),-real(0x172cb16211100LL), -real(0x21a8187537800LL),-real(0x31b06260f1f00LL), -real(0x4ab014ab28e00LL),-real(0x7280309c9cd00LL), -real(0xb366eef7be400LL),-real(0x11ff8a58b05b00LL), -real(0x1dae666558ba00LL),-real(0x327547ac4a0900LL), -real(0x58c9207d125000LL),-real(0xa2826b77361700LL), -real(0x137557a5841e600LL),-real(0x275355b4b1bc500LL), -real(0x54b37d85300bc00LL),-real(0xc517d06239a5300LL), -real(0x1f8f2f623d981200LL),-real(0x5b85a3034c390100LL), -reale(5020,0xa2ee6bc312800LL),-reale(21965,0x48d3177570f00LL), -reale(144343,0x4c469a2853e00LL),-reale(2526007,0xb6d389c1bbd00LL), reale(38395317,0x415c2de726c00LL),-reale(163180098,0x55c7c31664b00LL), reale(326360196,0xab8f862cc9600LL),-reale(303048754,0xd0545bbdf900LL), reale(104173009,0x3479cff894d98LL), reale(28712685662LL,0x1fa68a0342ac7LL), // C4[4], coeff of eps^29, polynomial in n of order 0 4519424,real(0x13ed3512585LL), // C4[4], coeff of eps^28, polynomial in n of order 1 real(322327509504LL),real(86419033792LL),real(0x12e7203d54087bdLL), // C4[4], coeff of eps^27, polynomial in n of order 2 real(0xdf868e997000LL),-real(0xc54488fde800LL),real(0x67996a8dfb80LL), reale(6219,0x86ed0fee71e5LL), // C4[4], coeff of eps^26, polynomial in n of order 3 real(0x1e30d5f17398800LL),-real(0x20335f44c005000LL), real(0x8656a9da59d800LL),real(0x246f3281df3200LL), reale(1871928,0xea4bbbb5bea41LL), // C4[4], coeff of eps^25, polynomial in n of order 4 real(0x640278dc982000LL),-real(0x64de2b5e388800LL), real(0x266cf1cb211000LL),-real(0x24af02897bd800LL), real(0x125236c4932c80LL),reale(225070,0xa1cd0c0f186c5LL), // C4[4], coeff of eps^24, polynomial in n of order 5 real(0x183393315f62f400LL),-real(0x147c8a635ba4f000LL), real(0xaadb07a361e2c00LL),-real(0xbd0a07cdca37800LL), real(0x2c490db64a86400LL),real(0xc3000bbe3e2580LL), reale(8327613,0x62a2be2e87a79LL), // C4[4], coeff of eps^23, polynomial in n of order 6 reale(7399,0xe4703b1ceb000LL),-reale(4925,0x718bf750ef800LL), reale(3656,0xc01290e152000LL),-reale(3594,0x9ae0aefbbc800LL), real(0x5080258211e79000LL),-real(0x5458466826cf9800LL), real(0x27a09e95cf36b080LL),reale(97921247,0xc3bd6c206251LL), // C4[4], coeff of eps^22, polynomial in n of order 7 reale(4319137,0xe5044c1364800LL),-reale(2259378,0xc043aee633000LL), reale(2431286,0xcceb783bf5800LL),-reale(1865690,0x884902c9a2000LL), reale(996566,0x94ae3b7946800LL),-reale(1135368,0x2cb1c30811000LL), reale(231629,0x92b25177d7800LL),reale(64961,0x89605803fda00LL), reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^21, polynomial in n of order 8 reale(6174501,0x53f34a829c000LL),-reale(2885765,0xddf01a0f35800LL), reale(4089976,0x588848e445000LL),-reale(2309244,0x73683320c8800LL), reale(1950621,0xac1b944ace000LL),-reale(1810054,0xa24c07eb4b800LL), reale(609590,0x74daa18497000LL),-reale(712107,0x16cff78e5e800LL), reale(310317,0x16957f6a36b80LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^20, polynomial in n of order 9 reale(7763095,0xd98a0c3214600LL),-reale(4551997,0xf65d38a54d000LL), reale(6348004,0x7dcc619ba1a00LL),-reale(2777846,0x11091dc381c00LL), reale(3645151,0x5af876afd6e00LL),-reale(2403756,0x12692c3266800LL), reale(1377366,0xde24866584200LL),-reale(1585712,0xf2192bea6b400LL), reale(268682,0xb0f056b079600LL),reale(77255,0xca5a822ebf740LL), reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^19, polynomial in n of order 10 reale(8073134,0x8bff962f2e000LL),-reale(9331256,0xe8e10405e1000LL), reale(8608510,0x42ad0321d8000LL),-reale(3959617,0x4c778c1e2f000LL), reale(6283090,0x55033b3d82000LL),-reale(2832307,0xbbdb17809d000LL), reale(2955095,0x929c8347ec000LL),-reale(2459067,0xd43d49c36b000LL), reale(787004,0x9cc4866d6000LL),-reale(1039103,0x6b1983acd9000LL), reale(412222,0xf695367aa1b00LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^18, polynomial in n of order 11 reale(8586281,0xffd2991fd000LL),-reale(20926106,0xdd733d721a000LL), reale(9282973,0x193483c94f000LL),-reale(8121077,0x9b55004148000LL), reale(9430655,0x90c0e29221000LL),-reale(3512067,0x80c2ac76000LL), reale(5840995,0x1886eb4173000LL),-reale(3061324,0xab1a78b4a4000LL), reale(2049544,0x4067911445000LL),-reale(2292525,0x617c054ad2000LL), reale(297833,0x966e637f97000LL),reale(88539,0x9a2e50b8c6400LL), reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^17, polynomial in n of order 12 reale(32196457,0xd679f8ae1c000LL),-reale(40594018,0x37167c5ef5000LL), reale(8052650,0x2eda271162000LL),-reale(20325613,0xcd34eeff17000LL), reale(11030346,0x5827875768000LL),-reale(6662972,0x9685f0fc59000LL), reale(10015916,0xfa65faac6e000LL),-reale(3377057,0x1ef6021e7b000LL), reale(4892320,0x94cb79bcb4000LL),-reale(3369439,0x93437f1d3d000LL), reale(1068721,0xdee482d47a000LL),-reale(1596884,0xcb3e26805f000LL), reale(562334,0xcf5270735f500LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^16, polynomial in n of order 13 reale(239019678,0x7928c61a8b800LL),-reale(41200119,0x147c0b11e000LL), reale(27063572,0xac3757be98800LL),-reale(45155983,0xc412cf1f79000LL), reale(8354845,0xf8b6ea7445800LL),-reale(18750027,0x4e7377c014000LL), reale(13292220,0xfed958edd2800LL),-reale(5165101,0x26aa3105af000LL), reale(10025000,0x43fec217f800LL),-reale(3715677,0xed5a4430a000LL), reale(3405288,0xc16fe1018c800LL),-reale(3440521,0x6cb0e4f2e5000LL), reale(291108,0x30be23439800LL),reale(90314,0xe93f4121c6900LL), reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^15, polynomial in n of order 14 -reale(301344600,0x1f7a69f35a000LL),-reale(137666269,0x81776c9d9b000LL), reale(257500426,0xa27a71193c000LL),-reale(52745704,0xa8e59f44d000LL), reale(20527629,0x3707e00852000LL),-reale(49389175,0x1679a6a55f000LL), reale(10057417,0xa546ce8428000LL),-reale(15960633,0x79a78f6a91000LL), reale(15828795,0x3b7a7e96fe000LL),-reale(4041479,0x5385608da3000LL), reale(9015452,0x8a056dcb14000LL),-reale(4531739,0xb18fd7c855000LL), reale(1608583,0x5c81da4aaa000LL),-reale(2620079,0xb9c03a2467000LL), reale(790676,0xf12036cb88d00LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^14, polynomial in n of order 15 -reale(152316078,0x9ee9710b1f000LL),reale(396132268,0xf6300698d2000LL), -reale(331944543,0x2a26efc8bd000LL),-reale(111967823,0x409ccb544c000LL), reale(276102802,0x8592b62d25000LL),-reale(69409637,0x2e4659b6a000LL), reale(12806364,0xaa4a38387000LL),-reale(52382533,0xaa3aad6588000LL), reale(13858261,0x7d9fda6f69000LL),-reale(11925525,0x17f68feba6000LL), reale(17994828,0x2633a57dcb000LL),-reale(3926621,0x9c334da6c4000LL), reale(6610729,0xa84ec063ad000LL),-reale(5341800,0xcfe0c57fe2000LL), reale(171304,0xc92dc0ce0f000LL),reale(53498,0x8a12fdd94c400LL), reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^13, polynomial in n of order 16 reale(945329,0x3e694a5630000LL),reale(13046260,0xd11553dc81000LL), -reale(145063327,0x6c5bbd04f6000LL),reale(395288944,0x9758cc3483000LL), -reale(364989750,0x4da45c465c000LL),-reale(77659847,0x7f601a5fdb000LL), reale(293261136,0xdb46a6c9be000LL),-reale(92956699,0x68d702f4d9000LL), reale(4748491,0xd717292318000LL),-reale(52641236,0xde7217eeb7000LL), reale(20401071,0xa831b35d72000LL),-reale(7165143,0xe2daef21b5000LL), reale(18530179,0x70f1fa908c000LL),-reale(5449998,0x995f61f213000LL), reale(2985284,0xf423c13426000LL),-reale(4674955,0x4c99b17411000LL), reale(1148405,0xaa811667d8300LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^12, polynomial in n of order 17 reale(39064,0xc457745427a00LL),reale(149707,0xe179ab818a000LL), reale(834482,0xb3de3faf4c600LL),reale(11844090,0x43801d34c0c00LL), -reale(136492367,0x606ac4f4b6e00LL),reale(391413380,0x8b1b355567800LL), -reale(399991879,0xf56c51d232200LL),-reale(32313943,0x670cb1cd91c00LL), reale(306137820,0x47c0d4df8aa00LL),-reale(125355715,0x12c37db13b000LL), -reale(1549012,0x61de67b1d0a00LL),-reale(48002827,0x1ef791fca4400LL), reale(29707099,0x80264b6e6c200LL),-reale(3304868,0xd90dacdedd800LL), reale(15595740,0x1c41b85df0e00LL),-reale(8339676,0x731c5b6cf6c00LL), -reale(264319,0x3253133a92600LL),-reale(128183,0x1fd72f4c70540LL), reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^11, polynomial in n of order 18 reale(3796,0xb8b80a685d000LL),reale(10243,0xe5415b1644800LL), reale(32134,0x75fe9c2f28000LL),reale(125896,0x13cc0b67cb800LL), reale(720062,0x2eb5ef2cf3000LL),reale(10542664,0x8e7784ebe2800LL), -reale(126401502,0xa942d02d22000LL),reale(383396973,0xa914c081a9800LL), -reale(435856143,0x9e18e4ddf7000LL),reale(26921352,0xa17bcee040800LL), reale(309790567,0x432113bb94000LL),-reale(168177156,0xf5a6b5d938800LL), -reale(1732899,0x7848d10f61000LL),-reale(36033193,0x6ff05a93a1800LL), reale(39850986,0x4a7ce5d24a000LL),-reale(3520516,0x12d4d9afda800LL), reale(7904559,0x47211641b5000LL),-reale(9293198,0x11e52b76c3800LL), reale(1712350,0xd1c47193d5a80LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^10, polynomial in n of order 19 real(0x20b0c3dbe662b800LL),real(0x49a4ee6b654d5000LL), reale(2895,0xbb9a481b3e800LL),reale(7963,0xd6290c9168000LL), reale(25525,0x742091bd91800LL),reale(102493,0xec03f49fb000LL), reale(603292,0x6fe940faa4800LL),reale(9144553,0x3f081030e000LL), -reale(114581171,0x9502f66408800LL),reale(369767644,0x159b783921000LL), -reale(470438620,0x42537ac0f5800LL),reale(102998223,0x33db2118b4000LL), reale(295924658,0xfd504b0d5d800LL),-reale(220875824,0xd68590c9b9000LL), reale(12088406,0x3b87c77470800LL),-reale(15966308,0xf7cc70b9a6000LL), reale(44660638,0xbb68d3ddc3800LL),-reale(11155854,0x316b572a93000LL), -reale(1400757,0x91d7719929800LL),-reale(909990,0x5b4dcbdcd9200LL), reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^9, polynomial in n of order 20 real(0x55091490e3fe000LL),real(0xab3101736f26800LL), real(0x16d77945c4e3b000LL),real(0x345d2a91137d7800LL), reale(2099,0xc55d2c398000LL),reale(5898,0x424192198800LL), reale(19366,0xa6f5f449f5000LL),reale(79943,0x847cdfac49800LL), reale(486014,0x6a1dc16732000LL),reale(7659629,0x94cc8fca800LL), -reale(100839015,0x651046eed1000LL),reale(348607247,0x22ddc22bfb800LL), -reale(499815073,0x4df2756234000LL),reale(197958555,0x77a0b2f8bc800LL), reale(251323198,0x2663cfb2e9000LL),-reale(276534810,0xe292670a12800LL), reale(51555588,0x6a67a23666000LL),reale(5587968,0x5e92831b6e800LL), reale(32523682,0xed2ae23e23000LL),-reale(21111776,0x46401336e0800LL), reale(2489921,0xe3c1e337a6d80LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^8, polynomial in n of order 21 real(0xeb8379f6b27c00LL),real(0x1b6c4de1f1d7000LL), real(0x355a1dadc956400LL),real(0x6d308de46411800LL), real(0xed54313f63d4c00LL),real(0x22ae87428a2ac000LL), real(0x58ce5dd980bc3400LL),reale(4090,0xd3c824bc46800LL), reale(13806,0x44b4a8a441c00LL),reale(58809,0x7ab991df81000LL), reale(370898,0xe410033e70400LL),reale(6109620,0x6402b9f6fb800LL), -reale(85053139,0x4bf446ca91400LL),reale(317515928,0x1b63894556000LL), -reale(517123103,0xa7a388b5a2c00LL),reale(310296682,0xe98bc80130800LL), reale(156996715,0xaa3cf3c05bc00LL),-reale(312601560,0xdd28200ed5000LL), reale(125126811,0xf01e02788a400LL),reale(4091818,0xb5091207e5800LL), -reale(866059,0xc9a79cf1f7400LL),-reale(4943757,0xf4721fe538b80LL), reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^7, polynomial in n of order 22 real(0x2814d49c0c5000LL),real(0x468b0d3a3db800LL), real(0x80724d98876000LL),real(0xf31dbc49b20800LL), real(0x1e12cb4a6a67000LL),real(0x3eb5a58b5455800LL), real(0x8b1eef20fbf8000LL),real(0x14cb29a266eda800LL), real(0x36974c82ca289000LL),reale(2585,0xefae20720f800LL), reale(9007,0x1d6baf437a000LL),reale(39779,0x24ec74fd54800LL), reale(261696,0x442f64f42b000LL),reale(4534975,0xa5b17f809800LL), -reale(67279179,0x4d9bf05604000LL),reale(273758534,0xd27122c18e800LL), -reale(510920394,0x40d515b3000LL),reale(428723861,0x53ee2b6143800LL), -reale(7330129,0x37be948582000LL),-reale(275708250,0xae16364977800LL), reale(204390109,0xe684af0fef000LL),-reale(52540960,0x7463315742800LL), reale(2056891,0xfeee14beab380LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^6, polynomial in n of order 23 real(0x628e4f4bb7800LL),real(0xa60e374943000LL),real(0x11fae77940e800LL), real(0x2022ddc061a000LL),real(0x3b7f2e2d7a5800LL), real(0x72aa26ca9f1000LL),real(0xe77392a11fc800LL), real(0x1ed1e51d0348000LL),real(0x460248a5fa93800LL), real(0xabd9e84dc89f000LL),real(0x1d078c2cd5cea800LL), real(0x58c9fda5cf076000LL),reale(5134,0xa77137081800LL), reale(23653,0x63d76094d000LL),reale(163469,0x772f4630d8800LL), reale(3004667,0x8d384291a4000LL),-reale(47956830,0xd53f134a90800LL), reale(214953528,0xfe0a5a4ffb000LL),-reale(463620631,0xbff95a7639800LL), reale(519033396,0x411553aad2000LL),-reale(237300381,0xd565fafaa2800LL), -reale(84296486,0x10fabff57000LL),reale(142611178,0x607af3a3b4800LL), -reale(46622885,0x3d1480e1d3a00LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^5, polynomial in n of order 24 real(0xc0b5b2cac000LL),real(0x139ac5d2ed800LL),real(0x20abe97223000LL), real(0x37e2f8cba0800LL),real(0x6269b1d1ba000LL),real(0xb3074a8a43800LL), real(0x151de1e3911000LL),real(0x298e5ccaa76800LL), real(0x55d208375c8000LL),real(0xbb7ea958fd9800LL), real(0x1b5e1854857f000LL),real(0x4547c4b8360c800LL), real(0xc1cdc899e5d6000LL),real(0x2682d6f5e00af800LL), reale(2326,0xf44888e46d000LL),reale(11275,0x7d4afe8b62800LL), reale(82638,0x859516eee4000LL),reale(1628359,0xc1653179c5800LL), -reale(28286265,0xc31f9b1d25000LL),reale(141205400,0x2bb5164778800LL), -reale(353352393,0x632221a20e000LL),reale(504046796,0x730ece181b800LL), -reale(416863444,0x7c7b16f237000LL),reale(186491540,0xf45203874e800LL), -reale(34967163,0xedcf60a95eb80LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[4], coeff of eps^4, polynomial in n of order 25 real(0xe07098dae00LL),real(0x16338b625000LL),real(0x23dda179f200LL), real(0x3b41a69cf400LL),real(0x645a89a6b600LL),real(0xaeabe0e09800LL), real(0x1397028dcfa00LL),real(0x246014e923c00LL),real(0x4633de275be00LL), real(0x8d95c8a56e000LL),real(0x12c670f9ba0200LL), real(0x2a433484738400LL),real(0x6608a70542c600LL), real(0x10c10ac322d2800LL),real(0x30ddb4b92590a00LL), real(0xa2e30513d28cc00LL),real(0x289386109855ce00LL), reale(3347,0x17499d2cb7000LL),reale(26358,0x5763b5c021200LL), reale(564821,0x99c65b39a1400LL),-reale(10825747,0x58af29d092a00LL), reale(60624185,0x23d4ea299b800LL),-reale(172778927,0xa61ece902e600LL), reale(279737311,0x6e7b054af5c00LL),-reale(233114426,0x3166846922200LL), reale(75762188,0x8341516ef7e40LL),reale(36916310137LL,0x41f43bb0c949LL), // C4[5], coeff of eps^29, polynomial in n of order 0 3108352,real(0x4338129a0b3LL), // C4[5], coeff of eps^28, polynomial in n of order 1 -real(4961047LL<<17),real(304969986048LL),real(0x171a7cbcbc0a5e7LL), // C4[5], coeff of eps^27, polynomial in n of order 2 -real(0xb7a8cf8589000LL),real(0x25cdf8a9f5800LL),real(0xaa8ee05df480LL), reale(53207,0x4825dfa147919LL), // C4[5], coeff of eps^26, polynomial in n of order 3 -real(0x4519d2e6066000LL),real(0x17b1d503134000LL), -real(0x1b53dc2d3c2000LL),real(0xc104a529c3b00LL), reale(207992,0x1a086a30a3679LL), // C4[5], coeff of eps^25, polynomial in n of order 4 -real(0xe48436400f9e000LL),real(0x825cbe3b5113800LL), -real(0x9657faac8f9f000LL),real(0x1ac735d19d16800LL), real(0x7b639e59c13780LL),reale(8527676,0x2b5901ca2b961LL), // C4[5], coeff of eps^24, polynomial in n of order 5 -real(0x13b86e0d5c5dc000LL),real(0x135f9b0385fb0000LL), -real(0x10df1064c3304000LL),real(0x58b0ae17a818000LL), -real(0x70d05036b8ec000LL),real(0x2e5299a0b610e00LL), reale(10178194,0x2338af8e3405bLL), // C4[5], coeff of eps^23, polynomial in n of order 6 -reale(126383,0x5f6b81564f000LL),reale(192332,0x2215a4d90d800LL), -reale(113392,0x893928fcaa000LL),reale(71665,0x3fb557978e800LL), -reale(81791,0xa6f9503f45000LL),reale(12036,0x1a6fad5adf800LL), reale(3561,0x9aef6f2cefa80LL),reale(3470764200LL,0xea81d86b4b937LL), // C4[5], coeff of eps^22, polynomial in n of order 7 -reale(191647,0x188f775ada000LL),reale(308186,0x45ee8f2434000LL), -reale(124928,0xd21a49314e000LL),reale(153616,0xaed0e35eb8000LL), -reale(118466,0xc4b6a2a9a2000LL),reale(38029,0x77ad4b77bc000LL), -reale(53612,0x41f60b8316000LL),reale(20169,0xecfa5f7fa8900LL), reale(3470764200LL,0xea81d86b4b937LL), // C4[5], coeff of eps^21, polynomial in n of order 8 -reale(5169843,0xc81db86efc000LL),reale(5341939,0xe957aa505800LL), -reale(2049228,0x2e9753666d000LL),reale(3734678,0xdcd2e44998800LL), -reale(1762099,0xebebc251fe000LL),reale(1337844,0xa441c7cbb800LL), -reale(1455577,0x7e18adc04f000LL),reale(163809,0xd9aab3cbce800LL), reale(50215,0x8f7a6f7ead780LL),reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^20, polynomial in n of order 9 -reale(11201228,0x9af12fea90000LL),reale(5330620,7096189457LL<<19), -reale(4084126,0xa473ecba70000LL),reale(5776338,0xc1238f4360000LL), -reale(1850318,0x7e36514750000LL),reale(3091001,2788978033LL<<18), -reale(1978996,0x9854b5b30000LL),reale(651396,0xde4e2e0920000LL), -reale(1009381,0x5e1878c010000LL),reale(341219,0x67868049b6800LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^19, polynomial in n of order 10 -reale(19364139,0xf3aad6c27e000LL),reale(3661269,0x231a8ee911000LL), -reale(10171658,0x9bc1444518000LL),reale(6650152,0x1449aa44ff000LL), -reale(2982446,0xb2f133d6b2000LL),reale(5796709,0x225c7b8fcd000LL), -reale(2004712,0xb33d0f538c000LL),reale(2087887,0x2718a4e53b000LL), -reale(2041244,0xb9c4a8d7e6000LL),reale(150337,0x64e8ec0109000LL), reale(48205,0x4eea8f2f13300LL),reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^18, polynomial in n of order 11 -reale(17821498,0x43ce2fe394000LL),reale(8113989,0x34042cf6f8000LL), -reale(21055211,0x1d823792dc000LL),reale(4458324,0xaba1762760000LL), -reale(8384573,0x54084121e4000LL),reale(8079221,0xcbb99849c8000LL), -reale(2172398,0x503335ed2c000LL),reale(5129813,0x3b8a4c21b0000LL), -reale(2481567,0xadec795134000LL),reale(934125,9279934035LL<<15), -reale(1531704,0x9cc504aa7c000LL),reale(453383,0xd34e451346a00LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^17, polynomial in n of order 12 reale(4095301,0x789aeb9e64000LL),reale(49542396,0x46ab457e8d000LL), -reale(24303219,0x1ccf0dd62000LL),reale(4679495,0x21a30e03df000LL), -reale(21666597,0xecbbb1868000LL),reale(6429258,0x6611bb6911000LL), -reale(5963806,0x7f45fe6c6e000LL),reale(9141324,0xab5773fc63000LL), -reale(2043796,0x5ca6f33334000LL),reale(3626747,0xd85dd12c15000LL), -reale(2919955,0xba0fdf867a000LL),reale(85758,0x333e03c667000LL), reale(28339,0x9119c9ad54d00LL),reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^16, polynomial in n of order 13 -reale(273240474,0x43c43c74c8000LL),reale(133674826,0x952bfc30e0000LL), reale(7048142,0x68e4684408000LL),reale(44883009,0xdb6a70b90000LL), -reale(32370151,0x153b9e91a8000LL),reale(2006331,0xa0ac245340000LL), -reale(20459012,0x9d1a27ed8000LL),reale(9634139,0x6e1e5ebef0000LL), -reale(3415127,0x8d101d0c88000LL),reale(9090639,8214448173LL<<17), -reale(2849328,0xea461fc3b8000LL),reale(1554483,7516134885LL<<16), -reale(2460922,0x6540542d68000LL),reale(615586,0x6f27f96118400LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^15, polynomial in n of order 14 reale(385255297,0xc522d651da000LL),-reale(58599463,0x810289e63d000LL), -reale(271784816,0x96bdc01bbc000LL),reale(164665597,0xfc4f4e3665000LL), reale(6169937,0xa7ea1cfd2e000LL),reale(36278794,0xf1d4bf77a7000LL), -reale(41327996,0x5935502f28000LL),reale(1406713,0xae66a659c9000LL), -reale(16753028,0x6b0d0fac7e000LL),reale(13550589,0x7d5a3390b000LL), -reale(1765295,0x851b6e8694000LL),reale(7142364,0xca525091ad000LL), -reale(4183412,0x818c59892a000LL),-reale(96164,0xa4307ac011000LL), -reale(44020,0x281c2d0515b00LL),reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^14, polynomial in n of order 15 reale(85300002,0xc7e70a9f1c000LL),-reale(294351273,0xafb8edef98000LL), reale(403760509,0xda2cbc2e94000LL),-reale(107444454,0x9ae8f34870000LL), -reale(261509454,0x4bda846b4000LL),reale(200593259,0xcaf344c1b8000LL), -reale(1492598,0x1c0b3e713c000LL),reale(23203659,0x98196f9e60000LL), -reale(49434335,0xf8209c0184000LL),reale(4620325,0x4eb0e8bd08000LL), -reale(10475101,0x343acca80c000LL),reale(16597245,8542632147LL<<16), -reale(2356576,0x3bbee61554000LL),reale(3249396,0x1edbdd7e58000LL), -reale(4240477,0x930e83f9dc000LL),reale(851256,0x2b979a0197a00LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^13, polynomial in n of order 16 -reale(334885,0xc6bdc7fcb0000LL),-reale(5563880,0xa3a405a9f1000LL), reale(77196254,0x955c2ca786000LL),-reale(280592470,0x60fd2cd013000LL), reale(419465490,0x135ebd637c000LL),-reale(164134806,0xd03e535795000LL), -reale(238238642,0xf95f61c30e000LL),reale(239782224,0x6d53e5d49000LL), -reale(20068072,0x4afa414658000LL),reale(6399560,0x53e56b4c47000LL), -reale(53380994,0xb54d3160a2000LL),reale(13179100,0x7f23319325000LL), -reale(3190623,0x71f1454c2c000LL),reale(15946535,0x7112262fa3000LL), -reale(5597132,0xd891768336000LL),-reale(517466,0x3872db407f000LL), -reale(280398,0x37b65ce5ca500LL),reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^12, polynomial in n of order 17 -reale(9362,0x69735ac9d0000LL),-reale(41698,3327447843LL<<20), -reale(274851,0x56e2bdf830000LL),-reale(4724425,0xa83b5c01a0000LL), reale(68370240,0x5baadc4870000LL),-reale(262946254,0xff686b9240000LL), reale(430395020,0x66a0aab610000LL),-reale(228360148,0x64a23696e0000LL), -reale(196492193,0xc6f6cbf150000LL),reale(277855749,243039325LL<<19), -reale(54565881,0x3f0390efb0000LL),-reale(10430670,3478671393LL<<17), -reale(48232829,0x9769bd8710000LL),reale(26504611,0xd8be140f40000LL), reale(733724,0x9fb250690000LL),reale(8992810,0x9e09f3a6a0000LL), -reale(7946224,0xca1f6288d0000LL),reale(1176502,0x79934ee544800LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^11, polynomial in n of order 18 -real(0x274a66713f785000LL),-real(0x78cbe0a9df914800LL), -reale(6986,0x5cd0ed6f68000LL),-reale(31980,0xbaca6835fb800LL), -reale(217574,0x7dc41d384b000LL),-reale(3882916,0x2edd7dacd2800LL), reale(58859398,0xdc7c0f67f2000LL),-reale(240755855,0x78dc5ddf79800LL), reale(433769587,0x318800cb6f000LL),-reale(298315443,0xab75c9fd0800LL), -reale(129660149,0x66ef2473b4000LL),reale(305615878,0x94b6a51048800LL), -reale(109156237,0x593300db57000LL),-reale(18007247,0x43b21e10e800LL), -reale(29424146,0x61ad17715a000LL),reale(38156138,0xf0096c8a4a800LL), -reale(4683041,0xee399b1b9d000LL),-reale(1149725,0xbf46657f8c800LL), -reale(1106736,0x8c2ceac93e180LL),reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^10, polynomial in n of order 19 -real(0x3bd4906e474e000LL),-real(0x97941b80ce3c000LL), -real(0x1a66716bc5afa000LL),-real(0x532298a0bc3e0000LL), -reale(4939,0xda9250746000LL),-reale(23308,0x7863f72384000LL), -reale(164254,0x558c90eef2000LL),-reale(3056120,0xcef6e5fe8000LL), reale(48766418,0xafc6204b42000LL),-reale(213414260,0xdc9b1ebcc000LL), reale(425806905,0x15318e0496000LL),-reale(369415923,0x757d6c39f0000LL), -reale(31178847,0x2c748765b6000LL),reale(306118804,0x213b4942ec000LL), -reale(181898310,0x263b289662000LL),reale(568685,0x4686791808000LL), -reale(309548,0x34bb55302e000LL),reale(32975540,0x34fcc4d2a4000LL), -reale(16246779,0x8dca2dd5da000LL),reale(1477949,0xdae92a7065f00LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^9, polynomial in n of order 20 -real(0x69d018a3b9e000LL),-real(0xed437c3919a800LL), -real(0x237e48279feb000LL),-real(0x5bea2151a0b3800LL), -real(0x10666acb6ec18000LL),-real(0x350c7e1643d3c800LL), -reale(3247,0xe2be74bf45000LL),-reale(15860,0x268da19a55800LL), -reale(116263,0x5e4790b892000LL),-reale(2266502,0x8314b6fb1e800LL), reale(38294967,0xecf46ee8e1000LL),-reale(180538484,0x555f9ed2b7800LL), reale(401643505,0x9c33fda5f4000LL),-reale(432258273,0xf8da98e440800LL), reale(101814780,0x5dd5e11f87000LL),reale(252370005,0x80f91f9d26800LL), -reale(252307179,0x99e21a8986000LL),reale(63455824,0x191a53ee5d800LL), reale(12621880,0x95e41abad000LL),reale(2033357,0xc3307b9c44800LL), -reale(4727243,0x20838a8bae80LL),reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^8, polynomial in n of order 21 -real(0xc09a6adbf4000LL),-real(0x18cab6e3030000LL), -real(0x359d0ace62c000LL),-real(0x7ab7d9cc438000LL), -real(0x12c67ab580a4000LL),-real(856171152199LL<<18), -real(0x9233f1c13ddc000LL),-real(0x1e779de654b48000LL), -real(0x789f22a00b054000LL),-reale(9796,7021023797LL<<16), -reale(75089,0xae07706a8c000LL),-reale(1543001,0x638fcd4c58000LL), reale(27798321,0x1e96e700fc000LL),-reale(142306959,0xd3ad6eb8e0000LL), reale(355697955,0xce7f78ffc4000LL),-reale(469861249,0x5989105b68000LL), reale(259457720,0x1370b4ff4c000LL),reale(112194489,0x36d40ed990000LL), -reale(260872269,0xf8005192ec000LL),reale(151422395,0x58f7b5f388000LL), -reale(32332898,0xbdc6e34964000LL),reale(433029,0xe4d3ce78fba00LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^7, polynomial in n of order 22 -real(0x1441fa2f35000LL),-real(0x272c726527800LL), -real(0x4ebdd7b856000LL),-real(0xa564301b74800LL), -real(0x16d6333bd37000LL),-real(0x3580dec1951800LL), -real(0x865ae53c178000LL),-real(0x16ec61d7f65e800LL), -real(0x455fa2e228b9000LL),-real(0xef77f4cbfa3b800LL), -real(0x3d9c6e708569a000LL),-reale(5230,0x8a511fbc88800LL), -reale(42196,0xcfdba8cebb000LL),-reale(920786,0xf57a80c4e5800LL), reale(17837247,0x2fc56aab44000LL),-reale(100064916,0x5e72032af2800LL), reale(283253574,0xc37962f3c3000LL),-reale(455567530,0xe21e28364f800LL), reale(400948026,0xf028b16722000LL),-reale(118913774,0x549816fe9c800LL), -reale(112010399,0x36034a3e3f000LL),reale(121825743,0x78c43cf486800LL), -reale(36338425,0x426e19287b880LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^6, polynomial in n of order 23 -real(0x1b5badebe000LL),-real(0x326332ca4000LL),-real(0x5fd1bd93a000LL), -real(0xbcd8e5378000LL),-real(0x1837bef256000LL), -real(0x3404424ccc000LL),-real(0x75bf8cd1d2000LL), -real(38025986691LL<<17),-real(0x2dc96f11f6e000LL), -real(0x811a6e895f4000LL),-real(0x195036bc82ea000LL), -real(0x5af70d135548000LL),-real(0x187d57cdaa406000LL), -reale(2189,0x32d399c61c000LL),-reale(18742,0x385cb42a82000LL), -reale(438375,0xd6a8872030000LL),reale(9224813,0x89f7eb41e2000LL), -reale(57288808,0xfdc8999b44000LL),reale(184899999,0x331692f966000LL), -reale(357870966,0x3154fb6f18000LL),reale(431875147,0x7929b7544a000LL), -reale(318710001,0xe0f19bd36c000LL),reale(131641087,0xbb852faace000LL), -reale(23311442,0x9e8a4070e9d00LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[5], coeff of eps^5, polynomial in n of order 24 -real(92116035LL<<14),-real(0x26e7bc2d800LL),-real(0x46d3779b000LL), -real(0x84e1d0c0800LL),-real(0x101cbc30a000LL),-real(0x2073376e3800LL), -real(0x442adb8b9000LL),-real(0x963884ff6800LL),-real(0x15dbd71e08000LL), -real(0x363ebc6d59800LL),-real(0x9122bbd857000LL), -real(0x1a90a4ab06c800LL),-real(0x56f0a68cd06000LL), -real(0x147a29992a8f800LL),-real(0x5d1402e6c175000LL), -real(0x228e263277d22800LL),-reale(5078,0x584c613b04000LL), -reale(128863,0x92233985800LL),reale(2982258,0xd360aa0ed000LL), -reale(20710125,0x5bbe664118800LL),reale(76213261,0x519df32cfe000LL), -reale(171479837,0xf7a363253b800LL),reale(241341994,0x2d1ed763cf000LL), -reale(186491540,0xf45203874e800LL),reale(58278606,0x8c59a11a48880LL), reale(45119934611LL,0xe897fd72d67cbLL), // C4[6], coeff of eps^29, polynomial in n of order 0 139264,real(63626127165LL), // C4[6], coeff of eps^28, polynomial in n of order 1 real(247833LL<<16),real(4782743552LL),real(0x219ae3fb400f15LL), // C4[6], coeff of eps^27, polynomial in n of order 2 real(420150473LL<<18),-real(0x876551ce0000LL),real(0x350bfa156000LL), reale(4837,0x68f14547adebLL), // C4[6], coeff of eps^26, polynomial in n of order 3 real(0x297e6b0e9e1000LL),-real(0x2e90de909aa000LL), real(0x6148b0a84b000LL),real(0x1d77336bca600LL), reale(207992,0x1a086a30a3679LL), // C4[6], coeff of eps^25, polynomial in n of order 4 real(0x10bc6a9e4ee30000LL),-real(0xc179e3d40c9c000LL), real(0x3edf483df118000LL),-real(0x5c91fff78634000LL), real(0x216fdab58654400LL),reale(10078162,0xbedd8dc0620e7LL), // C4[6], coeff of eps^24, polynomial in n of order 5 reale(17715,0xdb1cfba26000LL),-reale(7689,0x9976d7f948000LL), reale(6474,0xb1047d5d4a000LL),-reale(6855,0xa6eeabbaa4000LL), real(0x2ac3e335ea26e000LL),real(0xd6d2e7c22e28400LL), reale(372892021,0x96057cce2c163LL), // C4[6], coeff of eps^23, polynomial in n of order 6 reale(279883,0xa92c150938000LL),-reale(86797,0xd10c69f53c000LL), reale(160072,0xfd9d58a4d0000LL),-reale(96731,0xc2b3d16724000LL), reale(32938,0x46d62be868000LL),-reale(52162,0xc27e2d9b0c000LL), reale(17103,0x67a9fde667c00LL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[6], coeff of eps^22, polynomial in n of order 7 reale(293467,0x7db7c77729000LL),-reale(146628,0x46fd92fe6000LL), reale(282074,0xcdca0f3f8b000LL),-reale(92435,0x174eb2c344000LL), reale(105774,0xf5edeb18ed000LL),-reale(100726,0x78839052a2000LL), reale(6619,0xde4489894f000LL),reale(2174,0xdeb0a21cf2e00LL), reale(4101812237LL,0x723c5cdbe4f41LL), // C4[6], coeff of eps^21, polynomial in n of order 8 reale(183603,8337878185LL<<19),-reale(387951,0x8934978f10000LL), reale(363243,0x9b8677d760000LL),-reale(100927,0x6adc79e30000LL), reale(246790,7131746729LL<<18),-reale(115867,0xce56197550000LL), reale(45470,0x976a005d20000LL),-reale(74789,0x6bec0ac470000LL), reale(21823,0x7d1eb3d72b000LL),reale(4101812237LL,0x723c5cdbe4f41LL), // C4[6], coeff of eps^20, polynomial in n of order 9 reale(2390210,0x71ea4526d8000LL),-reale(11473167,6397281565LL<<18), reale(3566140,0xe9fdb6daa8000LL),-reale(3459649,0xbdbfad5d70000LL), reale(5328875,0xe507b89678000LL),-reale(1202839,0xbeff1963a0000LL), reale(2208040,0x527339ea48000LL),-reale(1770989,0xb71cae09d0000LL), reale(48626,0x557ebf6618000LL),reale(16670,0x4a1716aa8d000LL), reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^19, polynomial in n of order 10 reale(16170911,0xf66942f9a0000LL),-reale(15946100,0x87937e1ff0000LL), reale(1191966,5683381737LL<<19),-reale(10381645,0x67a9610710000LL), reale(5401104,0xec5f94af60000LL),-reale(1916345,0x9f2b7d6630000LL), reale(5166787,7293640425LL<<18),-reale(1681428,0xa094a5ad50000LL), reale(912008,0xad6a83a520000LL),-reale(1452992,0x3f13404c70000LL), reale(367621,0xca46f4fdbb000LL),reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^18, polynomial in n of order 11 reale(51879505,0x1c6021da42000LL),-reale(3388727,0x452f2e2244000LL), reale(10993546,0x58785d1036000LL),-reale(19450323,0x2862de39d0000LL), reale(1456775,0xebc764482a000LL),-reale(7922511,0x8d8f4f815c000LL), reale(7390372,0xfe1ce59e1e000LL),-reale(1065019,0x2a2a06ce8000LL), reale(3871757,0x7ef447ee12000LL),-reale(2395461,0x8df44bf074000LL), -reale(40351,0xb597a7abfa000LL),-reale(17707,0xeba2dcf1c1400LL), reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^17, polynomial in n of order 12 reale(18941665,0xd940803e20000LL),-reale(2462456,0xc647b5b638000LL), reale(55543449,0x9a9f25d270000LL),-reale(10182797,0xdffcb19ee8000LL), reale(4836527,0xb44e233ec0000LL),-reale(21402374,0x58dcab98000LL), reale(3817083,0xbef1c88b10000LL),-reale(4459099,0x992120d448000LL), reale(8502561,0xac3fb5bf60000LL),-reale(1525489,0x80b8b610f8000LL), reale(1649611,0x4cebe6e3b0000LL),-reale(2280763,0x4f507e59a8000LL), reale(482782,0x1ffc428c24800LL),reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^16, polynomial in n of order 13 reale(169672066,0xfc4e53058c000LL),-reale(255936417,0xcd4166f930000LL), reale(43044311,0x58bada2414000LL),reale(10984552,0x79ecf34458000LL), reale(54615551,0xb3c2ab069c000LL),-reale(20672829,0x547b9ae620000LL), -reale(762958,0xc96d76adc000LL),-reale(20252510,0xad74c43098000LL), reale(8266131,0x9541dc37ac000LL),-reale(1263055,0x9458475310000LL), reale(7416125,0xebded0d634000LL),-reale(3121438,0x16f54c0588000LL), -reale(225538,0xf843322744000LL),-reale(111163,0x41ef8785bb800LL), reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^15, polynomial in n of order 14 -reale(371272727,0xe93844d330000LL),reale(258600199,0x3ab9b44ef8000LL), reale(127447726,0xd7dad2fc20000LL),-reale(278220404,0x7730102b8000LL), reale(77869881,0xad9b189b70000LL),reale(21813766,0xb09d2ff98000LL), reale(46644312,9197745227LL<<18),-reale(33841430,0x25b28aa218000LL), -reale(3096455,0x6fa54a95f0000LL),-reale(14807144,0xa86ee6dfc8000LL), reale(13281582,0xf66e06a960000LL),-reale(452377,0x35cd9cb178000LL), reale(3621811,0x85d91d8b0000LL),-reale(3791781,0x3a80710f28000LL), reale(636887,0x5f8cc1d1bc800LL),reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^14, polynomial in n of order 15 -reale(40751652,0x879256f716000LL),reale(182461023,0x62c00442f4000LL), -reale(366891419,0xe235688602000LL),reale(303920923,0x2a6218fe88000LL), reale(70640959,0xa70aa30512000LL),-reale(290919308,0xf0cc1f4de4000LL), reale(124435738,0x116d522626000LL),reale(24575054,0x49539549b0000LL), reale(29829722,0x6d4c4f193a000LL),-reale(46205497,0xcd680acebc000LL), reale(1253661,0x8798d15a4e000LL),-reale(5829398,0x329c172b28000LL), reale(15178042,0x87d0f72562000LL),-reale(3413258,0x604057df94000LL), -reale(544537,0x1343d1098a000LL),-reale(371792,0x5ec0380ab3400LL), reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^13, polynomial in n of order 16 reale(100946,21976965LL<<20),reale(2010862,0x3c46708bb0000LL), -reale(34502092,0x6e09dbf3a0000LL),reale(163298206,0x527fb2e110000LL), -reale(355839921,948516465LL<<18),reale(347383598,0x3243b82e70000LL), -reale(2611762,0xae3f6124e0000LL),-reale(286060486,421499843LL<<16), reale(181022396,2339564421LL<<19),reale(11053843,0x8ea9e8f130000LL), reale(5354229,0xc704cb69e0000LL),-reale(50862137,0xf12aeaf970000LL), reale(14064844,5665935493LL<<18),reale(1748678,0x2e869553f0000LL), reale(9719088,0x671cfc38a0000LL),-reale(6714197,0x76aa8fd6b0000LL), reale(816805,0x9ce5b98e4f000LL),reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^12, polynomial in n of order 17 real(0x75cff722d22b8000LL),reale(9742,5260669319LL<<19), reale(75734,0x79163f0448000LL),reale(1568684,0xd935dd4310000LL), -reale(28213944,0x88db35f228000LL),reale(141802366,0xe4716652a0000LL), -reale(336424367,0x7aaa4f7098000LL),reale(384795625,0xe2aff0230000LL), -reale(92516926,0xbd45322708000LL),-reale(252728877,4730701433LL<<18), reale(239978666,0xfd893c3a88000LL),-reale(28528394,5445461995LL<<16), -reale(18370370,0x5cd8a4fbe8000LL),-reale(38961300,0x78b7628f20000LL), reale(30014507,0xb37b1485a8000LL),-reale(654615,0xa96a2bf90000LL), -reale(667571,0x85c41bf0c8000LL),-reale(1181523,0x1c81baa857000LL), reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^11, polynomial in n of order 18 real(0x55d873de6520000LL),real(0x12c7cfeef6810000LL), real(0x4e200e3f1e1LL<<20),reale(6671,0xd2467fb9f0000LL), reale(53806,3275978471LL<<17),reale(1163348,0xd1cfb7f3d0000LL), -reale(22032298,0xf3cc53d740000LL),reale(118198962,4397370971LL<<16), -reale(306929389,0x72efa76b60000LL),reale(409945031,0xba4df5f90000LL), -reale(195574008,5584443935LL<<19),-reale(178055138,0x4cd4f3ce90000LL), reale(282861404,0xd715020c60000LL),-reale(99637722,0xf11193d4b0000LL), -reale(20986520,0xfb661347c0000LL),-reale(8771627,7018708525LL<<16), reale(31360164,0xdb2c51c420000LL),-reale(12477955,8590832271LL<<16), reale(873590,0xbe0d3e9693000LL),reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^10, polynomial in n of order 19 real(0x5808512b12b000LL),real(0xfaa729276e2000LL), real(0x3175560e4519000LL),real(0xb21b680b3a90000LL), real(0x2fcbc5fe71407000LL),reale(4229,0xf0de326e3e000LL), reale(35532,0x38e22907f5000LL),reale(805604,0x42db4fa3ec000LL), -reale(16150031,0xfe4d67d51d000LL),reale(93034137,0xf6628ead9a000LL), -reale(265995225,0x398943192f000LL),reale(414315266,0x970145dd48000LL), -reale(301204836,0xc549c7ba41000LL),-reale(51738066,0x4e1063bb0a000LL), reale(275650719,0x10481031ad000LL),-reale(187610845,0x85f00095c000LL), reale(25230256,0x4ada23b49b000LL),reale(13917204,0x3da6dc4452000LL), reale(4066715,0x8660f73889000LL),-reale(4361677,0xea98323d07e00LL), reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^9, polynomial in n of order 20 real(0x65fa8c6bf0000LL),real(0xfe88642ae4000LL),real(0x2aa82304e58000LL), real(0x7ca8bddcccc000LL),real(434853972467LL<<18), real(0x5e16320d44b4000LL),real(0x1a2859bf40b28000LL), reale(2409,0x1b825da69c000LL),reale(21179,0xabe6860d90000LL), reale(506292,0x5b6e5f0684000LL),-reale(10810252,0xeee1886808000LL), reale(67327238,0xa18a80786c000LL),-reale(213364581,0xe79aac41a0000LL), reale(387619687,0x51e3ba1054000LL),-reale(387180015,0xd550406b38000LL), reale(121695298,0x2400c6e23c000LL),reale(172879787,0x9e57682f30000LL), -reale(230507460,0xb74e70fddc000LL),reale(112381926,0x4eee70a198000LL), -reale(20283371,0x42949e7bf4000LL),-reale(288686,0x988d3450a7c00LL), reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^8, polynomial in n of order 21 real(0x72e86a7de000LL),real(8772831327LL<<15),real(0x273ffc1812000LL), real(0x64635c5cac000LL),real(0x11473cdd246000LL), real(0x33fd816c260000LL),real(0xae6e2137a7a000LL), real(0x29ff10928814000LL),real(0xc26a115cf4ae000LL), real(0x492994f20c1c8000LL),reale(10833,0x80f3c9e4e2000LL), reale(274842,0xd406a2037c000LL),-reale(6296293,0xca802ed0ea000LL), reale(42731189,0xb6f3d1e130000LL),-reale(151191524,0x41a7e788b6000LL), reale(320575109,0xae49526ee4000LL),-reale(416345568,0xb8c8445e82000LL), reale(298319523,0xb52957c098000LL),-reale(42956565,0x78799bae4e000LL), -reale(119892798,0x70342c95b4000LL),reale(103927174,0x8691916be6000LL), -reale(29157346,0x2fb5a3d22ec00LL), reale(53323559086LL,0xcd10b72aa064dLL), // C4[6], coeff of eps^7, polynomial in n of order 22 real(74709635LL<<15),real(0x4ba47734000LL),real(0xa7b994d0000LL), real(0x1869c5c6c000LL),real(0x3c23e3d88000LL),real(0x9e1c8b7a4000LL), real(1882100649LL<<18),real(0x573ad5a4dc000LL),real(0x12f915ab6f8000LL), real(0x4c1f4084014000LL),real(0x170ced7cbfb0000LL), real(0x921b89aca54c000LL),real(0x599b4a7922068000LL), reale(38914,0x1efa73f084000LL),-reale(964915,0x51a6da0ae0000LL), reale(7200274,0x92a23dbc000LL),-reale(28652022,0x356dea628000LL), reale(70837833,0x39cdeca8f4000LL),-reale(114872161,0xfcdf3a9570000LL), reale(122704354,0xd9bfe74e2c000LL),-reale(83141739,0x9edadabcb8000LL), reale(32332898,0xbdc6e34964000LL),-reale(5485045,0x527ae1fc73400LL), reale(17774519695LL,0x99b03d0e3576fLL), // C4[6], coeff of eps^6, polynomial in n of order 23 real(257316433920LL),real(517719121920LL),real(0xfb6e649000LL), real(0x221f7064000LL),real(0x4d84a37f000LL),real(0xb958155a000LL), real(0x1d5dd0db5000LL),real(0x4faa5a050000LL),real(0xea04686eb000LL), real(0x2f40e3db46000LL),real(0xab8623d121000LL),real(0x2d147c4903c000LL), real(0xe63ae874e57000LL),real(0x60cd21bcc932000LL), real(0x3f869e23e408d000LL),reale(29814,0xcc97221028000LL), -reale(808726,0x6d837bf63d000LL),reale(6700876,0x1daf27af1e000LL), -reale(30153942,0x8594329407000LL),reale(86154121,0x7da76bf014000LL), -reale(165128732,0xdb80e436d1000LL),reale(210163841,0xd18cc55d0a000LL), -reale(153581269,0x570b79c9b000LL),reale(46622885,0x3d1480e1d3a00LL), reale(53323559086LL,0xcd10b72aa064dLL), // C4[7], coeff of eps^29, polynomial in n of order 0 real(13087612928LL),real(0x90e6983c364f3dLL), // C4[7], coeff of eps^28, polynomial in n of order 1 -real(161707LL<<21),real(7239297LL<<14),real(0xcf8f801ee602cdLL), // C4[7], coeff of eps^27, polynomial in n of order 2 -real(3500022825LL<<20),real(630513507LL<<19),real(0x6038c37fa000LL), reale(72555,0x626230f3330c5LL), // C4[7], coeff of eps^26, polynomial in n of order 3 -real(92252949633LL<<21),real(16187170389LL<<22), -real(51975912235LL<<21),real(0x7c00d0f2b78000LL), reale(3119881,0x867e38d993117LL), // C4[7], coeff of eps^25, polynomial in n of order 4 -real(0x64d0a86bae7c0000LL),real(0x7c07ce24c65f0000LL), -real(0x739ece76489e0000LL),real(0x6e7bce15f550000LL), real(0x24fc420030b8400LL),reale(127915142,0x8a371ad88dcafLL), // C4[7], coeff of eps^24, polynomial in n of order 5 -reale(5990,0xbd2326cc40000LL),reale(14992,4018200301LL<<20), -reale(6873,8929851351LL<<18),reale(2782,8051012645LL<<19), -reale(4583,0xc89924b340000LL),real(0x52aed30dcf988800LL), reale(430260024,0xe82db7640b7c1LL), // C4[7], coeff of eps^23, polynomial in n of order 6 -reale(169326,4206873009LL<<17),reale(261065,0x25b4e353d0000LL), -reale(59142,0xf0c50992c0000LL),reale(111182,4597550539LL<<16), -reale(88869,504433083LL<<17),reale(2313,0xe34bfe3f90000LL), real(0x32dc48b9e1d23400LL),reale(4732860273LL,0xf9f6e14c7e54bLL), // C4[7], coeff of eps^22, polynomial in n of order 7 -reale(467157,1100000847LL<<20),reale(258178,755278933LL<<21), -reale(91474,559664221LL<<20),reale(248285,171426119LL<<22), -reale(82821,231309675LL<<20),reale(44668,65972935LL<<21), -reale(71456,2669582201LL<<20),reale(18220,0x9846e079d4000LL), reale(4732860273LL,0xf9f6e14c7e54bLL), // C4[7], coeff of eps^21, polynomial in n of order 8 -reale(10858183,1145150433LL<<21),reale(1155453,0xa514064740000LL), -reale(4408275,1110140307LL<<19),reale(4494002,0xa8330ec1c0000LL), -reale(693747,3759921697LL<<20),reale(2336198,8880970129LL<<18), -reale(1499288,4981657777LL<<19),-reale(18466,6402610053LL<<18), -reale(7818,0x6ee4879b83000LL),reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^20, polynomial in n of order 9 -reale(7907170,4058896835LL<<20),reale(1601483,335338375LL<<23), -reale(11238504,3427529005LL<<20),reale(2745284,1787777405LL<<21), -reale(2325455,2252860775LL<<20),reale(4939939,712213223LL<<22), -reale(1021126,555773201LL<<20),reale(952760,1631005375LL<<21), -reale(1365312,965324491LL<<20),reale(299618,0x2f589c3f22000LL), reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^19, polynomial in n of order 10 reale(5811147,7891888051LL<<19),reale(19155879,6260648859LL<<18), -reale(13234724,832589145LL<<21),-reale(473729,0xaccee67ac0000LL), -reale(9690431,2460044795LL<<19),reale(5218195,5282091375LL<<18), -reale(699193,3313511321LL<<20),reale(4032431,0xb01d955a40000LL), -reale(1901524,5999844905LL<<19),-reale(111197,715304509LL<<18), -reale(51622,0xdda253af9f000LL),reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^18, polynomial in n of order 11 -reale(34477536,1085877825LL<<20),reale(44845230,817114545LL<<21), reale(4606432,1572161669LL<<20),reale(12496576,210421693LL<<23), -reale(18271471,1543698101LL<<20),-reale(128700,742574025LL<<21), -reale(6139017,689151983LL<<20),reale(7385046,100502461LL<<22), -reale(590509,2783893289LL<<20),reale(1800602,699157181LL<<21), -reale(2092277,3566080099LL<<20),reale(381025,0x99466ecd7c000LL), reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^17, polynomial in n of order 12 -reale(152644671,981125379LL<<19),-reale(24136152,0xd3514f38e0000LL), -reale(16909786,8097141141LL<<18),reale(53988238,0xc115854860000LL), -reale(2192558,3293732289LL<<20),reale(3853073,2819007469LL<<17), -reale(20689919,5309095411LL<<18),reale(3514368,0xf1b4463ee0000LL), -reale(1814216,3975618817LL<<19),reale(7354899,0xbd88356420000LL), -reale(2207882,191252177LL<<18),-reale(269543,3717910997LL<<17), -reale(156646,0x7bcb3b3a6a800LL),reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^16, polynomial in n of order 13 reale(52565396,753292423LL<<19),reale(252855342,568744119LL<<21), -reale(197183211,7281644191LL<<19),-reale(6678358,3552459447LL<<20), reale(4519131,7283469291LL<<19),reale(56648760,112164189LL<<22), -reale(15289276,2020707835LL<<19),-reale(3713103,1403767329LL<<20), -reale(17880720,7304289905LL<<19),reale(9494998,1497636157LL<<21), reale(492167,2907561065LL<<19),reale(3952538,4294903605LL<<20), -reale(3358139,5130468237LL<<19),reale(480004,0x1e727719e9000LL), reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^15, polynomial in n of order 14 reale(279617399,0xd9972cba40000LL),-reale(353187715,0x687b832220000LL), reale(118965967,4456434973LL<<19),reale(220096359,3595022681LL<<17), -reale(240814657,8170991797LL<<18),reale(28075084,0xec7a345460000LL), reale(24758769,1818605983LL<<20),reale(48013974,0xb5345431a0000LL), -reale(32373431,0xc7bac8f4c0000LL),-reale(5075135,8642954025LL<<17), -reale(9094832,6469786017LL<<19),reale(13639028,3685620545LL<<17), -reale(1773068,1431802737LL<<18),-reale(460476,0x51ab5a8ea0000LL), -reale(423738,0x5d98934922800LL),reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^14, polynomial in n of order 15 reale(16417106,2408387839LL<<20),-reale(93245803,1562234793LL<<21), reale(256985456,250552029LL<<20),-reale(365861944,857240429LL<<22), reale(190902238,1499270843LL<<20),reale(163412998,1423242741LL<<21), -reale(274443985,2668181351LL<<20),reale(82958237,163620913LL<<23), reale(33859016,1729347703LL<<20),reale(25275487,1495319443LL<<21), -reale(45844273,3794232747LL<<20),reale(4490176,231613489LL<<22), reale(1010900,690735667LL<<20),reale(10013483,1036831025LL<<21), -reale(5637707,2068106223LL<<20),reale(570308,0x8f0afe45ec000LL), reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^13, polynomial in n of order 16 -reale(25657,393048869LL<<22),-reale(608651,0xacbc40d5c0000LL), reale(12764052,2144856077LL<<19),-reale(76823449,3121867141LL<<18), reale(228672619,4131243473LL<<20),-reale(367062288,0xf756dca4c0000LL), reale(263470997,8569317111LL<<19),reale(78573490,0xffb10f8fc0000LL), -reale(283548774,1794660389LL<<21),reale(154702622,9227087281LL<<18), reale(16937276,1939608161LL<<19),-reale(6432822,7897704317LL<<18), -reale(43016670,946798949LL<<20),reale(22087851,0xaa7600dd40000LL), reale(1665577,8523064651LL<<19),-reale(163221,0xe0acad2e40000LL), -reale(1189371,0x766c2260a3000LL),reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^12, polynomial in n of order 17 -real(0x13bc5107d5fLL<<20),-real(506650109317LL<<24), -reale(17217,2185571073LL<<20),-reale(426469,557216187LL<<21), reale(9411503,1140836685LL<<20),-reale(60299258,66945391LL<<22), reale(194753933,1835852139LL<<20),-reale(352928157,2046106529LL<<21), reale(328231147,2405007161LL<<20),-reale(34561926,360605189LL<<23), -reale(248371006,3915897705LL<<20),reale(226668375,1401273273LL<<21), -reale(40114392,2920598683LL<<20),-reale(25898188,1028871717LL<<22), -reale(16043876,2538787453LL<<20),reale(28698456,1825641427LL<<21), -reale(9602688,2437057327LL<<20),reale(502063,0xa52218333a000LL), reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^11, polynomial in n of order 18 -real(81880241733LL<<19),-real(651169421489LL<<18), -real(194261131981LL<<22),-real(0x4616f301f1bc0000LL), -reale(10659,7786635659LL<<19),-reale(276843,0xf150eaf340000LL), reale(6459374,425055961LL<<20),-reale(44283297,2370521611LL<<18), reale(156003403,8328479919LL<<19),-reale(319848045,0xab86b09a40000LL), reale(372382116,1407449139LL<<21),-reale(166870261,0xbaeb2e09c0000LL), -reale(148815577,7753476247LL<<19),reale(260443738,1330203003LL<<18), -reale(131653575,428167437LL<<20),reale(2775725,691412797LL<<18), reale(12306214,6299226531LL<<19),reale(5355345,9401097695LL<<18), -reale(3966302,0xcbc08bfb17000LL),reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^10, polynomial in n of order 19 -real(1704454843LL<<20),-real(2722537665LL<<21),-real(19434970697LL<<20), -real(4989045369LL<<24),-real(394962411735LL<<20), -real(0x128b33efecfLL<<21),-reale(5903,789230693LL<<20), -reale(161527,569013611LL<<22),reale(4006338,1271698701LL<<20), -reale(29564239,1312346333LL<<21),reale(114267945,2347153791LL<<20), -reale(265827046,63320697LL<<23),reale(379233361,4202669809LL<<20), -reale(292689947,1148927723LL<<21),reale(19915451,3747715939LL<<20), reale(197711494,385979271LL<<22),-reale(197401730,911113003LL<<20), reale(83971818,387288839LL<<21),-reale(12852829,1345691321LL<<20), -reale(602476,0x5fc28370ac000LL),reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^9, polynomial in n of order 20 -real(304621785LL<<18),-real(0xc9814e4b0000LL),-real(5069418237LL<<17), -real(0x7c4fe70d90000LL),-real(7691534469LL<<20), -real(0x7a02179d470000LL),-real(0x274586580a60000LL), -real(0x10907db87bd50000LL),-reale(2773,9732262223LL<<18), -reale(80424,78339267LL<<16),reale(2134032,0xd8c3d9bae0000LL), -reale(17066460,0x8709888510000LL),reale(72842964,6932239995LL<<19), -reale(192914141,0x448548ebf0000LL),reale(332328916,0xa61d5e5020000LL), -reale(364348462,0x260e7984d0000LL),reale(215166704,0xfd6630ec0000LL), reale(5301792,6304582341LL<<16),-reale(118567350,0x6a550b6aa0000LL), reale(89166503,0x5c73fd2370000LL),-reale(23960987,0x75c7f62663400LL), reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^8, polynomial in n of order 21 -real(11869221LL<<18),-real(7450235LL<<20),-real(79397539LL<<18), -real(113271327LL<<19),-real(700448177LL<<18),-real(148973407LL<<22), -real(9118660335LL<<18),-real(20216702289LL<<19), -real(0xcadd965ff40000LL),-real(386512744317LL<<20), -real(0xf93c68aca7bLL<<18),-reale(30847,5279995331LL<<19), reale(882325,8584251383LL<<18),-reale(7706931,2116826591LL<<21), reale(36580048,2730390969LL<<18),-reale(110604386,3847062005LL<<19), reale(227103584,0x9e98f54ac0000LL),-reale(323034443,1752619391LL<<20), reale(314251676,0xb5ebcf2b40000LL),-reale(199218854,3061725287LL<<19), reale(73903768,9476063903LL<<18),-reale(12124837,0x72a953b85800LL), reale(61527183561LL,0xb18970e26a4cfLL), // C4[7], coeff of eps^7, polynomial in n of order 22 -real(575575LL<<17),-real(2681133LL<<16),-real(1637545LL<<18), -real(16890107LL<<16),-real(23159565LL<<17),-real(0x8210e690000LL), -real(27276821LL<<20),-real(0x5bebf1b70000LL),-real(3075032387LL<<17), -real(0x6a5f183250000LL),-real(40477467135LL<<18), -real(0x11b5c31caf30000LL),-real(0xd14cd352ff20000LL), -reale(6969,0xb17d189610000LL),reale(216834,7757873387LL<<19), -reale(2087035,0xf153506af0000LL),reale(11091105,0x4b9d7f7a20000LL), -reale(38290720,0xa99fbe31d0000LL),reale(91897729,0x9718fbaac0000LL), -reale(156643857,0x418d7e6eb0000LL),reale(184759421,0x6102c9a360000LL), -reale(129331594,0xf71b8d2590000LL),reale(38395317,0x415c2de726c00LL), reale(61527183561LL,0xb18970e26a4cfLL), // C4[8], coeff of eps^29, polynomial in n of order 0 real(7241<<16),real(0x112c657acf71bLL), // C4[8], coeff of eps^28, polynomial in n of order 1 real(1165359LL<<20),real(3168035LL<<17),real(0x21ffb4a731cf423fLL), // C4[8], coeff of eps^27, polynomial in n of order 2 real(41827383LL<<21),-real(137865429LL<<20),real(631109843LL<<16), reale(4837,0x68f14547adebLL), // C4[8], coeff of eps^26, polynomial in n of order 3 real(54350489115LL<<22),-real(21656377197LL<<23),real(1080358617LL<<22), real(0x5c4a2579a0000LL),reale(3535865,0xba8f0d3ad9e09LL), // C4[8], coeff of eps^25, polynomial in n of order 4 reale(4480,63845967LL<<22),-real(0x5f0bc8cec07LL<<20), real(0x198015cca1fLL<<21),-real(0x51d1e6f78cdLL<<20), real(0x14fb331d33f30000LL),reale(144970494,0xe0e91e6ce4f71LL), // C4[8], coeff of eps^24, polynomial in n of order 5 reale(226427,7535956641LL<<17),-reale(36730,6647829291LL<<19), reale(116830,5936429895LL<<17),-reale(76966,613785099LL<<18), -real(0x2a948e8d73a60000LL),-real(0x116572b5168a4000LL), reale(5363908310LL,0x81b165bd17b55LL), // C4[8], coeff of eps^23, polynomial in n of order 6 reale(151394,3866446399LL<<20),-reale(105723,1435687723LL<<19), reale(240417,2090106533LL<<21),-reale(54672,3991575693LL<<19), reale(46185,3230210197LL<<20),-reale(67790,4028416911LL<<19), reale(15270,0xa469197488000LL),reale(5363908310LL,0x81b165bd17b55LL), // C4[8], coeff of eps^22, polynomial in n of order 7 -reale(105618,1394014919LL<<21),-reale(5351753,377020849LL<<22), reale(3446650,1690522763LL<<21),-reale(453181,286167171LL<<23), reale(2431204,1637447437LL<<21),-reale(1239333,63204475LL<<22), -reale(60030,1665832481LL<<21),-reale(26716,0x6a2a5d69d0000LL), reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^21, polynomial in n of order 8 reale(4362900,465328075LL<<22),-reale(10560212,802403079LL<<19), reale(656010,2976408017LL<<20),-reale(3068612,8162681445LL<<19), reale(4482659,1990068235LL<<21),-reale(516359,5969201251LL<<19), reale(1022585,502576667LL<<20),-reale(1273161,3447687361LL<<19), reale(245310,0x45a78ad538000LL),reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^20, polynomial in n of order 9 reale(23624906,1629010283LL<<19),-reale(5851601,324958949LL<<22), reale(255419,6850290885LL<<19),-reale(10559838,1365338319LL<<20), reale(3058631,5351542623LL<<19),-reale(782822,266312293LL<<21), reale(4071490,3032871865LL<<19),-reale(1457911,2387656005LL<<20), -reale(144540,929274797LL<<19),-reale(76349,0x2c1c25d590000LL), reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^19, polynomial in n of order 10 reale(23056909,2395766741LL<<20),reale(8427619,3212023717LL<<19), reale(19522568,367619617LL<<22),-reale(12637641,5752438869LL<<19), -reale(1859539,2126155853LL<<20),-reale(7720368,2358643951LL<<19), reale(5969641,447801057LL<<21),-reale(4464,2860310889LL<<19), reale(1954609,2968726289LL<<20),-reale(1904959,7710818563LL<<19), reale(302310,0x7de136fc28000LL),reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^18, polynomial in n of order 11 -reale(34760584,1377594673LL<<21),-reale(45089279,700199389LL<<22), reale(38964787,642296389LL<<21),reale(8377867,242649263LL<<24), reale(10805340,270655563LL<<21),-reale(18348308,77894251LL<<22), -reale(8504,712824639LL<<21),-reale(2874058,104939633LL<<23), reale(7002991,271121287LL<<21),-reale(1456031,497148985LL<<22), -reale(262921,1640850307LL<<21),-reale(186713,0x66184da2b0000LL), reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^17, polynomial in n of order 12 reale(266733950,1060079417LL<<21),-reale(92315127,311764467LL<<19), -reale(39784767,2743383633LL<<20),-reale(24124714,5368290721LL<<19), reale(52035773,16490707LL<<22),-reale(214469,3779317103LL<<19), -reale(32744,3406796695LL<<20),-reale(19012957,4710528797LL<<19), reale(5897141,767669011LL<<21),reale(758445,547828629LL<<19), reale(4185368,186448291LL<<20),-reale(2955613,5547446041LL<<19), reale(363691,0xed908404b8000LL),reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^16, polynomial in n of order 13 -reale(254507630,0xe2b8b6bb40000LL),-reale(58148124,1471923579LL<<20), reale(270522720,3187458133LL<<18),-reale(149985652,7726894061LL<<19), -reale(27328603,0x99e6e9ea40000LL),reale(4011861,407374679LL<<21), reale(54943982,0xaf3dd22640000LL),-reale(17478454,3922351195LL<<19), -reale(6848089,0x9bbe86d940000LL),-reale(11885922,3297252137LL<<20), reale(11706960,678889437LL<<18),-reale(595378,2432546249LL<<19), -reale(329167,0xe066968840000LL),-reale(450081,0x595d162958000LL), reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^15, polynomial in n of order 14 -reale(166710239,3480741959LL<<20),reale(313421255,2329933911LL<<19), -reale(299209385,1287661491LL<<21),reale(24383199,5307535921LL<<19), reale(248029318,3243559867LL<<20),-reale(210032461,8189928917LL<<19), reale(10907073,960500783LL<<22),reale(29948106,2038678405LL<<19), reale(40306034,2725271357LL<<20),-reale(36745958,6196825729LL<<19), -reale(1934460,123839633LL<<21),-reale(492518,4761069735LL<<19), reale(9949315,1255380799LL<<20),-reale(4720329,388065197LL<<19), reale(398374,0x9081f25c18000LL),reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^14, polynomial in n of order 15 -reale(5499415,942753073LL<<21),reale(38811064,349279653LL<<22), -reale(140017234,1709558915LL<<21),reale(290760665,163783697LL<<23), -reale(332595868,714890693LL<<21),reale(118902683,730607999LL<<22), reale(189429058,237701737LL<<21),-reale(256456610,243945477LL<<24), reale(78365400,1246868327LL<<21),reale(35514427,78282137LL<<22), reale(8045132,96899221LL<<21),-reale(42695880,422981029LL<<23), reale(15212575,506177875LL<<21),reale(2863173,903918451LL<<22), reale(284029,1922203905LL<<21),-reale(1161079,0x6c18f2ad70000LL), reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^13, polynomial in n of order 16 reale(5407,439728533LL<<23),reale(151556,693836399LL<<19), -reale(3836797,3870271773LL<<20),reale(28742693,8016450573LL<<19), -reale(111747677,1508361473LL<<21),reale(256964119,236840267LL<<19), -reale(347691811,711701031LL<<20),reale(216072654,2622689769LL<<19), reale(88295276,790755477LL<<22),-reale(263658780,5516898905LL<<19), reale(163753678,37603151LL<<20),-reale(1803857,6339257275LL<<19), -reale(22560155,108468139LL<<21),-reale(21197875,3801517693LL<<19), reale(25658955,3111371333LL<<20),-reale(7416706,6937931487LL<<19), reale(268690,0x9ce0757848000LL),reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^12, polynomial in n of order 17 real(369814360487LL<<19),real(159053188703LL<<23), reale(3152,1136779065LL<<19),reale(92558,2295771257LL<<20), -reale(2473330,1734833909LL<<19),reale(19757571,360351901LL<<21), -reale(83162616,6619531363LL<<19),reale(212413714,2066066043LL<<20), -reale(337117487,5524436113LL<<19),reale(299293348,697772127LL<<22), -reale(51076102,4535292671LL<<19),-reale(200831521,1217539203LL<<20), reale(227963885,2651839699LL<<19),-reale(87452614,163103009LL<<21), -reale(9664164,7186873499LL<<19),reale(9739937,3920029055LL<<20), reale(6101400,4999938359LL<<19),-reale(3588081,0x84422b3e50000LL), reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^11, polynomial in n of order 18 real(3576016431LL<<20),real(32208729499LL<<19),real(10983028711LL<<23), real(0x9286be006280000LL),real(0x65e9f47db41LL<<20), reale(50386,4528870031LL<<19),-reale(1428014,1685009291LL<<21), reale(12227031,6176103481LL<<19),-reale(56007028,2392678701LL<<20), reale(159476659,5817614083LL<<19),-reale(295263705,809939737LL<<22), reale(344605761,6427356205LL<<19),-reale(202719833,951923227LL<<20), -reale(50658828,5629491977LL<<19),reale(201884255,1512264231LL<<21), -reale(166564947,5368120671LL<<19),reale(63259557,2614639991LL<<20), -reale(8140125,1990873493LL<<19),-reale(722971,0xa61c9dba68000LL), reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^10, polynomial in n of order 19 real(45596577LL<<21),real(81531441LL<<22),real(656187675LL<<21), real(191463201LL<<25),real(17391213765LL<<21),real(65094511967LL<<22), real(0x16272ee843fLL<<21),reale(23168,382193603LL<<23), -reale(700305,441535191LL<<21),reale(6465118,134564813LL<<22), -reale(32414063,913166045LL<<21),reale(103314135,145041825LL<<24), -reale(222332965,1267927603LL<<21),reale(326070132,55789563LL<<22), -reale(309964302,1355885369LL<<21),reale(149975409,308317249LL<<23), reale(35633361,576916401LL<<21),-reale(113104897,1027785623LL<<22), reale(77116975,1889590315LL<<21),-reale(20082545,0xcd53c80110000LL), reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^9, polynomial in n of order 20 real(1123785LL<<21),real(13838643LL<<19),real(23159565LL<<20), real(171251217LL<<19),real(44667189LL<<23),real(3472549135LL<<19), real(10302054723LL<<20),real(162001999341LL<<19), real(500351698399LL<<21),reale(8102,6578411627LL<<19), -reale(262912,1458939143LL<<20),reale(2634746,8016047177LL<<19), -reale(14551212,731365323LL<<22),reale(52133305,8561410375LL<<19), -reale(129964645,2819080401LL<<20),reale(232230181,2215647013LL<<19), -reale(298362920,1016411147LL<<21),reale(269480987,8039357859LL<<19), -reale(161945649,1493828379LL<<20),reale(57837731,7816254593LL<<19), -reale(9237971,9476063903LL<<15),reale(69730808036LL,0x96022a9a34351LL), // C4[8], coeff of eps^8, polynomial in n of order 21 real(292383LL<<17),real(202215LL<<19),real(2386137LL<<17), real(3789747LL<<18),real(26247507LL<<17),real(6294651LL<<21), real(437764365LL<<17),real(1112245757LL<<18),real(0x67551030e0000LL), real(28804895217LL<<19),real(0x2c0f1d988820000LL), real(0x66a336663d1c0000LL),-reale(57641,8501165381LL<<17), reale(631918,3696102011LL<<20),-reale(3870503,720372107LL<<17), reale(15639991,0xcc8b836440000LL),-reale(44892569,0xd7d7de220000LL), reale(94682509,2360318459LL<<19),-reale(147486216,0x5ecdb08ae0000LL), reale(163873573,0xbeaba7b6c0000LL),-reale(110855652,0xd3ce78fba0000LL), reale(32332898,0xbdc6e34964000LL),reale(69730808036LL,0x96022a9a34351LL), // C4[9], coeff of eps^29, polynomial in n of order 0 real(16847<<16),real(0x3d2e2985830503LL), // C4[9], coeff of eps^28, polynomial in n of order 1 -real(207753LL<<23),real(1712087LL<<18),real(0x438da32e1600335LL), // C4[9], coeff of eps^27, polynomial in n of order 2 -real(3127493161LL<<21),-real(38277317LL<<20),-real(0xe4960490000LL), reale(161925,0x30e683ffe0741LL), // C4[9], coeff of eps^26, polynomial in n of order 3 -real(9299582409LL<<22),real(3656674463LL<<23),-real(10918261107LL<<22), real(80278491423LL<<17),reale(1317283,0x4f8aa089603a9LL), // C4[9], coeff of eps^25, polynomial in n of order 4 -real(711479186953LL<<22),reale(3279,1361598081LL<<20), -real(0x3749d192179LL<<21),-real(309897952117LL<<20), -real(0x1f18264b9990000LL),reale(162025847,0x379b22013c233LL), // C4[9], coeff of eps^24, polynomial in n of order 5 -reale(133856,15001023LL<<25),reale(223946,23087107LL<<27), -reale(32028,12079289LL<<25),reale(48931,2142027LL<<26), -reale(63933,112742755LL<<25),reale(12842,2153614949LL<<20), reale(5994956347LL,0x96bea2db115fLL), // C4[9], coeff of eps^23, polynomial in n of order 6 -reale(5988742,4056322469LL<<20),reale(2349145,7648181561LL<<19), -reale(426462,344885543LL<<21),reale(2475174,940948911LL<<19), -reale(999559,3441325239LL<<20),-reale(83146,4971496059LL<<19), -reale(41198,0x4f02423cb8000LL),reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^22, polynomial in n of order 7 -reale(8631189,1052889985LL<<21),-reale(629492,634245703LL<<22), -reale(3874477,505696163LL<<21),reale(3866974,513650043LL<<23), -reale(159710,1408881461LL<<21),reale(1100061,714281683LL<<22), -reale(1180171,586380503LL<<21),reale(201643,0x9fcf910730000LL), reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^21, polynomial in n of order 8 reale(341632,721850923LL<<22),reale(2597220,4632100393LL<<19), -reale(10372056,1528523471LL<<20),reale(1205419,4719051179LL<<19), -reale(1145316,921601685LL<<21),reale(3990959,6117017869LL<<19), -reale(1073059,3486842565LL<<20),-reale(153111,7776387185LL<<19), -reale(94130,0x280827bb28000LL),reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^20, polynomial in n of order 9 reale(3783713,134627971LL<<22),reale(23115315,66415493LL<<25), -reale(6392067,518305043LL<<22),-reale(1733013,275013225LL<<23), -reale(8816564,833972409LL<<22),reale(4468878,247379557LL<<24), reale(300534,553592433LL<<22),reale(2085027,317816093LL<<23), -reale(1725044,456624309LL<<22),reale(240877,0x8d28f00d60000LL), reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^19, polynomial in n of order 10 -reale(58776429,1067354331LL<<20),reale(18829393,7579267909LL<<19), reale(10681211,592856305LL<<22),reale(16946593,1116323851LL<<19), -reale(14277877,2775669533LL<<20),-reale(2149268,8027942223LL<<19), -reale(4056423,828321103LL<<21),reale(6443828,4480734455LL<<19), -reale(857619,751312863LL<<20),-reale(227988,4599783267LL<<19), -reale(205805,0x3340b739f8000LL),reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^18, polynomial in n of order 11 -reale(8326980,196156635LL<<21),-reale(34821146,552451591LL<<22), -reale(46791029,557069513LL<<21),reale(38334852,177025053LL<<24), reale(8937287,838991609LL<<21),reale(5317827,1033371567LL<<22), -reale(18378967,400717301LL<<21),reale(2844411,12754877LL<<23), reale(593018,1659418637LL<<21),reale(4310821,76308389LL<<22), -reale(2591282,1217948513LL<<21),reale(276451,0x9f1a0fb950000LL), reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^17, polynomial in n of order 12 -reale(182057178,279202431LL<<21),reale(246730983,7282837989LL<<19), -reale(61609386,3656132889LL<<20),-reale(45340440,795982425LL<<19), -reale(20534253,134894613LL<<22),reale(51951312,243959241LL<<19), -reale(4823611,581671439LL<<20),-reale(5624597,8387045493LL<<19), -reale(13789372,989768405LL<<21),reale(9667615,6509295661LL<<19), reale(215496,1395596667LL<<20),-reale(184969,6596889361LL<<19), -reale(459826,0xaf07be5d28000LL),reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^16, polynomial in n of order 13 reale(316814308,524172905LL<<23),-reale(186563878,63588247LL<<25), -reale(110274143,526845649LL<<23),reale(263023219,83035351LL<<24), -reale(130904637,509865531LL<<23),-reale(30397924,20206077LL<<26), reale(13683269,123318603LL<<23),reale(48158450,141529345LL<<24), -reale(26437768,420249375LL<<23),-reale(5662772,129791197LL<<25), -reale(2185901,350246489LL<<23),reale(9629298,177188459LL<<24), -reale(3949112,493038403LL<<23),reale(276643,3634960421LL<<18), reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^15, polynomial in n of order 14 reale(78761274,365004673LL<<20),-reale(201515576,8484307809LL<<19), reale(313194006,1602645493LL<<21),-reale(252751914,5568714583LL<<19), -reale(13191170,2167441005LL<<20),reale(241719441,7606152787LL<<19), -reale(201822768,404840345LL<<22),reale(21302083,5136432093LL<<19), reale(37050656,1255073061LL<<20),reale(20598069,641077127LL<<19), -reale(39565379,1270355289LL<<21),reale(9630032,7047419793LL<<19), reale(3352897,1867330359LL<<20),reale(651457,7128437307LL<<19), -reale(1114108,0x7475455348000LL),reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^14, polynomial in n of order 15 reale(1503684,1762694997LL<<21),-reale(12945810,457623793LL<<22), reale(59109631,1997027375LL<<21),-reale(165337541,436423661LL<<23), reale(292248408,1310925625LL<<21),-reale(302358268,80333091LL<<22), reale(101329883,1625451155LL<<21),reale(168206436,256940945LL<<24), -reale(245462494,1698275235LL<<21),reale(106772813,575322475LL<<22), reale(20184277,1515722423LL<<21),-reale(15841583,115367503LL<<23), -reale(24343366,297803839LL<<21),reale(22619454,642864953LL<<22), -reale(5751128,1751200357LL<<21),reale(119914,0x778fad9290000LL), reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^13, polynomial in n of order 16 -real(494538685723LL<<23),-reale(30244,7532247025LL<<19), reale(913230,2357276371LL<<20),-reale(8356271,5886749331LL<<19), reale(41054740,50726383LL<<21),-reale(125953300,8377060373LL<<19), reale(252781900,3961145001LL<<20),-reale(323011393,7392450487LL<<19), reale(214671336,735258085LL<<22),reale(38642307,2838366023LL<<19), -reale(221064383,2701482241LL<<20),reale(190191489,7753766309LL<<19), -reale(54203341,2021364059LL<<21),-reale(15936650,4639479773LL<<19), reale(7069294,1728459477LL<<20),reale(6475976,7904740225LL<<19), -reale(3243677,0x65d7af1058000LL),reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^12, polynomial in n of order 17 -real(4941153649LL<<22),-real(2434362319LL<<26), -real(480183190319LL<<22),-reale(15428,422153761LL<<23), reale(492912,506448323LL<<22),-reale(4815395,177795021LL<<24), reale(25573504,64498885LL<<22),-reale(86374812,63633203LL<<23), reale(196725482,856584503LL<<22),-reale(303474922,105041487LL<<25), reale(296000607,1045914233LL<<22),-reale(124541003,470657541LL<<23), -reale(96946363,592229397LL<<22),reale(194787320,217061649LL<<24), -reale(139624521,484247315LL<<22),reale(48044895,435975913LL<<23), -reale(5082038,276187937LL<<22),-reale(749748,0x6069872020000LL), reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^11, polynomial in n of order 18 -real(231323121LL<<20),-real(2351460757LL<<19),-real(912558841LL<<23), -real(0xdfda7610580000LL),-real(777314384543LL<<20), -reale(6590,3852961377LL<<19),reale(223861,17176789LL<<21), -reale(2346980,3623268951LL<<19),reale(13542533,3871010099LL<<20), -reale(50565862,7643343277LL<<19),reale(130735502,766383623LL<<22), -reale(239800507,7719641123LL<<19),reale(308448660,3395101317LL<<20), -reale(258446712,3844536697LL<<19),reale(99709743,227483207LL<<21), reale(54337873,5199140497LL<<19),-reale(105984135,215955881LL<<20), reale(67263140,627338299LL<<19),-reale(17110329,0x5fa94e648000LL), reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[9], coeff of eps^10, polynomial in n of order 19 -real(538707LL<<21),-real(1075491LL<<22),-real(9728097LL<<21), -real(3213907LL<<25),-real(333357375LL<<21),-real(1438804621LL<<22), -real(39246385997LL<<21),-real(379094211993LL<<23), reale(25645,1674653973LL<<21),-reale(290249,472854199LL<<22), reale(1830100,1274307463LL<<21),-reale(7588281,99130323LL<<24), reale(22282256,82312105LL<<21),-reale(48025833,432719649LL<<22), reale(76964476,1304326427LL<<21),-reale(91125940,162742323LL<<23), reale(77471536,1478654845LL<<21),-reale(44556474,1023100235LL<<22), reale(15423395,377918063LL<<21),-reale(2409905,0x7f0a0dc2b0000LL), reale(25978144170LL,0x7e28f6c5ff5f1LL), // C4[9], coeff of eps^9, polynomial in n of order 20 -real(16575LL<<21),-real(226005LL<<19),-real(421083LL<<20), -real(3487431LL<<19),-real(1025715LL<<23),-real(90604825LL<<19), -real(308056405LL<<20),-real(5606626571LL<<19),-real(20270111449LL<<21), -real(0x30ab7cf8dddLL<<19),reale(15220,1707177905LL<<20), -reale(187210,7636838095LL<<19),reale(1297995,534056013LL<<22), -reale(6003229,1506461473LL<<19),reale(20010763,3942424887LL<<20), -reale(50026909,6827222547LL<<19),reale(95435950,2132760845LL<<21), -reale(138382128,8075045605LL<<19),reale(146522254,737992253LL<<20), -reale(96396219,7300467927LL<<19),reale(27713913,0x34f39e3ee8000LL), reale(77934432511LL,0x7a7ae451fe1d3LL), // C4[10], coeff of eps^29, polynomial in n of order 0 real(14059LL<<19),real(0x168a4531304537LL), // C4[10], coeff of eps^28, polynomial in n of order 1 -real(1004279LL<<22),-real(3373361LL<<19),reale(3807,0xdf0925caacfb9LL), // C4[10], coeff of eps^27, polynomial in n of order 2 real(78580619LL<<24),-real(212705597LL<<23),real(705875469LL<<19), reale(59656,0xa639fabc960fdLL), // C4[10], coeff of eps^26, polynomial in n of order 3 real(927832218729LL<<21),-real(204500125453LL<<22), -real(29157611613LL<<21),-real(0x66c4e2e4040000LL), reale(23087123,0x49a60b16d9e77LL), // C4[10], coeff of eps^25, polynomial in n of order 4 real(26024288967LL<<27),-real(7678900515LL<<25),real(13514191015LL<<26), -real(31097026337LL<<25),real(89826688809LL<<21), reale(25583028,0x820b055e82c23LL), // C4[10], coeff of eps^24, polynomial in n of order 5 reale(1328855,126349401LL<<24),-reale(550962,13774891LL<<26), reale(2464835,125518543LL<<24),-reale(784466,25625323LL<<25), -reale(93184,68528187LL<<24),-reale(52198,1190112709LL<<21), reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^23, polynomial in n of order 6 -reale(1114607,27405733LL<<26),-reale(4563722,53821803LL<<25), reale(3169393,348585LL<<27),reale(68182,92955763LL<<25), reale(1172595,45755337LL<<26),-reale(1088988,13585007LL<<25), reale(166307,46143431LL<<21),reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^22, polynomial in n of order 7 reale(5480278,504127481LL<<20),-reale(9293162,155326547LL<<21), -reale(197247,3072475525LL<<20),-reale(1644302,932629169LL<<22), reale(3811061,3287215741LL<<20),-reale(747954,323686257LL<<21), -reale(145848,3935467265LL<<20),-reale(106662,0xb8d6e5aaa0000LL), reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^21, polynomial in n of order 8 reale(22796753,23076841LL<<25),-reale(927290,180149865LL<<22), -reale(369606,74581989LL<<23),-reale(9303996,552920075LL<<22), reale(3036817,71115369LL<<24),reale(396000,898162707LL<<22), reale(2181010,484753161LL<<23),-reale(1556188,389640079LL<<22), reale(192540,3401040927LL<<18),reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^20, polynomial in n of order 9 reale(862955,1266777839LL<<21),reale(7027949,96012647LL<<24), reale(20762590,1932890753LL<<21),-reale(9559408,1057130891LL<<22), -reale(3064719,1040728173LL<<21),-reale(5129237,23711641LL<<23), reale(5760893,1279205669LL<<21),-reale(394463,240514009LL<<22), -reale(178786,1942994377LL<<21),-reale(217080,8651652815LL<<18), reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^19, polynomial in n of order 10 -reale(10913096,468931943LL<<23),-reale(57356320,139563275LL<<22), reale(21632622,17971173LL<<25),reale(12352870,1067519707LL<<22), reale(10546968,197307279LL<<23),-reale(16476123,321986815LL<<22), reale(466396,220388453LL<<24),reale(183297,876676071LL<<22), reale(4340035,31265157LL<<23),-reale(2266775,500956659LL<<22), reale(210337,0xe1ea7a84c0000LL),reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^18, polynomial in n of order 11 reale(183220667,2590575043LL<<20),reale(3573393,1902991101LL<<21), -reale(38433982,657724943LL<<20),-reale(39892891,403988263LL<<23), reale(42677900,967722655LL<<20),reale(4292702,1711217099LL<<21), -reale(2792039,799969587LL<<20),-reale(14767346,746757159LL<<22), reale(7703673,1133060475LL<<20),reale(747527,637790873LL<<21), -reale(45502,3704918615LL<<20),-reale(458872,0xc21d355260000LL), reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^17, polynomial in n of order 12 -reale(61780842,49135749LL<<25),-reale(196091506,391376453LL<<23), reale(232013693,187926637LL<<24),-reale(59475550,301219495LL<<23), -reale(46331600,62864215LL<<26),-reale(5439903,151048009LL<<23), reale(49627120,102515675LL<<24),-reale(16690048,509576107LL<<23), -reale(7354945,21733079LL<<25),-reale(3769052,366616397LL<<23), reale(9145462,214930505LL<<24),-reale(3305318,371590575LL<<23), reale(189374,6271289399LL<<19),reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^16, polynomial in n of order 13 -reale(246951312,552772347LL<<22),reale(295555190,29721595LL<<24), -reale(151972143,664869293LL<<22),-reale(114414430,423169395LL<<23), reale(248915402,492058657LL<<22),-reale(140322148,99500631LL<<25), -reale(15757705,299151505LL<<22),reale(29401843,368167099LL<<23), reale(29725213,39057725LL<<22),-reale(34936824,2445655LL<<24), reale(5290998,483472011LL<<22),reale(3412892,270211305LL<<23), reale(939828,308185177LL<<22),-reale(1058440,2262901433LL<<19), reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^15, polynomial in n of order 14 -reale(29237793,21929809LL<<24),reale(96597143,85827693LL<<23), -reale(210653294,75090197LL<<25),reale(297719766,264531499LL<<23), -reale(232859751,332419LL<<24),reale(779198,466262825LL<<23), reale(210565738,49075321LL<<26),-reale(210231291,35636249LL<<23), reale(60435795,147172683LL<<24),reale(30790678,95503589LL<<23), -reale(8341137,27440903LL<<25),-reale(25891285,147600733LL<<23), reale(19770912,119140889LL<<24),-reale(4475853,348372575LL<<23), reale(24304,4909664935LL<<19),reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^14, polynomial in n of order 15 -reale(326980,1465789373LL<<20),reale(3379554,1566468779LL<<21), -reale(19029758,226591575LL<<20),reale(68313947,940737655LL<<22), -reale(165836985,3033756273LL<<20),reale(273579872,472941105LL<<21), -reale(286670501,2169744907LL<<20),reale(131674848,489609853LL<<23), reale(102478771,1504412891LL<<20),-reale(220713363,225877065LL<<21), reale(153302553,1201451329LL<<20),-reale(29968476,1046042243LL<<22), -reale(18498599,2914872793LL<<20),reale(4637884,270502717LL<<21), reale(6604171,2668065421LL<<20),-reale(2936921,0x8973648be0000LL), reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^13, polynomial in n of order 16 real(8181919521LL<<26),reale(4651,463423847LL<<22), -reale(165627,528682553LL<<23),reale(1821092,755660373LL<<22), -reale(11021646,91392285LL<<24),reale(43145010,992272131LL<<22), -reale(116748177,310953403LL<<23),reale(223068773,47271409LL<<22), -reale(294932999,99296991LL<<25),reale(242263024,286305695LL<<22), -reale(60276785,30271037LL<<23),-reale(125363778,717272947LL<<22), reale(182026841,37372833LL<<24),-reale(116787755,417593029LL<<22), reale(36759949,346012225LL<<23),-reale(3061422,962217431LL<<22), -reale(731281,0xaaf6b13240000LL),reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^12, polynomial in n of order 17 real(777809483LL<<21),real(436668683LL<<25),real(99139014933LL<<21), real(0x1cfc4bfd58dLL<<22),-reale(70023,1623299233LL<<21), reale(822756,446933025LL<<23),-reale(5376526,2111656919LL<<21), reale(23042396,297910775LL<<22),-reale(69630161,297782669LL<<21), reale(153266731,112309515LL<<24),-reale(247130955,1577554627LL<<21), reale(284460705,580739169LL<<22),-reale(212091093,1801700473LL<<21), reale(61297082,319619083LL<<23),reale(65462218,2096893009LL<<21), -reale(98426842,1047683893LL<<22),reale(59152561,1235484315LL<<21), -reale(14780753,0xb5d74354c0000LL), reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^11, polynomial in n of order 18 real(1233981LL<<23),real(14104237LL<<22),real(6201077LL<<26), real(933195507LL<<22),real(6966040851LL<<23),real(592370721657LL<<22), -reale(22184,189431713LL<<24),reale(279989,474035391LL<<22), -reale(1985627,52832535LL<<23),reale(9357698,635528005LL<<22), -reale(31645438,92987147LL<<25),reale(79909927,996806539LL<<22), -reale(153562851,494252097LL<<23),reale(225351987,543734289LL<<22), -reale(249473559,252214923LL<<24),reale(201676475,478217047LL<<22), -reale(111804841,353712747LL<<23),reale(37701632,700509149LL<<22), -reale(5783773,3281237837LL<<18),reale(86138056986LL,0x5ef39e09c8055LL), // C4[10], coeff of eps^10, polynomial in n of order 19 real(57057LL<<20),real(126819LL<<21),real(1284843LL<<20), real(478667LL<<24),real(56414325LL<<20),real(279062861LL<<21), real(8810413183LL<<20),real(99625441377LL<<22), -reale(3997,1800115191LL<<20),reale(54510,559965495LL<<21), -reale(421909,1796318189LL<<20),reale(2196607,410595787LL<<23), -reale(8328804,1896277603LL<<20),reale(24012916,1506461473LL<<21), -reale(53875133,2685050457LL<<20),reale(94820235,193579723LL<<22), -reale(129680615,3269639887LL<<20),reale(131955714,608596747LL<<21), -reale(84828673,2009615045LL<<20),reale(24099054,0xf664899ae0000LL), reale(86138056986LL,0x5ef39e09c8055LL), // C4[11], coeff of eps^29, polynomial in n of order 0 -real(255169LL<<19),real(0xbdc79d6e266b55fLL), // C4[11], coeff of eps^28, polynomial in n of order 1 -real(535829LL<<26),real(6461547LL<<20),real(0x56e2cdab4666fea1LL), // C4[11], coeff of eps^27, polynomial in n of order 2 -real(54075943LL<<25),-real(11012147LL<<24),-real(184884229LL<<19), reale(65338,0x3c271ece8bf8fLL), // C4[11], coeff of eps^26, polynomial in n of order 3 -real(29189823LL<<30),real(157366885LL<<32),-real(637753597LL<<30), real(13332470307LL<<23),reale(19666808,0xb9ff38da93b23LL), // C4[11], coeff of eps^25, polynomial in n of order 4 -reale(768828,16543417LL<<28),reale(2405043,41201001LL<<26), -reale(595679,17511625LL<<27),-reale(94147,42169149LL<<26), -reale(60455,661597895LL<<21),reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^24, polynomial in n of order 5 -reale(5042070,2793567LL<<28),reale(2454743,3154771LL<<30), reale(191058,8757223LL<<28),reale(1233521,5992667LL<<29), -reale(1001395,9125891LL<<28),reale(137539,51052897LL<<22), reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^23, polynomial in n of order 6 -reale(7620321,6390387LL<<27),-reale(1118882,49853273LL<<26), -reale(2175696,13938625LL<<28),reale(3557797,45648113LL<<26), -reale(479218,13589073LL<<27),-reale(128928,23280229LL<<26), -reale(115227,1709406351LL<<21),reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^22, polynomial in n of order 7 reale(3030693,3978133LL<<30),reale(1618004,874507LL<<32), -reale(9217736,134985LL<<30),reale(1767041,97063LL<<33), reale(345531,3069873LL<<30),reale(2240563,263433LL<<32), -reale(1400217,895853LL<<30),reale(154222,296573467LL<<23), reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^21, polynomial in n of order 8 reale(304504,49998275LL<<26),reale(21950325,110791689LL<<23), -reale(5005332,65785063LL<<24),-reale(3038456,102319349LL<<23), -reale(5977063,34913149LL<<25),reale(5022754,485487661LL<<23), -reale(45293,7681997LL<<24),-reale(123970,179449809LL<<23), -reale(222792,7672407751LL<<18),reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^20, polynomial in n of order 9 -reale(56432361,120691497LL<<25),reale(6246807,9955417LL<<28), reale(11410351,83254233LL<<25),reale(14692579,49664915LL<<26), -reale(13833928,124401461LL<<25),-reale(1245123,9835207LL<<27), -reale(339985,114545011LL<<25),reale(4291293,22713457LL<<26), -reale(1980685,98627585LL<<25),reale(159775,7030690975LL<<19), reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^19, polynomial in n of order 10 reale(40826627,234278683LL<<24),-reale(19124677,161584861LL<<23), -reale(51024100,50981393LL<<26),reale(30646271,384869645LL<<23), reale(9815197,6859997LL<<24),reale(639236,244693975LL<<23), -reale(14951689,12090449LL<<25),reale(5916250,151054657LL<<23), reale(1073676,226322463LL<<24),reale(80953,380993803LL<<23), -reale(451111,0xff79096c0000LL),reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^18, polynomial in n of order 11 -reale(233788807,3535193LL<<28),reale(177892093,3762413LL<<30), -reale(5486729,8981851LL<<28),-reale(45008759,222901LL<<32), -reale(22295157,5977845LL<<28),reale(46499690,3347131LL<<30), -reale(8381947,991351LL<<28),-reale(7636513,1723229LL<<31), -reale(5108235,6476849LL<<28),reale(8568922,940153LL<<30), -reale(2769555,11314291LL<<28),reale(126172,1159668425LL<<21), reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^17, polynomial in n of order 12 reale(246666787,23370677LL<<26),-reale(50685638,204720607LL<<24), -reale(179803952,51059789LL<<25),reale(226753224,100010811LL<<24), -reale(83690537,703961LL<<27),-reale(36110826,15584139LL<<24), reale(17880019,26951173LL<<25),reale(35367319,73259919LL<<24), -reale(29730133,51577369LL<<26),reale(2029349,105583177LL<<24), reale(3224077,120316375LL<<25),reale(1158582,83501667LL<<24), -reale(999784,6146420159LL<<19),reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^16, polynomial in n of order 13 reale(135472555,2919565LL<<26),-reale(240891001,9823619LL<<28), reale(277187915,48314475LL<<26),-reale(153860890,22130685LL<<27), -reale(78071452,50966567LL<<26),reale(224257271,6520287LL<<29), -reale(168898235,23643785LL<<26),reale(25365615,30758325LL<<27), reale(33991594,22223845LL<<26),-reale(1325267,13358465LL<<28), -reale(26274549,1352253LL<<26),reale(17195323,12709799LL<<27), -reale(3493469,55138895LL<<26),-reale(37171,2996514251LL<<20), reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^15, polynomial in n of order 14 reale(8369149,65829073LL<<25),-reale(34468304,77612041LL<<24), reale(98238486,50466661LL<<26),-reale(197855127,257258223LL<<24), reale(275634083,126808451LL<<25),-reale(237329411,109823349LL<<24), reale(57709083,378039LL<<27),reale(144028485,10992165LL<<24), -reale(208082193,86131531LL<<25),reale(120116321,182851999LL<<24), -reale(12733337,27687817LL<<26),-reale(18886416,178008391LL<<24), reale(2557866,23705959LL<<25),reale(6572718,173475635LL<<24), -reale(2666354,4022017967LL<<19),reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^14, polynomial in n of order 15 reale(54399,8224347LL<<28),-reale(665621,1410497LL<<30), reale(4527846,10561865LL<<28),-reale(20181039,1593975LL<<31), reale(63299017,4532479LL<<28),-reale(144047710,3737571LL<<30), reale(238046961,3527085LL<<28),-reale(274611219,485845LL<<32), reale(189061064,3080067LL<<28),-reale(9459768,127989LL<<30), -reale(141083601,3627343LL<<28),reale(166868825,1278147LL<<31), -reale(97711641,16702617LL<<28),reale(28303864,4120681LL<<30), -reale(1707991,14300715LL<<28),-reale(691965,964491519LL<<21), reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^13, polynomial in n of order 16 -real(394848061LL<<27),-real(277855615551LL<<23), reale(21507,221049445LL<<24),-reale(280152,15918397LL<<23), reale(2046623,76965257LL<<25),-reale(9908745,30179611LL<<23), reale(34287090,9035647LL<<24),-reale(88042794,304571673LL<<23), reale(170266683,41403331LL<<26),-reale(246546803,514564215LL<<23), reale(257558635,22204697LL<<24),-reale(171596509,74164853LL<<23), reale(32098211,100286083LL<<25),reale(71621283,185724333LL<<23), -reale(91026815,208301517LL<<24),reale(52421624,501338287LL<<23), -reale(12919309,7987587551LL<<18),reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^12, polynomial in n of order 17 -real(2506701LL<<25),-real(1595211LL<<29),-real(414133331LL<<25), -real(9611154693LL<<26),reale(6318,129560535LL<<25), -reale(88018,7994433LL<<27),reale(693686,99032081LL<<25), -reale(3663195,37640223LL<<26),reale(14022738,83451835LL<<25), -reale(40598902,6803915LL<<28),reale(90961965,119128629LL<<25), -reale(159220781,788729LL<<26),reale(217217490,112380639LL<<25), -reale(227284915,26366059LL<<27),reale(176075660,9208089LL<<25), -reale(94610548,45670931LL<<26),reale(31201351,21556291LL<<25), -reale(4712704,700509149LL<<19),reale(94341681461LL,0x436c57c191ed7LL), // C4[11], coeff of eps^11, polynomial in n of order 18 -real(13041LL<<24),-real(166957LL<<23),-real(82777LL<<27), -real(14154867LL<<23),-real(121102751LL<<24),-real(11919970777LL<<23), real(140288886837LL<<25),-reale(15649,252654239LL<<23), reale(133731,225409843LL<<24),-reale(773734,115698949LL<<23), reale(3285982,23309223LL<<26),-reale(10716783,181102411LL<<23), reale(27557442,232845957LL<<24),-reale(56645854,420384689LL<<23), reale(93299054,125728615LL<<25),-reale(121534295,132369527LL<<23), reale(119605179,120525655LL<<24),-reale(75403265,163638237LL<<23), reale(21207168,6304582341LL<<18),reale(94341681461LL,0x436c57c191ed7LL), // C4[12], coeff of eps^29, polynomial in n of order 0 real(2113LL<<23),real(0x495846bc80a035LL), // C4[12], coeff of eps^28, polynomial in n of order 1 -real(5059597LL<<25),-real(23775299LL<<22), reale(61953,0x75e619a89ce07LL), // C4[12], coeff of eps^27, polynomial in n of order 2 real(30823201LL<<29),-real(55301563LL<<28),real(131431881LL<<24), reale(497138,0xbe8dd4238d2e7LL), // C4[12], coeff of eps^26, polynomial in n of order 3 real(8059635627LL<<28),-real(757042391LL<<29),-real(311216327LL<<28), -real(7273579LL<<33),reale(21376966,0x1d2a1f8b6ccdLL), // C4[12], coeff of eps^25, polynomial in n of order 4 reale(590308,751003LL<<30),reale(77521,16047653LL<<28), reale(426657,125003LL<<29),-reale(306166,5244457LL<<28), reale(37995,207060411LL<<24),reale(34181768645LL,0x62a1b07dc9473LL), // C4[12], coeff of eps^24, polynomial in n of order 5 -reale(1599658,2394579LL<<27),-reale(2671318,5123391LL<<29), reale(3256460,16377243LL<<27),-reale(261261,3982303LL<<28), -reale(106562,1204279LL<<27),-reale(120793,1029973LL<<24), reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^23, polynomial in n of order 6 reale(1248773,4542469LL<<29),-reale(2889741,9813249LL<<28), reale(234885,3135591LL<<30),reale(66922,9908313LL<<28), reale(755418,635863LL<<29),-reale(419245,13200621LL<<28), reale(41213,192739239LL<<24),reale(34181768645LL,0x62a1b07dc9473LL), // C4[12], coeff of eps^22, polynomial in n of order 7 reale(20885911,4938503LL<<28),-reale(1107830,1234733LL<<29), -reale(2370377,3771643LL<<28),-reale(6561451,624527LL<<30), reale(4279851,10797315LL<<28),reale(210660,3761905LL<<29), -reale(68724,2033407LL<<28),-reale(224555,1152577LL<<29), reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^21, polynomial in n of order 8 -reale(5562062,38325LL<<31),reale(7741765,4470897LL<<28), reale(17399328,6149297LL<<29),-reale(10890962,10744893LL<<28), -reale(2368414,446197LL<<30),-reale(891562,9146315LL<<28), reale(4183586,393403LL<<29),-reale(1730085,6072185LL<<28), reale(120797,18742483LL<<24),reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^20, polynomial in n of order 9 reale(3332722,179104103LL<<24),-reale(54245156,21887465LL<<27), reale(18428910,34326153LL<<24),reale(12293411,106053413LL<<25), reale(4024929,78680811LL<<24),-reale(14528270,1262953LL<<26), reale(4350569,36952333LL<<24),reale(1251271,92345015LL<<25), reale(191236,5049199LL<<24),-reale(439124,1983321823LL<<21), reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^19, polynomial in n of order 10 reale(117817828,9756529LL<<27),reale(29304818,21859033LL<<26), -reale(33857646,3348243LL<<29),-reale(34756825,30241097LL<<26), reale(40576649,11012471LL<<27),-reale(1809964,37385419LL<<26), -reale(7014724,9945043LL<<28),-reale(6163099,62399597LL<<26), reale(7950550,2557949LL<<27),-reale(2323999,3159279LL<<26), reale(80031,1030811061LL<<22),reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^18, polynomial in n of order 11 reale(37677439,43610729LL<<26),-reale(212417438,31724009LL<<27), reale(188774384,60946099LL<<26),-reale(37276694,6182933LL<<29), -reale(44097735,31570179LL<<26),reale(5696664,10497345LL<<27), reale(38054298,7154503LL<<26),-reale(24525159,12952085LL<<28), -reale(350073,57822319LL<<26),reale(2901654,18012267LL<<27), reale(1319354,63457243LL<<26),-reale(941373,59576227LL<<26), reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^17, polynomial in n of order 12 -reale(253394431,1462439LL<<28),reale(237669216,409221LL<<26), -reale(76296320,28335185LL<<27),-reale(133872864,17217849LL<<26), reale(218174046,2622387LL<<29),-reale(127998192,57914967LL<<26), reale(363472,30718057LL<<27),reale(32681168,4189163LL<<26), reale(4677048,16088179LL<<28),-reale(25857930,7142835LL<<26), reale(14914891,9312419LL<<27),-reale(2731797,52301425LL<<26), -reale(76352,726189181LL<<22),reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^16, polynomial in n of order 13 -reale(53643409,97684423LL<<25),reale(127408278,3174879LL<<27), -reale(219370358,126672641LL<<25),reale(262176902,49024297LL<<26), -reale(182579118,132254331LL<<25),-reale(3956056,15289739LL<<28), reale(167880537,57011019LL<<25),-reale(188895775,46555265LL<<26), reale(91621970,25449425LL<<25),-reale(762367,26232331LL<<27), -reale(18049661,12932969LL<<25),reale(839158,10679509LL<<26), reale(6440415,29973277LL<<25),-reale(2428550,982597961LL<<22), reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^15, polynomial in n of order 14 -reale(1786573,13634499LL<<27),reale(8939902,21088027LL<<26), -reale(31907799,6174271LL<<28),reale(84216248,4944333LL<<26), -reale(166330228,11364729LL<<27),reale(242706491,8863071LL<<26), -reale(246937724,7698133LL<<29),reale(139651898,50060433LL<<26), reale(29493809,19297617LL<<27),-reale(148014628,18656733LL<<26), reale(151165884,622571LL<<28),-reale(81883041,55488299LL<<26), reale(21903841,15379355LL<<27),-reale(792996,14574745LL<<26), -reale(644309,457907141LL<<22),reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^14, polynomial in n of order 15 -reale(6504,28793619LL<<26),reale(93075,33271365LL<<27), -reale(752118,6462873LL<<26),reale(4061558,11832697LL<<28), -reale(15840997,35193887LL<<26),reale(46482714,19239327LL<<27), -reale(104709924,13039269LL<<26),reale(181860520,7828435LL<<29), -reale(240159499,36173099LL<<26),reale(229992094,10037497LL<<27), -reale(136854274,43911089LL<<26),reale(9990763,2550227LL<<28), reale(74520212,5689801LL<<26),-reale(84057599,709549LL<<27), reale(46786776,54603587LL<<26),-reale(11406945,39298831LL<<26), reale(102545305936LL,0x27e511795bd59LL), // C4[12], coeff of eps^13, polynomial in n of order 16 real(1030055LL<<30),real(829418525LL<<26),-real(19924010015LL<<27), reale(9050,10804695LL<<26),-reale(78488,9283787LL<<28), reale(459151,22444081LL<<26),-reale(1962716,17985613LL<<27), reale(6408338,7820523LL<<26),-reale(16395176,1626457LL<<29), reale(33311385,35536325LL<<26),-reale(53946341,7054843LL<<27), reale(69201696,61410431LL<<26),-reale(69012103,3773337LL<<28), reale(51544754,7834329LL<<26),-reale(26961871,12889641LL<<27), reale(8722958,26104467LL<<26),-reale(1300056,320360129LL<<22), reale(34181768645LL,0x62a1b07dc9473LL), // C4[12], coeff of eps^12, polynomial in n of order 17 real(127075LL<<24),real(91195LL<<28),real(26902525LL<<24), real(715607165LL<<25),-real(73094160425LL<<24), reale(4440,35913265LL<<26),-reale(41519,978831LL<<24), reale(264211,112928967LL<<25),-reale(1241795,175695285LL<<24), reale(4515620,18853435LL<<27),-reale(13069247,261014043LL<<24), reale(30619380,129358865LL<<25),-reale(58537051,226171969LL<<24), reale(91194564,65482939LL<<26),-reale(113993206,58979239LL<<24), reale(109036979,115740763LL<<25),-reale(67602927,138149837LL<<24), reale(18850816,700509149LL<<21),reale(102545305936LL,0x27e511795bd59LL), // C4[13], coeff of eps^29, polynomial in n of order 0 -real(634219LL<<23),reale(3193,0x402148867236bLL), // C4[13], coeff of eps^28, polynomial in n of order 1 -real(400561LL<<32),real(1739049LL<<27),reale(66909,0xbcc54ee94d445LL), // C4[13], coeff of eps^27, polynomial in n of order 2 -real(6387996953LL<<29),-real(3461245957LL<<28),-real(49206438547LL<<24), reale(286172946,0xcc6f5fc7e64c9LL), // C4[13], coeff of eps^26, polynomial in n of order 3 real(7296571113LL<<30),reale(10661,1488313LL<<31), -reale(6836,2507629LL<<30),real(103233906747LL<<25), reale(900397808,0x384bb07b32421LL), // C4[13], coeff of eps^25, polynomial in n of order 4 -reale(1030602,1434287LL<<30),reale(976249,6303335LL<<28), -reale(29214,7243007LL<<29),-reale(27193,4360723LL<<28), -reale(41363,170006437LL<<24),reale(36916310137LL,0x41f43bb0c949LL), // C4[13], coeff of eps^24, polynomial in n of order 5 -reale(2597630,109963LL<<31),-reale(46366,88065LL<<33), real(835763379LL<<31),reale(754229,667751LL<<32), -reale(376195,1000319LL<<31),reale(33027,62908623LL<<26), reale(36916310137LL,0x41f43bb0c949LL), // C4[13], coeff of eps^23, polynomial in n of order 6 reale(1907767,7512493LL<<29),-reale(1322539,10099505LL<<28), -reale(6889396,2784065LL<<30),reale(3566231,12064393LL<<28), reale(392016,1668111LL<<29),-reale(16024,9677725LL<<28), -reale(223530,46890859LL<<24),reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^22, polynomial in n of order 7 reale(2768819,1533979LL<<30),reale(18682895,1051157LL<<31), -reale(7962826,2061455LL<<30),-reale(3008388,501585LL<<32), -reale(1419492,411945LL<<30),reale(4033867,1208903LL<<31), -reale(1511425,98131LL<<30),reale(90538,115806565LL<<25), reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^21, polynomial in n of order 8 -reale(51332124,214119LL<<31),reale(7579765,3153587LL<<28), reale(12475441,1655707LL<<29),reale(7005177,5256105LL<<28), -reale(13679833,119207LL<<30),reale(3016909,4530623LL<<28), reale(1323928,2024201LL<<29),reale(284896,6925237LL<<28), -reale(424636,138679005LL<<24),reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^20, polynomial in n of order 9 reale(47250711,14679LL<<32),-reale(18472981,62575LL<<35), -reale(42459575,893863LL<<32),reale(33307537,106651LL<<33), reale(3060800,842635LL<<32),-reale(5867540,102671LL<<34), -reale(6941741,849331LL<<32),reale(7324844,423881LL<<33), -reale(1953157,771073LL<<32),reale(46148,28524089LL<<27), reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^19, polynomial in n of order 10 -reale(218954922,27801141LL<<27),reale(144947317,36456347LL<<26), -reale(2491117,129025LL<<29),-reale(43746541,53566187LL<<26), -reale(5414513,33128531LL<<27),reale(38475112,39418671LL<<26), -reale(19653214,3660993LL<<28),-reale(2031714,8235735LL<<26), reale(2517568,31068687LL<<27),reale(1433299,8158787LL<<26), -reale(884985,911850811LL<<22),reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^18, polynomial in n of order 11 reale(186784429,10521821LL<<28),-reale(7066121,6171767LL<<29), -reale(168709085,159265LL<<28),reale(199772613,1997709LL<<31), -reale(91000398,5796399LL<<28),-reale(16385586,3500385LL<<29), reale(28845005,1198547LL<<28),reale(9523912,3994797LL<<30), -reale(24921512,7172347LL<<28),reale(12920997,2065141LL<<29), -reale(2137442,11262329LL<<28),-reale(100773,90157665LL<<23), reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^17, polynomial in n of order 12 reale(153014747,10291963LL<<28),-reale(229746959,27043849LL<<26), reale(237324258,14238909LL<<27),-reale(127910449,9268979LL<<26), -reale(52661288,2811671LL<<29),reale(178449477,48064707LL<<26), -reale(166899831,11458293LL<<27),reale(67870692,24951769LL<<26), reale(7326612,206249LL<<28),-reale(16569622,39442673LL<<26), -reale(550002,21806887LL<<27),reale(6246699,62490405LL<<26), -reale(2219585,747027389LL<<22),reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^16, polynomial in n of order 13 reale(15145062,3114639LL<<29),-reale(45473383,71569LL<<31), reale(104280194,4043033LL<<29),-reale(182691434,3191599LL<<30), reale(238813543,4302931LL<<29),-reale(215430056,686779LL<<32), reale(95643898,4170781LL<<29),reale(58502156,871831LL<<30), -reale(149008930,6169513LL<<29),reale(135928257,1117477LL<<31), -reale(68778720,227103LL<<29),reale(17013972,3743517LL<<30), -reale(171458,5381733LL<<29),-reale(594747,43724235LL<<24), reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^15, polynomial in n of order 14 reale(268265,12727175LL<<27),-reale(1599130,17232215LL<<26), reale(6942204,4883571LL<<28),-reale(22914299,20494129LL<<26), reale(58880733,8011269LL<<27),-reale(118985431,7979051LL<<26), reale(188592645,4054545LL<<29),-reale(229762161,35295621LL<<26), reale(203148724,31300867LL<<27),-reale(107385077,53637247LL<<26), -reale(6680614,2406191LL<<28),reale(75281884,8527271LL<<26), -reale(77627899,32310399LL<<27),reale(42028799,34263981LL<<26), -reale(10160264,35032709LL<<22),reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^14, polynomial in n of order 15 real(8350913025LL<<28),-reale(8241,2495877LL<<29), reale(78008,13111987LL<<28),-reale(500800,4045265LL<<30), reale(2364509,9424021LL<<28),-reale(8593646,4773407LL<<29), reale(24709323,11418567LL<<28),-reale(57114100,2066875LL<<31), reale(106928260,4889705LL<<28),-reale(162113251,5033977LL<<29), reale(197269922,8596123LL<<28),-reale(188736396,4070811LL<<30), reale(136566807,16720509LL<<28),-reale(69783667,938643LL<<29), reale(22203894,1359919LL<<28),-reale(3271109,212531129LL<<23), reale(110748930411LL,0xc5dcb3125bdbLL), // C4[13], coeff of eps^13, polynomial in n of order 16 -real(94185LL<<30),-real(86179275LL<<26),real(2372802705LL<<27), -real(83726038305LL<<26),reale(12668,1555717LL<<28), -reale(87922,39994007LL<<26),reale(452934,19637187LL<<27), -reale(1815855,62281965LL<<26),reale(5835571,1574167LL<<29), -reale(15318374,24668899LL<<26),reale(33211265,14617205LL<<27), -reale(59722012,27257657LL<<26),reale(88729847,57943LL<<28), -reale(107054489,21433519LL<<26),reale(99917523,12239271LL<<27), -reale(61060708,48513541LL<<26),reale(16900731,943456205LL<<22), reale(110748930411LL,0xc5dcb3125bdbLL), // C4[14], coeff of eps^29, polynomial in n of order 0 real(41LL<<28),real(0x3fbc634a12a6b1LL), // C4[14], coeff of eps^28, polynomial in n of order 1 -real(6907093LL<<31),-real(59887787LL<<28), reale(5739014,0x909af11944e4bLL), // C4[14], coeff of eps^27, polynomial in n of order 2 reale(3432,499601LL<<33),-real(2083199471LL<<32),real(3406572267LL<<28), reale(307370942,0xdb94118adae9fLL), // C4[14], coeff of eps^26, polynomial in n of order 3 reale(287986,4314073LL<<29),reale(5344,3636147LL<<30), -reale(6205,2906637LL<<29),-reale(13964,12467885LL<<26), reale(13216950542LL,0xe1def252c54b5LL), // C4[14], coeff of eps^25, polynomial in n of order 4 -reale(258061,515595LL<<33),-reale(74790,1657665LL<<31), reale(745027,493173LL<<32),-reale(337382,84843LL<<31), reale(26418,5099583LL<<27),reale(39650851628LL,0xa59cd6f84fe1fLL), // C4[14], coeff of eps^24, polynomial in n of order 5 -reale(100052,3082133LL<<30),-reale(6991386,428305LL<<32), reale(2902871,3549453LL<<30),reale(514674,1320943LL<<31), reale(32543,4070319LL<<30),-reale(220557,2292103LL<<27), reale(118952554885LL,0xf0d684e8efa5dLL), // C4[14], coeff of eps^23, polynomial in n of order 6 reale(6249633,975799LL<<32),-reale(1750517,1286063LL<<31), -reale(1090661,209219LL<<33),-reale(631632,1802089LL<<31), reale(1285387,761149LL<<32),-reale(440347,2020899LL<<31), reale(22303,14762615LL<<27),reale(39650851628LL,0xa59cd6f84fe1fLL), // C4[14], coeff of eps^22, polynomial in n of order 7 -reale(1155507,7367607LL<<29),reale(11090657,3295693LL<<30), reale(9416360,3921899LL<<29),-reale(12562252,1614097LL<<31), reale(1905484,7990669LL<<29),reale(1324142,2135535LL<<30), reale(362851,6226223LL<<29),-reale(408795,45924241LL<<26), reale(118952554885LL,0xf0d684e8efa5dLL), // C4[14], coeff of eps^21, polynomial in n of order 8 -reale(2556392,83451LL<<35),-reale(45924405,628445LL<<32), reale(25722566,76303LL<<33),reale(6427311,738073LL<<32), -reale(4460754,79355LL<<34),-reale(7474566,842481LL<<32), reale(6714086,421381LL<<33),-reale(1643964,835835LL<<32), reale(21175,2825543LL<<28),reale(118952554885LL,0xf0d684e8efa5dLL), // C4[14], coeff of eps^20, polynomial in n of order 9 reale(101794762,1213867LL<<31),reale(21384252,53331LL<<34), -reale(38294895,814203LL<<31),-reale(14666563,397319LL<<32), reale(37283642,1395551LL<<31),-reale(15279397,125869LL<<33), -reale(3174330,433863LL<<31),reale(2115734,458067LL<<32), reale(1510128,1624339LL<<31),-reale(831539,10478291LL<<28), reale(118952554885LL,0xf0d684e8efa5dLL), // C4[14], coeff of eps^19, polynomial in n of order 10 reale(50295468,469581LL<<33),-reale(186185623,531407LL<<32), reale(174713425,41641LL<<35),-reale(59412258,3489LL<<32), -reale(26728127,294149LL<<33),reale(23787374,31373LL<<32), reale(13262792,54953LL<<34),-reale(23669724,520005LL<<32), reale(11190603,172969LL<<33),-reale(1670792,243479LL<<32), -reale(115324,7271069LL<<28),reale(118952554885LL,0xf0d684e8efa5dLL), // C4[14], coeff of eps^18, polynomial in n of order 11 -reale(229751836,26450113LL<<27),reale(205122059,12799441LL<<28), -reale(76881886,7573243LL<<27),-reale(89213757,3943587LL<<30), reale(179505441,31406283LL<<27),-reale(144430080,11541225LL<<28), reale(48475411,26026641LL<<27),reale(12591449,3614557LL<<29), -reale(14798010,26226089LL<<27),-reale(1654995,15989667LL<<28), reale(6017860,18394141LL<<27),-reale(2035659,55899187LL<<24), reale(118952554885LL,0xf0d684e8efa5dLL), // C4[14], coeff of eps^17, polynomial in n of order 12 -reale(60003627,419631LL<<31),reale(122260158,890121LL<<29), -reale(193015194,2586489LL<<30),reale(228332901,6912147LL<<29), -reale(182676146,109669LL<<32),reale(57596630,2823965LL<<29), reale(79437172,3055697LL<<30),-reale(146103578,5035353LL<<29), reale(121669517,1691035LL<<31),-reale(57926620,1249999LL<<29), reale(13245099,2677787LL<<30),reale(250593,3348667LL<<29), -reale(546524,56364575LL<<25),reale(118952554885LL,0xf0d684e8efa5dLL), // C4[14], coeff of eps^16, polynomial in n of order 13 -reale(2910026,15317989LL<<28),reale(10671028,169493LL<<30), -reale(30788418,3245427LL<<28),reale(70862414,261923LL<<29), -reale(130581700,1010945LL<<28),reale(191189814,642567LL<<31), -reale(216782974,13106831LL<<28),reale(177827671,7710997LL<<29), -reale(82572754,6587933LL<<28),-reale(19188450,2518521LL<<30), reale(74652545,11169877LL<<28),-reale(71762036,443641LL<<29), reale(37978089,1743047LL<<28),-reale(9119456,66783679LL<<25), reale(118952554885LL,0xf0d684e8efa5dLL), // C4[14], coeff of eps^15, polynomial in n of order 14 -reale(25313,471763LL<<30),reale(176943,4508751LL<<29), -reale(914488,1483519LL<<31),reale(3661023,8037561LL<<29), -reale(11683077,3602217LL<<30),reale(30253421,7276067LL<<29), -reale(64215578,725077LL<<32),reale(112133608,2030221LL<<29), -reale(160624032,1744767LL<<30),reale(186713478,2165751LL<<29), -reale(172286017,2016853LL<<31),reale(121247637,6964321LL<<29), -reale(60696359,459733LL<<30),reale(19031909,1781195LL<<29), -reale(2775486,102023215LL<<25),reale(118952554885LL,0xf0d684e8efa5dLL), // C4[14], coeff of eps^14, polynomial in n of order 15 -real(614557125LL<<27),real(5831464275LL<<28), -reale(3808,17097199LL<<27),reale(28626,5026047LL<<29), -reale(160361,32462873LL<<27),reale(702411,15495849LL<<28), -reale(2480054,13665347LL<<27),reale(7201343,703573LL<<30), -reale(17420896,11395693LL<<27),reale(35365729,6899711LL<<28), -reale(60346284,10497687LL<<27),reale(86059048,7827541LL<<29), -reale(100689087,8447169LL<<27),reale(91987561,3237205LL<<28), -reale(55509735,6799595LL<<27),reale(15265177,48513541LL<<24), reale(118952554885LL,0xf0d684e8efa5dLL), // C4[15], coeff of eps^29, polynomial in n of order 0 -real(204761LL<<28),reale(20426,0xaa7b82b97d24fLL), // C4[15], coeff of eps^28, polynomial in n of order 1 -real(34699LL<<42),real(26415501LL<<29),reale(6134808,0xac3bb24726559LL), // C4[15], coeff of eps^27, polynomial in n of order 2 reale(16894,439LL<<40),-reale(3396,5539LL<<38), -reale(13997,7293149LL<<28),reale(14128464373LL,0x6d08ce11dbba7LL), // C4[15], coeff of eps^26, polynomial in n of order 3 -reale(50643,63489LL<<36),reale(243167,8553LL<<37), -reale(100839,3467LL<<36),reale(7018,548741LL<<30), reale(14128464373LL,0x6d08ce11dbba7LL), // C4[15], coeff of eps^25, polynomial in n of order 4 -reale(6907413,21379LL<<36),reale(2301071,198931LL<<34), reale(591806,32973LL<<35),reale(76262,38289LL<<34), -reale(216244,23833777LL<<27),reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[15], coeff of eps^24, polynomial in n of order 5 -reale(2869395,52521LL<<36),-reale(3255913,8819LL<<38), -reale(2304160,33823LL<<36),reale(3661540,28261LL<<37), -reale(1155441,18213LL<<36),reale(48366,13607837LL<<28), reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[15], coeff of eps^23, polynomial in n of order 6 reale(8754539,110435LL<<35),reale(11218727,249609LL<<34), -reale(11298141,31087LL<<36),reale(996220,194783LL<<34), reale(1275763,41633LL<<35),reale(426630,95573LL<<34), -reale(392368,19533817LL<<27),reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[15], coeff of eps^22, polynomial in n of order 7 -reale(46020147,1607LL<<36),reale(18483914,31121LL<<37), reale(8546239,40923LL<<36),-reale(2972379,4277LL<<38), -reale(7799822,49315LL<<36),reale(6131851,9051LL<<37), -reale(1385578,60289LL<<36),reale(2743,3362879LL<<30), reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[15], coeff of eps^21, polynomial in n of order 8 reale(36025526,1303LL<<40),-reale(30131090,26093LL<<37), -reale(21835156,15459LL<<38),reale(35026415,31673LL<<37), -reale(11464406,5705LL<<39),-reale(3907909,12145LL<<37), reale(1722090,1439LL<<38),reale(1557916,18869LL<<37), -reale(781446,6381283LL<<28),reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[15], coeff of eps^20, polynomial in n of order 9 -reale(190262221,2387LL<<40),reale(146996287,1227LL<<41), -reale(33573688,3541LL<<40),-reale(32294922,2067LL<<39), reale(18331180,2115LL<<40),reale(16022794,2331LL<<40), -reale(22246846,3383LL<<40),reale(9695242,4143LL<<39), -reale(1302304,2671LL<<40),-reale(123235,5577019LL<<29), reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[15], coeff of eps^19, polynomial in n of order 10 reale(169057636,9637LL<<37),-reale(31515275,17095LL<<36), -reale(115123722,7359LL<<39),reale(174060780,58071LL<<36), -reale(122862790,20125LL<<37),reale(32880337,12981LL<<36), reale(15824026,705LL<<38),-reale(12943852,57005LL<<36), -reale(2522257,22495LL<<37),reale(5771316,18225LL<<36), -reale(1873338,7714415LL<<28),reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[15], coeff of eps^18, polynomial in n of order 11 reale(137352006,26079LL<<36),-reale(197705648,26891LL<<37), reale(213128803,51077LL<<36),-reale(150461460,3135LL<<39), reale(25445949,34251LL<<36),reale(93962136,11667LL<<37), -reale(140732252,24207LL<<36),reale(108614245,6273LL<<38), -reale(48923563,62665LL<<36),reale(10316934,1969LL<<37), reale(535285,33757LL<<36),-reale(501186,3348667LL<<30), reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[15], coeff of eps^17, polynomial in n of order 12 reale(15155809,205049LL<<34),-reale(39104030,957115LL<<32), reale(81967212,139599LL<<33),-reale(139468172,993913LL<<32), reale(190415844,61587LL<<35),-reale(202311488,967447LL<<32), reale(154439958,403401LL<<33),-reale(61783996,889045LL<<32), -reale(28504911,66989LL<<34),reale(73132006,1030157LL<<32), -reale(66442314,293949LL<<33),reale(34502754,346959LL<<32), -reale(8240730,128798053LL<<25),reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[15], coeff of eps^16, polynomial in n of order 13 reale(114172,142577LL<<34),-reale(499141,33119LL<<36), reale(1750098,174183LL<<34),-reale(5016097,114721LL<<35), reale(11893006,66221LL<<34),-reale(23470909,19093LL<<37), reale(38591591,188131LL<<34),-reale(52613301,65223LL<<35), reale(58753809,139305LL<<34),-reale(52512562,23925LL<<36), reale(36059714,158111LL<<34),-reale(17726185,93229LL<<35), reale(5486676,138853LL<<34),-reale(792996,14574745LL<<26), reale(42385393120LL,0x471a6a35932f5LL), // C4[15], coeff of eps^15, polynomial in n of order 14 real(592706205LL<<33),-reale(9147,839013LL<<32), reale(55355,240865LL<<34),-reale(262940,644275LL<<32), reale(1011310,29095LL<<33),-reale(3215965,1023905LL<<32), reale(8575909,35467LL<<35),-reale(19352216,329839LL<<32), reale(37124659,455473LL<<33),-reale(60529336,778589LL<<32), reale(83288367,93771LL<<34),-reale(94856196,165035LL<<32), reale(85043486,110139LL<<33),-reale(50751757,943257LL<<32), reale(13877433,107462891LL<<25),reale(127156179360LL,0xd54f3ea0b98dfLL), // C4[16], coeff of eps^29, polynomial in n of order 0 real(553LL<<31),real(0x292ecb9a960d27d1LL), // C4[16], coeff of eps^28, polynomial in n of order 1 -real(61453LL<<36),-real(4754645LL<<34), reale(19591808,0x57955a5f17535LL), // C4[16], coeff of eps^27, polynomial in n of order 2 reale(33770,14237LL<<36),-reale(12917,115767LL<<35), real(1665987897LL<<31),reale(2148568314LL,0xda506166fe05fLL), // C4[16], coeff of eps^26, polynomial in n of order 3 reale(1765351,9719LL<<36),reale(634098,16193LL<<37), reale(114937,5021LL<<36),-reale(211035,902511LL<<32), reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^25, polynomial in n of order 4 -reale(3041817,11535LL<<37),-reale(2643315,63657LL<<35), reale(3458443,225LL<<36),-reale(1011407,29251LL<<35), reale(33755,354965LL<<31),reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^24, polynomial in n of order 5 reale(12443946,111847LL<<35),-reale(9978547,23661LL<<37), reale(264818,24689LL<<35),reale(1196082,9587LL<<36), reale(477961,17339LL<<35),-reale(375862,243659LL<<32), reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^23, polynomial in n of order 6 reale(11971225,59849LL<<36),reale(9677599,56595LL<<35), -reale(1515717,2317LL<<37),-reale(7956047,112667LL<<35), reale(5585704,62147LL<<36),-reale(1169086,64041LL<<35), -reale(10840,1435009LL<<31),reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^22, polynomial in n of order 7 -reale(20905609,47207LL<<36),-reale(27003899,18815LL<<37), reale(32128586,62715LL<<36),-reale(8207156,6437LL<<38), -reale(4335741,20931LL<<36),reale(1351161,14763LL<<37), reale(1583200,44703LL<<36),-reale(734819,355141LL<<32), reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^21, polynomial in n of order 8 reale(119271221,13241LL<<38),-reale(13185134,117885LL<<35), -reale(34424757,12741LL<<36),reale(12971898,62105LL<<35), reale(17958221,23929LL<<37),-reale(20751983,45233LL<<35), reale(8405753,5609LL<<36),-reale(1009805,84123LL<<35), -reale(126669,998091LL<<31),reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^20, polynomial in n of order 9 reale(7281953,46177LL<<36),-reale(132136826,3687LL<<39), reale(164419146,28463LL<<36),-reale(102943145,13301LL<<37), reale(20499773,15997LL<<36),reale(17609391,14489LL<<38), -reale(11127728,9397LL<<36),-reale(3194109,31911LL<<37), reale(5518515,63129LL<<36),-reale(1729623,95963LL<<34), reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^19, polynomial in n of order 10 -reale(197461925,11965LL<<36),reale(194820269,1667LL<<35), -reale(119937281,937LL<<38),-reale(1213288,24915LL<<35), reale(103481944,52469LL<<36),-reale(133891976,7945LL<<35), reale(96822293,18071LL<<37),-reale(41434588,121951LL<<35), reale(8025452,27431LL<<36),reale(724406,126187LL<<35), -reale(459367,1295029LL<<31),reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^18, polynomial in n of order 11 -reale(47525285,62545LL<<36),reale(91887649,22453LL<<37), -reale(145781941,19979LL<<36),reale(186991182,8001LL<<39), -reale(187151585,35749LL<<36),reale(133148350,20179LL<<37), -reale(44425461,13151LL<<36),-reale(35371425,9983LL<<38), reale(71056997,38023LL<<36),-reale(61631567,21647LL<<37), reale(31499493,50637LL<<36),-reale(7491423,758351LL<<32), reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^17, polynomial in n of order 12 -reale(2259631,24697LL<<37),reale(7098981,78723LL<<35), -reale(18582556,8879LL<<36),reale(40852668,12369LL<<35), -reale(75692831,12691LL<<38),reale(118080654,84927LL<<35), -reale(154130872,52073LL<<36),reale(166118829,74381LL<<35), -reale(144327913,2259LL<<37),reale(96964720,98683LL<<35), -reale(46899246,18595LL<<36),reale(14349769,50505LL<<35), -reale(2057503,1465135LL<<31),reale(135359803835LL,0xb9c7f85883761LL), // C4[16], coeff of eps^16, polynomial in n of order 13 -reale(18695,264305LL<<33),reale(95700,8265LL<<35), -reale(398136,419847LL<<33),reale(1375381,177071LL<<34), -reale(4004787,429789LL<<33),reale(9930000,13635LL<<36), -reale(21101250,231795LL<<33),reale(38532718,52073LL<<34), -reale(60367925,93257LL<<33),reale(80490566,118467LL<<35), -reale(89511061,246751LL<<33),reale(78923731,162339LL<<34), -reale(46636750,263349LL<<33),reale(12687939,1991833LL<<30), reale(135359803835LL,0xb9c7f85883761LL), // C4[17], coeff of eps^29, polynomial in n of order 0 -real(280331LL<<31),reale(154847,0x4e6e7be138cdbLL), // C4[17], coeff of eps^28, polynomial in n of order 1 -real(82431LL<<38),real(142069LL<<33),reale(989485,0x4511e2f2b39a3LL), // C4[17], coeff of eps^27, polynomial in n of order 2 reale(30957,2723LL<<36),reale(7080,38071LL<<35), -reale(9773,1986585LL<<31),reale(6836353729LL,0x13b9f01928417LL), // C4[17], coeff of eps^26, polynomial in n of order 3 -reale(138771,28785LL<<37),reale(154910,14439LL<<38), -reale(42193,29611LL<<37),real(1108797915LL<<32), reale(6836353729LL,0x13b9f01928417LL), // C4[17], coeff of eps^25, polynomial in n of order 4 -reale(1238256,21701LL<<37),-reale(44811,81027LL<<35), reale(156785,14859LL<<36),reale(74079,77407LL<<35), -reale(51372,1082481LL<<31),reale(20509061187LL,0x3b2dd04b78c45LL), // C4[17], coeff of eps^24, polynomial in n of order 5 reale(10057115,7495LL<<39),-reale(158283,1579LL<<41), -reale(7978477,2703LL<<39),reale(5079175,3021LL<<40), -reale(987192,2101LL<<39),-reale(20806,242401LL<<34), reale(143563428310LL,0x9e40b2104d5e3LL), // C4[17], coeff of eps^23, polynomial in n of order 6 -reale(30405369,16203LL<<36),reale(28904813,10839LL<<35), -reale(5472666,28841LL<<37),-reale(4538327,21695LL<<35), reale(1010309,2151LL<<36),reale(1591197,61387LL<<35), -reale(691600,842821LL<<31),reale(143563428310LL,0x9e40b2104d5e3LL), // C4[17], coeff of eps^22, polynomial in n of order 7 reale(2360974,20517LL<<37),-reale(34168343,7885LL<<38), reale(7988557,399LL<<37),reale(19220645,2761LL<<39), -reale(19251394,21847LL<<37),reale(7294617,7633LL<<38), -reale(776533,25709LL<<37),-reale(127091,628387LL<<32), reale(143563428310LL,0x9e40b2104d5e3LL), // C4[17], coeff of eps^21, polynomial in n of order 8 -reale(141970389,5875LL<<38),reale(152285106,31LL<<35), -reale(85013706,54665LL<<36),reale(10784519,74157LL<<35), reale(18376223,22989LL<<37),-reale(9415616,123045LL<<35), -reale(3707065,39939LL<<36),reale(5266887,19945LL<<35), -reale(1601936,974407LL<<31),reale(143563428310LL,0x9e40b2104d5e3LL), // C4[17], coeff of eps^20, polynomial in n of order 9 reale(174732199,7199LL<<38),-reale(91781661,1783LL<<41), -reale(22947906,1007LL<<38),reale(109147441,451LL<<39), -reale(126268040,11085LL<<38),reale(86262862,2409LL<<40), -reale(35185382,1435LL<<38),reale(6220582,7041LL<<39), reale(846498,391LL<<38),-reale(421214,84365LL<<33), reale(143563428310LL,0x9e40b2104d5e3LL), // C4[17], coeff of eps^19, polynomial in n of order 10 reale(100447726,5039LL<<36),-reale(149758021,121873LL<<35), reale(181554380,1939LL<<38),-reale(171878757,123903LL<<35), reale(113962110,29289LL<<36),-reale(29967290,80205LL<<35), -reale(40353928,13613LL<<37),reale(68655180,86853LL<<35), -reale(57285125,57949LL<<36),reale(28886745,8439LL<<35), -reale(6846764,2025561LL<<31),reale(143563428310LL,0x9e40b2104d5e3LL), // C4[17], coeff of eps^18, polynomial in n of order 11 reale(9163438,32371LL<<37),-reale(22188557,9937LL<<38), reale(45681407,15569LL<<37),-reale(80085759,21LL<<40), reale(119267529,32127LL<<37),-reale(149784698,12951LL<<38), reale(156408668,30941LL<<37),-reale(132494258,5045LL<<39), reale(87286969,10059LL<<37),-reale(41608633,10397LL<<38), reale(12599797,16681LL<<37),-reale(1793721,181577LL<<32), reale(143563428310LL,0x9e40b2104d5e3LL), // C4[17], coeff of eps^17, polynomial in n of order 12 reale(152058,3531LL<<37),-reale(566838,109449LL<<35), reale(1788421,65069LL<<36),-reale(4828739,49907LL<<35), reale(11241509,10969LL<<38),-reale(22666304,107837LL<<35), reale(39633653,283LL<<36),-reale(59939783,113319LL<<35), reale(77715030,3737LL<<37),-reale(84609105,47985LL<<35), reale(73498818,52617LL<<36),-reale(43049308,20443LL<<35), reale(11659187,1311925LL<<31),reale(143563428310LL,0x9e40b2104d5e3LL), // C4[18], coeff of eps^29, polynomial in n of order 0 real(35LL<<34),real(0x29845c2bcb5c10d7LL), // C4[18], coeff of eps^28, polynomial in n of order 1 reale(3628,18373LL<<37),-reale(4063,232509LL<<34), reale(3097286791LL,0x8a812bfedbe75LL), // C4[18], coeff of eps^27, polynomial in n of order 2 reale(435730,613LL<<39),-reale(110987,3811LL<<38),real(489021323LL<<34), reale(21681007540LL,0xc98833f803533LL), // C4[18], coeff of eps^26, polynomial in n of order 3 -reale(762945,31179LL<<36),reale(988791,87LL<<37), reale(550009,38375LL<<36),-reale(343815,323189LL<<33), reale(151767052785LL,0x82b96bc817465LL), // C4[18], coeff of eps^25, polynomial in n of order 4 reale(1063744,27LL<<41),-reale(7897635,7767LL<<39), reale(4613149,699LL<<40),-reale(833936,93LL<<39), -reale(28054,94387LL<<35),reale(151767052785LL,0x82b96bc817465LL), // C4[18], coeff of eps^24, polynomial in n of order 5 reale(25578507,4379LL<<38),-reale(3209600,1553LL<<40), -reale(4577572,5923LL<<38),reale(702466,1583LL<<39), reale(1586031,287LL<<38),-reale(651636,122639LL<<35), reale(151767052785LL,0x82b96bc817465LL), // C4[18], coeff of eps^23, polynomial in n of order 6 -reale(32324739,1815LL<<40),reale(3520775,1207LL<<39), reale(19946468,259LL<<41),-reale(17787966,4575LL<<39), reale(6336978,3235LL<<40),-reale(589727,5685LL<<39), -reale(125505,20667LL<<35),reale(151767052785LL,0x82b96bc817465LL), // C4[18], coeff of eps^22, polynomial in n of order 7 reale(138884729,22203LL<<36),-reale(69168625,14473LL<<37), reale(3249237,4577LL<<36),reale(18436830,10301LL<<38), -reale(7840055,31609LL<<36),-reale(4091705,30595LL<<37), reale(5021146,27565LL<<36),-reale(1488082,115687LL<<33), reale(151767052785LL,0x82b96bc817465LL), // C4[18], coeff of eps^21, polynomial in n of order 8 -reale(66334778,1299LL<<41),-reale(40377625,16285LL<<38), reale(111882749,4839LL<<39),-reale(118325119,4711LL<<38), reale(76858390,3693LL<<40),-reale(29952902,3569LL<<38), reale(4790818,4941LL<<39),reale(921311,4421LL<<38), -reale(386621,181821LL<<34),reale(151767052785LL,0x82b96bc817465LL), // C4[18], coeff of eps^20, polynomial in n of order 9 -reale(151679112,16629LL<<37),reale(174648786,1667LL<<40), -reale(156892091,15835LL<<37),reale(96799837,4169LL<<38), -reale(17949188,6721LL<<37),-reale(43885384,7293LL<<39), reale(66080580,25305LL<<37),-reale(53357084,1853LL<<38), reale(26599572,17011LL<<37),-reale(6287689,169979LL<<34), reale(151767052785LL,0x82b96bc817465LL), // C4[18], coeff of eps^19, polynomial in n of order 10 -reale(8594193,5169LL<<39),reale(16702080,5475LL<<38), -reale(27882498,1245LL<<41),reale(39843622,14413LL<<38), -reale(48340851,951LL<<39),reale(49066184,11639LL<<38), -reale(40627946,3165LL<<40),reale(26296855,15713LL<<38), -reale(12371894,1597LL<<39),reale(3711568,4235LL<<38), -reale(524991,147555LL<<34),reale(50589017595LL,0x2b9323ed5d177LL), // C4[18], coeff of eps^18, polynomial in n of order 11 -reale(768539,29011LL<<36),reale(2243105,18035LL<<37), -reale(5671852,39713LL<<36),reale(12494515,7255LL<<39), -reale(24051943,5231LL<<36),reale(40468348,22085LL<<37), -reale(59307062,46653LL<<36),reale(74994737,5975LL<<38), -reale(80108014,59787LL<<36),reale(68664012,25623LL<<37), -reale(39899358,51033LL<<36),reale(10762327,20443LL<<33), reale(151767052785LL,0x82b96bc817465LL), // C4[19], coeff of eps^29, polynomial in n of order 0 -real(69697LL<<34),reale(220556,0x6c98ea537e51fLL), // C4[19], coeff of eps^28, polynomial in n of order 1 -real(1238839LL<<41),real(675087LL<<35), reale(141943813,0x222cc7846d81LL), // C4[19], coeff of eps^27, polynomial in n of order 2 reale(876102,3999LL<<40),reale(573743,1451LL<<39), -reale(328615,14973LL<<34),reale(159970677260LL,0x6732257fe12e7LL), // C4[19], coeff of eps^26, polynomial in n of order 3 -reale(7739083,17LL<<46),reale(4186838,53LL<<45),-reale(704448,1LL<<46), -reale(33249,11241LL<<37),reale(159970677260LL,0x6732257fe12e7LL), // C4[19], coeff of eps^25, polynomial in n of order 4 -reale(1360864,133LL<<42),-reale(4500609,2667LL<<40), reale(427896,299LL<<41),reale(1570943,1191LL<<40), -reale(614728,45789LL<<35),reale(159970677260LL,0x6732257fe12e7LL), // C4[19], coeff of eps^24, polynomial in n of order 5 -reale(379105,631LL<<42),reale(20252634,139LL<<44), -reale(16388211,705LL<<42),reale(5510947,339LL<<43), -reale(439601,699LL<<42),-reale(122601,56745LL<<36), reale(159970677260LL,0x6732257fe12e7LL), // C4[19], coeff of eps^23, polynomial in n of order 6 -reale(55355388,567LL<<41),-reale(2520461,2117LL<<40), reale(18017708,147LL<<42),-reale(6413373,771LL<<40), -reale(4373212,61LL<<41),reale(4784182,2079LL<<40), -reale(1386197,54485LL<<35),reale(159970677260LL,0x6732257fe12e7LL), // C4[19], coeff of eps^22, polynomial in n of order 7 -reale(54112477,29LL<<46),reale(112419812,35LL<<45), -reale(110372726,9LL<<46),reale(68510282,53LL<<46), -reale(25556330,19LL<<46),reale(3652507,1LL<<45),reale(962676,17LL<<46), -reale(355362,30093LL<<37),reale(159970677260LL,0x6732257fe12e7LL), // C4[19], coeff of eps^21, polynomial in n of order 8 reale(166723371,209LL<<42),-reale(142457721,7469LL<<39), reale(81530379,2787LL<<40),-reale(7977897,3383LL<<39), -reale(46298043,1775LL<<41),reale(63437092,799LL<<39), -reale(49803454,3807LL<<40),reale(24585849,2581LL<<39), -reale(5799325,105875LL<<34),reale(159970677260LL,0x6732257fe12e7LL), // C4[19], coeff of eps^20, polynomial in n of order 9 reale(54095236,1729LL<<41),-reale(86448328,33LL<<44), reale(119042325,527LL<<41),-reale(140012701,875LL<<42), reale(138519104,1133LL<<41),-reale(112357061,257LL<<43), reale(71568963,1275LL<<41),-reale(33272498,441LL<<42), reale(9897515,729LL<<41),-reale(1391838,12705LL<<35), reale(159970677260LL,0x6732257fe12e7LL), // C4[19], coeff of eps^19, polynomial in n of order 10 reale(2731650,3225LL<<40),-reale(6520331,5423LL<<39), reale(13678206,885LL<<42),-reale(25266687,5569LL<<39), reale(41073925,3215LL<<40),-reale(58519302,7091LL<<39), reale(72351138,181LL<<41),-reale(75968694,8133LL<<39), reale(64333849,3333LL<<40),-reale(37115682,4791LL<<39), reale(9974839,182105LL<<34),reale(159970677260LL,0x6732257fe12e7LL), // C4[20], coeff of eps^29, polynomial in n of order 0 real(1LL<<39),reale(386445,0x44b61aebc827LL), // C4[20], coeff of eps^28, polynomial in n of order 1 reale(3670,3431LL<<40),-real(63923791LL<<37), reale(1044560880,0x57ec63f8653c9LL), // C4[20], coeff of eps^27, polynomial in n of order 2 reale(165149,453LL<<43),-reale(25858,471LL<<42),-real(26276299LL<<38), reale(7311926162LL,0x6776bbcac4a7fLL), // C4[20], coeff of eps^26, polynomial in n of order 3 -reale(4343033,595LL<<42),reale(185313,303LL<<43), reale(1548473,271LL<<42),-reale(580654,777LL<<40), reale(168174301735LL,0x4baadf37ab169LL), // C4[20], coeff of eps^25, polynomial in n of order 4 reale(20236427,149LL<<44),-reale(15067334,133LL<<42), reale(4797544,165LL<<43),-reale(318599,375LL<<42), -reale(118861,3875LL<<38),reale(168174301735LL,0x4baadf37ab169LL), // C4[20], coeff of eps^24, polynomial in n of order 5 -reale(6870833,1979LL<<41),reale(17282399,281LL<<43), -reale(5135975,189LL<<41),-reale(4572111,263LL<<42), reale(4557653,1537LL<<41),-reale(1294702,4061LL<<38), reale(168174301735LL,0x4baadf37ab169LL), // C4[20], coeff of eps^23, polynomial in n of order 6 reale(111332564,131LL<<43),-reale(102611836,439LL<<42), reale(61113705,49LL<<44),-reale(21849131,865LL<<42), reale(2742318,257LL<<43),reale(980372,533LL<<42), -reale(327159,8391LL<<38),reale(168174301735LL,0x4baadf37ab169LL), // C4[20], coeff of eps^22, polynomial in n of order 7 -reale(128743521,979LL<<42),reale(67998970,481LL<<43), reale(279122,855LL<<42),-reale(47847734,245LL<<44), reale(60794248,257LL<<42),-reale(46583621,181LL<<43), reale(22803394,43LL<<42),-reale(5369928,2229LL<<40), reale(168174301735LL,0x4baadf37ab169LL), // C4[20], coeff of eps^21, polynomial in n of order 8 -reale(88564699,121LL<<45),reale(117949702,533LL<<42), -reale(134881895,27LL<<43),reale(130376590,239LL<<42), -reale(103788735,57LL<<44),reale(65154071,233LL<<42), -reale(29963298,393LL<<43),reale(8844588,195LL<<42), -reale(1237189,6873LL<<38),reale(168174301735LL,0x4baadf37ab169LL), // C4[20], coeff of eps^20, polynomial in n of order 9 -reale(7362630,999LL<<40),reale(14785858,137LL<<43), -reale(26321377,9LL<<40),reale(41483460,1083LL<<41), -reale(57615917,1643LL<<40),reale(69797568,521LL<<42), -reale(72155594,1933LL<<40),reale(60438019,617LL<<41), -reale(34641303,3055LL<<40),reale(9278920,21175LL<<37), reale(168174301735LL,0x4baadf37ab169LL), // C4[21], coeff of eps^29, polynomial in n of order 0 -real(2017699LL<<39),reale(144690669,0x92d5d14b2b5b9LL), // C4[21], coeff of eps^28, polynomial in n of order 1 -reale(21806,31LL<<47),-real(1751493LL<<42), reale(7668605487LL,0x6644548ff9f4dLL), // C4[21], coeff of eps^27, polynomial in n of order 2 -real(610053LL<<43),reale(66113,223LL<<42),-reale(23877,14131LL<<38), reale(7668605487LL,0x6644548ff9f4dLL), // C4[21], coeff of eps^26, polynomial in n of order 3 -reale(601427,223LL<<44),reale(181759,65LL<<45),-reale(9602,5LL<<44), -reale(4983,2721LL<<39),reale(7668605487LL,0x6644548ff9f4dLL), // C4[21], coeff of eps^25, polynomial in n of order 4 reale(16348405,227LL<<44),-reale(4001511,795LL<<42), -reale(4705038,397LL<<43),reale(4342393,855LL<<42), -reale(1212256,1051LL<<38),reale(176377926210LL,0x302398ef74febLL), // C4[21], coeff of eps^24, polynomial in n of order 5 -reale(95167920,19LL<<45),reale(54565817,7LL<<47), -reale(18712410,5LL<<45),reale(2011897,15LL<<46),reale(981374,25LL<<45), -reale(301721,597LL<<40),reale(176377926210LL,0x302398ef74febLL), // C4[21], coeff of eps^23, polynomial in n of order 6 reale(56043535,133LL<<43),reale(7101303,759LL<<42), -reale(48732132,249LL<<44),reale(58197907,161LL<<42), -reale(43660867,425LL<<43),reale(21217809,619LL<<42), -reale(4990122,11039LL<<38),reale(176377926210LL,0x302398ef74febLL), // C4[21], coeff of eps^22, polynomial in n of order 7 reale(38792824,189LL<<44),-reale(43241527,125LL<<45), reale(40920531,151LL<<44),-reale(32022608,39LL<<46), reale(19836099,97LL<<44),-reale(9032168,63LL<<45), reale(2647359,187LL<<44),-reale(368524,4161LL<<39), reale(58792642070LL,0x100bdda526ff9LL), // C4[21], coeff of eps^21, polynomial in n of order 8 reale(15813930,121LL<<45),-reale(27228018,205LL<<42), reale(41726053,443LL<<43),-reale(56628215,983LL<<42), reale(67341662,57LL<<44),-reale(68636694,193LL<<42), reale(56918234,105LL<<43),-reale(32430156,715LL<<42), reale(8660325,15343LL<<38),reale(176377926210LL,0x302398ef74febLL), // C4[22], coeff of eps^29, polynomial in n of order 0 -real(229LL<<43),reale(2018939,0x935060fc493cdLL), // C4[22], coeff of eps^28, polynomial in n of order 1 reale(64733,61LL<<46),-reale(22613,493LL<<43), reale(8025284812LL,0x6511ed552f41bLL), // C4[22], coeff of eps^27, polynomial in n of order 2 reale(158513,3LL<<48),-reale(6162,29LL<<47),-reale(4786,487LL<<43), reale(8025284812LL,0x6511ed552f41bLL), // C4[22], coeff of eps^26, polynomial in n of order 3 -reale(130438,301LL<<43),-reale(208062,47LL<<44),reale(179942,497LL<<43), -reale(49466,167LL<<40),reale(8025284812LL,0x6511ed552f41bLL), // C4[22], coeff of eps^25, polynomial in n of order 4 reale(2120438,3LL<<47),-reale(697803,39LL<<45),reale(61914,3LL<<46), reale(42203,115LL<<45),-reale(12120,543LL<<41), reale(8025284812LL,0x6511ed552f41bLL), // C4[22], coeff of eps^24, polynomial in n of order 5 reale(12722577,33LL<<44),-reale(49104495,51LL<<46), reale(55677556,71LL<<44),-reale(41002422,115LL<<45), reale(19800840,109LL<<44),-reale(4652345,837LL<<41), reale(184581550685LL,0x149c52a73ee6dLL), // C4[22], coeff of eps^23, polynomial in n of order 6 -reale(124610244,57LL<<46),reale(115654934,113LL<<45), -reale(89096506,19LL<<47),reale(54518354,119LL<<45), -reale(24598996,19LL<<46),reale(7163443,125LL<<45), -reale(992759,1841LL<<41),reale(184581550685LL,0x149c52a73ee6dLL), // C4[22], coeff of eps^22, polynomial in n of order 7 -reale(27999005,155LL<<43),reale(41827085,121LL<<44), -reale(55581037,1LL<<43),reale(64987058,83LL<<45), -reale(65383321,103LL<<43),reale(53725829,211LL<<44), -reale(30444636,461LL<<43),reale(8107539,715LL<<40), reale(184581550685LL,0x149c52a73ee6dLL), // C4[23], coeff of eps^29, polynomial in n of order 0 -reale(4289,21LL<<43),reale(1676392827,0x7a5fe79ee0e95LL), // C4[23], coeff of eps^28, polynomial in n of order 1 -real(1351LL<<51),-real(234789LL<<44), reale(1676392827,0x7a5fe79ee0e95LL), // C4[23], coeff of eps^27, polynomial in n of order 2 -reale(209744,1LL<<50),reale(171585,3LL<<49),-reale(46526,469LL<<43), reale(8381964137LL,0x63df861a648e9LL), // C4[23], coeff of eps^26, polynomial in n of order 3 -reale(599194,1LL<<51),reale(41297,0),reale(41388,1LL<<51), -reale(11218,97LL<<45),reale(8381964137LL,0x63df861a648e9LL), // C4[23], coeff of eps^25, polynomial in n of order 4 -reale(2134087,7LL<<49),reale(2315275,31LL<<47),-reale(1677358,15LL<<48), reale(805613,21LL<<47),-reale(189149,1213LL<<41), reale(8381964137LL,0x63df861a648e9LL), // C4[23], coeff of eps^24, polynomial in n of order 5 reale(4740508,1LL<<49),-reale(3599518,1LL<<51),reale(2177844,7LL<<49), -reale(974429,1LL<<50),reale(282071,5LL<<49),-reale(38931,779LL<<42), reale(8381964137LL,0x63df861a648e9LL), // C4[23], coeff of eps^23, polynomial in n of order 6 reale(1817763,3LL<<48),-reale(2369306,23LL<<47),reale(2727592,1LL<<49), -reale(2711734,1LL<<47),reale(2209561,1LL<<48),-reale(1245816,11LL<<47), reale(330919,1979LL<<41),reale(8381964137LL,0x63df861a648e9LL), // C4[24], coeff of eps^29, polynomial in n of order 0 -real(1439LL<<46),reale(44813556,0x37a4fd885dffdLL), // C4[24], coeff of eps^28, polynomial in n of order 1 reale(32742,3LL<<50),-reale(8770,21LL<<47), reale(1747728692,0x7a229fc651f8bLL), // C4[24], coeff of eps^27, polynomial in n of order 2 reale(4928,1LL<<51),reale(8067,1LL<<50),-reale(2080,43LL<<46), reale(1747728692,0x7a229fc651f8bLL), // C4[24], coeff of eps^26, polynomial in n of order 3 reale(2214330,0),-reale(1581120,0),reale(755790,0), -reale(177363,7LL<<47),reale(8738643462LL,0x62ad1edf99db7LL), // C4[24], coeff of eps^25, polynomial in n of order 4 -reale(1116955,0),reale(668788,3LL<<50),-reale(296917,1LL<<51), reale(85476,1LL<<50),-reale(11752,63LL<<46), reale(2912881154LL,0x20e45f9fddf3dLL), // C4[24], coeff of eps^24, polynomial in n of order 5 -reale(2320992,3LL<<48),reale(2634056,1LL<<50),-reale(2590155,5LL<<48), reale(2094168,1LL<<49),-reale(1175298,7LL<<48),reale(311454,11LL<<45), reale(8738643462LL,0x62ad1edf99db7LL), // C4[25], coeff of eps^29, polynomial in n of order 0 -real(3707LL<<46),reale(12720731,0x2bd144a4925efLL), // C4[25], coeff of eps^28, polynomial in n of order 1 real(301LL<<53),-real(2379LL<<48),reale(139928042,0xe1fdf3124a145LL), // C4[25], coeff of eps^27, polynomial in n of order 2 -reale(298603,1LL<<51),reale(142145,1LL<<50),-reale(33346,63LL<<46), reale(1819064557,0x79e557edc3081LL), // C4[25], coeff of eps^26, polynomial in n of order 3 reale(370617,0),-reale(163358,0),reale(46787,0),-reale(6410,23LL<<47), reale(1819064557,0x79e557edc3081LL), // C4[25], coeff of eps^25, polynomial in n of order 4 reale(508963,0),-reale(495426,3LL<<50),reale(397689,1LL<<51), -reale(222238,1LL<<50),reale(58764,59LL<<46), reale(1819064557,0x79e557edc3081LL), // C4[26], coeff of eps^29, polynomial in n of order 0 -real(1LL<<49),reale(131359,0xe834f81ee20c1LL), // C4[26], coeff of eps^28, polynomial in n of order 1 reale(10305,0),-reale(2417,1LL<<49),reale(145415417,0x1d0ced8b7a293LL), // C4[26], coeff of eps^27, polynomial in n of order 2 -reale(11556,0),reale(3294,0),-real(3599LL<<49), reale(145415417,0x1d0ced8b7a293LL), // C4[26], coeff of eps^26, polynomial in n of order 3 -reale(36490,1LL<<51),reale(29097,0),-reale(16195,1LL<<51), reale(4273,13LL<<48),reale(145415417,0x1d0ced8b7a293LL), // C4[27], coeff of eps^29, polynomial in n of order 0 -real(2029LL<<49),reale(16766976,0xd0e6a80084b19LL), // C4[27], coeff of eps^28, polynomial in n of order 1 real(7LL<<56),-real(61LL<<50),reale(5588992,0x45a238002c3b3LL), // C4[27], coeff of eps^27, polynomial in n of order 2 reale(3080,0),-real(427LL<<54),real(3599LL<<49), reale(16766976,0xd0e6a80084b19LL), // C4[28], coeff of eps^29, polynomial in n of order 0 -real(1LL<<53),reale(827461,0x318a62b8e0a5bLL), // C4[28], coeff of eps^28, polynomial in n of order 1 -real(29LL<<55),real(61LL<<52),reale(2482383,0x949f282aa1f11LL), // C4[29], coeff of eps^29, polynomial in n of order 0 real(1LL<<53),reale(88602,0xec373d36a45dfLL), }; // count = 5425 #else #error "Bad value for GEOGRAPHICLIB_GEODESICEXACT_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == (nC4_ * (nC4_ + 1) * (nC4_ + 5)) / 6, "Coefficient array size mismatch in C4coeff"); int o = 0, k = 0; for (int l = 0; l < nC4_; ++l) { // l is index of C4[l] for (int j = nC4_ - 1; j >= l; --j) { // coeff of eps^j int m = nC4_ - j - 1; // order of polynomial in n _C4x[k++] = Math::polyval(m, coeff + o, _n) / coeff[o + m + 1]; o += m + 2; } } // Post condition: o == sizeof(coeff) / sizeof(real) && k == nC4x_ if (!(o == sizeof(coeff) / sizeof(real) && k == nC4x_)) throw GeographicErr("C4 misalignment"); } } // namespace GeographicLib GeographicLib-1.52/src/GeodesicLine.cpp0000644000771000077100000003062214064202371017645 0ustar ckarneyckarney/** * \file GeodesicLine.cpp * \brief Implementation for GeographicLib::GeodesicLine class * * Copyright (c) Charles Karney (2009-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * 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 namespace GeographicLib { using namespace std; void GeodesicLine::LineInit(const Geodesic& g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps) { tiny_ = g.tiny_; _lat1 = Math::LatFix(lat1); _lon1 = lon1; _azi1 = azi1; _salp1 = salp1; _calp1 = calp1; _a = g._a; _f = g._f; _b = g._b; _c2 = g._c2; _f1 = g._f1; // Always allow latitude and azimuth and unrolling of longitude _caps = caps | LATITUDE | AZIMUTH | LONG_UNROLL; real cbet1, sbet1; Math::sincosd(Math::AngRound(_lat1), sbet1, cbet1); sbet1 *= _f1; // Ensure cbet1 = +epsilon at poles Math::norm(sbet1, cbet1); cbet1 = max(tiny_, cbet1); _dn1 = sqrt(1 + g._ep2 * Math::sq(sbet1)); // 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 = 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; Math::norm(_ssig1, _csig1); // sig1 in (-pi, pi] // Math::norm(_somg1, _comg1); -- don't need to normalize! _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(eps, _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_); } _a13 = _s13 = Math::NaN(); } GeodesicLine::GeodesicLine(const Geodesic& g, real lat1, real lon1, real azi1, unsigned caps) { azi1 = Math::AngNormalize(azi1); real salp1, calp1; // Guard against underflow in salp0. Also -0 is converted to +0. Math::sincosd(Math::AngRound(azi1), salp1, calp1); LineInit(g, lat1, lon1, azi1, salp1, calp1, caps); } GeodesicLine::GeodesicLine(const Geodesic& g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps, bool arcmode, real s13_a13) { LineInit(g, lat1, lon1, azi1, salp1, calp1, caps); GenSetDistance(arcmode, s13_a13); } 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 { outmask &= _caps & OUT_MASK; if (!( Init() && (arcmode || (_caps & (OUT_MASK & DISTANCE_IN))) )) // 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(); Math::sincosd(s12_a12, ssig12, csig12); } 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); if (abs(_f) > 0.01) { // Reverted distance series is inaccurate for |f| > 1/100, so correct // sig12 with 1 Newton iteration. The following table shows the // approximate maximum error for a = WGS_a() and various f relative to // GeodesicExact. // erri = the error in the inverse solution (nm) // errd = the error in the direct solution (series only) (nm) // errda = the error in the direct solution // (series + 1 Newton) (nm) // // f erri errd errda // -1/5 12e6 1.2e9 69e6 // -1/10 123e3 12e6 765e3 // -1/20 1110 108e3 7155 // -1/50 18.63 200.9 27.12 // -1/100 18.63 23.78 23.37 // -1/150 18.63 21.05 20.26 // 1/150 22.35 24.73 25.83 // 1/100 22.35 25.03 25.31 // 1/50 29.80 231.9 30.44 // 1/20 5376 146e3 10e3 // 1/10 829e3 22e6 1.5e6 // 1/5 157e6 3.8e9 280e6 real ssig2 = _ssig1 * csig12 + _csig1 * ssig12, csig2 = _csig1 * csig12 - _ssig1 * ssig12; B12 = Geodesic::SinCosSeries(true, ssig2, csig2, _C1a, nC1_); real serr = (1 + _A1m1) * (sig12 + (B12 - _B11)) - s12_a12 / _b; sig12 = sig12 - serr / sqrt(1 + _k2 * Math::sq(ssig2)); ssig12 = sin(sig12); csig12 = cos(sig12); // Update B12 below } } real ssig2, csig2, sbet2, cbet2, salp2, calp2; // sig2 = sig1 + sig12 ssig2 = _ssig1 * csig12 + _csig1 * ssig12; csig2 = _csig1 * csig12 - _ssig1 * ssig12; real dn2 = sqrt(1 + _k2 * Math::sq(ssig2)); if (outmask & (DISTANCE | REDUCEDLENGTH | GEODESICSCALE)) { if (arcmode || abs(_f) > 0.01) 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 = hypot(_salp0, _calp0 * csig2); if (cbet2 == 0) // I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case cbet2 = csig2 = tiny_; // tan(alp0) = cos(sig2)*tan(alp2) salp2 = _salp0; calp2 = _calp0 * csig2; // No need to normalize if (outmask & DISTANCE) s12 = arcmode ? _b * ((1 + _A1m1) * sig12 + AB1) : s12_a12; if (outmask & LONGITUDE) { // tan(omg2) = sin(alp0) * tan(sig2) real somg2 = _salp0 * ssig2, comg2 = csig2, // No need to normalize E = copysign(real(1), _salp0); // east-going? // omg12 = omg2 - omg1 real omg12 = outmask & LONG_UNROLL ? E * (sig12 - (atan2( ssig2, csig2) - atan2( _ssig1, _csig1)) + (atan2(E * somg2, comg2) - atan2(E * _somg1, _comg1))) : atan2(somg2 * _comg1 - comg2 * _somg1, comg2 * _comg1 + somg2 * _somg1); real lam12 = omg12 + _A3c * ( sig12 + (Geodesic::SinCosSeries(true, ssig2, csig2, _C3a, nC3_-1) - _B31)); real lon12 = lam12 / Math::degree(); lon2 = outmask & LONG_UNROLL ? _lon1 + lon12 : Math::AngNormalize(Math::AngNormalize(_lon1) + Math::AngNormalize(lon12)); } if (outmask & LATITUDE) lat2 = Math::atan2d(sbet2, _f1 * cbet2); if (outmask & AZIMUTH) azi2 = Math::atan2d(salp2, calp2); if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) { real 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 * ((dn2 * (_csig1 * ssig2) - _dn1 * (_ssig1 * csig2)) - _csig1 * csig2 * J12); if (outmask & GEODESICSCALE) { real t = _k2 * (ssig2 - _ssig1) * (ssig2 + _ssig1) / (_dn1 + dn2); M12 = csig12 + (t * ssig2 - csig2 * J12) * _ssig1 / _dn1; M21 = csig12 - (t * _ssig1 - _csig1 * J12) * ssig2 / dn2; } } 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 normalize salp12 = salp2 * _calp1 - calp2 * _salp1; calp12 = calp2 * _calp1 + salp2 * _salp1; // We used to include here some patch up code that purported to deal // with nearly meridional geodesics properly. However, this turned out // to be wrong once _salp1 = -0 was allowed (via // Geodesic::InverseLine). In fact, the calculation of {s,c}alp12 // was already correct (following the IEEE rules for handling signed // zeros). So the patch up code was unnecessary (as well as // dangerous). } 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(); } void GeodesicLine::SetDistance(real s13) { _s13 = s13; real t; // This will set _a13 to NaN if the GeodesicLine doesn't have the // DISTANCE_IN capability. _a13 = GenPosition(false, _s13, 0u, t, t, t, t, t, t, t, t); } void GeodesicLine::SetArc(real a13) { _a13 = a13; // In case the GeodesicLine doesn't have the DISTANCE capability. _s13 = Math::NaN(); real t; GenPosition(true, _a13, DISTANCE, t, t, t, _s13, t, t, t, t); } void GeodesicLine::GenSetDistance(bool arcmode, real s13_a13) { arcmode ? SetArc(s13_a13) : SetDistance(s13_a13); } } // namespace GeographicLib GeographicLib-1.52/src/GeodesicLineExact.cpp0000644000771000077100000002600014064202371020625 0ustar ckarneyckarney/** * \file GeodesicLineExact.cpp * \brief Implementation for GeographicLib::GeodesicLineExact class * * Copyright (c) Charles Karney (2012-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * 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 namespace GeographicLib { using namespace std; void GeodesicLineExact::LineInit(const GeodesicExact& g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps) { tiny_ = g.tiny_; _lat1 = Math::LatFix(lat1); _lon1 = lon1; _azi1 = azi1; _salp1 = salp1; _calp1 = calp1; _a = g._a; _f = g._f; _b = g._b; _c2 = g._c2; _f1 = g._f1; _e2 = g._e2; // Always allow latitude and azimuth and unrolling of longitude _caps = caps | LATITUDE | AZIMUTH | LONG_UNROLL; real cbet1, sbet1; Math::sincosd(Math::AngRound(_lat1), sbet1, cbet1); sbet1 *= _f1; // Ensure cbet1 = +epsilon at poles Math::norm(sbet1, cbet1); cbet1 = max(tiny_, cbet1); _dn1 = (_f >= 0 ? sqrt(1 + g._ep2 * Math::sq(sbet1)) : sqrt(1 - _e2 * Math::sq(cbet1)) / _f1); // 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 = 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; // Without normalization we have schi1 = somg1. _cchi1 = _f1 * _dn1 * _comg1; Math::norm(_ssig1, _csig1); // sig1 in (-pi, pi] // Math::norm(_somg1, _comg1); -- don't need to normalize! // Math::norm(_schi1, _cchi1); -- don't need to normalize! _k2 = Math::sq(_calp0) * g._ep2; _E.Reset(-_k2, -g._ep2, 1 + _k2, 1 + g._ep2); if (_caps & CAP_E) { _E0 = _E.E() / (Math::pi() / 2); _E1 = _E.deltaE(_ssig1, _csig1, _dn1); real s = sin(_E1), c = cos(_E1); // tau1 = sig1 + B11 _stau1 = _ssig1 * c + _csig1 * s; _ctau1 = _csig1 * c - _ssig1 * s; // Not necessary because Einv inverts E // _E1 = -_E.deltaEinv(_stau1, _ctau1); } if (_caps & CAP_D) { _D0 = _E.D() / (Math::pi() / 2); _D1 = _E.deltaD(_ssig1, _csig1, _dn1); } if (_caps & CAP_H) { _H0 = _E.H() / (Math::pi() / 2); _H1 = _E.deltaH(_ssig1, _csig1, _dn1); } if (_caps & CAP_C4) { real eps = _k2 / (2 * (1 + sqrt(1 + _k2)) + _k2); g.C4f(eps, _C4a); // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) _A4 = Math::sq(_a) * _calp0 * _salp0 * _e2; _B41 = GeodesicExact::CosSeries(_ssig1, _csig1, _C4a, nC4_); } _a13 = _s13 = Math::NaN(); } GeodesicLineExact::GeodesicLineExact(const GeodesicExact& g, real lat1, real lon1, real azi1, unsigned caps) { azi1 = Math::AngNormalize(azi1); real salp1, calp1; // Guard against underflow in salp0. Also -0 is converted to +0. Math::sincosd(Math::AngRound(azi1), salp1, calp1); LineInit(g, lat1, lon1, azi1, salp1, calp1, caps); } GeodesicLineExact::GeodesicLineExact(const GeodesicExact& g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps, bool arcmode, real s13_a13) { LineInit(g, lat1, lon1, azi1, salp1, calp1, caps); GenSetDistance(arcmode, s13_a13); } Math::real GeodesicLineExact::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 { outmask &= _caps & OUT_MASK; if (!( Init() && (arcmode || (_caps & (OUT_MASK & DISTANCE_IN))) )) // Uninitialized or impossible distance calculation requested return Math::NaN(); // Avoid warning about uninitialized B12. real sig12, ssig12, csig12, E2 = 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 * _E0), s = sin(tau12), c = cos(tau12); // tau2 = tau1 + tau12 E2 = - _E.deltaEinv(_stau1 * c + _ctau1 * s, _ctau1 * c - _stau1 * s); sig12 = tau12 - (E2 - _E1); ssig12 = sin(sig12); csig12 = cos(sig12); } real ssig2, csig2, sbet2, cbet2, salp2, calp2; // sig2 = sig1 + sig12 ssig2 = _ssig1 * csig12 + _csig1 * ssig12; csig2 = _csig1 * csig12 - _ssig1 * ssig12; real dn2 = _E.Delta(ssig2, csig2); if (outmask & (DISTANCE | REDUCEDLENGTH | GEODESICSCALE)) { if (arcmode) { E2 = _E.deltaE(ssig2, csig2, dn2); } AB1 = _E0 * (E2 - _E1); } // sin(bet2) = cos(alp0) * sin(sig2) sbet2 = _calp0 * ssig2; // Alt: cbet2 = hypot(csig2, salp0 * ssig2); cbet2 = hypot(_salp0, _calp0 * csig2); if (cbet2 == 0) // I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case cbet2 = csig2 = tiny_; // tan(alp0) = cos(sig2)*tan(alp2) salp2 = _salp0; calp2 = _calp0 * csig2; // No need to normalize if (outmask & DISTANCE) s12 = arcmode ? _b * (_E0 * sig12 + AB1) : s12_a12; if (outmask & LONGITUDE) { real somg2 = _salp0 * ssig2, comg2 = csig2, // No need to normalize E = copysign(real(1), _salp0); // east-going? // Without normalization we have schi2 = somg2. real cchi2 = _f1 * dn2 * comg2; real chi12 = outmask & LONG_UNROLL ? E * (sig12 - (atan2( ssig2, csig2) - atan2( _ssig1, _csig1)) + (atan2(E * somg2, cchi2) - atan2(E * _somg1, _cchi1))) : atan2(somg2 * _cchi1 - cchi2 * _somg1, cchi2 * _cchi1 + somg2 * _somg1); real lam12 = chi12 - _e2/_f1 * _salp0 * _H0 * (sig12 + (_E.deltaH(ssig2, csig2, dn2) - _H1)); real lon12 = lam12 / Math::degree(); lon2 = outmask & LONG_UNROLL ? _lon1 + lon12 : Math::AngNormalize(Math::AngNormalize(_lon1) + Math::AngNormalize(lon12)); } if (outmask & LATITUDE) lat2 = Math::atan2d(sbet2, _f1 * cbet2); if (outmask & AZIMUTH) azi2 = Math::atan2d(salp2, calp2); if (outmask & (REDUCEDLENGTH | GEODESICSCALE)) { real J12 = _k2 * _D0 * (sig12 + (_E.deltaD(ssig2, csig2, dn2) - _D1)); if (outmask & REDUCEDLENGTH) // Add parens around (_csig1 * ssig2) and (_ssig1 * csig2) to ensure // accurate cancellation in the case of coincident points. m12 = _b * ((dn2 * (_csig1 * ssig2) - _dn1 * (_ssig1 * csig2)) - _csig1 * csig2 * J12); if (outmask & GEODESICSCALE) { real t = _k2 * (ssig2 - _ssig1) * (ssig2 + _ssig1) / (_dn1 + dn2); M12 = csig12 + (t * ssig2 - csig2 * J12) * _ssig1 / _dn1; M21 = csig12 - (t * _ssig1 - _csig1 * J12) * ssig2 / dn2; } } if (outmask & AREA) { real B42 = GeodesicExact::CosSeries(ssig2, csig2, _C4a, nC4_); real salp12, calp12; if (_calp0 == 0 || _salp0 == 0) { // alp12 = alp2 - alp1, used in atan2 so no need to normalize salp12 = salp2 * _calp1 - calp2 * _salp1; calp12 = calp2 * _calp1 + salp2 * _salp1; // We used to include here some patch up code that purported to deal // with nearly meridional geodesics properly. However, this turned out // to be wrong once _salp1 = -0 was allowed (via // GeodesicExact::InverseLine). In fact, the calculation of {s,c}alp12 // was already correct (following the IEEE rules for handling signed // zeros). So the patch up code was unnecessary (as well as // dangerous). } 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(); } void GeodesicLineExact::SetDistance(real s13) { _s13 = s13; real t; // This will set _a13 to NaN if the GeodesicLineExact doesn't have the // DISTANCE_IN capability. _a13 = GenPosition(false, _s13, 0u, t, t, t, t, t, t, t, t); } void GeodesicLineExact::SetArc(real a13) { _a13 = a13; // In case the GeodesicLineExact doesn't have the DISTANCE capability. _s13 = Math::NaN(); real t; GenPosition(true, _a13, DISTANCE, t, t, t, _s13, t, t, t, t); } void GeodesicLineExact::GenSetDistance(bool arcmode, real s13_a13) { arcmode ? SetArc(s13_a13) : SetDistance(s13_a13); } } // namespace GeographicLib GeographicLib-1.52/src/Geohash.cpp0000644000771000077100000000662514064202371016677 0ustar ckarneyckarney/** * \file Geohash.cpp * \brief Implementation for GeographicLib::Geohash class * * Copyright (c) Charles Karney (2012-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include namespace GeographicLib { using namespace std; const char* const Geohash::lcdigits_ = "0123456789bcdefghjkmnpqrstuvwxyz"; const char* const Geohash::ucdigits_ = "0123456789BCDEFGHJKMNPQRSTUVWXYZ"; void Geohash::Forward(real lat, real lon, int len, string& geohash) { using std::isnan; // Needed for Centos 7, ubuntu 14 static const real shift = ldexp(real(1), 45); static const real loneps = 180 / shift; static const real lateps = 90 / shift; if (abs(lat) > 90) throw GeographicErr("Latitude " + Utility::str(lat) + "d not in [-90d, 90d]"); if (isnan(lat) || isnan(lon)) { geohash = "invalid"; return; } if (lat == 90) lat -= lateps / 2; lon = Math::AngNormalize(lon); if (lon == 180) lon = -180; // lon now in [-180,180) // lon/loneps in [-2^45,2^45); lon/loneps + shift in [0,2^46) // similarly for lat len = max(0, min(int(maxlen_), len)); unsigned long long ulon = (unsigned long long)(floor(lon/loneps) + shift), ulat = (unsigned long long)(floor(lat/lateps) + shift); char geohash1[maxlen_]; unsigned byte = 0; for (unsigned i = 0; i < 5 * unsigned(len);) { if ((i & 1) == 0) { byte = (byte << 1) + unsigned((ulon & mask_) != 0); ulon <<= 1; } else { byte = (byte << 1) + unsigned((ulat & mask_) != 0); ulat <<= 1; } ++i; if (i % 5 == 0) { geohash1[(i/5)-1] = lcdigits_[byte]; byte = 0; } } geohash.resize(len); copy(geohash1, geohash1 + len, geohash.begin()); } void Geohash::Reverse(const string& geohash, real& lat, real& lon, int& len, bool centerp) { static const real shift = ldexp(real(1), 45); static const real loneps = 180 / shift; static const real lateps = 90 / shift; int len1 = min(int(maxlen_), int(geohash.length())); if (len1 >= 3 && ((toupper(geohash[0]) == 'I' && toupper(geohash[1]) == 'N' && toupper(geohash[2]) == 'V') || // Check A first because it is not in a standard geohash (toupper(geohash[1]) == 'A' && toupper(geohash[0]) == 'N' && toupper(geohash[2]) == 'N'))) { lat = lon = Math::NaN(); return; } unsigned long long ulon = 0, ulat = 0; for (unsigned k = 0, j = 0; k < unsigned(len1); ++k) { int byte = Utility::lookup(ucdigits_, geohash[k]); if (byte < 0) throw GeographicErr("Illegal character in geohash " + geohash); for (unsigned m = 16; m; m >>= 1) { if (j == 0) ulon = (ulon << 1) + unsigned((byte & m) != 0); else ulat = (ulat << 1) + unsigned((byte & m) != 0); j ^= 1; } } ulon <<= 1; ulat <<= 1; if (centerp) { ulon += 1; ulat += 1; } int s = 5 * (maxlen_ - len1); ulon <<= (s / 2); ulat <<= s - (s / 2); lon = ulon * loneps - 180; lat = ulat * lateps - 90; len = len1; } } // namespace GeographicLib GeographicLib-1.52/src/Geoid.cpp0000644000771000077100000004132314064202371016342 0ustar ckarneyckarney/** * \file Geoid.cpp * \brief Implementation for GeographicLib::Geoid class * * Copyright (c) Charles Karney (2009-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include // For getenv #include #include #if !defined(GEOGRAPHICLIB_DATA) # if defined(_WIN32) # define GEOGRAPHICLIB_DATA "C:/ProgramData/GeographicLib" # else # define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib" # endif #endif #if !defined(GEOGRAPHICLIB_GEOID_DEFAULT_NAME) # define GEOGRAPHICLIB_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). // https://doi.org/10.1145/368424.368443 // // 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 int Geoid::c0_ = 240; // Common denominator const int 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 int Geoid::c0n_ = 372; // Common denominator const int 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 int Geoid::c0s_ = 372; // Common denominator const int 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) const { using std::isnan; // Needed for Centos 7, ubuntu 14 lat = Math::LatFix(lat); if (isnan(lat) || isnan(lon)) { return Math::NaN(); } lon = Math::AngNormalize(lon); 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 int* c3x = iy == 0 ? c3n_ : (iy == _height - 2 ? c3s_ : c3_); int 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 (!_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 (!_threadsafe) { _ix = ix; _iy = iy; copy(t, t + nterms_, _t); } return h; } } void Geoid::CacheClear() const { 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; } south = Math::LatFix(south); north = Math::LatFix(north); west = Math::AngNormalize(west); // west in [-180, 180) east = Math::AngNormalize(east); 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()); } } string Geoid::DefaultGeoidPath() { string path; char* geoidpath = getenv("GEOGRAPHICLIB_GEOID_PATH"); if (geoidpath) path = string(geoidpath); if (!path.empty()) return path; char* datapath = getenv("GEOGRAPHICLIB_DATA"); if (datapath) path = string(datapath); return (!path.empty() ? path : string(GEOGRAPHICLIB_DATA)) + "/geoids"; } string Geoid::DefaultGeoidName() { string name; char* geoidname = getenv("GEOGRAPHICLIB_GEOID_NAME"); if (geoidname) name = string(geoidname); return !name.empty() ? name : string(GEOGRAPHICLIB_GEOID_DEFAULT_NAME); } } // namespace GeographicLib GeographicLib-1.52/src/Georef.cpp0000644000771000077100000001223314064202371016520 0ustar ckarneyckarney/** * \file Georef.cpp * \brief Implementation for GeographicLib::Georef class * * Copyright (c) Charles Karney (2015-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include namespace GeographicLib { using namespace std; const char* const Georef::digits_ = "0123456789"; const char* const Georef::lontile_ = "ABCDEFGHJKLMNPQRSTUVWXYZ"; const char* const Georef::lattile_ = "ABCDEFGHJKLM"; const char* const Georef::degrees_ = "ABCDEFGHJKLMNPQ"; void Georef::Forward(real lat, real lon, int prec, string& georef) { using std::isnan; // Needed for Centos 7, ubuntu 14 if (abs(lat) > 90) throw GeographicErr("Latitude " + Utility::str(lat) + "d not in [-90d, 90d]"); if (isnan(lat) || isnan(lon)) { georef = "INVALID"; return; } lon = Math::AngNormalize(lon); // lon in [-180,180) if (lat == 90) lat *= (1 - numeric_limits::epsilon() / 2); prec = max(-1, min(int(maxprec_), prec)); if (prec == 1) ++prec; // Disallow prec = 1 // The C++ standard mandates 64 bits for long long. But // check, to make sure. static_assert(numeric_limits::digits >= 45, "long long not wide enough to store 21600e9"); const long long m = 60000000000LL; long long x = (long long)(floor(lon * real(m))) - lonorig_ * m, y = (long long)(floor(lat * real(m))) - latorig_ * m; int ilon = int(x / m); int ilat = int(y / m); char georef1[maxlen_]; georef1[0] = lontile_[ilon / tile_]; georef1[1] = lattile_[ilat / tile_]; if (prec >= 0) { georef1[2] = degrees_[ilon % tile_]; georef1[3] = degrees_[ilat % tile_]; if (prec > 0) { x -= m * ilon; y -= m * ilat; long long d = (long long)pow(real(base_), maxprec_ - prec); x /= d; y /= d; for (int c = prec; c--;) { georef1[baselen_ + c ] = digits_[x % base_]; x /= base_; georef1[baselen_ + c + prec] = digits_[y % base_]; y /= base_; } } } georef.resize(baselen_ + 2 * prec); copy(georef1, georef1 + baselen_ + 2 * prec, georef.begin()); } void Georef::Reverse(const string& georef, real& lat, real& lon, int& prec, bool centerp) { int len = int(georef.length()); if (len >= 3 && toupper(georef[0]) == 'I' && toupper(georef[1]) == 'N' && toupper(georef[2]) == 'V') { lat = lon = Math::NaN(); return; } if (len < baselen_ - 2) throw GeographicErr("Georef must start with at least 2 letters " + georef); int prec1 = (2 + len - baselen_) / 2 - 1; int k; k = Utility::lookup(lontile_, georef[0]); if (k < 0) throw GeographicErr("Bad longitude tile letter in georef " + georef); real lon1 = k + lonorig_ / tile_; k = Utility::lookup(lattile_, georef[1]); if (k < 0) throw GeographicErr("Bad latitude tile letter in georef " + georef); real lat1 = k + latorig_ / tile_; real unit = 1; if (len > 2) { unit *= tile_; k = Utility::lookup(degrees_, georef[2]); if (k < 0) throw GeographicErr("Bad longitude degree letter in georef " + georef); lon1 = lon1 * tile_ + k; if (len < 4) throw GeographicErr("Missing latitude degree letter in georef " + georef); k = Utility::lookup(degrees_, georef[3]); if (k < 0) throw GeographicErr("Bad latitude degree letter in georef " + georef); lat1 = lat1 * tile_ + k; if (prec1 > 0) { if (georef.find_first_not_of(digits_, baselen_) != string::npos) throw GeographicErr("Non digits in trailing portion of georef " + georef.substr(baselen_)); if (len % 2) throw GeographicErr("Georef must end with an even number of digits " + georef.substr(baselen_)); if (prec1 == 1) throw GeographicErr("Georef needs at least 4 digits for minutes " + georef.substr(baselen_)); if (prec1 > maxprec_) throw GeographicErr("More than " + Utility::str(2*maxprec_) + " digits in georef " + georef.substr(baselen_)); for (int i = 0; i < prec1; ++i) { int m = i ? base_ : 6; unit *= m; int x = Utility::lookup(digits_, georef[baselen_ + i]), y = Utility::lookup(digits_, georef[baselen_ + i + prec1]); if (!(i || (x < m && y < m))) throw GeographicErr("Minutes terms in georef must be less than 60 " + georef.substr(baselen_)); lon1 = m * lon1 + x; lat1 = m * lat1 + y; } } } if (centerp) { unit *= 2; lat1 = 2 * lat1 + 1; lon1 = 2 * lon1 + 1; } lat = (tile_ * lat1) / unit; lon = (tile_ * lon1) / unit; prec = prec1; } } // namespace GeographicLib GeographicLib-1.52/src/Gnomonic.cpp0000644000771000077100000000515314064202371017065 0ustar ckarneyckarney/** * \file Gnomonic.cpp * \brief Implementation for GeographicLib::Gnomonic class * * Copyright (c) Charles Karney (2010-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #if defined(_MSC_VER) // Squelch warnings about potentially uninitialized local variables and // constant conditional expressions # pragma warning (disable: 4701 4127) #endif namespace GeographicLib { using namespace std; Gnomonic::Gnomonic(const Geodesic& earth) : eps0_(numeric_limits::epsilon()) , eps_(real(0.01) * sqrt(eps0_)) , _earth(earth) , _a(_earth.EquatorialRadius()) , _f(_earth.Flattening()) {} void Gnomonic::Forward(real lat0, real lon0, real lat, real lon, real& x, real& y, real& azi, real& rk) const { 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; Math::sincosd(azi0, x, y); x *= rho; y *= rho; } } void Gnomonic::Reverse(real lat0, real lon0, real x, real y, real& lat, real& lon, real& azi, real& rk) const { real azi0 = Math::atan2d(x, y), rho = 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-- || GEOGRAPHICLIB_PANIC) { 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 - rho * M) * M : (rho * m - M) * m; s -= ds; // Reversed test to allow escape with NaNs 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.52/src/GravityCircle.cpp0000644000771000077100000001214214064202371020057 0ustar ckarneyckarney/** * \file GravityCircle.cpp * \brief Implementation for GeographicLib::GravityCircle class * * Copyright (c) Charles Karney (2011-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include #include #include namespace GeographicLib { using namespace std; GravityCircle::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(Math::LatFix(lat)) , _h(h) , _Z(Z) , _Px(P) , _invR(1 / hypot(_Px, _Z)) , _cpsi(_Px * _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) {} Math::real GravityCircle::Gravity(real lon, real& gx, real& gy, real& gz) const { real slam, clam, M[Geocentric::dim2_]; Math::sincosd(lon, slam, clam); real Wres = W(slam, clam, 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 { real slam, clam, M[Geocentric::dim2_]; Math::sincosd(lon, slam, clam); real Tres = InternalT(slam, clam, 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 { if ((_caps & GEOID_HEIGHT) != GEOID_HEIGHT) return Math::NaN(); real slam, clam, dummy; Math::sincosd(lon, slam, clam); real T = InternalT(slam, clam, dummy, dummy, dummy, false, false); real correction = _corrmult * _correction(slam, clam); return T/_gamma0 + correction; } void GravityCircle::SphericalAnomaly(real lon, real& Dg01, real& xi, real& eta) const { if ((_caps & SPHERICAL_ANOMALY) != SPHERICAL_ANOMALY) { Dg01 = xi = eta = Math::NaN(); return; } real slam, clam; Math::sincosd(lon, slam, clam); real deltax, deltay, deltaz, T = InternalT(slam, clam, 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 slam, real clam, real& gX, real& gY, real& gZ) const { real Wres = V(slam, clam, gX, gY, gZ) + _frot * _Px / 2; gX += _frot * clam; gY += _frot * slam; return Wres; } Math::real GravityCircle::V(real slam, real clam, real& GX, real& GY, real& GZ) const { if ((_caps & GRAVITY) != GRAVITY) { GX = GY = GZ = Math::NaN(); return Math::NaN(); } real Vres = _gravitational(slam, clam, GX, GY, GZ), f = _GMmodel / _amodel; Vres *= f; GX *= f; GY *= f; GZ *= f; return Vres; } Math::real GravityCircle::InternalT(real slam, real clam, real& deltaX, real& deltaY, real& deltaZ, bool gradp, bool correct) const { 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(slam, clam, deltaX, deltaY, deltaZ) : _disturbing(slam, clam)); 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 += _Px * clam * r3; deltaY += _Px * slam * r3; deltaZ += _Z * r3; } } return T; } } // namespace GeographicLib GeographicLib-1.52/src/GravityModel.cpp0000644000771000077100000003415714064202371017730 0ustar ckarneyckarney/** * \file GravityModel.cpp * \brief Implementation for GeographicLib::GravityModel class * * Copyright (c) Charles Karney (2011-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include #include #include #include #include #if !defined(GEOGRAPHICLIB_DATA) # if defined(_WIN32) # define GEOGRAPHICLIB_DATA "C:/ProgramData/GeographicLib" # else # define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib" # endif #endif #if !defined(GEOGRAPHICLIB_GRAVITY_DEFAULT_NAME) # define GEOGRAPHICLIB_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, int Nmax, int Mmax) : _name(name) , _dir(path) , _description("NONE") , _date("UNKNOWN") , _amodel(Math::NaN()) , _GMmodel(Math::NaN()) , _zeta0(0) , _corrmult(1) , _nmx(-1) , _mmx(-1) , _norm(SphericalHarmonic::FULL) { if (_dir.empty()) _dir = DefaultGravityPath(); bool truncate = Nmax >= 0 || Mmax >= 0; if (truncate) { if (Nmax >= 0 && Mmax < 0) Mmax = Nmax; if (Nmax < 0) Nmax = numeric_limits::max(); if (Mmax < 0) Mmax = numeric_limits::max(); } 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; if (truncate) { N = Nmax; M = Mmax; } SphericalEngine::coeff::readcoeffs(coeffstr, N, M, _Cx, _Sx, truncate); if (!(N >= 0 && M >= 0)) throw GeographicErr("Degree and order must be at least 0"); if (_Cx[0] != 0) throw GeographicErr("The degree 0 term should be zero"); _Cx[0] = 1; // Include the 1/r term in the sum _gravitational = SphericalHarmonic(_Cx, _Sx, N, N, M, _amodel, _norm); if (truncate) { N = Nmax; M = Mmax; } SphericalEngine::coeff::readcoeffs(coeffstr, N, M, _CC, _CS, truncate); 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(); _nmx = max(nmx, _correction.Coefficients().nmx()); _mmx = max(_gravitational.Coefficients().mmx(), _correction.Coefficients().mmx()); // 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 = _Cx[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(_Cx, _Sx, _gravitational.Coefficients().N(), nmx, _gravitational.Coefficients().mmx(), _zonal, _zonal, // This is not accessed! nmx1, nmx1, 0, _amodel, SphericalHarmonic1::normalization(_norm)); } void GravityModel::ReadMetadata(const 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, 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::val(val); else if (key == "ModelMass") _GMmodel = Utility::val(val); else if (key == "AngularVelocity") omega = Utility::val(val); else if (key == "ReferenceRadius") a = Utility::val(val); else if (key == "ReferenceMass") GM = Utility::val(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 (!(isfinite(_amodel) && _amodel > 0)) throw GeographicErr("Model radius must be positive"); if (!(isfinite(_GMmodel) && _GMmodel > 0)) throw GeographicErr("Model mass constant must be positive"); if (!(isfinite(_corrmult) && _corrmult > 0)) throw GeographicErr("Correction multiplier must be positive"); if (!(isfinite(_zeta0))) throw GeographicErr("Height offset must be finite"); if (int(_id.size()) != idlength_) throw GeographicErr("Invalid ID"); if (isfinite(f) && isfinite(J2)) throw GeographicErr("Cannot specify both f and J2"); _earth = NormalGravity(a, GM, omega, isfinite(f) ? f : J2, isfinite(f)); } Math::real GravityModel::InternalT(real X, real Y, real Z, real& deltaX, real& deltaY, real& deltaZ, bool gradp, bool correct) const { // 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 T, invR = correct ? 1 / hypot(hypot(X, Y), Z) : 1; if (gradp) { // initial values to suppress warnings deltaX = deltaY = deltaZ = 0; T = _disturbing(-1, X, Y, Z, deltaX, deltaY, deltaZ); 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; } } else T = _disturbing(-1, X, Y, Z); T = (T / _amodel - (correct ? _dzonal0 : 0) * invR) * _GMmodel; return T; } Math::real GravityModel::V(real X, real Y, real Z, real& GX, real& GY, real& GZ) const { 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 { 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 { 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 = hypot(X, Y), R = hypot(P, Z), // psi is geocentric latitude cpsi = R != 0 ? P / R : M[7], spsi = R != 0 ? 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 = hypot( hypot(gammaX, gammaY), gammaZ); xi = -(deltay/gamma) / Math::degree(); eta = -(deltax/gamma) / Math::degree(); } Math::real GravityModel::GeoidHeight(real lat, real lon) const { 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 / hypot(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 { 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 { 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 / 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 = 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()); } string GravityModel::DefaultGravityPath() { string path; char* gravitypath = getenv("GEOGRAPHICLIB_GRAVITY_PATH"); if (gravitypath) path = string(gravitypath); if (!path.empty()) return path; char* datapath = getenv("GEOGRAPHICLIB_DATA"); if (datapath) path = string(datapath); return (!path.empty() ? path : string(GEOGRAPHICLIB_DATA)) + "/gravity"; } string GravityModel::DefaultGravityName() { string name; char* gravityname = getenv("GEOGRAPHICLIB_GRAVITY_NAME"); if (gravityname) name = string(gravityname); return !name.empty() ? name : string(GEOGRAPHICLIB_GRAVITY_DEFAULT_NAME); } } // namespace GeographicLib GeographicLib-1.52/src/LambertConformalConic.cpp0000644000771000077100000004432714064202371021525 0ustar ckarneyckarney/** * \file LambertConformalConic.cpp * \brief Implementation for GeographicLib::LambertConformalConic class * * Copyright (c) Charles Karney (2010-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { using namespace std; LambertConformalConic::LambertConformalConic(real a, real f, real stdlat, real k0) : eps_(numeric_limits::epsilon()) , epsx_(Math::sq(eps_)) , ahypover_(Math::digits() * log(real(numeric_limits::radix)) + 2) , _a(a) , _f(f) , _fm(1 - _f) , _e2(_f * (2 - _f)) , _es((_f < 0 ? -1 : 1) * sqrt(abs(_e2))) { if (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_f) && _f < 1)) throw GeographicErr("Polar semi-axis is not positive"); if (!(isfinite(k0) && k0 > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(stdlat) <= 90)) throw GeographicErr("Standard latitude not in [-90d, 90d]"); real sphi, cphi; Math::sincosd(stdlat, sphi, cphi); Init(sphi, cphi, sphi, cphi, k0); } LambertConformalConic::LambertConformalConic(real a, real f, real stdlat1, real stdlat2, real k1) : eps_(numeric_limits::epsilon()) , epsx_(Math::sq(eps_)) , ahypover_(Math::digits() * log(real(numeric_limits::radix)) + 2) , _a(a) , _f(f) , _fm(1 - _f) , _e2(_f * (2 - _f)) , _es((_f < 0 ? -1 : 1) * sqrt(abs(_e2))) { if (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_f) && _f < 1)) throw GeographicErr("Polar semi-axis is not positive"); if (!(isfinite(k1) && k1 > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(stdlat1) <= 90)) throw GeographicErr("Standard latitude 1 not in [-90d, 90d]"); if (!(abs(stdlat2) <= 90)) throw GeographicErr("Standard latitude 2 not in [-90d, 90d]"); real sphi1, cphi1, sphi2, cphi2; Math::sincosd(stdlat1, sphi1, cphi1); Math::sincosd(stdlat2, sphi2, cphi2); Init(sphi1, cphi1, sphi2, cphi2, k1); } LambertConformalConic::LambertConformalConic(real a, real f, real sinlat1, real coslat1, real sinlat2, real coslat2, real k1) : eps_(numeric_limits::epsilon()) , epsx_(Math::sq(eps_)) , ahypover_(Math::digits() * log(real(numeric_limits::radix)) + 2) , _a(a) , _f(f) , _fm(1 - _f) , _e2(_f * (2 - _f)) , _es((_f < 0 ? -1 : 1) * sqrt(abs(_e2))) { if (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_f) && _f < 1)) throw GeographicErr("Polar semi-axis is not positive"); if (!(isfinite(k1) && k1 > 0)) throw GeographicErr("Scale is not positive"); if (!(coslat1 >= 0)) throw GeographicErr("Standard latitude 1 not in [-90d, 90d]"); if (!(coslat2 >= 0)) throw GeographicErr("Standard latitude 2 not in [-90d, 90d]"); 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) { { real r; r = hypot(sphi1, cphi1); sphi1 /= r; cphi1 /= r; r = 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 = Math::eatanhe(sphi1, _es), shxi1 = sinh(xi1), chxi1 = hyp(shxi1), tchi1 = chxi1 * tphi1 - shxi1 * scphi1, scchi1 = hyp(tchi1), scphi2 = 1/cphi2, xi2 = Math::eatanhe(sphi2, _es), shxi2 = sinh(xi2), chxi2 = hyp(shxi2), tchi2 = chxi2 * tphi2 - shxi2 * scphi2, scchi2 = hyp(tchi2), psi1 = 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 = Math::eatanhe(real(1), _es), 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 = 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(Math::eatanhe(_n, _es)); _tchi0 = tphi0 * hyp(shxi0) - shxi0 * hyp(tphi0); _scchi0 = hyp(_tchi0); _psi0 = asinh(_tchi0); _lat0 = atan(_sign * tphi0) / Math::degree(); _t0nm1 = 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; { // Figure _drhomax using code at beginning of Forward with lat = -90 real sphi = -1, cphi = epsx_, tphi = sphi/cphi, scphi = 1/cphi, shxi = sinh(Math::eatanhe(sphi, _es)), tchi = hyp(shxi) * tphi - shxi * scphi, scchi = hyp(tchi), psi = asinh(tchi), dpsi = Dasinh(tchi, _tchi0, scchi, _scchi0) * (tchi - _tchi0); _drhomax = - _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); } } const LambertConformalConic& LambertConformalConic::Mercator() { static const LambertConformalConic mercator(Constants::WGS84_a(), Constants::WGS84_f(), real(0), real(1)); return mercator; } void LambertConformalConic::Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const { lon = Math::AngDiff(lon0, lon); // 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 sphi, cphi; Math::sincosd(Math::LatFix(lat) * _sign, sphi, cphi); cphi = max(epsx_, cphi); real lam = lon * Math::degree(), tphi = sphi/cphi, scbet = hyp(_fm * tphi), scphi = 1/cphi, shxi = sinh(Math::eatanhe(sphi, _es)), tchi = hyp(shxi) * tphi - shxi * scphi, scchi = hyp(tchi), psi = 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 { // 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 // Guard against 0 * inf in computation of ny nx = _n * x, ny = _n != 0 ? _n * y : 0, y1 = _nrho0 - ny, den = hypot(nx, y1) + _nrho0, // 0 implies origin with polar aspect // isfinite test is to avoid inf/inf drho = ((den != 0 && isfinite(den)) ? (x*nx + y * (ny - 2*_nrho0)) / den : den); drho = min(drho, _drhomax); if (_n == 0) drho = max(drho, -_drhomax); real 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 ? log1p(tnm1) : log(tn)) ); tchi = sh * (tn + 1/tn)/2 - hyp(sh) * (tnm1 * (tn + 1)/tn)/2; } // log(t) = -asinh(tan(chi)) = -psi gamma = atan2(nx, y1); real tphi = Math::tauf(tchi, _es), scbet = hyp(_fm * tphi), scchi = hyp(tchi), lam = _n != 0 ? gamma / _n : x / y1; lat = Math::atand(_sign * tphi); lon = lam / Math::degree(); lon = Math::AngNormalize(lon + Math::AngNormalize(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 (!(isfinite(k) && k > 0)) throw GeographicErr("Scale is not positive"); if (!(abs(lat) <= 90)) throw GeographicErr("Latitude for SetScale not in [-90d, 90d]"); 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.52/src/LocalCartesian.cpp0000644000771000077100000000377714064202371020212 0ustar ckarneyckarney/** * \file LocalCartesian.cpp * \brief Implementation for GeographicLib::LocalCartesian class * * Copyright (c) Charles Karney (2008-2015) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { using namespace std; void LocalCartesian::Reset(real lat0, real lon0, real h0) { _lat0 = Math::LatFix(lat0); _lon0 = Math::AngNormalize(lon0); _h0 = h0; _earth.Forward(_lat0, _lon0, _h0, _x0, _y0, _z0); real sphi, cphi, slam, clam; Math::sincosd(_lat0, sphi, cphi); Math::sincosd(_lon0, slam, clam); Geocentric::Rotation(sphi, cphi, slam, clam, _r); } void LocalCartesian::MatrixMultiply(real M[dim2_]) const { // M = r' . M 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 { 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 { 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.52/src/MGRS.cpp0000644000771000077100000004554014064202371016070 0ustar ckarneyckarney/** * \file MGRS.cpp * \brief Implementation for GeographicLib::MGRS class * * Copyright (c) Charles Karney (2008-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include namespace GeographicLib { using namespace std; const char* const MGRS::hemispheres_ = "SN"; const char* const MGRS::utmcols_[] = { "ABCDEFGH", "JKLMNPQR", "STUVWXYZ" }; const char* const MGRS::utmrow_ = "ABCDEFGHJKLMNPQRSTUV"; const char* const MGRS::upscols_[] = { "JKLPQRSTUXYZ", "ABCFGHJKLPQR", "RSTUXYZ", "ABCFGHJ" }; const char* const MGRS::upsrows_[] = { "ABCDEFGHJKLMNPQRSTUVWXYZ", "ABCDEFGHJKLMNP" }; const char* const MGRS::latband_ = "CDEFGHJKLMNPQRSTUVWX"; const char* const MGRS::upsband_ = "ABYZ"; const char* const MGRS::digits_ = "0123456789"; const int MGRS::mineasting_[] = { minupsSind_, minupsNind_, minutmcol_, minutmcol_ }; const int MGRS::maxeasting_[] = { maxupsSind_, maxupsNind_, maxutmcol_, maxutmcol_ }; const int MGRS::minnorthing_[] = { minupsSind_, minupsNind_, minutmSrow_, minutmSrow_ - (maxutmSrow_ - minutmNrow_) }; const int MGRS::maxnorthing_[] = { maxupsSind_, maxupsNind_, maxutmNrow_ + (maxutmSrow_ - minutmNrow_), maxutmNrow_ }; void MGRS::Forward(int zone, bool northp, real x, real y, real lat, int prec, std::string& mgrs) { using std::isnan; // Needed for Centos 7, ubuntu 14 // The smallest angle s.t., 90 - angeps() < 90 (approx 50e-12 arcsec) // 7 = ceil(log_2(90)) static const real angeps = ldexp(real(1), -(Math::digits() - 7)); if (zone == UTMUPS::INVALID || isnan(x) || isnan(y) || isnan(lat)) { 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 >= -1 && prec <= maxprec_)) throw GeographicErr("MGRS precision " + Utility::str(prec) + " not in [-1, " + 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_; } // The C++ standard mandates 64 bits for long long. But // check, to make sure. static_assert(numeric_limits::digits >= 44, "long long not wide enough to store 10e12"); // Guard against floor(x * mult_) being computed incorrectly on some // platforms. The problem occurs when x * mult_ is held in extended // precision and floor is inlined. This causes tests GeoConvert1[678] to // fail. Problem reported and diagnosed by Thorkil Naur with g++ 10.2.0 // under Cygwin. GEOGRAPHICLIB_VOLATILE real xx = x * mult_; GEOGRAPHICLIB_VOLATILE real yy = y * mult_; long long ix = (long long)(floor(xx)), iy = (long long)(floor(yy)), m = (long long)(mult_) * (long long)(tile_); int xh = int(ix / m), yh = int(iy / m); 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_)]; } if (prec > 0) { ix -= m * xh; iy -= m * yh; long long d = (long long)(pow(real(base_), maxprec_ - prec)); ix /= d; iy /= d; for (int c = prec; c--;) { mgrs1[z + c ] = digits_[ix % base_]; ix /= base_; mgrs1[z + c + 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) { // Does a rough estimate for latitude determine the latitude band? real ys = northp ? y : y - utmNshift_; // A cheap calculation of the latitude which results in an "allowed" // latitude band would be // lat = ApproxLatitudeBand(ys) * 8 + 4; // // Here we do a more careful job using the band letter corresponding to // the actual latitude. ys /= tile_; if (abs(ys) < 1) lat = real(0.9) * ys; // accurate enough estimate near equator else { real // The poleward bound is a fit from above of lat(x,y) // for x = 500km and y = [0km, 950km] latp = real(0.901) * ys + (ys > 0 ? 1 : -1) * real(0.135), // The equatorward bound is a fit from below of lat(x,y) // for x = 900km and y = [0km, 950km] late = real(0.902) * ys * (1 - real(1.85e-6) * ys * ys); if (LatitudeBand(latp) == LatitudeBand(late)) lat = latp; else // bounds straddle a band boundary so need to compute lat accurately 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 string& mgrs, int& zone, bool& northp, real& x, real& y, int& prec, bool centerp) { int p = 0, len = int(mgrs.length()); 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 = -2; 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 < 1) throw GeographicErr("MGRS string too short " + mgrs); bool utmp = zone1 != UTMUPS::UPS; int zonem1 = zone1 - 1; const char* 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); if (p == len) { // Grid zone only (ignore centerp) // Approx length of a degree of meridian arc in units of tile. real deg = real(utmNshift_) / (90 * tile_); zone = zone1; northp = northp1; if (utmp) { // Pick central meridian except for 31V x = ((zone == 31 && iband == 17) ? 4 : 5) * tile_; // Pick center of 8deg latitude bands y = floor(8 * (iband - real(9.5)) * deg + real(0.5)) * tile_ + (northp ? 0 : utmNshift_); } else { // Pick point at lat 86N or 86S x = ((iband & 1 ? 1 : -1) * floor(4 * deg + real(0.5)) + upseasting_) * tile_; // Pick point at lon 90E or 90W. y = upseasting_ * tile_; } prec = -1; return; } else if (len - p < 2) throw GeographicErr("Missing row letter in " + mgrs); const char* col = utmp ? utmcols_[zonem1 % 3] : upscols_[iband]; const char* 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 = 1, x1 = icol, y1 = 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 = base_ * x1 + ix; y1 = base_ * y1 + 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) { unit *= 2; x1 = 2 * x1 + 1; y1 = 2 * y1 + 1; } zone = zone1; northp = northp1; x = (tile_ * x1) / unit; y = (tile_ * y1) / unit; 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. // The smallest length s.t., 1.0e7 - eps() < 1.0e7 (approx 1.9 nm) // 25 = ceil(log_2(2e7)) -- use half circumference here because // northing 195e5 is a legal in the "southern" hemisphere. static const real eps = ldexp(real(1), -(Math::digits() - 25)); 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) { // Input is iband = band index in [-10, 10) (as returned by LatitudeBand), // icol = column index in [0,8) with origin of easting = 100km, and irow = // periodic row index in [0,20) with origin = equator. Output is true row // index in [-90, 95). Returns maxutmSrow_ = 100, if irow and iband are // incompatible. // 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; // These are safe bounds on the rows // iband minrow maxrow // -10 -90 -81 // -9 -80 -72 // -8 -71 -63 // -7 -63 -54 // -6 -54 -45 // -5 -45 -36 // -4 -36 -27 // -3 -27 -18 // -2 -18 -9 // -1 -9 -1 // 0 0 8 // 1 8 17 // 2 17 26 // 3 26 35 // 4 35 44 // 5 44 53 // 6 53 62 // 7 62 70 // 8 71 79 // 9 80 94 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; // Offset irow by the multiple of utmrowperiod_ which brings it as close as // possible to the center of the latitude band, (minrow + maxrow) / 2. // (Add maxutmSrow_ = 5 * utmrowperiod_ to ensure operand is positive.) irow = (irow - baserow + maxutmSrow_) % utmrowperiod_ + baserow; if (!( irow >= minrow && irow <= maxrow )) { // Outside the safe bounds, so need to check... // Northing = 71e5 and 80e5 intersect band boundaries // y = 71e5 in scol = 2 (x = [3e5,4e5] and x = [6e5,7e5]) // y = 80e5 in scol = 1 (x = [2e5,3e5] and x = [7e5,8e5]) // This holds for all the ellipsoids given in NGA.SIG.0012_2.0.0_UTMUPS. // 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; // For example, the safe rows for band 8 are 71 - 79. However row 70 is // allowed if scol = [2,3] and row 80 is allowed if scol = [0,1]. 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; } void MGRS::Check() { real lat, lon, x, y, t = tile_; int zone; bool northp; UTMUPS::Reverse(31, true , 1*t, 0*t, lat, lon); if (!( lon < 0 )) throw GeographicErr("MGRS::Check: equator coverage failure"); UTMUPS::Reverse(31, true , 1*t, 95*t, lat, lon); if (!( lat > 84 )) throw GeographicErr("MGRS::Check: UTM doesn't reach latitude = 84"); UTMUPS::Reverse(31, false, 1*t, 10*t, lat, lon); if (!( lat < -80 )) throw GeographicErr("MGRS::Check: UTM doesn't reach latitude = -80"); UTMUPS::Forward(56, 3, zone, northp, x, y, 32); if (!( x > 1*t )) throw GeographicErr("MGRS::Check: Norway exception creates a gap"); UTMUPS::Forward(72, 21, zone, northp, x, y, 35); if (!( x > 1*t )) throw GeographicErr("MGRS::Check: Svalbard exception creates a gap"); UTMUPS::Reverse(0, true , 20*t, 13*t, lat, lon); if (!( lat < 84 )) throw GeographicErr("MGRS::Check: North UPS doesn't reach latitude = 84"); UTMUPS::Reverse(0, false, 20*t, 8*t, lat, lon); if (!( lat > -80 )) throw GeographicErr("MGRS::Check: South UPS doesn't reach latitude = -80"); // Entries are [band, x, y] either side of the band boundaries. Units for // x, y are t = 100km. const short tab[] = { 0, 5, 0, 0, 9, 0, // south edge of band 0 0, 5, 8, 0, 9, 8, // north edge of band 0 1, 5, 9, 1, 9, 9, // south edge of band 1 1, 5, 17, 1, 9, 17, // north edge of band 1 2, 5, 18, 2, 9, 18, // etc. 2, 5, 26, 2, 9, 26, 3, 5, 27, 3, 9, 27, 3, 5, 35, 3, 9, 35, 4, 5, 36, 4, 9, 36, 4, 5, 44, 4, 9, 44, 5, 5, 45, 5, 9, 45, 5, 5, 53, 5, 9, 53, 6, 5, 54, 6, 9, 54, 6, 5, 62, 6, 9, 62, 7, 5, 63, 7, 9, 63, 7, 5, 70, 7, 7, 70, 7, 7, 71, 7, 9, 71, // y = 71t crosses boundary 8, 5, 71, 8, 6, 71, 8, 6, 72, 8, 9, 72, // between bands 7 and 8. 8, 5, 79, 8, 8, 79, 8, 8, 80, 8, 9, 80, // y = 80t crosses boundary 9, 5, 80, 9, 7, 80, 9, 7, 81, 9, 9, 81, // between bands 8 and 9. 9, 5, 95, 9, 9, 95, // north edge of band 9 }; const int bandchecks = sizeof(tab) / (3 * sizeof(short)); for (int i = 0; i < bandchecks; ++i) { UTMUPS::Reverse(38, true, tab[3*i+1]*t, tab[3*i+2]*t, lat, lon); if (!( LatitudeBand(lat) == tab[3*i+0] )) throw GeographicErr("MGRS::Check: Band error, b = " + Utility::str(tab[3*i+0]) + ", x = " + Utility::str(tab[3*i+1]) + "00km, y = " + Utility::str(tab[3*i+2]) + "00km"); } } } // namespace GeographicLib GeographicLib-1.52/src/MagneticCircle.cpp0000644000771000077100000000415014064202371020161 0ustar ckarneyckarney/** * \file MagneticCircle.cpp * \brief Implementation for GeographicLib::MagneticCircle class * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include #include #include namespace GeographicLib { using namespace std; void MagneticCircle::FieldGeocentric(real slam, real clam, real& BX, real& BY, real& BZ, real& BXt, real& BYt, real& BZt) const { real BXc = 0, BYc = 0, BZc = 0; _circ0(slam, clam, BX, BY, BZ); _circ1(slam, clam, BXt, BYt, BZt); if (_constterm) _circ2(slam, clam, BXc, BYc, BZc); if (_interpolate) { BXt = (BXt - BX) / _dt0; BYt = (BYt - BY) / _dt0; BZt = (BZt - BZ) / _dt0; } BX += _t1 * BXt + BXc; BY += _t1 * BYt + BYc; BZ += _t1 * BZt + BZc; BXt *= - _a; BYt *= - _a; BZt *= - _a; BX *= - _a; BY *= - _a; BZ *= - _a; } void MagneticCircle::FieldGeocentric(real lon, real& BX, real& BY, real& BZ, real& BXt, real& BYt, real& BZt) const { real slam, clam; Math::sincosd(lon, slam, clam); FieldGeocentric(slam, clam, BX, BY, BZ, BXt, BYt, BZt); } void MagneticCircle::Field(real lon, bool diffp, real& Bx, real& By, real& Bz, real& Bxt, real& Byt, real& Bzt) const { real slam, clam; Math::sincosd(lon, slam, clam); real M[Geocentric::dim2_]; Geocentric::Rotation(_sphi, _cphi, slam, clam, M); real BX, BY, BZ, BXt, BYt, BZt; // Components in geocentric basis FieldGeocentric(slam, clam, BX, BY, BZ, BXt, BYt, BZt); if (diffp) Geocentric::Unrotate(M, BXt, BYt, BZt, Bxt, Byt, Bzt); Geocentric::Unrotate(M, BX, BY, BZ, Bx, By, Bz); } } // namespace GeographicLib GeographicLib-1.52/src/MagneticModel.cpp0000644000771000077100000002437214064202371020030 0ustar ckarneyckarney/** * \file MagneticModel.cpp * \brief Implementation for GeographicLib::MagneticModel class * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include #include #include #include #if !defined(GEOGRAPHICLIB_DATA) # if defined(_WIN32) # define GEOGRAPHICLIB_DATA "C:/ProgramData/GeographicLib" # else # define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib" # endif #endif #if !defined(GEOGRAPHICLIB_MAGNETIC_DEFAULT_NAME) # define GEOGRAPHICLIB_MAGNETIC_DEFAULT_NAME "wmm2020" #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, int Nmax, int Mmax) : _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) , _Nconstants(0) , _nmx(-1) , _mmx(-1) , _norm(SphericalHarmonic::SCHMIDT) , _earth(earth) { if (_dir.empty()) _dir = DefaultMagneticPath(); bool truncate = Nmax >= 0 || Mmax >= 0; if (truncate) { if (Nmax >= 0 && Mmax < 0) Mmax = Nmax; if (Nmax < 0) Nmax = numeric_limits::max(); if (Mmax < 0) Mmax = numeric_limits::max(); } ReadMetadata(_name); _G.resize(_Nmodels + 1 + _Nconstants); _H.resize(_Nmodels + 1 + _Nconstants); { 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 + 1 + _Nconstants; ++i) { int N, M; if (truncate) { N = Nmax; M = Mmax; } SphericalEngine::coeff::readcoeffs(coeffstr, N, M, _G[i], _H[i], truncate); 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)); _nmx = max(_nmx, _harm.back().Coefficients().nmx()); _mmx = max(_mmx, _harm.back().Coefficients().mmx()); } int pos = int(coeffstr.tellg()); coeffstr.seekg(0, ios::end); if (pos != coeffstr.tellg()) throw GeographicErr("Extra data in " + coeff); } } void MagneticModel::ReadMetadata(const 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, 5, n); if (!(version == "1" || version == "2")) 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::val(val); else if (key == "Type") { if (!(val == "Linear" || val == "linear")) throw GeographicErr("Only linear models are supported"); } else if (key == "Epoch") _t0 = Utility::val(val); else if (key == "DeltaEpoch") _dt0 = Utility::val(val); else if (key == "NumModels") _Nmodels = Utility::val(val); else if (key == "NumConstants") _Nconstants = Utility::val(val); else if (key == "MinTime") _tmin = Utility::val(val); else if (key == "MaxTime") _tmax = Utility::val(val); else if (key == "MinHeight") _hmin = Utility::val(val); else if (key == "MaxHeight") _hmax = Utility::val(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 (!(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 (_Nmodels < 1) throw GeographicErr("NumModels must be positive"); if (!(_Nconstants == 0 || _Nconstants == 1)) throw GeographicErr("NumConstants must be 0 or 1"); if (!(_dt0 > 0)) { if (_Nmodels > 1) throw GeographicErr("DeltaEpoch must be positive"); else _dt0 = 1; } } void MagneticModel::FieldGeocentric(real t, real X, real Y, real Z, real& BX, real& BY, real& BZ, real& BXt, real& BYt, real& BZt) const { t -= _t0; int n = max(min(int(floor(t / _dt0)), _Nmodels - 1), 0); bool interpolate = n + 1 < _Nmodels; t -= n * _dt0; // Components in geocentric basis // initial values to suppress warning real BXc = 0, BYc = 0, BZc = 0; _harm[n](X, Y, Z, BX, BY, BZ); _harm[n + 1](X, Y, Z, BXt, BYt, BZt); if (_Nconstants) _harm[_Nmodels + 1](X, Y, Z, BXc, BYc, BZc); if (interpolate) { // Convert to a time derivative BXt = (BXt - BX) / _dt0; BYt = (BYt - BY) / _dt0; BZt = (BZt - BZ) / _dt0; } BX += t * BXt + BXc; BY += t * BYt + BYc; BZ += t * BZt + BZc; BXt = BXt * - _a; BYt = BYt * - _a; BZt = BZt * - _a; BX *= - _a; BY *= - _a; BZ *= - _a; } 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 { real X, Y, Z; real M[Geocentric::dim2_]; _earth.IntForward(lat, lon, h, X, Y, Z, M); // Components in geocentric basis // initial values to suppress warning real BX = 0, BY = 0, BZ = 0, BXt = 0, BYt = 0, BZt = 0; FieldGeocentric(t, X, Y, Z, BX, BY, BZ, BXt, BYt, BZt); if (diffp) Geocentric::Unrotate(M, BXt, BYt, BZt, Bxt, Byt, Bzt); Geocentric::Unrotate(M, BX, BY, BZ, Bx, By, Bz); } 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 (_Nconstants == 0 ? 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)) : 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), _harm[_Nmodels + 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) { H = hypot(Bx, By); Ht = H != 0 ? (Bx * Bxt + By * Byt) / H : hypot(Bxt, Byt); D = H != 0 ? Math::atan2d(Bx, By) : Math::atan2d(Bxt, Byt); Dt = (H != 0 ? (By * Bxt - Bx * Byt) / Math::sq(H) : 0) / Math::degree(); F = hypot(H, Bz); Ft = F != 0 ? (H * Ht + Bz * Bzt) / F : hypot(Ht, Bzt); I = F != 0 ? Math::atan2d(-Bz, H) : Math::atan2d(-Bzt, Ht); It = (F != 0 ? (Bz * Ht - H * Bzt) / Math::sq(F) : 0) / Math::degree(); } string MagneticModel::DefaultMagneticPath() { string path; char* magneticpath = getenv("GEOGRAPHICLIB_MAGNETIC_PATH"); if (magneticpath) path = string(magneticpath); if (!path.empty()) return path; char* datapath = getenv("GEOGRAPHICLIB_DATA"); if (datapath) path = string(datapath); return (!path.empty() ? path : string(GEOGRAPHICLIB_DATA)) + "/magnetic"; } string MagneticModel::DefaultMagneticName() { string name; char* magneticname = getenv("GEOGRAPHICLIB_MAGNETIC_NAME"); if (magneticname) name = string(magneticname); return !name.empty() ? name : string(GEOGRAPHICLIB_MAGNETIC_DEFAULT_NAME); } } // namespace GeographicLib GeographicLib-1.52/src/Makefile.am0000644000771000077100000000705714064202371016651 0ustar ckarneyckarney# # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine 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 = Accumulator.cpp \ AlbersEqualArea.cpp \ AzimuthalEquidistant.cpp \ CassiniSoldner.cpp \ CircularEngine.cpp \ DMS.cpp \ Ellipsoid.cpp \ EllipticFunction.cpp \ GARS.cpp \ GeoCoords.cpp \ Geocentric.cpp \ Geodesic.cpp \ GeodesicExact.cpp \ GeodesicExactC4.cpp \ GeodesicLine.cpp \ GeodesicLineExact.cpp \ Geohash.cpp \ Geoid.cpp \ Georef.cpp \ Gnomonic.cpp \ GravityCircle.cpp \ GravityModel.cpp \ LambertConformalConic.cpp \ LocalCartesian.cpp \ MGRS.cpp \ MagneticCircle.cpp \ MagneticModel.cpp \ Math.cpp \ NormalGravity.cpp \ OSGB.cpp \ PolarStereographic.cpp \ PolygonArea.cpp \ Rhumb.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/Ellipsoid.hpp \ ../include/GeographicLib/EllipticFunction.hpp \ ../include/GeographicLib/GARS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicExact.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/GeodesicLineExact.hpp \ ../include/GeographicLib/Geohash.hpp \ ../include/GeographicLib/Geoid.hpp \ ../include/GeographicLib/Georef.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/NearestNeighbor.hpp \ ../include/GeographicLib/NormalGravity.hpp \ ../include/GeographicLib/OSGB.hpp \ ../include/GeographicLib/PolarStereographic.hpp \ ../include/GeographicLib/PolygonArea.hpp \ ../include/GeographicLib/Rhumb.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|\bGEOGRAPHICLIB_|\bHAVE_LONG_DOUBLE\b' $< | \ sed -e 's/ VERSION / GEOGRAPHICLIB_VERSION_STRING /' \ -e 's/ HAVE_LONG_DOUBLE / GEOGRAPHICLIB_HAVE_LONG_DOUBLE /'; \ grep WORDS_BIGENDIAN $< | tail -1 | \ sed -e 's/ WORDS_BIGENDIAN / GEOGRAPHICLIB_WORDS_BIGENDIAN /' ) > $@ $(libGeographic_la_OBJECTS): ../include/GeographicLib/Config.h geographiclib_data=$(datadir)/GeographicLib DEFS=-DGEOGRAPHICLIB_DATA=\"$(geographiclib_data)\" @DEFS@ EXTRA_DIST = Makefile.mk CMakeLists.txt GeographicLib-1.52/src/Makefile.mk0000644000771000077100000001163314064202371016656 0ustar ckarneyckarneyLIBSTEM = Geographic LIBRARY = lib$(LIBSTEM).a all: $(LIBRARY) INCLUDEPATH = ../include GEOGRAPHICLIB_DATA = $(PREFIX)/share/GeographicLib MODULES = Accumulator \ AlbersEqualArea \ AzimuthalEquidistant \ CassiniSoldner \ CircularEngine \ DMS \ Ellipsoid \ EllipticFunction \ GARS \ GeoCoords \ Geocentric \ Geodesic \ GeodesicExact \ GeodesicLine \ GeodesicLineExact \ Geohash \ Geoid \ Georef \ Gnomonic \ GravityCircle \ GravityModel \ LambertConformalConic \ LocalCartesian \ MGRS \ MagneticCircle \ MagneticModel \ Math \ NormalGravity \ OSGB \ PolarStereographic \ PolygonArea \ Rhumb \ SphericalEngine \ TransverseMercator \ TransverseMercatorExact \ UTMUPS \ Utility EXTRAHEADERS = Constants \ NearestNeighbor \ SphericalHarmonic \ SphericalHarmonic1 \ SphericalHarmonic2 EXTRASOURCES = GeodesicExactC4 HEADERS = Config.h $(addsuffix .hpp,$(EXTRAHEADERS) $(MODULES)) SOURCES = $(addsuffix .cpp,$(MODULES) $(EXTRASOURCES)) OBJECTS = $(addsuffix .o,$(MODULES) $(EXTRASOURCES)) CC = g++ -g CXXFLAGS = -g -Wall -Wextra -O3 -std=c++0x 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 $^ Accumulator.o: Accumulator.hpp Config.h Constants.hpp Math.hpp 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 Ellipsoid.o: Config.h Constants.hpp Ellipsoid.hpp AlbersEqualArea.hpp \ EllipticFunction.hpp Math.hpp TransverseMercator.hpp EllipticFunction.o: Config.h Constants.hpp EllipticFunction.hpp Math.hpp GARS.o: Config.h Constants.hpp GARS.hpp Utility.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 GeodesicExact.o: Config.h Constants.hpp GeodesicExact.hpp \ GeodesicLineExact.hpp Math.hpp GeodesicExactC4.o: Config.h Constants.hpp GeodesicExact.hpp Math.hpp GeodesicLine.o: Config.h Constants.hpp Geodesic.hpp GeodesicLine.hpp Math.hpp GeodesicLineExact.o: Config.h Constants.hpp GeodesicExact.hpp \ GeodesicLineExact.hpp Math.hpp Geohash.o: Config.h Constants.hpp Geohash.hpp Utility.hpp Geoid.o: Config.h Constants.hpp Geoid.hpp Math.hpp Georef.o: Config.h Constants.hpp Georef.hpp Utility.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 Math.o: Config.h Constants.hpp Math.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 Rhumb.o: Config.h Constants.hpp Ellipsoid.hpp Math.hpp Rhumb.hpp \ AlbersEqualArea.hpp EllipticFunction.hpp TransverseMercator.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.52/src/Math.cpp0000644000771000077100000002635614064202371016215 0ustar ckarneyckarney/** * \file Math.cpp * \brief Implementation for GeographicLib::Math class * * Copyright (c) Charles Karney (2015-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif namespace GeographicLib { using namespace std; void Math::dummy() { static_assert(GEOGRAPHICLIB_PRECISION >= 1 && GEOGRAPHICLIB_PRECISION <= 5, "Bad value of precision"); } int Math::digits() { #if GEOGRAPHICLIB_PRECISION != 5 return numeric_limits::digits; #else return numeric_limits::digits(); #endif } int Math::set_digits(int ndigits) { #if GEOGRAPHICLIB_PRECISION != 5 (void)ndigits; #else mpfr::mpreal::set_default_prec(ndigits >= 2 ? ndigits : 2); #endif return digits(); } int Math::digits10() { #if GEOGRAPHICLIB_PRECISION != 5 return numeric_limits::digits10; #else return numeric_limits::digits10(); #endif } int Math::extra_digits() { return digits10() > numeric_limits::digits10 ? digits10() - numeric_limits::digits10 : 0; } template T Math::hypot(T x, T y) { using std::hypot; return hypot(x, y); } template T Math::expm1(T x) { using std::expm1; return expm1(x); } template T Math::log1p(T x) { using std::log1p; return log1p(x); } template T Math::asinh(T x) { using std::asinh; return asinh(x); } template T Math::atanh(T x) { using std::atanh; return atanh(x); } template T Math::copysign(T x, T y) { using std::copysign; return copysign(x, y); } template T Math::cbrt(T x) { using std::cbrt; return cbrt(x); } template T Math::remainder(T x, T y) { using std::remainder; return remainder(x, y); } template T Math::remquo(T x, T y, int* n) { using std::remquo; return remquo(x, y, n); } template T Math::round(T x) { using std::round; return round(x); } template long Math::lround(T x) { using std::lround; return lround(x); } template T Math::fma(T x, T y, T z) { using std::fma; return fma(x, y, z); } template T Math::sum(T u, T v, T& t) { GEOGRAPHICLIB_VOLATILE T s = u + v; GEOGRAPHICLIB_VOLATILE T up = s - v; GEOGRAPHICLIB_VOLATILE T vpp = s - up; up -= u; vpp -= v; t = -(up + vpp); // u + v = s + t // = round(u + v) + t return s; } template T Math::AngRound(T x) { static const T z = 1/T(16); if (x == 0) return 0; GEOGRAPHICLIB_VOLATILE T y = abs(x); // The compiler mustn't "simplify" z - (z - y) to y y = y < z ? z - (z - y) : y; return x < 0 ? -y : y; } template void Math::sincosd(T x, T& sinx, T& cosx) { // In order to minimize round-off errors, this function exactly reduces // the argument to the range [-45, 45] before converting it to radians. using std::remquo; T r; int q = 0; // N.B. the implementation of remquo in glibc pre 2.22 were buggy. See // https://sourceware.org/bugzilla/show_bug.cgi?id=17569 // This was fixed in version 2.22 on 2015-08-05 r = remquo(x, T(90), &q); // now abs(r) <= 45 r *= degree(); // g++ -O turns these two function calls into a call to sincos T s = sin(r), c = cos(r); switch (unsigned(q) & 3U) { case 0U: sinx = s; cosx = c; break; case 1U: sinx = c; cosx = -s; break; case 2U: sinx = -s; cosx = -c; break; default: sinx = -c; cosx = s; break; // case 3U } // Set sign of 0 results. -0 only produced for sin(-0) if (x != 0) { sinx += T(0); cosx += T(0); } } template T Math::sind(T x) { // See sincosd using std::remquo; T r; int q = 0; r = remquo(x, T(90), &q); // now abs(r) <= 45 r *= degree(); unsigned p = unsigned(q); r = p & 1U ? cos(r) : sin(r); if (p & 2U) r = -r; if (x != 0) r += T(0); return r; } template T Math::cosd(T x) { // See sincosd using std::remquo; T r; int q = 0; r = remquo(x, T(90), &q); // now abs(r) <= 45 r *= degree(); unsigned p = unsigned(q + 1); r = p & 1U ? cos(r) : sin(r); if (p & 2U) r = -r; return T(0) + r; } template T Math::tand(T x) { static const T overflow = 1 / sq(numeric_limits::epsilon()); T s, c; sincosd(x, s, c); return c != 0 ? s / c : (s < 0 ? -overflow : overflow); } template T Math::atan2d(T y, T x) { // In order to minimize round-off errors, this function rearranges the // arguments so that result of atan2 is in the range [-pi/4, pi/4] before // converting it to degrees and mapping the result to the correct // quadrant. int q = 0; if (abs(y) > abs(x)) { swap(x, y); q = 2; } if (x < 0) { x = -x; ++q; } // here x >= 0 and x >= abs(y), so angle is in [-pi/4, pi/4] T ang = atan2(y, x) / degree(); switch (q) { // Note that atan2d(-0.0, 1.0) will return -0. However, we expect that // atan2d will not be called with y = -0. If need be, include // // case 0: ang = 0 + ang; break; // // and handle mpfr as in AngRound. case 1: ang = (y >= 0 ? 180 : -180) - ang; break; case 2: ang = 90 - ang; break; case 3: ang = -90 + ang; break; default: break; } return ang; } template T Math::atand(T x) { return atan2d(x, T(1)); } template T Math::eatanhe(T x, T es) { using std::atanh; return es > T(0) ? es * atanh(es * x) : -es * atan(es * x); } template T Math::taupf(T tau, T es) { // Need this test, otherwise tau = +/-inf gives taup = nan. using std::isfinite; using std::hypot; if (isfinite(tau)) { T tau1 = hypot(T(1), tau), sig = sinh( eatanhe(tau / tau1, es ) ); return hypot(T(1), sig) * tau - sig * tau1; } else return tau; } template T Math::tauf(T taup, T es) { using std::hypot; static const int numit = 5; // min iterations = 1, max iterations = 2; mean = 1.95 static const T tol = sqrt(numeric_limits::epsilon()) / 10; static const T taumax = 2 / sqrt(numeric_limits::epsilon()); T e2m = T(1) - sq(es), // 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.999 (2 // iterations are needed except near tau = 0). // // For large tau, taup = exp(-es*atanh(es)) * tau. Use this as for the // initial guess for |taup| > 70 (approx |phi| > 89deg). Then for // sufficiently large tau (such that sqrt(1+tau^2) = |tau|), we can exit // with the intial guess and avoid overflow problems. This also reduces // the mean number of iterations slightly from 1.963 to 1.954. tau = abs(taup) > 70 ? taup * exp(eatanhe(T(1), es)) : taup/e2m, stol = tol * max(T(1), abs(taup)); if (!(abs(tau) < taumax)) return tau; // handles +/-inf and nan for (int i = 0; i < numit || GEOGRAPHICLIB_PANIC; ++i) { T taupa = taupf(tau, es), dtau = (taup - taupa) * (1 + e2m * sq(tau)) / ( e2m * hypot(T(1), tau) * hypot(T(1), taupa) ); tau += dtau; if (!(abs(dtau) >= stol)) break; } return tau; } template bool Math::isfinite(T x) { using std::isfinite; return isfinite(x); } template T Math::NaN() { #if defined(_MSC_VER) return numeric_limits::has_quiet_NaN ? numeric_limits::quiet_NaN() : (numeric_limits::max)(); #else return numeric_limits::has_quiet_NaN ? numeric_limits::quiet_NaN() : numeric_limits::max(); #endif } template bool Math::isnan(T x) { using std::isnan; return isnan(x); } template T Math::infinity() { #if defined(_MSC_VER) return numeric_limits::has_infinity ? numeric_limits::infinity() : (numeric_limits::max)(); #else return numeric_limits::has_infinity ? numeric_limits::infinity() : numeric_limits::max(); #endif } /// \cond SKIP // Instantiate #define GEOGRAPHICLIB_MATH_INSTANTIATE(T) \ template T GEOGRAPHICLIB_EXPORT Math::hypot (T, T); \ template T GEOGRAPHICLIB_EXPORT Math::expm1 (T); \ template T GEOGRAPHICLIB_EXPORT Math::log1p (T); \ template T GEOGRAPHICLIB_EXPORT Math::asinh (T); \ template T GEOGRAPHICLIB_EXPORT Math::atanh (T); \ template T GEOGRAPHICLIB_EXPORT Math::cbrt (T); \ template T GEOGRAPHICLIB_EXPORT Math::remainder(T, T); \ template T GEOGRAPHICLIB_EXPORT Math::remquo (T, T, int*); \ template T GEOGRAPHICLIB_EXPORT Math::round (T); \ template long GEOGRAPHICLIB_EXPORT Math::lround (T); \ template T GEOGRAPHICLIB_EXPORT Math::copysign (T, T); \ template T GEOGRAPHICLIB_EXPORT Math::fma (T, T, T); \ template T GEOGRAPHICLIB_EXPORT Math::sum (T, T, T&); \ template T GEOGRAPHICLIB_EXPORT Math::AngRound (T); \ template void GEOGRAPHICLIB_EXPORT Math::sincosd (T, T&, T&); \ template T GEOGRAPHICLIB_EXPORT Math::sind (T); \ template T GEOGRAPHICLIB_EXPORT Math::cosd (T); \ template T GEOGRAPHICLIB_EXPORT Math::tand (T); \ template T GEOGRAPHICLIB_EXPORT Math::atan2d (T, T); \ template T GEOGRAPHICLIB_EXPORT Math::atand (T); \ template T GEOGRAPHICLIB_EXPORT Math::eatanhe (T, T); \ template T GEOGRAPHICLIB_EXPORT Math::taupf (T, T); \ template T GEOGRAPHICLIB_EXPORT Math::tauf (T, T); \ template bool GEOGRAPHICLIB_EXPORT Math::isfinite (T); \ template T GEOGRAPHICLIB_EXPORT Math::NaN (); \ template bool GEOGRAPHICLIB_EXPORT Math::isnan (T); \ template T GEOGRAPHICLIB_EXPORT Math::infinity (); // Instantiate with the standard floating type GEOGRAPHICLIB_MATH_INSTANTIATE(float) GEOGRAPHICLIB_MATH_INSTANTIATE(double) #if GEOGRAPHICLIB_HAVE_LONG_DOUBLE // Instantiate if long double is distinct from double GEOGRAPHICLIB_MATH_INSTANTIATE(long double) #endif #if GEOGRAPHICLIB_PRECISION > 3 // Instantiate with the high precision type GEOGRAPHICLIB_MATH_INSTANTIATE(Math::real) #endif #undef GEOGRAPHICLIB_MATH_INSTANTIATE // Also we need int versions for Utility::nummatch template int GEOGRAPHICLIB_EXPORT Math::NaN (); template int GEOGRAPHICLIB_EXPORT Math::infinity(); /// \endcond } // namespace GeographicLib GeographicLib-1.52/src/NormalGravity.cpp0000644000771000077100000002547114064202371020117 0ustar ckarneyckarney/** * \file NormalGravity.cpp * \brief Implementation for GeographicLib::NormalGravity class * * Copyright (c) Charles Karney (2011-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif namespace GeographicLib { using namespace std; void NormalGravity::Initialize(real a, real GM, real omega, real f_J2, bool geometricp) { _a = a; if (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); _GM = GM; if (!isfinite(_GM)) throw GeographicErr("Gravitational constant is not finite"); _omega = omega; _omega2 = Math::sq(_omega); _aomega2 = Math::sq(_omega * _a); if (!(isfinite(_omega2) && isfinite(_aomega2))) throw GeographicErr("Rotation velocity is not finite"); _f = geometricp ? f_J2 : J2ToFlattening(_a, _GM, _omega, f_J2); _b = _a * (1 - _f); if (!(isfinite(_b) && _b > 0)) throw GeographicErr("Polar semi-axis is not positive"); _J2 = geometricp ? FlatteningToJ2(_a, _GM, _omega, f_J2) : f_J2; _e2 = _f * (2 - _f); _ep2 = _e2 / (1 - _e2); real ex2 = _f < 0 ? -_e2 : _ep2; _Q0 = Qf(ex2, _f < 0); _earth = Geocentric(_a, _f); _E = _a * sqrt(abs(_e2)); // H+M, Eq 2-54 // H+M, Eq 2-61 _U0 = _GM * atanzz(ex2, _f < 0) / _b + _aomega2 / 3; real P = Hf(ex2, _f < 0) / (6 * _Q0); // H+M, Eq 2-73 _gammae = _GM / (_a * _b) - (1 + P) * _a * _omega2; // H+M, Eq 2-74 _gammap = _GM / (_a * _a) + 2 * P * _b * _omega2; // k = gammae * (b * gammap / (a * gammae) - 1) // = (b * gammap - a * gammae) / a _k = -_e2 * _GM / (_a * _b) + _omega2 * (P * (_a + 2 * _b * (1 - _f)) + _a); // f* = (gammap - gammae) / gammae _fstar = (-_f * _GM / (_a * _b) + _omega2 * (P * (_a + 2 * _b) + _a)) / _gammae; } NormalGravity::NormalGravity(real a, real GM, real omega, real f_J2, bool geometricp) { Initialize(a, GM, omega, f_J2, geometricp); } const NormalGravity& NormalGravity::WGS84() { static const NormalGravity wgs84(Constants::WGS84_a(), Constants::WGS84_GM(), Constants::WGS84_omega(), Constants::WGS84_f(), true); return wgs84; } const NormalGravity& NormalGravity::GRS80() { static const NormalGravity grs80(Constants::GRS80_a(), Constants::GRS80_GM(), Constants::GRS80_omega(), Constants::GRS80_J2(), false); return grs80; } Math::real NormalGravity::atan7series(real x) { // compute -sum( (-x)^n/(2*n+7), n, 0, inf) // = -1/7 + x/9 - x^2/11 + x^3/13 ... // = (atan(sqrt(x))/sqrt(x)-(1-x/3+x^2/5)) / x^3 (x > 0) // = (atanh(sqrt(-x))/sqrt(-x)-(1-x/3+x^2/5)) / x^3 (x < 0) // require abs(x) < 1/2, but better to restrict calls to abs(x) < 1/4 static const real lg2eps_ = -log2(numeric_limits::epsilon() / 2); int e; frexp(x, &e); e = max(-e, 1); // Here's where abs(x) < 1/2 is assumed // x = [0.5,1) * 2^(-e) // estimate n s.t. x^n/n < 1/7 * epsilon/2 // a stronger condition is x^n < epsilon/2 // taking log2 of both sides, a stronger condition is n*(-e) < -lg2eps; // or n*e > lg2eps or n > ceiling(lg2eps/e) int n = x == 0 ? 1 : int(ceil(lg2eps_ / e)); Math::real v = 0; while (n--) // iterating from n-1 down to 0 v = - x * v - 1/Math::real(2*n + 7); return v; } Math::real NormalGravity::atan5series(real x) { // Compute Taylor series approximations to // (atan(z)-(z-z^3/3))/z^5, // z = sqrt(x) // require abs(x) < 1/2, but better to restrict calls to abs(x) < 1/4 return 1/real(5) + x * atan7series(x); } Math::real NormalGravity::Qf(real x, bool alt) { // Compute // Q(z) = (((1 + 3/z^2) * atan(z) - 3/z)/2) / z^3 // = q(z)/z^3 with q(z) defined by H+M, Eq 2-57 with z = E/u // z = sqrt(x) real y = alt ? -x / (1 + x) : x; return !(4 * abs(y) < 1) ? // Backwards test to allow NaNs through ((1 + 3/y) * atanzz(x, alt) - 3/y) / (2 * y) : (3 * (3 + y) * atan5series(y) - 1) / 6; } Math::real NormalGravity::Hf(real x, bool alt) { // z = sqrt(x) // Compute // H(z) = (3*Q(z)+z*diff(Q(z),z))*(1+z^2) // = (3 * (1 + 1/z^2) * (1 - atan(z)/z) - 1) / z^2 // = q'(z)/z^2, with q'(z) defined by H+M, Eq 2-67, with z = E/u real y = alt ? -x / (1 + x) : x; return !(4 * abs(y) < 1) ? // Backwards test to allow NaNs through (3 * (1 + 1/y) * (1 - atanzz(x, alt)) - 1) / y : 1 - 3 * (1 + y) * atan5series(y); } Math::real NormalGravity::QH3f(real x, bool alt) { // z = sqrt(x) // (Q(z) - H(z)/3) / z^2 // = - (1+z^2)/(3*z) * d(Q(z))/dz - Q(z) // = ((15+9*z^2)*atan(z)-4*z^3-15*z)/(6*z^7) // = ((25+15*z^2)*atan7+3)/10 real y = alt ? -x / (1 + x) : x; return !(4 * abs(y) < 1) ? // Backwards test to allow NaNs through ((9 + 15/y) * atanzz(x, alt) - 4 - 15/y) / (6 * Math::sq(y)) : ((25 + 15*y) * atan7series(y) + 3)/10; } Math::real NormalGravity::Jn(int n) const { // 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 { real sphi = Math::sind(Math::LatFix(lat)); // H+M, Eq 2-78 return (_gammae + _k * Math::sq(sphi)) / sqrt(1 - _e2 * Math::sq(sphi)); } Math::real NormalGravity::V0(real X, real Y, real Z, real& GammaX, real& GammaY, real& GammaZ) const { // See H+M, Sec 6-2 real p = hypot(X, Y), clam = p != 0 ? X/p : 1, slam = p != 0 ? Y/p : 0, r = hypot(p, Z); if (_f < 0) swap(p, Z); real 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 = hypot(u, _E), // H+M, Eq 6-8b sbet = u != 0 ? Z * uE : copysign(sqrt(-Q), Z), cbet = u != 0 ? p * u : p, s = hypot(cbet, sbet); sbet = s != 0 ? sbet/s : 1; cbet = s != 0 ? cbet/s : 0; real z = _E/u, z2 = Math::sq(z), den = hypot(u, _E * sbet); if (_f < 0) { swap(sbet, cbet); swap(u, uE); } real invw = uE / den, // H+M, Eq 2-63 bu = _b / (u != 0 || _f < 0 ? u : _E), // Qf(z2->inf, false) = pi/(4*z^3) q = ((u != 0 || _f < 0 ? Qf(z2, _f < 0) : Math::pi() / 4) / _Q0) * bu * Math::sq(bu), qp = _b * Math::sq(bu) * (u != 0 || _f < 0 ? Hf(z2, _f < 0) : 2) / _Q0, ang = (Math::sq(sbet) - 1/real(3)) / 2, // H+M, Eqs 2-62 + 6-9, but omitting last (rotational) term. Vres = _GM * (u != 0 || _f < 0 ? atanzz(z2, _f < 0) / u : Math::pi() / (2 * _E)) + _aomega2 * q * ang, // H+M, Eq 6-10 gamu = - (_GM + (_aomega2 * qp * ang)) * invw / Math::sq(uE), gamb = _aomega2 * q * sbet * cbet * invw / uE, t = u * invw / uE, gamp = t * cbet * gamu - invw * sbet * gamb; // H+M, Eq 6-12 GammaX = gamp * clam; GammaY = gamp * slam; GammaZ = invw * sbet * gamu + t * cbet * gamb; return Vres; } Math::real NormalGravity::Phi(real X, real Y, real& fX, real& fY) const { 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 { 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 { 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; } Math::real NormalGravity::J2ToFlattening(real a, real GM, real omega, real J2) { // Solve // f = e^2 * (1 - K * e/q0) - 3 * J2 = 0 // for e^2 using Newton's method static const real maxe_ = 1 - numeric_limits::epsilon(); static const real eps2_ = sqrt(numeric_limits::epsilon()) / 100; real K = 2 * Math::sq(a * omega) * a / (15 * GM), J0 = (1 - 4 * K / Math::pi()) / 3; if (!(GM > 0 && isfinite(K) && K >= 0)) return Math::NaN(); if (!(isfinite(J2) && J2 <= J0)) return Math::NaN(); if (J2 == J0) return 1; // Solve e2 - f1 * f2 * K / Q0 - 3 * J2 = 0 for J2 close to J0; // subst e2 = ep2/(1+ep2), f2 = 1/(1+ep2), f1 = 1/sqrt(1+ep2), J2 = J0-dJ2, // Q0 = pi/(4*z^3) - 2/z^4 + (3*pi)/(4*z^5), z = sqrt(ep2), and balance two // leading terms to give real ep2 = max(Math::sq(32 * K / (3 * Math::sq(Math::pi()) * (J0 - J2))), -maxe_), e2 = min(ep2 / (1 + ep2), maxe_); for (int j = 0; j < maxit_ || GEOGRAPHICLIB_PANIC; ++j) { real e2a = e2, ep2a = ep2, f2 = 1 - e2, // (1 - f)^2 f1 = sqrt(f2), // (1 - f) Q0 = Qf(e2 < 0 ? -e2 : ep2, e2 < 0), h = e2 - f1 * f2 * K / Q0 - 3 * J2, dh = 1 - 3 * f1 * K * QH3f(e2 < 0 ? -e2 : ep2, e2 < 0) / (2 * Math::sq(Q0)); e2 = min(e2a - h / dh, maxe_); ep2 = max(e2 / (1 - e2), -maxe_); if (abs(h) < eps2_ || e2 == e2a || ep2 == ep2a) break; } return e2 / (1 + sqrt(1 - e2)); } Math::real NormalGravity::FlatteningToJ2(real a, real GM, real omega, real f) { real K = 2 * Math::sq(a * omega) * a / (15 * GM), f1 = 1 - f, f2 = Math::sq(f1), e2 = f * (2 - f); // H+M, Eq 2-90 + 2-92' return (e2 - K * f1 * f2 / Qf(f < 0 ? -e2 : e2 / f2, f < 0)) / 3; } } // namespace GeographicLib GeographicLib-1.52/src/OSGB.cpp0000644000771000077100000001261314064202371016045 0ustar ckarneyckarney/** * \file OSGB.cpp * \brief Implementation for GeographicLib::OSGB class * * Copyright (c) Charles Karney (2010-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include namespace GeographicLib { using namespace std; const char* const OSGB::letters_ = "ABCDEFGHJKLMNOPQRSTUVWXYZ"; const char* const OSGB::digits_ = "0123456789"; const TransverseMercator& OSGB::OSGBTM() { static const TransverseMercator osgbtm(EquatorialRadius(), Flattening(), CentralScale()); return osgbtm; } Math::real OSGB::computenorthoffset() { real x, y; static const real northoffset = ( OSGBTM().Forward(real(0), OriginLatitude(), real(0), x, y), FalseNorthing() - y ); return northoffset; } void OSGB::GridReference(real x, real y, int prec, std::string& gridref) { using std::isnan; // Needed for Centos 7, ubuntu 14 CheckCoords(x, y); if (!(prec >= 0 && prec <= maxprec_)) throw GeographicErr("OSGB precision " + Utility::str(prec) + " not in [0, " + Utility::str(int(maxprec_)) + "]"); if (isnan(x) || isnan(y)) { gridref = "INVALID"; return; } 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_)]; // Need extra real because, since C++11, pow(float, int) returns double real mult = real(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 = real(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; if (len >= 2 && toupper(gridref[0]) == 'I' && toupper(gridref[1]) == 'N') { x = y = Math::NaN(); prec = -2; // For compatibility with MGRS::Reverse. return; } 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. NaNs are let through. 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.52/src/PolarStereographic.cpp0000644000771000077100000000737514064202371021121 0ustar ckarneyckarney/** * \file PolarStereographic.cpp * \brief Implementation for GeographicLib::PolarStereographic class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { using namespace std; PolarStereographic::PolarStereographic(real a, real f, real k0) : _a(a) , _f(f) , _e2(_f * (2 - _f)) , _es((_f < 0 ? -1 : 1) * sqrt(abs(_e2))) , _e2m(1 - _e2) , _c( (1 - _f) * exp(Math::eatanhe(real(1), _es)) ) , _k0(k0) { if (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_f) && _f < 1)) throw GeographicErr("Polar semi-axis is not positive"); if (!(isfinite(_k0) && _k0 > 0)) throw GeographicErr("Scale is not positive"); } const PolarStereographic& PolarStereographic::UPS() { static const PolarStereographic ups(Constants::WGS84_a(), Constants::WGS84_f(), Constants::UPS_k0()); return ups; } // 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 { lat = Math::LatFix(lat); lat *= northp ? 1 : -1; real tau = Math::tand(lat), secphi = hypot(real(1), tau), taup = Math::taupf(tau, _es), rho = 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; Math::sincosd(lon, x, y); x *= rho; y *= (northp ? -rho : rho); gamma = Math::AngNormalize(northp ? lon : -lon); } void PolarStereographic::Reverse(bool northp, real x, real y, real& lat, real& lon, real& gamma, real& k) const { real rho = hypot(x, y), t = rho != 0 ? rho / (2 * _k0 * _a / _c) : Math::sq(numeric_limits::epsilon()), taup = (1 / t - t) / 2, tau = Math::tauf(taup, _es), secphi = hypot(real(1), tau); k = rho != 0 ? (rho / _a) * secphi * sqrt(_e2m + _e2 / Math::sq(secphi)) : _k0; lat = (northp ? 1 : -1) * Math::atand(tau); lon = Math::atan2d(x, northp ? -y : y ); gamma = Math::AngNormalize(northp ? lon : -lon); } void PolarStereographic::SetScale(real lat, real k) { if (!(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.52/src/PolygonArea.cpp0000644000771000077100000001245214064202371017534 0ustar ckarneyckarney/** * \file PolygonArea.cpp * \brief Implementation for GeographicLib::PolygonAreaT class * * Copyright (c) Charles Karney (2010-2019) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include namespace GeographicLib { using namespace std; template void PolygonAreaT::AddPoint(real lat, real lon) { lat = Math::LatFix(lat); lon = Math::AngNormalize(lon); 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; } template void PolygonAreaT::AddEdge(real azi, real s) { if (_num) { // Do nothing if _num is zero real lat, lon, S12, t; _earth.GenDirect(_lat1, _lon1, azi, false, s, _mask, lat, lon, t, t, t, t, t, S12); _perimetersum += s; if (!_polyline) { _areasum += S12; _crossings += transitdirect(_lon1, lon); lon = Math::AngNormalize(lon); } _lat1 = lat; _lon1 = lon; ++_num; } } template unsigned PolygonAreaT::Compute(bool reverse, bool sign, real& perimeter, real& area) const { 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); AreaReduce(tempsum, crossings, reverse, sign); area = 0 + tempsum(); return _num; } template unsigned PolygonAreaT::TestPoint(real lat, real lon, bool reverse, bool sign, real& perimeter, real& area) const { if (_num == 0) { perimeter = 0; if (!_polyline) area = 0; return 1; } perimeter = _perimetersum(); real tempsum = _polyline ? 0 : _areasum(); int crossings = _crossings; unsigned 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; AreaReduce(tempsum, crossings, reverse, sign); area = 0 + tempsum; return num; } template unsigned PolygonAreaT::TestEdge(real azi, real s, bool reverse, bool sign, real& perimeter, real& area) const { if (_num == 0) { // we don't have a starting point! perimeter = Math::NaN(); if (!_polyline) area = Math::NaN(); return 0; } unsigned num = _num + 1; perimeter = _perimetersum() + s; if (_polyline) return num; real tempsum = _areasum(); int crossings = _crossings; { real lat, lon, s12, S12, t; _earth.GenDirect(_lat1, _lon1, azi, false, s, _mask, lat, lon, t, t, t, t, t, S12); tempsum += S12; crossings += transitdirect(_lon1, lon); lon = Math::AngNormalize(lon); _earth.GenInverse(lat, lon, _lat0, _lon0, _mask, s12, t, t, t, t, t, S12); perimeter += s12; tempsum += S12; crossings += transit(lon, _lon0); } AreaReduce(tempsum, crossings, reverse, sign); area = 0 + tempsum; return num; } template template void PolygonAreaT::AreaReduce(T& area, int crossings, bool reverse, bool sign) const { Remainder(area); if (crossings & 1) area += (area < 0 ? 1 : -1) * _area0/2; // area is with the clockwise sense. If !reverse convert to // counter-clockwise convention. if (!reverse) area *= -1; // If sign put area in (-_area0/2, _area0/2], else put area in [0, _area0) if (sign) { if (area > _area0/2) area -= _area0; else if (area <= -_area0/2) area += _area0; } else { if (area >= _area0) area -= _area0; else if (area < 0) area += _area0; } } template class GEOGRAPHICLIB_EXPORT PolygonAreaT; template class GEOGRAPHICLIB_EXPORT PolygonAreaT; template class GEOGRAPHICLIB_EXPORT PolygonAreaT; } // namespace GeographicLib GeographicLib-1.52/src/Rhumb.cpp0000644000771000077100000003507414064202371016376 0ustar ckarneyckarney/** * \file Rhumb.cpp * \brief Implementation for GeographicLib::Rhumb and GeographicLib::RhumbLine * classes * * Copyright (c) Charles Karney (2014-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include namespace GeographicLib { using namespace std; Rhumb::Rhumb(real a, real f, bool exact) : _ell(a, f) , _exact(exact) , _c2(_ell.Area() / 720) { // Generated by Maxima on 2015-05-15 08:24:04-04:00 #if GEOGRAPHICLIB_RHUMBAREA_ORDER == 4 static const real coeff[] = { // R[0]/n^0, polynomial in n of order 4 691, 7860, -20160, 18900, 0, 56700, // R[1]/n^1, polynomial in n of order 3 1772, -5340, 6930, -4725, 14175, // R[2]/n^2, polynomial in n of order 2 -1747, 1590, -630, 4725, // R[3]/n^3, polynomial in n of order 1 104, -31, 315, // R[4]/n^4, polynomial in n of order 0 -41, 420, }; // count = 20 #elif GEOGRAPHICLIB_RHUMBAREA_ORDER == 5 static const real coeff[] = { // R[0]/n^0, polynomial in n of order 5 -79036, 22803, 259380, -665280, 623700, 0, 1871100, // R[1]/n^1, polynomial in n of order 4 41662, 58476, -176220, 228690, -155925, 467775, // R[2]/n^2, polynomial in n of order 3 18118, -57651, 52470, -20790, 155925, // R[3]/n^3, polynomial in n of order 2 -23011, 17160, -5115, 51975, // R[4]/n^4, polynomial in n of order 1 5480, -1353, 13860, // R[5]/n^5, polynomial in n of order 0 -668, 5775, }; // count = 27 #elif GEOGRAPHICLIB_RHUMBAREA_ORDER == 6 static const real coeff[] = { // R[0]/n^0, polynomial in n of order 6 128346268, -107884140, 31126095, 354053700, -908107200, 851350500, 0, 2554051500LL, // R[1]/n^1, polynomial in n of order 5 -114456994, 56868630, 79819740, -240540300, 312161850, -212837625, 638512875, // R[2]/n^2, polynomial in n of order 4 51304574, 24731070, -78693615, 71621550, -28378350, 212837625, // R[3]/n^3, polynomial in n of order 3 1554472, -6282003, 4684680, -1396395, 14189175, // R[4]/n^4, polynomial in n of order 2 -4913956, 3205800, -791505, 8108100, // R[5]/n^5, polynomial in n of order 1 1092376, -234468, 2027025, // R[6]/n^6, polynomial in n of order 0 -313076, 2027025, }; // count = 35 #elif GEOGRAPHICLIB_RHUMBAREA_ORDER == 7 static const real coeff[] = { // R[0]/n^0, polynomial in n of order 7 -317195588, 385038804, -323652420, 93378285, 1062161100, -2724321600LL, 2554051500LL, 0, 7662154500LL, // R[1]/n^1, polynomial in n of order 6 258618446, -343370982, 170605890, 239459220, -721620900, 936485550, -638512875, 1915538625, // R[2]/n^2, polynomial in n of order 5 -248174686, 153913722, 74193210, -236080845, 214864650, -85135050, 638512875, // R[3]/n^3, polynomial in n of order 4 114450437, 23317080, -94230045, 70270200, -20945925, 212837625, // R[4]/n^4, polynomial in n of order 3 15445736, -103193076, 67321800, -16621605, 170270100, // R[5]/n^5, polynomial in n of order 2 -27766753, 16385640, -3517020, 30405375, // R[6]/n^6, polynomial in n of order 1 4892722, -939228, 6081075, // R[7]/n^7, polynomial in n of order 0 -3189007, 14189175, }; // count = 44 #elif GEOGRAPHICLIB_RHUMBAREA_ORDER == 8 static const real coeff[] = { // R[0]/n^0, polynomial in n of order 8 71374704821LL, -161769749880LL, 196369790040LL, -165062734200LL, 47622925350LL, 541702161000LL, -1389404016000LL, 1302566265000LL, 0, 3907698795000LL, // R[1]/n^1, polynomial in n of order 7 -13691187484LL, 65947703730LL, -87559600410LL, 43504501950LL, 61062101100LL, -184013329500LL, 238803815250LL, -162820783125LL, 488462349375LL, // R[2]/n^2, polynomial in n of order 6 30802104839LL, -63284544930LL, 39247999110LL, 18919268550LL, -60200615475LL, 54790485750LL, -21709437750LL, 162820783125LL, // R[3]/n^3, polynomial in n of order 5 -8934064508LL, 5836972287LL, 1189171080, -4805732295LL, 3583780200LL, -1068242175, 10854718875LL, // R[4]/n^4, polynomial in n of order 4 50072287748LL, 3938662680LL, -26314234380LL, 17167059000LL, -4238509275LL, 43418875500LL, // R[5]/n^5, polynomial in n of order 3 359094172, -9912730821LL, 5849673480LL, -1255576140, 10854718875LL, // R[6]/n^6, polynomial in n of order 2 -16053944387LL, 8733508770LL, -1676521980, 10854718875LL, // R[7]/n^7, polynomial in n of order 1 930092876, -162639357, 723647925, // R[8]/n^8, polynomial in n of order 0 -673429061, 1929727800, }; // count = 54 #else #error "Bad value for GEOGRAPHICLIB_RHUMBAREA_ORDER" #endif static_assert(sizeof(coeff) / sizeof(real) == ((maxpow_ + 1) * (maxpow_ + 4))/2, "Coefficient array size mismatch for Rhumb"); real d = 1; int o = 0; for (int l = 0; l <= maxpow_; ++l) { int m = maxpow_ - l; // R[0] is just an integration constant so it cancels when evaluating a // definite integral. So don't bother computing it. It won't be used // when invoking SinCosSeries. if (l) _R[l] = d * Math::polyval(m, coeff + o, _ell._n) / coeff[o + m + 1]; o += m + 2; d *= _ell._n; } // Post condition: o == sizeof(alpcoeff) / sizeof(real) } const Rhumb& Rhumb::WGS84() { static const Rhumb wgs84(Constants::WGS84_a(), Constants::WGS84_f(), false); return wgs84; } void Rhumb::GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real& s12, real& azi12, real& S12) const { real lon12 = Math::AngDiff(lon1, lon2), psi1 = _ell.IsometricLatitude(lat1), psi2 = _ell.IsometricLatitude(lat2), psi12 = psi2 - psi1, h = hypot(lon12, psi12); if (outmask & AZIMUTH) azi12 = Math::atan2d(lon12, psi12); if (outmask & DISTANCE) { real dmudpsi = DIsometricToRectifying(psi2, psi1); s12 = h * dmudpsi * _ell.QuarterMeridian() / 90; } if (outmask & AREA) S12 = _c2 * lon12 * MeanSinXi(psi2 * Math::degree(), psi1 * Math::degree()); } RhumbLine Rhumb::Line(real lat1, real lon1, real azi12) const { return RhumbLine(*this, lat1, lon1, azi12, _exact); } void Rhumb::GenDirect(real lat1, real lon1, real azi12, real s12, unsigned outmask, real& lat2, real& lon2, real& S12) const { Line(lat1, lon1, azi12).GenPosition(s12, outmask, lat2, lon2, S12); } Math::real Rhumb::DE(real x, real y) const { const EllipticFunction& ei = _ell._ell; real d = x - y; if (x * y <= 0) return d != 0 ? (ei.E(x) - ei.E(y)) / d : 1; // See DLMF: Eqs (19.11.2) and (19.11.4) letting // theta -> x, phi -> -y, psi -> z // // (E(x) - E(y)) / d = E(z)/d - k2 * sin(x) * sin(y) * sin(z)/d // // tan(z/2) = (sin(x)*Delta(y) - sin(y)*Delta(x)) / (cos(x) + cos(y)) // = d * Dsin(x,y) * (sin(x) + sin(y))/(cos(x) + cos(y)) / // (sin(x)*Delta(y) + sin(y)*Delta(x)) // = t = d * Dt // sin(z) = 2*t/(1+t^2); cos(z) = (1-t^2)/(1+t^2) // Alt (this only works for |z| <= pi/2 -- however, this conditions holds // if x*y > 0): // sin(z) = d * Dsin(x,y) * (sin(x) + sin(y))/ // (sin(x)*cos(y)*Delta(y) + sin(y)*cos(x)*Delta(x)) // cos(z) = sqrt((1-sin(z))*(1+sin(z))) real sx = sin(x), sy = sin(y), cx = cos(x), cy = cos(y); real Dt = Dsin(x, y) * (sx + sy) / ((cx + cy) * (sx * ei.Delta(sy, cy) + sy * ei.Delta(sx, cx))), t = d * Dt, Dsz = 2 * Dt / (1 + t*t), sz = d * Dsz, cz = (1 - t) * (1 + t) / (1 + t*t); return ((sz != 0 ? ei.E(sz, cz, ei.Delta(sz, cz)) / sz : 1) - ei.k2() * sx * sy) * Dsz; } Math::real Rhumb::DRectifying(real latx, real laty) const { real tbetx = _ell._f1 * Math::tand(latx), tbety = _ell._f1 * Math::tand(laty); return (Math::pi()/2) * _ell._b * _ell._f1 * DE(atan(tbetx), atan(tbety)) * Dtan(latx, laty) * Datan(tbetx, tbety) / _ell.QuarterMeridian(); } Math::real Rhumb::DIsometric(real latx, real laty) const { real phix = latx * Math::degree(), tx = Math::tand(latx), phiy = laty * Math::degree(), ty = Math::tand(laty); return Dasinh(tx, ty) * Dtan(latx, laty) - Deatanhe(sin(phix), sin(phiy)) * Dsin(phix, phiy); } Math::real Rhumb::SinCosSeries(bool sinp, real x, real y, const real c[], int n) { // N.B. n >= 0 and c[] has n+1 elements 0..n, of which c[0] is ignored. // // Use Clenshaw summation to evaluate // m = (g(x) + g(y)) / 2 -- mean value // s = (g(x) - g(y)) / (x - y) -- average slope // where // g(x) = sum(c[j]*SC(2*j*x), j = 1..n) // SC = sinp ? sin : cos // CS = sinp ? cos : sin // // This function returns only s; m is discarded. // // Write // t = [m; s] // t = sum(c[j] * f[j](x,y), j = 1..n) // where // f[j](x,y) = [ (SC(2*j*x)+SC(2*j*y))/2 ] // [ (SC(2*j*x)-SC(2*j*y))/d ] // // = [ cos(j*d)*SC(j*p) ] // [ +/-(2/d)*sin(j*d)*CS(j*p) ] // (+/- = sinp ? + : -) and // p = x+y, d = x-y // // f[j+1](x,y) = A * f[j](x,y) - f[j-1](x,y) // // A = [ 2*cos(p)*cos(d) -sin(p)*sin(d)*d] // [ -4*sin(p)*sin(d)/d 2*cos(p)*cos(d) ] // // Let b[n+1] = b[n+2] = [0 0; 0 0] // b[j] = A * b[j+1] - b[j+2] + c[j] * I for j = n..1 // t = (c[0] * I - b[2]) * f[0](x,y) + b[1] * f[1](x,y) // c[0] is not accessed for s = t[2] real p = x + y, d = x - y, cp = cos(p), cd = cos(d), sp = sin(p), sd = d != 0 ? sin(d)/d : 1, m = 2 * cp * cd, s = sp * sd; // 2x2 matrices stored in row-major order const real a[4] = {m, -s * d * d, -4 * s, m}; real ba[4] = {0, 0, 0, 0}; real bb[4] = {0, 0, 0, 0}; real* b1 = ba; real* b2 = bb; if (n > 0) b1[0] = b1[3] = c[n]; for (int j = n - 1; j > 0; --j) { // j = n-1 .. 1 swap(b1, b2); // b1 = A * b2 - b1 + c[j] * I b1[0] = a[0] * b2[0] + a[1] * b2[2] - b1[0] + c[j]; b1[1] = a[0] * b2[1] + a[1] * b2[3] - b1[1]; b1[2] = a[2] * b2[0] + a[3] * b2[2] - b1[2]; b1[3] = a[2] * b2[1] + a[3] * b2[3] - b1[3] + c[j]; } // Here are the full expressions for m and s // m = (c[0] - b2[0]) * f01 - b2[1] * f02 + b1[0] * f11 + b1[1] * f12; // s = - b2[2] * f01 + (c[0] - b2[3]) * f02 + b1[2] * f11 + b1[3] * f12; if (sinp) { // real f01 = 0, f02 = 0; real f11 = cd * sp, f12 = 2 * sd * cp; // m = b1[0] * f11 + b1[1] * f12; s = b1[2] * f11 + b1[3] * f12; } else { // real f01 = 1, f02 = 0; real f11 = cd * cp, f12 = - 2 * sd * sp; // m = c[0] - b2[0] + b1[0] * f11 + b1[1] * f12; s = - b2[2] + b1[2] * f11 + b1[3] * f12; } return s; } Math::real Rhumb::DConformalToRectifying(real chix, real chiy) const { return 1 + SinCosSeries(true, chix, chiy, _ell.ConformalToRectifyingCoeffs(), tm_maxord); } Math::real Rhumb::DRectifyingToConformal(real mux, real muy) const { return 1 - SinCosSeries(true, mux, muy, _ell.RectifyingToConformalCoeffs(), tm_maxord); } Math::real Rhumb::DIsometricToRectifying(real psix, real psiy) const { if (_exact) { real latx = _ell.InverseIsometricLatitude(psix), laty = _ell.InverseIsometricLatitude(psiy); return DRectifying(latx, laty) / DIsometric(latx, laty); } else { psix *= Math::degree(); psiy *= Math::degree(); return DConformalToRectifying(gd(psix), gd(psiy)) * Dgd(psix, psiy); } } Math::real Rhumb::DRectifyingToIsometric(real mux, real muy) const { real latx = _ell.InverseRectifyingLatitude(mux/Math::degree()), laty = _ell.InverseRectifyingLatitude(muy/Math::degree()); return _exact ? DIsometric(latx, laty) / DRectifying(latx, laty) : Dgdinv(Math::taupf(Math::tand(latx), _ell._es), Math::taupf(Math::tand(laty), _ell._es)) * DRectifyingToConformal(mux, muy); } Math::real Rhumb::MeanSinXi(real psix, real psiy) const { return Dlog(cosh(psix), cosh(psiy)) * Dcosh(psix, psiy) + SinCosSeries(false, gd(psix), gd(psiy), _R, maxpow_) * Dgd(psix, psiy); } RhumbLine::RhumbLine(const Rhumb& rh, real lat1, real lon1, real azi12, bool /* exact */) : _rh(rh) , _exact(true) // TODO: RhumbLine::_exact is unused; retire , _lat1(Math::LatFix(lat1)) , _lon1(lon1) , _azi12(Math::AngNormalize(azi12)) { real alp12 = _azi12 * Math::degree(); _salp = _azi12 == -180 ? 0 : sin(alp12); _calp = abs(_azi12) == 90 ? 0 : cos(alp12); _mu1 = _rh._ell.RectifyingLatitude(lat1); _psi1 = _rh._ell.IsometricLatitude(lat1); _r1 = _rh._ell.CircleRadius(lat1); } void RhumbLine::GenPosition(real s12, unsigned outmask, real& lat2, real& lon2, real& S12) const { real mu12 = s12 * _calp * 90 / _rh._ell.QuarterMeridian(), mu2 = _mu1 + mu12; real psi2, lat2x, lon2x; if (abs(mu2) <= 90 && _exact) { // TODO: dummy use of _exact; retire if (_calp != 0) { lat2x = _rh._ell.InverseRectifyingLatitude(mu2); real psi12 = _rh.DRectifyingToIsometric( mu2 * Math::degree(), _mu1 * Math::degree()) * mu12; lon2x = _salp * psi12 / _calp; psi2 = _psi1 + psi12; } else { lat2x = _lat1; lon2x = _salp * s12 / (_r1 * Math::degree()); psi2 = _psi1; } if (outmask & AREA) S12 = _rh._c2 * lon2x * _rh.MeanSinXi(_psi1 * Math::degree(), psi2 * Math::degree()); lon2x = outmask & LONG_UNROLL ? _lon1 + lon2x : Math::AngNormalize(Math::AngNormalize(_lon1) + lon2x); } else { // Reduce to the interval [-180, 180) mu2 = Math::AngNormalize(mu2); // Deal with points on the anti-meridian if (abs(mu2) > 90) mu2 = Math::AngNormalize(180 - mu2); lat2x = _rh._ell.InverseRectifyingLatitude(mu2); lon2x = Math::NaN(); if (outmask & AREA) S12 = Math::NaN(); } if (outmask & LATITUDE) lat2 = lat2x; if (outmask & LONGITUDE) lon2 = lon2x; } } // namespace GeographicLib GeographicLib-1.52/src/SphericalEngine.cpp0000644000771000077100000005057114064202371020360 0ustar ckarneyckarney/** * \file SphericalEngine.cpp * \brief Implementation for GeographicLib::SphericalEngine class * * Copyright (c) Charles Karney (2011-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * 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 #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif namespace GeographicLib { using namespace std; vector& SphericalEngine::sqrttable() { static vector sqrttable(0); return sqrttable; } 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) { 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 = hypot(x, y), cl = p != 0 ? x / p : 1, // cos(lambda); at pole, pick lambda = 0 sl = p != 0 ? y / p : 0, // sin(lambda) r = hypot(z, p), t = r != 0 ? z / r : 0, // cos(theta); at origin, pick theta = pi/2 u = r != 0 ? 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]; const vector& root( sqrttable() ); 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] wrc = 0, wrc2 = 0, wrs = 0, wrs2 = 0, // wr[N - m + 1], wr[N - m + 2] 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; default: break; // To suppress warning message from Visual Studio } 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; default: break; // To suppress warning message from Visual Studio } 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; default: break; // To suppress warning message from Visual Studio } 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 = hypot(z, p), t = r != 0 ? z / r : 0, // cos(theta); at origin, pick theta = pi/2 u = r != 0 ? 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]; const vector& root( sqrttable() ); 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] wrc = 0, wrc2 = 0, wrs = 0, wrs2 = 0, // wr[N - m + 1], wr[N - m + 2] 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; default: break; // To suppress warning message from Visual Studio } 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). vector& root( sqrttable() ); 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(istream& stream, int& N, int& M, vector& C, vector& S, bool truncate) { if (truncate) { if (!((N >= M && M >= 0) || (N == -1 && M == -1))) // The last condition is that M = -1 implies N = -1. throw GeographicErr("Bad requested degree and order " + Utility::str(N) + " " + Utility::str(M)); } int nm[2]; Utility::readarray(stream, nm, 2); int N0 = nm[0], M0 = nm[1]; if (!((N0 >= M0 && M0 >= 0) || (N0 == -1 && M0 == -1))) // The last condition is that M0 = -1 implies N0 = -1. throw GeographicErr("Bad degree and order " + Utility::str(N0) + " " + Utility::str(M0)); N = truncate ? min(N, N0) : N0; M = truncate ? min(M, M0) : M0; C.resize(SphericalEngine::coeff::Csize(N, M)); S.resize(SphericalEngine::coeff::Ssize(N, M)); int skip = (SphericalEngine::coeff::Csize(N0, M0) - SphericalEngine::coeff::Csize(N0, M )) * sizeof(double); if (N == N0) { Utility::readarray(stream, C); if (skip) stream.seekg(streamoff(skip), ios::cur); Utility::readarray(stream, S); if (skip) stream.seekg(streamoff(skip), ios::cur); } else { for (int m = 0, k = 0; m <= M; ++m) { Utility::readarray(stream, &C[k], N + 1 - m); stream.seekg((N0 - N) * sizeof(double), ios::cur); k += N + 1 - m; } if (skip) stream.seekg(streamoff(skip), ios::cur); for (int m = 1, k = 0; m <= M; ++m) { Utility::readarray(stream, &S[k], N + 1 - m); stream.seekg((N0 - N) * sizeof(double), ios::cur); k += N + 1 - m; } if (skip) stream.seekg(streamoff(skip), ios::cur); } return; } /// \cond SKIP template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template Math::real GEOGRAPHICLIB_EXPORT SphericalEngine::Value (const coeff[], const real[], real, real, real, real, real&, real&, real&); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); template CircularEngine GEOGRAPHICLIB_EXPORT SphericalEngine::Circle (const coeff[], const real[], real, real, real); /// \endcond } // namespace GeographicLib GeographicLib-1.52/src/TransverseMercator.cpp0000644000771000077100000005426214064202371021152 0ustar ckarneyckarney/** * \file TransverseMercator.cpp * \brief Implementation for GeographicLib::TransverseMercator class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * 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 GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER 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.) **********************************************************************/ #include #include namespace GeographicLib { using namespace std; TransverseMercator::TransverseMercator(real a, real f, real k0) : _a(a) , _f(f) , _k0(k0) , _e2(_f * (2 - _f)) , _es((_f < 0 ? -1 : 1) * 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(Math::eatanhe(real(1), _es)) ) , _n(_f / (2 - _f)) { if (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(isfinite(_f) && _f < 1)) throw GeographicErr("Polar semi-axis is not positive"); if (!(isfinite(_k0) && _k0 > 0)) throw GeographicErr("Scale is not positive"); // Generated by Maxima on 2015-05-14 22:55:13-04:00 #if GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER/2 == 2 static const real b1coeff[] = { // b1*(n+1), polynomial in n2 of order 2 1, 16, 64, 64, }; // count = 4 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER/2 == 3 static const real b1coeff[] = { // b1*(n+1), polynomial in n2 of order 3 1, 4, 64, 256, 256, }; // count = 5 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER/2 == 4 static const real b1coeff[] = { // b1*(n+1), polynomial in n2 of order 4 25, 64, 256, 4096, 16384, 16384, }; // count = 6 #else #error "Bad value for GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER" #endif #if GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 4 static const real alpcoeff[] = { // alp[1]/n^1, polynomial in n of order 3 164, 225, -480, 360, 720, // alp[2]/n^2, polynomial in n of order 2 557, -864, 390, 1440, // alp[3]/n^3, polynomial in n of order 1 -1236, 427, 1680, // alp[4]/n^4, polynomial in n of order 0 49561, 161280, }; // count = 14 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 5 static const real alpcoeff[] = { // alp[1]/n^1, polynomial in n of order 4 -635, 328, 450, -960, 720, 1440, // alp[2]/n^2, polynomial in n of order 3 4496, 3899, -6048, 2730, 10080, // alp[3]/n^3, polynomial in n of order 2 15061, -19776, 6832, 26880, // alp[4]/n^4, polynomial in n of order 1 -171840, 49561, 161280, // alp[5]/n^5, polynomial in n of order 0 34729, 80640, }; // count = 20 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 6 static const real alpcoeff[] = { // alp[1]/n^1, polynomial in n of order 5 31564, -66675, 34440, 47250, -100800, 75600, 151200, // alp[2]/n^2, polynomial in n of order 4 -1983433, 863232, 748608, -1161216, 524160, 1935360, // alp[3]/n^3, polynomial in n of order 3 670412, 406647, -533952, 184464, 725760, // alp[4]/n^4, polynomial in n of order 2 6601661, -7732800, 2230245, 7257600, // alp[5]/n^5, polynomial in n of order 1 -13675556, 3438171, 7983360, // alp[6]/n^6, polynomial in n of order 0 212378941, 319334400, }; // count = 27 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 7 static const real alpcoeff[] = { // alp[1]/n^1, polynomial in n of order 6 1804025, 2020096, -4267200, 2204160, 3024000, -6451200, 4838400, 9676800, // alp[2]/n^2, polynomial in n of order 5 4626384, -9917165, 4316160, 3743040, -5806080, 2620800, 9676800, // alp[3]/n^3, polynomial in n of order 4 -67102379, 26816480, 16265880, -21358080, 7378560, 29030400, // alp[4]/n^4, polynomial in n of order 3 155912000, 72618271, -85060800, 24532695, 79833600, // alp[5]/n^5, polynomial in n of order 2 102508609, -109404448, 27505368, 63866880, // alp[6]/n^6, polynomial in n of order 1 -12282192400LL, 2760926233LL, 4151347200LL, // alp[7]/n^7, polynomial in n of order 0 1522256789, 1383782400, }; // count = 35 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 8 static const real alpcoeff[] = { // alp[1]/n^1, polynomial in n of order 7 -75900428, 37884525, 42422016, -89611200, 46287360, 63504000, -135475200, 101606400, 203212800, // alp[2]/n^2, polynomial in n of order 6 148003883, 83274912, -178508970, 77690880, 67374720, -104509440, 47174400, 174182400, // alp[3]/n^3, polynomial in n of order 5 318729724, -738126169, 294981280, 178924680, -234938880, 81164160, 319334400, // alp[4]/n^4, polynomial in n of order 4 -40176129013LL, 14967552000LL, 6971354016LL, -8165836800LL, 2355138720LL, 7664025600LL, // alp[5]/n^5, polynomial in n of order 3 10421654396LL, 3997835751LL, -4266773472LL, 1072709352, 2490808320LL, // alp[6]/n^6, polynomial in n of order 2 175214326799LL, -171950693600LL, 38652967262LL, 58118860800LL, // alp[7]/n^7, polynomial in n of order 1 -67039739596LL, 13700311101LL, 12454041600LL, // alp[8]/n^8, polynomial in n of order 0 1424729850961LL, 743921418240LL, }; // count = 44 #else #error "Bad value for GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER" #endif #if GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 4 static const real betcoeff[] = { // bet[1]/n^1, polynomial in n of order 3 -4, 555, -960, 720, 1440, // bet[2]/n^2, polynomial in n of order 2 -437, 96, 30, 1440, // bet[3]/n^3, polynomial in n of order 1 -148, 119, 3360, // bet[4]/n^4, polynomial in n of order 0 4397, 161280, }; // count = 14 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 5 static const real betcoeff[] = { // bet[1]/n^1, polynomial in n of order 4 -3645, -64, 8880, -15360, 11520, 23040, // bet[2]/n^2, polynomial in n of order 3 4416, -3059, 672, 210, 10080, // bet[3]/n^3, polynomial in n of order 2 -627, -592, 476, 13440, // bet[4]/n^4, polynomial in n of order 1 -3520, 4397, 161280, // bet[5]/n^5, polynomial in n of order 0 4583, 161280, }; // count = 20 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 6 static const real betcoeff[] = { // bet[1]/n^1, polynomial in n of order 5 384796, -382725, -6720, 932400, -1612800, 1209600, 2419200, // bet[2]/n^2, polynomial in n of order 4 -1118711, 1695744, -1174656, 258048, 80640, 3870720, // bet[3]/n^3, polynomial in n of order 3 22276, -16929, -15984, 12852, 362880, // bet[4]/n^4, polynomial in n of order 2 -830251, -158400, 197865, 7257600, // bet[5]/n^5, polynomial in n of order 1 -435388, 453717, 15966720, // bet[6]/n^6, polynomial in n of order 0 20648693, 638668800, }; // count = 27 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 7 static const real betcoeff[] = { // bet[1]/n^1, polynomial in n of order 6 -5406467, 6156736, -6123600, -107520, 14918400, -25804800, 19353600, 38707200, // bet[2]/n^2, polynomial in n of order 5 829456, -5593555, 8478720, -5873280, 1290240, 403200, 19353600, // bet[3]/n^3, polynomial in n of order 4 9261899, 3564160, -2708640, -2557440, 2056320, 58060800, // bet[4]/n^4, polynomial in n of order 3 14928352, -9132761, -1742400, 2176515, 79833600, // bet[5]/n^5, polynomial in n of order 2 -8005831, -1741552, 1814868, 63866880, // bet[6]/n^6, polynomial in n of order 1 -261810608, 268433009, 8302694400LL, // bet[7]/n^7, polynomial in n of order 0 219941297, 5535129600LL, }; // count = 35 #elif GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER == 8 static const real betcoeff[] = { // bet[1]/n^1, polynomial in n of order 7 31777436, -37845269, 43097152, -42865200, -752640, 104428800, -180633600, 135475200, 270950400, // bet[2]/n^2, polynomial in n of order 6 24749483, 14930208, -100683990, 152616960, -105719040, 23224320, 7257600, 348364800, // bet[3]/n^3, polynomial in n of order 5 -232468668, 101880889, 39205760, -29795040, -28131840, 22619520, 638668800, // bet[4]/n^4, polynomial in n of order 4 324154477, 1433121792, -876745056, -167270400, 208945440, 7664025600LL, // bet[5]/n^5, polynomial in n of order 3 457888660, -312227409, -67920528, 70779852, 2490808320LL, // bet[6]/n^6, polynomial in n of order 2 -19841813847LL, -3665348512LL, 3758062126LL, 116237721600LL, // bet[7]/n^7, polynomial in n of order 1 -1989295244, 1979471673, 49816166400LL, // bet[8]/n^8, polynomial in n of order 0 191773887257LL, 3719607091200LL, }; // count = 44 #else #error "Bad value for GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER" #endif static_assert(sizeof(b1coeff) / sizeof(real) == maxpow_/2 + 2, "Coefficient array size mismatch for b1"); static_assert(sizeof(alpcoeff) / sizeof(real) == (maxpow_ * (maxpow_ + 3))/2, "Coefficient array size mismatch for alp"); static_assert(sizeof(betcoeff) / sizeof(real) == (maxpow_ * (maxpow_ + 3))/2, "Coefficient array size mismatch for bet"); int m = maxpow_/2; _b1 = Math::polyval(m, b1coeff, Math::sq(_n)) / (b1coeff[m + 1] * (1+_n)); // _a1 is the equivalent radius for computing the circumference of // ellipse. _a1 = _b1 * _a; int o = 0; real d = _n; for (int l = 1; l <= maxpow_; ++l) { m = maxpow_ - l; _alp[l] = d * Math::polyval(m, alpcoeff + o, _n) / alpcoeff[o + m + 1]; _bet[l] = d * Math::polyval(m, betcoeff + o, _n) / betcoeff[o + m + 1]; o += m + 2; d *= _n; } // Post condition: o == sizeof(alpcoeff) / sizeof(real) && // o == sizeof(betcoeff) / sizeof(real) } const TransverseMercator& TransverseMercator::UTM() { static const TransverseMercator utm(Constants::WGS84_a(), Constants::WGS84_f(), Constants::UTM_k0()); return utm; } // Engsager and Poder (2007) use trigonometric series to convert between phi // and phip. Here are the series... // // Conversion from phi to phip: // // phip = phi + sum(c[j] * sin(2*j*phi), j, 1, 6) // // c[1] = - 2 * n // + 2/3 * n^2 // + 4/3 * n^3 // - 82/45 * n^4 // + 32/45 * n^5 // + 4642/4725 * n^6; // c[2] = 5/3 * n^2 // - 16/15 * n^3 // - 13/9 * n^4 // + 904/315 * n^5 // - 1522/945 * n^6; // c[3] = - 26/15 * n^3 // + 34/21 * n^4 // + 8/5 * n^5 // - 12686/2835 * n^6; // c[4] = 1237/630 * n^4 // - 12/5 * n^5 // - 24832/14175 * n^6; // c[5] = - 734/315 * n^5 // + 109598/31185 * n^6; // c[6] = 444337/155925 * n^6; // // Conversion from phip to phi: // // phi = phip + sum(d[j] * sin(2*j*phip), j, 1, 6) // // d[1] = 2 * n // - 2/3 * n^2 // - 2 * n^3 // + 116/45 * n^4 // + 26/45 * n^5 // - 2854/675 * n^6; // d[2] = 7/3 * n^2 // - 8/5 * n^3 // - 227/45 * n^4 // + 2704/315 * n^5 // + 2323/945 * n^6; // d[3] = 56/15 * n^3 // - 136/35 * n^4 // - 1262/105 * n^5 // + 73814/2835 * n^6; // d[4] = 4279/630 * n^4 // - 332/35 * n^5 // - 399572/14175 * n^6; // d[5] = 4174/315 * n^5 // - 144838/6237 * n^6; // d[6] = 601676/22275 * n^6; // // In order to maintain sufficient relative accuracy close to the pole use // // S = sum(c[i]*sin(2*i*phi),i,1,6) // taup = (tau + tan(S)) / (1 - tau * tan(S)) // In Math::taupf and Math::tauf we evaluate the forward transform explicitly // and solve the reverse one by Newton's method. // // There are adapted from TransverseMercatorExact (taup and taupinv). tau = // tan(phi), taup = sinh(psi) void TransverseMercator::Forward(real lon0, real lat, real lon, real& x, real& y, real& gamma, real& k) const { lat = Math::LatFix(lat); lon = Math::AngDiff(lon0, lon); // 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 sphi, cphi, slam, clam; Math::sincosd(lat, sphi, cphi); Math::sincosd(lon, slam, clam); // 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 tau = sphi / cphi, taup = Math::taupf(tau, _es); xip = atan2(taup, clam); // Used to be // etap = Math::atanh(sin(lam) / cosh(psi)); etap = asinh(slam / hypot(taup, clam)); // 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) // Krueger p 22 (44) gamma = Math::atan2d(slam * taup, clam * hypot(real(1), taup)); // 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(cphi)) * hypot(real(1), tau) / hypot(taup, clam); } else { xip = Math::pi()/2; etap = 0; gamma = lon; 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 expressed 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 // https://en.wikipedia.org/wiki/Clenshaw_algorithm // // Let // // S = sum(a[k] * phi[k](x), k = 0..n) // phi[k+1](x) = alpha[k](x) * phi[k](x) + beta[k](x) * phi[k-1](x) // // Evaluate S with // // b[n+2] = b[n+1] = 0 // b[k] = alpha[k](x) * b[k+1] + beta[k+1](x) * b[k+2] + a[k] // S = (a[0] + beta[1](x) * b[2]) * phi[0](x) + b[1] * phi[1](x) // // Here we have // // x = 2 * zeta' // phi[k](x) = sin(k * x) // alpha[k](x) = 2 * cos(x) // beta[k](x) = -1 // [ sin(A+B) - 2*cos(B)*sin(A) + sin(A-B) = 0, A = k*x, B = x ] // n = maxpow_ // a[k] = _alp[k] // S = b[1] * sin(x) // // For the derivative we have // // x = 2 * zeta' // phi[k](x) = cos(k * x) // alpha[k](x) = 2 * cos(x) // beta[k](x) = -1 // [ cos(A+B) - 2*cos(B)*cos(A) + cos(A-B) = 0, A = k*x, B = x ] // a[0] = 1; a[k] = 2*k*_alp[k] // S = (a[0] - b[2]) + b[1] * cos(x) // // Matrix formulation (not used here): // phi[k](x) = [sin(k * x); k * cos(k * x)] // alpha[k](x) = 2 * [cos(x), 0; -sin(x), cos(x)] // beta[k](x) = -1 * [1, 0; 0, 1] // a[k] = _alp[k] * [1, 0; 0, 1] // b[n+2] = b[n+1] = [0, 0; 0, 0] // b[k] = alpha[k](x) * b[k+1] + beta[k+1](x) * b[k+2] + a[k] // N.B., for all k: b[k](1,2) = 0; b[k](1,1) = b[k](2,2) // S = (a[0] + beta[1](x) * b[2]) * phi[0](x) + b[1] * phi[1](x) // phi[0](x) = [0; 0] // phi[1](x) = [sin(x); cos(x)] real c0 = cos(2 * xip), ch0 = cosh(2 * etap), s0 = sin(2 * xip), sh0 = sinh(2 * etap); complex a(2 * c0 * ch0, -2 * s0 * sh0); // 2 * cos(2*zeta') int n = maxpow_; complex y0(n & 1 ? _alp[n] : 0), y1, // default initializer is 0+i0 z0(n & 1 ? 2*n * _alp[n] : 0), z1; if (n & 1) --n; while (n) { y1 = a * y0 - y1 + _alp[n]; z1 = a * z0 - z1 + 2*n * _alp[n]; --n; y0 = a * y1 - y0 + _alp[n]; z0 = a * z1 - z0 + 2*n * _alp[n]; --n; } a /= real(2); // cos(2*zeta') z1 = real(1) - z1 + a * z0; a = complex(s0 * ch0, c0 * sh0); // sin(2*zeta') y1 = complex(xip, etap) + a * y0; // Fold in change in convergence and scale for Gauss-Schreiber TM to // Gauss-Krueger TM. gamma -= Math::atan2d(z1.imag(), z1.real()); k *= _b1 * abs(z1); real xi = y1.real(), eta = y1.imag(); y = _a1 * _k0 * (backside ? Math::pi() - xi : xi) * latsign; x = _a1 * _k0 * eta * lonsign; if (backside) gamma = 180 - gamma; gamma *= latsign * lonsign; gamma = Math::AngNormalize(gamma); k *= _k0; } void TransverseMercator::Reverse(real lon0, real x, real y, real& lat, real& lon, real& gamma, real& k) const { // 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); complex a(2 * c0 * ch0, -2 * s0 * sh0); // 2 * cos(2*zeta) int n = maxpow_; complex y0(n & 1 ? -_bet[n] : 0), y1, // default initializer is 0+i0 z0(n & 1 ? -2*n * _bet[n] : 0), z1; if (n & 1) --n; while (n) { y1 = a * y0 - y1 - _bet[n]; z1 = a * z0 - z1 - 2*n * _bet[n]; --n; y0 = a * y1 - y0 - _bet[n]; z0 = a * z1 - z0 - 2*n * _bet[n]; --n; } a /= real(2); // cos(2*zeta) z1 = real(1) - z1 + a * z0; a = complex(s0 * ch0, c0 * sh0); // sin(2*zeta) y1 = complex(xi, eta) + a * y0; // Convergence and scale for Gauss-Schreiber TM to Gauss-Krueger TM. gamma = Math::atan2d(z1.imag(), z1.real()); k = _b1 / abs(z1); // JHS 154 has // // phi' = asin(sin(xi') / cosh(eta')) (Krueger p 17 (25)) // lam = asin(tanh(eta') / cos(phi') // psi = asinh(tan(phi')) real xip = y1.real(), etap = y1.imag(), s = sinh(etap), c = max(real(0), cos(xip)), // cos(pi/2) might be negative r = hypot(s, c); if (r != 0) { lon = Math::atan2d(s, c); // Krueger p 17 (25) // Use Newton's method to solve for tau real sxip = sin(xip), tau = Math::tauf(sxip/r, _es); gamma += Math::atan2d(sxip * tanh(etap), c); // Krueger p 19 (31) lat = Math::atand(tau); // Note cos(phi') * cosh(eta') = r k *= sqrt(_e2m + _e2 / (1 + Math::sq(tau))) * hypot(real(1), tau) * r; } else { lat = 90; lon = 0; k *= _c; } lat *= xisign; if (backside) lon = 180 - lon; lon *= etasign; lon = Math::AngNormalize(lon + lon0); if (backside) gamma = 180 - gamma; gamma *= xisign * etasign; gamma = Math::AngNormalize(gamma); k *= _k0; } } // namespace GeographicLib GeographicLib-1.52/src/TransverseMercatorExact.cpp0000644000771000077100000004103214064202371022126 0ustar ckarneyckarney/** * \file TransverseMercatorExact.cpp * \brief Implementation for GeographicLib::TransverseMercatorExact class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * 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 #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif namespace GeographicLib { using namespace std; TransverseMercatorExact::TransverseMercatorExact(real a, real f, real k0, bool extendp) : tol_(numeric_limits::epsilon()) , tol2_(real(0.1) * tol_) , taytol_(pow(tol_, real(0.6))) , _a(a) , _f(f) , _k0(k0) , _mu(_f * (2 - _f)) // e^2 , _mv(1 - _mu) // 1 - e^2 , _e(sqrt(_mu)) , _extendp(extendp) , _Eu(_mu) , _Ev(_mv) { if (!(isfinite(_a) && _a > 0)) throw GeographicErr("Equatorial radius is not positive"); if (!(_f > 0)) throw GeographicErr("Flattening is not positive"); if (!(_f < 1)) throw GeographicErr("Polar semi-axis is not positive"); if (!(isfinite(_k0) && _k0 > 0)) throw GeographicErr("Scale is not positive"); } const TransverseMercatorExact& TransverseMercatorExact::UTM() { static const TransverseMercatorExact utm(Constants::WGS84_a(), Constants::WGS84_f(), Constants::UTM_k0()); return utm; } void TransverseMercatorExact::zeta(real /*u*/, real snu, real cnu, real dnu, real /*v*/, real snv, real cnv, real dnv, real& taup, real& lam) const { // 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)) // Overflow value s.t. atan(overflow) = pi/2 static const real overflow = 1 / Math::sq(numeric_limits::epsilon()); real d1 = sqrt(Math::sq(cnu) + _mv * Math::sq(snu * snv)), d2 = sqrt(_mu * Math::sq(cnu) + _mv * Math::sq(cnv)), t1 = (d1 != 0 ? snu * dnv / d1 : (snu < 0 ? -overflow : overflow)), t2 = (d2 != 0 ? sinh( _e * asinh(_e * snu / d2) ) : (snu < 0 ? -overflow : overflow)); // psi = asinh(t1) - asinh(t2) // taup = sinh(psi) taup = t1 * hypot(real(1), t2) - t2 * 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 { // 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 { 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 = asinh(sin(lamx) / 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 = 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 = 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 = asinh(sin(lam) / 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 { real psi = asinh(taup), scal = 1/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_ || GEOGRAPHICLIB_PANIC; ++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 { // 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 { // 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 { 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 = 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 = 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 { if (sigmainv0(xi, eta, u, v)) return; // min iterations = 2, max iterations = 7; mean = 3.9 for (int i = 0, trip = 0; i < numit_ || GEOGRAPHICLIB_PANIC; ++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 { 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 { lat = Math::LatFix(lat); lon = Math::AngDiff(lon0, lon); // 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 lam = lon * Math::degree(), tau = Math::tand(lat); // 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 // tau = tan(phi), taup = sinh(psi) zetainv(Math::taupf(tau, _e), 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; if (lat == 90) { gamma = lon; k = 1; } else { // Recompute (tau, lam) from (u, v) to improve accuracy of Scale zeta(u, snu, cnu, dnu, v, snv, cnv, dnv, tau, lam); tau = Math::tauf(tau, _e); 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 { // 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 = Math::tauf(tau, _e); phi = atan(tau); lat = phi / Math::degree(); lon = lam / Math::degree(); Scale(tau, lam, snu, cnu, dnu, snv, cnv, dnv, gamma, k); gamma /= Math::degree(); } else { lat = 90; lon = lam = gamma = 0; k = 1; } if (backside) lon = 180 - lon; lon *= lonsign; lon = Math::AngNormalize(lon + Math::AngNormalize(lon0)); lat *= latsign; if (backside) gamma = 180 - gamma; gamma *= latsign * lonsign; k *= _k0; } } // namespace GeographicLib GeographicLib-1.52/src/UTMUPS.cpp0000644000771000077100000002657114064202371016360 0ustar ckarneyckarney/** * \file UTMUPS.cpp * \brief Implementation for GeographicLib::UTMUPS class * * Copyright (c) Charles Karney (2008-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include #include #include #include namespace GeographicLib { using namespace std; const int UTMUPS::falseeasting_[] = { MGRS::upseasting_ * MGRS::tile_, MGRS::upseasting_ * MGRS::tile_, MGRS::utmeasting_ * MGRS::tile_, MGRS::utmeasting_ * MGRS::tile_ }; const int UTMUPS::falsenorthing_[] = { MGRS::upseasting_ * MGRS::tile_, MGRS::upseasting_ * MGRS::tile_, MGRS::maxutmSrow_ * MGRS::tile_, MGRS::minutmNrow_ * MGRS::tile_ }; const int UTMUPS::mineasting_[] = { MGRS::minupsSind_ * MGRS::tile_, MGRS::minupsNind_ * MGRS::tile_, MGRS::minutmcol_ * MGRS::tile_, MGRS::minutmcol_ * MGRS::tile_ }; const int UTMUPS::maxeasting_[] = { MGRS::maxupsSind_ * MGRS::tile_, MGRS::maxupsNind_ * MGRS::tile_, MGRS::maxutmcol_ * MGRS::tile_, MGRS::maxutmcol_ * MGRS::tile_ }; const int UTMUPS::minnorthing_[] = { MGRS::minupsSind_ * MGRS::tile_, MGRS::minupsNind_ * MGRS::tile_, MGRS::minutmSrow_ * MGRS::tile_, (MGRS::minutmNrow_ + MGRS::minutmSrow_ - MGRS::maxutmSrow_) * MGRS::tile_ }; const int UTMUPS::maxnorthing_[] = { 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) { using std::isnan; // Needed for Centos 7, ubuntu 14 if (!(setzone >= MINPSEUDOZONE && setzone <= MAXZONE)) throw GeographicErr("Illegal zone requested " + Utility::str(setzone)); if (setzone >= MINZONE || setzone == INVALID) return setzone; if (isnan(lat) || isnan(lon)) // Check if lat or lon is a NaN return INVALID; if (setzone == UTM || (lat >= -80 && lat < 84)) { int ilon = int(floor(Math::AngNormalize(lon))); if (ilon == 180) ilon = -180; // ilon now in [-180,180) int zone = (ilon + 186)/6; int band = MGRS::LatitudeBand(lat); if (band == 7 && zone == 31 && ilon >= 3) // The Norway exception zone = 32; else if (band == 9 && ilon >= 0 && ilon < 42) // The Svalbard exception 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) { if (abs(lat) > 90) throw GeographicErr("Latitude " + Utility::str(lat) + "d not in [-90d, 90d]"); 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) { using std::isnan; // Needed for Centos 7, ubuntu 14 if (zone == INVALID || isnan(x) || 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); } 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::Transfer(int zonein, bool northpin, real xin, real yin, int zoneout, bool northpout, real& xout, real& yout, int& zone) { bool northp = northpin; if (zonein != zoneout) { // Determine lat, lon real lat, lon; GeographicLib::UTMUPS::Reverse(zonein, northpin, xin, yin, lat, lon); // Try converting to zoneout real x, y; int zone1; GeographicLib::UTMUPS::Forward(lat, lon, zone1, northp, x, y, zoneout == UTMUPS::MATCH ? zonein : zoneout); if (zone1 == 0 && northp != northpout) throw GeographicErr ("Attempt to transfer UPS coordinates between hemispheres"); zone = zone1; xout = x; yout = y; } else { if (zoneout == 0 && northp != northpout) throw GeographicErr ("Attempt to transfer UPS coordinates between hemispheres"); zone = zoneout; xout = xin; yout = yin; } if (northp != northpout) // Can't get here if UPS yout += (northpout ? -1 : 1) * MGRS::utmNshift_; return; } void UTMUPS::DecodeZone(const string& zonestr, int& zone, bool& northp) { unsigned zlen = unsigned(zonestr.size()); if (zlen == 0) throw GeographicErr("Empty zone specification"); // Longest zone spec is 32north, 42south, invalid = 7 if (zlen > 7) throw GeographicErr("More than 7 characters in zone specification " + zonestr); const char* c = zonestr.c_str(); char* q; int zone1 = strtol(c, &q, 10); // if (zone1 == 0) zone1 = UPS; (not necessary) if (zone1 == UPS) { if (!(q == c)) // Don't allow 0n as an alternative to n for UPS coordinates throw GeographicErr("Illegal zone 0 in " + zonestr + ", use just the hemisphere for UPS"); } else if (!(zone1 >= MINUTMZONE && zone1 <= MAXUTMZONE)) throw GeographicErr("Zone " + Utility::str(zone1) + " not in range [1, 60]"); else if (!isdigit(zonestr[0])) throw GeographicErr("Must use unsigned number for zone " + Utility::str(zone1)); else if (q - c > 2) throw GeographicErr("More than 2 digits use to specify zone " + Utility::str(zone1)); string hemi(zonestr, q - c); for (string::iterator p = hemi.begin(); p != hemi.end(); ++p) *p = char(tolower(*p)); if (q == c && (hemi == "inv" || hemi == "invalid")) { zone = INVALID; northp = false; return; } bool northp1 = hemi == "north" || hemi == "n"; if (!(northp1 || hemi == "south" || hemi == "s")) throw GeographicErr(string("Illegal hemisphere ") + hemi + " in " + zonestr + ", specify north or south"); zone = zone1; northp = northp1; } string UTMUPS::EncodeZone(int zone, bool northp, bool abbrev) { if (zone == INVALID) return string(abbrev ? "inv" : "invalid"); 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; if (abbrev) os << (northp ? 'n' : 's'); else os << (northp ? "north" : "south"); return os.str(); } void UTMUPS::DecodeEPSG(int epsg, int& zone, bool& northp) { northp = false; if (epsg >= epsg01N && epsg <= epsg60N) { zone = (epsg - epsg01N) + MINUTMZONE; northp = true; } else if (epsg == epsgN) { zone = UPS; northp = true; } else if (epsg >= epsg01S && epsg <= epsg60S) { zone = (epsg - epsg01S) + MINUTMZONE; } else if (epsg == epsgS) { zone = UPS; } else { zone = INVALID; } } int UTMUPS::EncodeEPSG(int zone, bool northp) { int epsg = -1; if (zone == UPS) epsg = epsgS; else if (zone >= MINUTMZONE && zone <= MAXUTMZONE) epsg = (zone - MINUTMZONE) + epsg01S; if (epsg >= 0 && northp) epsg += epsgN - epsgS; return epsg; } Math::real UTMUPS::UTMShift() { return real(MGRS::utmNshift_); } } // namespace GeographicLib GeographicLib-1.52/src/Utility.cpp0000644000771000077100000000312214064202371016751 0ustar ckarneyckarney/** * \file Utility.cpp * \brief Implementation for GeographicLib::Utility class * * Copyright (c) Charles Karney (2011-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ #include #include #if defined(_MSC_VER) // Squelch warnings about unsafe use of getenv # pragma warning (disable: 4996) #endif namespace GeographicLib { using namespace std; bool Utility::ParseLine(const std::string& line, std::string& key, std::string& value, char delim) { key.clear(); value.clear(); string::size_type n = line.find('#'); string linea = trim(line.substr(0, n)); if (linea.empty()) return false; n = delim ? linea.find(delim) : linea.find_first_of(" \t\n\v\f\r"); // key = trim(linea.substr(0, n)); if (key.empty()) return false; if (n != string::npos) value = trim(linea.substr(n + 1)); return true; } bool Utility::ParseLine(const std::string& line, std::string& key, std::string& value) { return ParseLine(line, key, value, '\0'); } int Utility::set_digits(int ndigits) { #if GEOGRAPHICLIB_PRECISION == 5 if (ndigits <= 0) { char* digitenv = getenv("GEOGRAPHICLIB_DIGITS"); if (digitenv) ndigits = strtol(digitenv, NULL, 0); if (ndigits <= 0) ndigits = 256; } #endif return Math::set_digits(ndigits); } } // namespace GeographicLib GeographicLib-1.52/src/Makefile.in0000644000771000077100000010152614064202402016651 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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 VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libGeographic_la_LIBADD = am_libGeographic_la_OBJECTS = Accumulator.lo AlbersEqualArea.lo \ AzimuthalEquidistant.lo CassiniSoldner.lo CircularEngine.lo \ DMS.lo Ellipsoid.lo EllipticFunction.lo GARS.lo GeoCoords.lo \ Geocentric.lo Geodesic.lo GeodesicExact.lo GeodesicExactC4.lo \ GeodesicLine.lo GeodesicLineExact.lo Geohash.lo Geoid.lo \ Georef.lo Gnomonic.lo GravityCircle.lo GravityModel.lo \ LambertConformalConic.lo LocalCartesian.lo MGRS.lo \ MagneticCircle.lo MagneticModel.lo Math.lo NormalGravity.lo \ OSGB.lo PolarStereographic.lo PolygonArea.lo Rhumb.lo \ SphericalEngine.lo TransverseMercator.lo \ TransverseMercatorExact.lo UTMUPS.lo Utility.lo libGeographic_la_OBJECTS = $(am_libGeographic_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libGeographic_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(AM_CXXFLAGS) $(CXXFLAGS) $(libGeographic_la_LDFLAGS) \ $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/GeographicLib depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/Accumulator.Plo \ ./$(DEPDIR)/AlbersEqualArea.Plo \ ./$(DEPDIR)/AzimuthalEquidistant.Plo \ ./$(DEPDIR)/CassiniSoldner.Plo ./$(DEPDIR)/CircularEngine.Plo \ ./$(DEPDIR)/DMS.Plo ./$(DEPDIR)/Ellipsoid.Plo \ ./$(DEPDIR)/EllipticFunction.Plo ./$(DEPDIR)/GARS.Plo \ ./$(DEPDIR)/GeoCoords.Plo ./$(DEPDIR)/Geocentric.Plo \ ./$(DEPDIR)/Geodesic.Plo ./$(DEPDIR)/GeodesicExact.Plo \ ./$(DEPDIR)/GeodesicExactC4.Plo ./$(DEPDIR)/GeodesicLine.Plo \ ./$(DEPDIR)/GeodesicLineExact.Plo ./$(DEPDIR)/Geohash.Plo \ ./$(DEPDIR)/Geoid.Plo ./$(DEPDIR)/Georef.Plo \ ./$(DEPDIR)/Gnomonic.Plo ./$(DEPDIR)/GravityCircle.Plo \ ./$(DEPDIR)/GravityModel.Plo \ ./$(DEPDIR)/LambertConformalConic.Plo \ ./$(DEPDIR)/LocalCartesian.Plo ./$(DEPDIR)/MGRS.Plo \ ./$(DEPDIR)/MagneticCircle.Plo ./$(DEPDIR)/MagneticModel.Plo \ ./$(DEPDIR)/Math.Plo ./$(DEPDIR)/NormalGravity.Plo \ ./$(DEPDIR)/OSGB.Plo ./$(DEPDIR)/PolarStereographic.Plo \ ./$(DEPDIR)/PolygonArea.Plo ./$(DEPDIR)/Rhumb.Plo \ ./$(DEPDIR)/SphericalEngine.Plo \ ./$(DEPDIR)/TransverseMercator.Plo \ ./$(DEPDIR)/TransverseMercatorExact.Plo ./$(DEPDIR)/UTMUPS.Plo \ ./$(DEPDIR)/Utility.Plo am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libGeographic_la_SOURCES) DIST_SOURCES = $(libGeographic_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ 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@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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@ pkgconfigdir = @pkgconfigdir@ 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 = Accumulator.cpp \ AlbersEqualArea.cpp \ AzimuthalEquidistant.cpp \ CassiniSoldner.cpp \ CircularEngine.cpp \ DMS.cpp \ Ellipsoid.cpp \ EllipticFunction.cpp \ GARS.cpp \ GeoCoords.cpp \ Geocentric.cpp \ Geodesic.cpp \ GeodesicExact.cpp \ GeodesicExactC4.cpp \ GeodesicLine.cpp \ GeodesicLineExact.cpp \ Geohash.cpp \ Geoid.cpp \ Georef.cpp \ Gnomonic.cpp \ GravityCircle.cpp \ GravityModel.cpp \ LambertConformalConic.cpp \ LocalCartesian.cpp \ MGRS.cpp \ MagneticCircle.cpp \ MagneticModel.cpp \ Math.cpp \ NormalGravity.cpp \ OSGB.cpp \ PolarStereographic.cpp \ PolygonArea.cpp \ Rhumb.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/Ellipsoid.hpp \ ../include/GeographicLib/EllipticFunction.hpp \ ../include/GeographicLib/GARS.hpp \ ../include/GeographicLib/GeoCoords.hpp \ ../include/GeographicLib/Geocentric.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicExact.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/GeodesicLineExact.hpp \ ../include/GeographicLib/Geohash.hpp \ ../include/GeographicLib/Geoid.hpp \ ../include/GeographicLib/Georef.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/NearestNeighbor.hpp \ ../include/GeographicLib/NormalGravity.hpp \ ../include/GeographicLib/OSGB.hpp \ ../include/GeographicLib/PolarStereographic.hpp \ ../include/GeographicLib/PolygonArea.hpp \ ../include/GeographicLib/Rhumb.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 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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) @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 " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ 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)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libGeographic.la: $(libGeographic_la_OBJECTS) $(libGeographic_la_DEPENDENCIES) $(EXTRA_libGeographic_la_DEPENDENCIES) $(AM_V_CXXLD)$(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)/Accumulator.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AlbersEqualArea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AzimuthalEquidistant.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CassiniSoldner.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CircularEngine.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DMS.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Ellipsoid.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EllipticFunction.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GARS.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoCoords.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Geocentric.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Geodesic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodesicExact.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodesicExactC4.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodesicLine.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodesicLineExact.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Geohash.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Geoid.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Georef.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Gnomonic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GravityCircle.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GravityModel.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LambertConformalConic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LocalCartesian.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MGRS.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MagneticCircle.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MagneticModel.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Math.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NormalGravity.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OSGB.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PolarStereographic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PolygonArea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Rhumb.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SphericalEngine.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransverseMercator.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransverseMercatorExact.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UTMUPS.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Utility.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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 -f ./$(DEPDIR)/Accumulator.Plo -rm -f ./$(DEPDIR)/AlbersEqualArea.Plo -rm -f ./$(DEPDIR)/AzimuthalEquidistant.Plo -rm -f ./$(DEPDIR)/CassiniSoldner.Plo -rm -f ./$(DEPDIR)/CircularEngine.Plo -rm -f ./$(DEPDIR)/DMS.Plo -rm -f ./$(DEPDIR)/Ellipsoid.Plo -rm -f ./$(DEPDIR)/EllipticFunction.Plo -rm -f ./$(DEPDIR)/GARS.Plo -rm -f ./$(DEPDIR)/GeoCoords.Plo -rm -f ./$(DEPDIR)/Geocentric.Plo -rm -f ./$(DEPDIR)/Geodesic.Plo -rm -f ./$(DEPDIR)/GeodesicExact.Plo -rm -f ./$(DEPDIR)/GeodesicExactC4.Plo -rm -f ./$(DEPDIR)/GeodesicLine.Plo -rm -f ./$(DEPDIR)/GeodesicLineExact.Plo -rm -f ./$(DEPDIR)/Geohash.Plo -rm -f ./$(DEPDIR)/Geoid.Plo -rm -f ./$(DEPDIR)/Georef.Plo -rm -f ./$(DEPDIR)/Gnomonic.Plo -rm -f ./$(DEPDIR)/GravityCircle.Plo -rm -f ./$(DEPDIR)/GravityModel.Plo -rm -f ./$(DEPDIR)/LambertConformalConic.Plo -rm -f ./$(DEPDIR)/LocalCartesian.Plo -rm -f ./$(DEPDIR)/MGRS.Plo -rm -f ./$(DEPDIR)/MagneticCircle.Plo -rm -f ./$(DEPDIR)/MagneticModel.Plo -rm -f ./$(DEPDIR)/Math.Plo -rm -f ./$(DEPDIR)/NormalGravity.Plo -rm -f ./$(DEPDIR)/OSGB.Plo -rm -f ./$(DEPDIR)/PolarStereographic.Plo -rm -f ./$(DEPDIR)/PolygonArea.Plo -rm -f ./$(DEPDIR)/Rhumb.Plo -rm -f ./$(DEPDIR)/SphericalEngine.Plo -rm -f ./$(DEPDIR)/TransverseMercator.Plo -rm -f ./$(DEPDIR)/TransverseMercatorExact.Plo -rm -f ./$(DEPDIR)/UTMUPS.Plo -rm -f ./$(DEPDIR)/Utility.Plo -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 -f ./$(DEPDIR)/Accumulator.Plo -rm -f ./$(DEPDIR)/AlbersEqualArea.Plo -rm -f ./$(DEPDIR)/AzimuthalEquidistant.Plo -rm -f ./$(DEPDIR)/CassiniSoldner.Plo -rm -f ./$(DEPDIR)/CircularEngine.Plo -rm -f ./$(DEPDIR)/DMS.Plo -rm -f ./$(DEPDIR)/Ellipsoid.Plo -rm -f ./$(DEPDIR)/EllipticFunction.Plo -rm -f ./$(DEPDIR)/GARS.Plo -rm -f ./$(DEPDIR)/GeoCoords.Plo -rm -f ./$(DEPDIR)/Geocentric.Plo -rm -f ./$(DEPDIR)/Geodesic.Plo -rm -f ./$(DEPDIR)/GeodesicExact.Plo -rm -f ./$(DEPDIR)/GeodesicExactC4.Plo -rm -f ./$(DEPDIR)/GeodesicLine.Plo -rm -f ./$(DEPDIR)/GeodesicLineExact.Plo -rm -f ./$(DEPDIR)/Geohash.Plo -rm -f ./$(DEPDIR)/Geoid.Plo -rm -f ./$(DEPDIR)/Georef.Plo -rm -f ./$(DEPDIR)/Gnomonic.Plo -rm -f ./$(DEPDIR)/GravityCircle.Plo -rm -f ./$(DEPDIR)/GravityModel.Plo -rm -f ./$(DEPDIR)/LambertConformalConic.Plo -rm -f ./$(DEPDIR)/LocalCartesian.Plo -rm -f ./$(DEPDIR)/MGRS.Plo -rm -f ./$(DEPDIR)/MagneticCircle.Plo -rm -f ./$(DEPDIR)/MagneticModel.Plo -rm -f ./$(DEPDIR)/Math.Plo -rm -f ./$(DEPDIR)/NormalGravity.Plo -rm -f ./$(DEPDIR)/OSGB.Plo -rm -f ./$(DEPDIR)/PolarStereographic.Plo -rm -f ./$(DEPDIR)/PolygonArea.Plo -rm -f ./$(DEPDIR)/Rhumb.Plo -rm -f ./$(DEPDIR)/SphericalEngine.Plo -rm -f ./$(DEPDIR)/TransverseMercator.Plo -rm -f ./$(DEPDIR)/TransverseMercatorExact.Plo -rm -f ./$(DEPDIR)/UTMUPS.Plo -rm -f ./$(DEPDIR)/Utility.Plo -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 TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \ ctags ctags-am 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 tags-am uninstall uninstall-am uninstall-libLTLIBRARIES .PRECIOUS: Makefile ../include/GeographicLib/Config.h: ../include/GeographicLib/Config-ac.h ( egrep '\bVERSION\b|\bGEOGRAPHICLIB_|\bHAVE_LONG_DOUBLE\b' $< | \ sed -e 's/ VERSION / GEOGRAPHICLIB_VERSION_STRING /' \ -e 's/ HAVE_LONG_DOUBLE / GEOGRAPHICLIB_HAVE_LONG_DOUBLE /'; \ grep WORDS_BIGENDIAN $< | tail -1 | \ sed -e 's/ WORDS_BIGENDIAN / GEOGRAPHICLIB_WORDS_BIGENDIAN /' ) > $@ $(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.52/tools/CMakeLists.txt0000644000771000077100000000453514064202371017724 0ustar ckarneyckarney# Build the tools... # Where to find the *.usage files for the --help option. include_directories (${PROJECT_BINARY_DIR}/man) # Only needed if target_compile_definitions is not supported add_definitions (${PROJECT_DEFINITIONS}) # Loop over all the tools, specifying the source and library. add_custom_target (tools ALL) foreach (TOOL ${TOOLS}) add_executable (${TOOL} ${TOOL}.cpp) if (MAINTAINER) add_dependencies (${TOOL} usage) endif () add_dependencies (tools ${TOOL}) set_source_files_properties (${TOOL}.cpp PROPERTIES OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/man/${TOOL}.usage) target_link_libraries (${TOOL} ${PROJECT_LIBRARIES} ${HIGHPREC_LIBRARIES}) endforeach () if (MSVC OR CMAKE_CONFIGURATION_TYPES) # Add _d suffix for your debug versions of the tools set_target_properties (${TOOLS} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}") endif () if (APPLE) # Ensure that the package is relocatable set_target_properties (${TOOLS} PROPERTIES INSTALL_RPATH "@loader_path/../lib${LIB_SUFFIX}") endif () # Specify where the tools are installed, adding them to the export targets install (TARGETS ${TOOLS} EXPORT targets DESTINATION bin) if (MSVC AND PACKAGE_DEBUG_LIBS) # Possibly don't EXPORT the debug versions of the tools and then this # wouldn't be necessary. However, including the debug versions of the # tools in the installer package is innocuous. foreach (TOOL ${TOOLS}) install (PROGRAMS "${PROJECT_BINARY_DIR}/bin/Debug/${TOOL}${CMAKE_DEBUG_POSTFIX}.exe" DESTINATION bin CONFIGURATIONS Release) endforeach () endif () # Put all the tools into a folder in the IDE set_property (TARGET tools ${TOOLS} PROPERTY FOLDER tools) # Create the scripts for downloading the data files on non-Windows # systems. This needs to substitute ${GEOGRAPHICLIB_DATA} as the # default data directory. These are installed under sbin, because it is # expected to be run with write access to /usr/local. if (NOT WIN32) foreach (SCRIPT ${SCRIPTS}) configure_file (${SCRIPT}.sh scripts/${SCRIPT} @ONLY) add_custom_command (OUTPUT ${SCRIPT} COMMAND ${CMAKE_COMMAND} -E copy scripts/${SCRIPT} ${SCRIPT} && chmod +x ${SCRIPT} DEPENDS ${SCRIPT}.sh) install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT} DESTINATION sbin) endforeach () add_custom_target (scripts ALL DEPENDS ${SCRIPTS}) endif () GeographicLib-1.52/tools/CartConvert.cpp0000644000771000077100000001555714064202371020130 0ustar ckarneyckarney/** * \file CartConvert.cpp * \brief Command line utility for geodetic to cartesian coordinate conversions * * Copyright (c) Charles Karney (2009-2017) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "CartConvert.usage" int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool localcartesian = false, reverse = false, longfirst = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); int prec = 6; 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, longfirst); h0 = Utility::val(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::val(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 == "-w") longfirst = !longfirst; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(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] << ": 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); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, stra, strb, strc, strd; std::istringstream str; int retval = 0; while (std::getline(*input, s)) { try { 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); } } str.clear(); str.str(s); // initial values to suppress warnings real lat, lon, h, x = 0, y = 0, z = 0; if (!(str >> stra >> strb >> strc)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::val(stra); y = Utility::val(strb); z = Utility::val(strc); } else { DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); h = Utility::val(strc); } 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(longfirst ? lon : lat, prec + 5) << " " << Utility::str(longfirst ? lat : lon, prec + 5) << " " << Utility::str(h, prec) << 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, prec) << " " << Utility::str(y, prec) << " " << Utility::str(z, prec) << 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.52/tools/ConicProj.cpp0000644000771000077100000002014714064202371017553 0ustar ckarneyckarney/** * \file ConicProj.cpp * \brief Command line utility for conical projections * * Copyright (c) Charles Karney (2009-2017) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "ConicProj.usage" int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool lcc = false, albers = false, reverse = false, longfirst = false; real lat1 = 0, lat2 = 0, lon0 = 0, k1 = 1; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); int prec = 6; 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"); lon0 = Math::AngNormalize(lon0); } 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::val(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::val(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 == "-w") longfirst = !longfirst; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(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] << ": 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); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, stra, strb, strc; std::istringstream str; int retval = 0; while (std::getline(*input, s)) { try { 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); } } str.clear(); str.str(s); real lat, lon, x, y, gamma, k; if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::val(stra); y = Utility::val(strb); } else DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); 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(longfirst ? lon : lat, prec + 5) << " " << Utility::str(longfirst ? lat : lon, prec + 5) << " " << Utility::str(gamma, prec + 6) << " " << Utility::str(k, prec + 6) << 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, prec) << " " << Utility::str(y, prec) << " " << Utility::str(gamma, prec + 6) << " " << Utility::str(k, prec + 6) << 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.52/tools/GeoConvert.cpp0000644000771000077100000001661414064202371017744 0ustar ckarneyckarney/** * \file GeoConvert.cpp * \brief Command line utility for geographic coordinate conversions * * Copyright (c) Charles Karney (2008-2017) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif #include "GeoConvert.usage" int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); enum { GEOGRAPHIC, DMS, UTMUPS, MGRS, CONVERGENCE }; int outputmode = GEOGRAPHIC; int prec = 0; int zone = UTMUPS::MATCH; bool centerp = true, longfirst = false; std::string istring, ifile, ofile, cdelim; char lsep = ';', dmssep = char(0); bool sethemisphere = false, northp = false, abbrev = true, latch = false; 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 == "-z") { if (++m == argc) return usage(1, true); std::string zonestr(argv[m]); try { UTMUPS::DecodeZone(zonestr, zone, northp); sethemisphere = true; } 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; } sethemisphere = false; } latch = false; } else if (arg == "-s") { zone = UTMUPS::STANDARD; sethemisphere = false; latch = false; } else if (arg == "-S") { zone = UTMUPS::STANDARD; sethemisphere = false; latch = true; } else if (arg == "-t") { zone = UTMUPS::UTM; sethemisphere = false; latch = false; } else if (arg == "-T") { zone = UTMUPS::UTM; sethemisphere = false; latch = true; } else if (arg == "-w") longfirst = !longfirst; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-l") abbrev = false; else if (arg == "-a") abbrev = 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] << ": GeographicLib version " << GEOGRAPHICLIB_VERSION_STRING << "\n"; MGRS::Check(); 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, eol; std::string os; int retval = 0; while (std::getline(*input, s)) { 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, longfirst); p.SetAltZone(zone); switch (outputmode) { case GEOGRAPHIC: os = p.GeoRepresentation(prec, longfirst); break; case DMS: os = p.DMSRepresentation(prec, longfirst, dmssep); break; case UTMUPS: os = (sethemisphere ? p.AltUTMUPSRepresentation(northp, prec, abbrev) : p.AltUTMUPSRepresentation(prec, abbrev)); break; case MGRS: os = p.AltMGRSRepresentation(prec); break; case CONVERGENCE: { real gamma = p.AltConvergence(), k = p.AltScale(); int prec1 = std::max(-5, std::min(Math::extra_digits() + 8, prec)); os = Utility::str(gamma, prec1 + 5) + " " + Utility::str(k, prec1 + 7); } } if (latch && zone < UTMUPS::MINZONE && p.AltZone() >= UTMUPS::MINZONE) { zone = p.AltZone(); northp = p.Northp(); sethemisphere = true; latch = false; } } 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.52/tools/GeodSolve.cpp0000644000771000077100000003472214064202371017560 0ustar ckarneyckarney/** * \file GeodSolve.cpp * \brief Command line utility for geodesic calculations * * Copyright (c) Charles Karney (2009-2019) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "GeodSolve.usage" typedef GeographicLib::Math::real real; std::string LatLonString(real lat, real lon, int prec, bool dms, char dmssep, bool longfirst) { using namespace GeographicLib; std::string latstr = dms ? DMS::Encode(lat, prec + 5, DMS::LATITUDE, dmssep) : DMS::Encode(lat, prec + 5, DMS::NUMBER), lonstr = dms ? DMS::Encode(lon, prec + 5, DMS::LONGITUDE, dmssep) : DMS::Encode(lon, prec + 5, DMS::NUMBER); return (longfirst ? lonstr : latstr) + " " + (longfirst ? latstr : lonstr); } 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, 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, bool fraction = false) { using namespace GeographicLib; return fraction ? Utility::fract(s) : (arcmode ? DMS::DecodeAngle(s) : Utility::val(s)); } int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; enum { NONE = 0, LINE, DIRECT, INVERSE }; Utility::set_digits(); bool inverse = false, arcmode = false, dms = false, full = false, exact = false, unroll = false, longfirst = false, azi2back = false, fraction = false, arcmodeline = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); real lat1, lon1, azi1, lat2, lon2, azi2, s12, m12, a12, M12, M21, S12, mult = 1; int linecalc = NONE, 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 = NONE; } else if (arg == "-a") arcmode = !arcmode; else if (arg == "-F") fraction = true; else if (arg == "-L" || arg == "-l") { // -l is DEPRECATED inverse = false; linecalc = LINE; if (m + 3 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat1, lon1, longfirst); 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 == "-D") { inverse = false; linecalc = DIRECT; if (m + 4 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat1, lon1, longfirst); azi1 = DMS::DecodeAzimuth(std::string(argv[m + 3])); s12 = ReadDistance(std::string(argv[m + 4]), arcmode); arcmodeline = arcmode; } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -D: " << e.what() << "\n"; return 1; } m += 4; } else if (arg == "-I") { inverse = false; linecalc = INVERSE; if (m + 4 >= argc) return usage(1, true); try { DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]), lat1, lon1, longfirst); DMS::DecodeLatLon(std::string(argv[m + 3]), std::string(argv[m + 4]), lat2, lon2, longfirst); } catch (const std::exception& e) { std::cerr << "Error decoding arguments of -I: " << e.what() << "\n"; return 1; } m += 4; } else if (arg == "-e") { if (m + 2 >= argc) return usage(1, true); try { a = Utility::val(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 == "-u") unroll = true; else if (arg == "-d") { dms = true; dmssep = '\0'; } else if (arg == "-:") { dms = true; dmssep = ':'; } else if (arg == "-w") longfirst = !longfirst; else if (arg == "-b") azi2back = true; else if (arg == "-f") full = true; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-E") exact = 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] << ": 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; // GeodesicExact mask values are the same as Geodesic unsigned outmask = Geodesic::LATITUDE | Geodesic::LONGITUDE | Geodesic::AZIMUTH; // basic output quantities outmask |= inverse ? Geodesic::DISTANCE : // distance-related flags (arcmode ? Geodesic::NONE : Geodesic::DISTANCE_IN); // longitude unrolling outmask |= unroll ? Geodesic::LONG_UNROLL : Geodesic::NONE; // full output -- don't use Geodesic::ALL since this includes DISTANCE_IN outmask |= full ? (Geodesic::DISTANCE | Geodesic::REDUCEDLENGTH | Geodesic::GEODESICSCALE | Geodesic::AREA) : Geodesic::NONE; const Geodesic geods(a, f); const GeodesicExact geode(a, f); GeodesicLine ls; GeodesicLineExact le; if (linecalc) { if (linecalc == LINE) fraction = false; if (exact) { le = linecalc == DIRECT ? geode.GenDirectLine(lat1, lon1, azi1, arcmodeline, s12, outmask) : linecalc == INVERSE ? geode.InverseLine(lat1, lon1, lat2, lon2, outmask) : // linecalc == LINE geode.Line(lat1, lon1, azi1, outmask); mult = fraction ? le.GenDistance(arcmode) : 1; if (linecalc == INVERSE) azi1 = le.Azimuth(); } else { ls = linecalc == DIRECT ? geods.GenDirectLine(lat1, lon1, azi1, arcmodeline, s12, outmask) : linecalc == INVERSE ? geods.InverseLine(lat1, lon1, lat2, lon2, outmask) : // linecalc == LINE geods.Line(lat1, lon1, azi1, outmask); mult = fraction ? ls.GenDistance(arcmode) : 1; if (linecalc == INVERSE) azi1 = ls.Azimuth(); } } // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, slat1, slon1, slat2, slon2, sazi1, ss12, strc; std::istringstream str; int retval = 0; while (std::getline(*input, s)) { try { 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); } } str.clear(); str.str(s); if (inverse) { if (!(str >> slat1 >> slon1 >> slat2 >> slon2)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1, longfirst); DMS::DecodeLatLon(slat2, slon2, lat2, lon2, longfirst); a12 = exact ? geode.GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi1, azi2, m12, M12, M21, S12) : geods.GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi1, azi2, m12, M12, M21, S12); if (full) { if (unroll) { real e; lon2 = lon1 + Math::AngDiff(lon1, lon2, e); lon2 += e; } else { lon1 = Math::AngNormalize(lon1); lon2 = Math::AngNormalize(lon2); } *output << LatLonString(lat1, lon1, prec, dms, dmssep, longfirst) << " "; } *output << AzimuthString(azi1, prec, dms, dmssep) << " "; if (full) *output << LatLonString(lat2, lon2, prec, dms, dmssep, longfirst) << " "; if (azi2back) azi2 += azi2 >= 0 ? -180 : 180; *output << AzimuthString(azi2, 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) { if (!(str >> ss12)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); // In fraction mode input is read as a distance s12 = ReadDistance(ss12, !fraction && arcmode, fraction) * mult; a12 = exact ? le.GenPosition(arcmode, s12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12) : ls.GenPosition(arcmode, s12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12); } else { if (!(str >> slat1 >> slon1 >> sazi1 >> ss12)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1, longfirst); azi1 = DMS::DecodeAzimuth(sazi1); s12 = ReadDistance(ss12, arcmode); a12 = exact ? geode.GenDirect(lat1, lon1, azi1, arcmode, s12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12) : geods.GenDirect(lat1, lon1, azi1, arcmode, s12, outmask, lat2, lon2, azi2, s12, m12, M12, M21, S12); } if (full) *output << LatLonString(lat1, unroll ? lon1 : Math::AngNormalize(lon1), prec, dms, dmssep, longfirst) << " " << AzimuthString(azi1, prec, dms, dmssep) << " "; if (azi2back) azi2 += azi2 >= 0 ? -180 : 180; *output << LatLonString(lat2, lon2, prec, dms, dmssep, longfirst) << " " << AzimuthString(azi2, 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.52/tools/GeodesicProj.cpp0000644000771000077100000001706514064202371020247 0ustar ckarneyckarney/** * \file GeodesicProj.cpp * \brief Command line utility for geodesic projections * * Copyright (c) Charles Karney (2009-2017) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "GeodesicProj.usage" int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool azimuthal = false, cassini = false, gnomonic = false, reverse = false, longfirst = false; real lat0 = 0, lon0 = 0; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); int prec = 6; 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 = azimuthal = gnomonic = false; 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, longfirst); } 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::val(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 == "-w") longfirst = !longfirst; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(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] << ": 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); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, stra, strb, strc; std::istringstream str; int retval = 0; std::cout << std::fixed; while (std::getline(*input, s)) { try { 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); } } str.clear(); str.str(s); real lat, lon, x, y, azi, rk; if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::val(stra); y = Utility::val(strb); } else DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); 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(longfirst ? lon : lat, prec + 5) << " " << Utility::str(longfirst ? lat : lon, prec + 5) << " " << Utility::str(azi, prec + 5) << " " << Utility::str(rk, prec + 6) << 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, prec) << " " << Utility::str(y, prec) << " " << Utility::str(azi, prec + 5) << " " << Utility::str(rk, prec + 6) << 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.52/tools/GeoidEval.cpp0000644000771000077100000002336514064202371017531 0ustar ckarneyckarney/** * \file GeoidEval.cpp * \brief Command line utility for evaluating geoid heights * * Copyright (c) Charles Karney (2009-2017) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "GeoidEval.usage" int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool cacheall = false, cachearea = false, verbose = false, cubic = true; 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, longfirst = 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, longfirst); DMS::DecodeLatLon(std::string(argv[m + 3]), std::string(argv[m + 4]), cachen, cachee, longfirst); } 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 == "-w") longfirst = !longfirst; 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 == "-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] << ": 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, eol, suff; const char* spaces = " \t\n\v\f\r,"; // Include comma as space while (std::getline(*input, s)) { try { 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::val(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::val(s.substr(pa + 1, pb - pa)); s = s.substr(0, pa + 1); } p.Reset(s, true, longfirst); } if (heightmult) { real h = g(p.Latitude(), p.Longitude()); *output << s << Utility::str(height + real(heightmult) * h, 4) << suff << 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.52/tools/Gravity.cpp0000644000771000077100000002600314064202371017307 0ustar ckarneyckarney/** * \file Gravity.cpp * \brief Command line utility for evaluating gravity fields * * Copyright (c) Charles Karney (2011-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "Gravity.usage" int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool verbose = false, longfirst = 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, Nmax = -1, Mmax = -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 == "-N") { if (++m == argc) return usage(1, true); try { Nmax = Utility::val(std::string(argv[m])); if (Nmax < 0) { std::cerr << "Maximum degree " << argv[m] << " is negative\n"; return 1; } } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-M") { if (++m == argc) return usage(1, true); try { Mmax = Utility::val(std::string(argv[m])); if (Mmax < 0) { std::cerr << "Maximum order " << argv[m] << " is negative\n"; return 1; } } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } 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 { using std::abs; DMS::flag ind; lat = DMS::Decode(std::string(argv[++m]), ind); if (ind == DMS::LONGITUDE) throw GeographicErr("Bad hemisphere letter on latitude"); if (!(abs(lat) <= 90)) throw GeographicErr("Latitude not in [-90d, 90d]"); h = Utility::val(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 == "-w") longfirst = !longfirst; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(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] << ": 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 + Math::extra_digits(), prec < 0 ? 5 : prec); break; case DISTURBANCE: case ANOMALY: prec = std::min(14 + Math::extra_digits(), prec < 0 ? 3 : prec); break; case UNDULATION: default: prec = std::min(12 + Math::extra_digits(), prec < 0 ? 4 : prec); break; } int retval = 0; try { using std::isfinite; const GravityModel g(model, dir, Nmax, Mmax); if (circle) { if (!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, eol, stra, strb; std::istringstream str; while (std::getline(*input, s)) { try { 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); } } str.clear(); str.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); } else { if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); 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 * 100000, prec) << " " << Utility::str(deltay * 100000, prec) << " " << Utility::str(deltaz * 100000, 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 *= 100000; // 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.52/tools/MagneticField.cpp0000644000771000077100000003303614064202371020361 0ustar ckarneyckarney/** * \file MagneticField.cpp * \brief Command line utility for evaluating magnetic fields * * Copyright (c) Charles Karney (2011-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif #include "MagneticField.usage" int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool verbose = false, longfirst = 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, Nmax = -1, Mmax = -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 == "-N") { if (++m == argc) return usage(1, true); try { Nmax = Utility::val(std::string(argv[m])); if (Nmax < 0) { std::cerr << "Maximum degree " << argv[m] << " is negative\n"; return 1; } } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-M") { if (++m == argc) return usage(1, true); try { Mmax = Utility::val(std::string(argv[m])); if (Mmax < 0) { std::cerr << "Maximum order " << argv[m] << " is negative\n"; return 1; } } 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 { 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 { using std::abs; 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 (!(abs(lat) <= 90)) throw GeographicErr("Latitude not in [-90d, 90d]"); h = Utility::val(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 == "-w") longfirst = !longfirst; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(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::val(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::val(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] << ": 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 + Math::extra_digits(), std::max(0, prec)); int retval = 0; try { using std::isfinite; const MagneticModel m(model, dir, Geocentric::WGS84(), Nmax, Mmax); if ((timeset || circle) && (!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 && (!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, eol, stra, strb; std::istringstream str; while (std::getline(*input, s)) { try { eol = "\n"; if (!cdelim.empty()) { std::string::size_type n = s.find(cdelim); if (n != std::string::npos) { eol = " " + s.substr(n) + "\n"; s = s.substr(0, n); } } str.clear(); str.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); } else { if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); 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.52/tools/Makefile.am0000644000771000077100000001350614064202371017216 0ustar ckarneyckarney# # Makefile.am # # Copyright (C) 2009, Francesco P. Lovergine AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/man -I$(top_srcdir)/man -Wall -Wextra LDADD = $(top_builddir)/src/libGeographic.la DEPS = $(top_builddir)/src/libGeographic.la bin_PROGRAMS = CartConvert \ ConicProj \ GeoConvert \ GeodSolve \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ RhumbSolve \ 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 GeodSolve_SOURCES = GeodSolve.cpp \ ../man/GeodSolve.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicExact.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/GeodesicLineExact.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/Ellipsoid.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 RhumbSolve_SOURCES = RhumbSolve.cpp \ ../man/RhumbSolve.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Ellipsoid.hpp \ ../include/GeographicLib/Math.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%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-gravity: geographiclib-get-gravity.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-magnetic: geographiclib-get-magnetic.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ CLEANFILES = $(sbin_SCRIPTS) EXTRA_DIST = Makefile.mk CMakeLists.txt tests.cmake \ geographiclib-get-geoids.sh geographiclib-get-gravity.sh \ geographiclib-get-magnetic.sh GeographicLib-1.52/tools/Makefile.mk0000644000771000077100000000623614064202371017232 0ustar ckarneyckarneyPROGRAMS = CartConvert \ ConicProj \ GeoConvert \ GeodSolve \ GeodesicProj \ GeoidEval \ Gravity \ MagneticField \ Planimeter \ RhumbSolve \ TransverseMercatorProj 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 GEOGRAPHICLIB_DATA = $(PREFIX)/share/GeographicLib CC = g++ -g CXXFLAGS = -g -Wall -Wextra -O3 -std=c++0x CPPFLAGS = -I$(INCLUDEPATH) -I../man $(DEFINES) LDLIBS = -L$(LIBPATH) -l$(LIBSTEM) EXTRALIBS = $(PROGRAMS): $(LIBPATH)/$(LIBRARY) $(CC) $(LDFLAGS) -o $@ $@.o $(LDLIBS) $(EXTRALIBS) VPATH = ../include/GeographicLib ../man clean: rm -f *.o $(SCRIPTS) CartConvert: CartConvert.o ConicProj: ConicProj.o GeoConvert: GeoConvert.o GeodSolve: GeodSolve.o GeodesicProj: GeodesicProj.o GeoidEval: GeoidEval.o Gravity: Gravity.o MagneticField: MagneticField.o Planimeter: Planimeter.o RhumbSolve: RhumbSolve.o TransverseMercatorProj: TransverseMercatorProj.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 GeodSolve.o: GeodSolve.usage Config.h Constants.hpp DMS.hpp Geodesic.hpp \ GeodesicExact.hpp GeodesicLine.hpp GeodesicLineExact.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 \ Ellipsoid.hpp GeoCoords.hpp Geodesic.hpp Math.hpp PolygonArea.hpp \ UTMUPS.hpp Utility.hpp RhumbSolve.o: RhumbSolve.usage Config.h Constants.hpp DMS.hpp Ellipsoid.hpp \ Math.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%@GEOGRAPHICLIB_DATA@%$(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.52/tools/Planimeter.cpp0000644000771000077100000001663114064202371017770 0ustar ckarneyckarney/** * \file Planimeter.cpp * \brief Command line utility for measuring the area of geodesic polygons * * Copyright (c) Charles Karney (2010-2020) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions # pragma warning (disable: 4127) #endif #include "Planimeter.usage" int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); enum { GEODESIC, EXACT, AUTHALIC, RHUMB }; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); bool reverse = false, sign = true, polyline = false, longfirst = false; int linetype = GEODESIC; int prec = 6; 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::val(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 == "-w") longfirst = !longfirst; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-G") linetype = GEODESIC; else if (arg == "-E") linetype = EXACT; else if (arg == "-Q") linetype = AUTHALIC; else if (arg == "-R") linetype = RHUMB; 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] << ": 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 Ellipsoid ellip(a, f); if (linetype == AUTHALIC) { using std::sqrt; a = sqrt(ellip.Area() / (4 * Math::pi())); f = 0; } const Geodesic geod(a, f); const GeodesicExact geode(a, f); const Rhumb rhumb(a, f); PolygonArea poly(geod, polyline); PolygonAreaExact polye(geode, polyline); PolygonAreaRhumb polyr(rhumb, polyline); GeoCoords p; // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol("\n"); real perimeter, area; unsigned num; 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 { using std::isnan; p.Reset(s, true, longfirst); if (isnan(p.Latitude()) || isnan(p.Longitude())) endpoly = true; } catch (const GeographicErr&) { endpoly = true; } } if (endpoly) { num = linetype == EXACT ? polye.Compute(reverse, sign, perimeter, area) : linetype == RHUMB ? polyr.Compute(reverse, sign, perimeter, area) : poly.Compute(reverse, sign, perimeter, area); // geodesic + authalic if (num > 0) { *output << num << " " << Utility::str(perimeter, prec); if (!polyline) { *output << " " << Utility::str(area, std::max(0, prec - 5)); } *output << eol; } linetype == EXACT ? polye.Clear() : linetype == RHUMB ? polyr.Clear() : poly.Clear(); eol = "\n"; } else { linetype == EXACT ? polye.AddPoint(p.Latitude(), p.Longitude()) : linetype == RHUMB ? polyr.AddPoint(p.Latitude(), p.Longitude()) : poly.AddPoint(linetype == AUTHALIC ? ellip.AuthalicLatitude(p.Latitude()) : p.Latitude(), p.Longitude()); } } num = linetype == EXACT ? polye.Compute(reverse, sign, perimeter, area) : linetype == RHUMB ? polyr.Compute(reverse, sign, perimeter, area) : poly.Compute(reverse, sign, perimeter, area); if (num > 0) { *output << num << " " << Utility::str(perimeter, prec); if (!polyline) { *output << " " << Utility::str(area, std::max(0, prec - 5)); } *output << eol; } linetype == EXACT ? polye.Clear() : linetype == RHUMB ? polyr.Clear() : 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.52/tools/RhumbSolve.cpp0000644000771000077100000002052714064202371017755 0ustar ckarneyckarney/** * \file RhumbSolve.cpp * \brief Command line utility for rhumb line calculations * * Copyright (c) Charles Karney (2014-2017) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage information. **********************************************************************/ #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "RhumbSolve.usage" using namespace GeographicLib; typedef Math::real real; std::string LatLonString(real lat, real lon, int prec, bool dms, char dmssep, bool longfirst) { using namespace GeographicLib; std::string latstr = dms ? DMS::Encode(lat, prec + 5, DMS::LATITUDE, dmssep) : DMS::Encode(lat, prec + 5, DMS::NUMBER), lonstr = dms ? DMS::Encode(lon, prec + 5, DMS::LONGITUDE, dmssep) : DMS::Encode(lon, prec + 5, DMS::NUMBER); return (longfirst ? lonstr : latstr) + " " + (longfirst ? latstr : lonstr); } std::string AzimuthString(real azi, int prec, bool dms, char dmssep) { return dms ? DMS::Encode(azi, prec + 5, DMS::AZIMUTH, dmssep) : DMS::Encode(azi, prec + 5, DMS::NUMBER); } int main(int argc, const char* const argv[]) { try { Utility::set_digits(); bool linecalc = false, inverse = false, dms = false, exact = true, longfirst = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(); real lat1, lon1, azi12 = Math::NaN(), lat2, lon2, s12, S12; 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 == "-L" || arg == "-l") { // -l is DEPRECATED 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, longfirst); azi12 = 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::val(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 == "-w") longfirst = !longfirst; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(std::string(argv[m])); } catch (const std::exception&) { std::cerr << "Precision " << argv[m] << " is not a number\n"; return 1; } } else if (arg == "-s") exact = false; 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] << ": 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 Rhumb rh(a, f, exact); const RhumbLine rhl(linecalc ? rh.Line(lat1, lon1, azi12) : rh.Line(0, 0, 90)); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, slat1, slon1, slat2, slon2, sazi, ss12, strc; std::istringstream str; int retval = 0; while (std::getline(*input, s)) { try { 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); } } str.clear(); str.str(s); if (linecalc) { if (!(str >> s12)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); rhl.Position(s12, lat2, lon2, S12); *output << LatLonString(lat2, lon2, prec, dms, dmssep, longfirst) << " " << Utility::str(S12, std::max(prec-7, 0)) << eol; } else if (inverse) { if (!(str >> slat1 >> slon1 >> slat2 >> slon2)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1, longfirst); DMS::DecodeLatLon(slat2, slon2, lat2, lon2, longfirst); rh.Inverse(lat1, lon1, lat2, lon2, s12, azi12, S12); *output << AzimuthString(azi12, prec, dms, dmssep) << " " << Utility::str(s12, prec) << " " << Utility::str(S12, std::max(prec-7, 0)) << eol; } else { // direct if (!(str >> slat1 >> slon1 >> sazi >> s12)) throw GeographicErr("Incomplete input: " + s); if (str >> strc) throw GeographicErr("Extraneous input: " + strc); DMS::DecodeLatLon(slat1, slon1, lat1, lon1, longfirst); azi12 = DMS::DecodeAzimuth(sazi); rh.Direct(lat1, lon1, azi12, s12, lat2, lon2, S12); *output << LatLonString(lat2, lon2, prec, dms, dmssep, longfirst) << " " << Utility::str(S12, std::max(prec-7, 0)) << 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.52/tools/TransverseMercatorProj.cpp0000644000771000077100000001730214064202371022350 0ustar ckarneyckarney/** * \file TransverseMercatorProj.cpp * \brief Command line utility for transverse Mercator projections * * Copyright (c) Charles Karney (2008-2017) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * See the man page for usage * information. **********************************************************************/ #include #include #include #include #include #include #include #include #if defined(_MSC_VER) // Squelch warnings about constant conditional expressions and potentially // uninitialized local variables # pragma warning (disable: 4127 4701) #endif #include "TransverseMercatorProj.usage" int main(int argc, const char* const argv[]) { try { using namespace GeographicLib; typedef Math::real real; Utility::set_digits(); bool exact = true, extended = false, series = false, reverse = false, longfirst = false; real a = Constants::WGS84_a(), f = Constants::WGS84_f(), k0 = Constants::UTM_k0(), lon0 = 0; int prec = 6; 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"); lon0 = Math::AngNormalize(lon0); } 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::val(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::val(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 == "-w") longfirst = !longfirst; else if (arg == "-p") { if (++m == argc) return usage(1, true); try { prec = Utility::val(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] << ": 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); // Max precision = 10: 0.1 nm in distance, 10^-15 deg (= 0.11 nm), // 10^-11 sec (= 0.3 nm). prec = std::min(10 + Math::extra_digits(), std::max(0, prec)); std::string s, eol, stra, strb, strc; std::istringstream str; int retval = 0; std::cout << std::fixed; while (std::getline(*input, s)) { try { 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); } } str.clear(); str.str(s); real lat, lon, x, y; if (!(str >> stra >> strb)) throw GeographicErr("Incomplete input: " + s); if (reverse) { x = Utility::val(stra); y = Utility::val(strb); } else DMS::DecodeLatLon(stra, strb, lat, lon, longfirst); 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(longfirst ? lon : lat, prec + 5) << " " << Utility::str(longfirst ? lat : lon, prec + 5) << " " << Utility::str(gamma, prec + 6) << " " << Utility::str(k, prec + 6) << 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, prec) << " " << Utility::str(y, prec) << " " << Utility::str(gamma, prec + 6) << " " << Utility::str(k, prec + 6) << 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.52/tools/geographiclib-get-geoids.sh0000644000771000077100000001200514064202371022333 0ustar ckarneyckarney#! /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-2019) and # licensed under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ DEFAULTDIR="@GEOGRAPHICLIB_DATA@" SUBDIR=geoids NAME=geoid MODEL=geoid CLASS=Geoid TOOL=GeoidEval EXT=pgm usage() { cat <&2; exit 1 ;; esac done shift `expr $OPTIND - 1` if test $# -eq 0; then usage 1>&2; exit 1 fi test -d "$PARENTDIR"/$SUBDIR || mkdir -p "$PARENTDIR"/$SUBDIR 2> /dev/null if test ! -d "$PARENTDIR"/$SUBDIR; then echo Cannot create directory $PARENTDIR/$SUBDIR 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 -d -q -t $NAME-XXXXXXXX` if test -z "$TEMP" -o ! -d "$TEMP"; then echo Cannot create temporary directory 1>&2 exit 1 fi WRITETEST="$PARENTDIR"/$SUBDIR/write-test-`basename $TEMP` if touch "$WRITETEST" 2> /dev/null; then rm -f "$WRITETEST" else echo Cannot write in directory $PARENTDIR/$SUBDIR 1>&2 exit 1 fi set -e cat > $TEMP/all < /dev/null; then echo $1 else case "$1" in all ) cat $TEMP/all ;; minimal ) echo egm96-5 ;; best ) # highest resolution models cat < egm2008-2_5 cat <&2 exit 1 fi ;; esac fi shift done > $TEMP/list sort -u $TEMP/list > $TEMP/todo while read file; do if test -z "$FORCE" -a -s $PARENTDIR/$SUBDIR/$file.$EXT; then echo $PARENTDIR/$SUBDIR/$file.$EXT already installed, skipping $file... echo $file >> $TEMP/skip continue fi echo download $file.tar.bz2 ... echo $file >> $TEMP/download URL="https://downloads.sourceforge.net/project/geographiclib/$SUBDIR-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 $MODEL $file installed. done < $TEMP/todo if test "$DEBUG"; then echo Saving temporary directory $TEMP fi echo if test -s $TEMP/download; then n=`wc -l < $TEMP/download` s=; test $n -gt 1 && s=s cat < and # licensed under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ DEFAULTDIR="@GEOGRAPHICLIB_DATA@" SUBDIR=gravity NAME=gravity MODEL=gravitymodel CLASS=GravityModel TOOL=Gravity EXT=egm.cof usage() { cat <&2; exit 1 ;; esac done shift `expr $OPTIND - 1` if test $# -eq 0; then usage 1>&2; exit 1 fi test -d "$PARENTDIR"/$SUBDIR || mkdir -p "$PARENTDIR"/$SUBDIR 2> /dev/null if test ! -d "$PARENTDIR"/$SUBDIR; then echo Cannot create directory $PARENTDIR/$SUBDIR 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 -d -q -t $NAME-XXXXXXXX` if test -z "$TEMP" -o ! -d "$TEMP"; then echo Cannot create temporary directory 1>&2 exit 1 fi WRITETEST="$PARENTDIR"/$SUBDIR/write-test-`basename $TEMP` if touch "$WRITETEST" 2> /dev/null; then rm -f "$WRITETEST" else echo Cannot write in directory $PARENTDIR/$SUBDIR 1>&2 exit 1 fi set -e cat > $TEMP/all < /dev/null; then echo $1 else case "$1" in all ) cat $TEMP/all ;; minimal ) echo egm96; echo wgs84 ;; * ) if test -n "$FORCE"; then echo $1 else echo Unknown $MODEL $1 1>&2 exit 1 fi ;; esac fi shift done > $TEMP/list sort -u $TEMP/list > $TEMP/todo while read file; do if test -z "$FORCE" -a -s $PARENTDIR/$SUBDIR/$file.$EXT; then echo $PARENTDIR/$SUBDIR/$file.$EXT already installed, skipping $file... echo $file >> $TEMP/skip continue fi echo download $file.tar.bz2 ... echo $file >> $TEMP/download URL="https://downloads.sourceforge.net/project/geographiclib/$SUBDIR-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 $MODEL $file installed. done < $TEMP/todo if test "$DEBUG"; then echo Saving temporary directory $TEMP fi echo if test -s $TEMP/download; then n=`wc -l < $TEMP/download` s=; test $n -gt 1 && s=s cat < and # licensed under the MIT/X11 License. For more information, see # https://geographiclib.sourceforge.io/ DEFAULTDIR="@GEOGRAPHICLIB_DATA@" SUBDIR=magnetic NAME=magnetic MODEL=magneticmodel CLASS=MagneticModel TOOL=MagneticField EXT=wmm.cof usage() { cat <&2; exit 1 ;; esac done shift `expr $OPTIND - 1` if test $# -eq 0; then usage 1>&2; exit 1 fi test -d "$PARENTDIR"/$SUBDIR || mkdir -p "$PARENTDIR"/$SUBDIR 2> /dev/null if test ! -d "$PARENTDIR"/$SUBDIR; then echo Cannot create directory $PARENTDIR/$SUBDIR 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 -d -q -t $NAME-XXXXXXXX` if test -z "$TEMP" -o ! -d "$TEMP"; then echo Cannot create temporary directory 1>&2 exit 1 fi WRITETEST="$PARENTDIR"/$SUBDIR/write-test-`basename $TEMP` if touch "$WRITETEST" 2> /dev/null; then rm -f "$WRITETEST" else echo Cannot write in directory $PARENTDIR/$SUBDIR 1>&2 exit 1 fi set -e cat > $TEMP/all < /dev/null; then echo $1 else case "$1" in all ) cat $TEMP/all ;; minimal ) echo wmm2020; echo igrf13 ;; * ) if test -n "$FORCE"; then echo $1 else echo Unknown $MODEL $1 1>&2 exit 1 fi ;; esac fi shift done > $TEMP/list sort -u $TEMP/list > $TEMP/todo while read file; do if test -z "$FORCE" -a -s $PARENTDIR/$SUBDIR/$file.$EXT; then echo $PARENTDIR/$SUBDIR/$file.$EXT already installed, skipping $file... echo $file >> $TEMP/skip continue fi echo download $file.tar.bz2 ... echo $file >> $TEMP/download URL="https://downloads.sourceforge.net/project/geographiclib/$SUBDIR-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 $MODEL $file installed. done < $TEMP/todo if test "$DEBUG"; then echo Saving temporary directory $TEMP fi echo if test -s $TEMP/download; then n=`wc -l < $TEMP/download` s=; test $n -gt 1 && s=s cat <= 60 and decimal(minutes) > 60 fail. # Latter used to succeed; fixed 2015-06-11. add_test (NAME GeoConvert9 COMMAND GeoConvert --input-string "5d70.0 10") add_test (NAME GeoConvert10 COMMAND GeoConvert --input-string "5d60 10") set_tests_properties (GeoConvert9 GeoConvert10 PROPERTIES WILL_FAIL ON) # Check that integer(minutes) < 60 and decimal(minutes) <= 60 succeed. # Latter used to fail with 60.; fixed 2015-06-11. add_test (NAME GeoConvert11 COMMAND GeoConvert --input-string "5d59 10") add_test (NAME GeoConvert12 COMMAND GeoConvert --input-string "5d60. 10") add_test (NAME GeoConvert13 COMMAND GeoConvert --input-string "5d60.0 10") # Check DMS::Encode does round ties to even. Fixed 2015-06-11. add_test (NAME GeoConvert14 COMMAND GeoConvert -: -p -4 --input-string "5.25 5.75") set_tests_properties (GeoConvert14 PROPERTIES PASS_REGULAR_EXPRESSION "05.2N 005.8E") add_test (NAME GeoConvert15 COMMAND GeoConvert -: -p -1 --input-string "5.03125 5.09375") set_tests_properties (GeoConvert15 PROPERTIES PASS_REGULAR_EXPRESSION "05:01:52N 005:05:38E") # Check MGRS::Forward improved rounding fix, 2015-07-22 add_test (NAME GeoConvert16 COMMAND GeoConvert -m -p 3 --input-string "38n 444140.6 3684706.3") set_tests_properties (GeoConvert16 PROPERTIES PASS_REGULAR_EXPRESSION "38SMB4414060084706300") # Check MGRS::Forward digit consistency fix, 2015-07-23 add_test (NAME GeoConvert17 COMMAND GeoConvert -m -p 3 --input-string "38n 500000 63.811") add_test (NAME GeoConvert18 COMMAND GeoConvert -m -p 4 --input-string "38n 500000 63.811") set_tests_properties (GeoConvert17 PROPERTIES PASS_REGULAR_EXPRESSION "38NNF0000000000063811") set_tests_properties (GeoConvert18 PROPERTIES PASS_REGULAR_EXPRESSION "38NNF000000000000638110") # Check prec = -6 for UPS (to check fix to Matlab mgrs_fwd, 2018-03-19) add_test (NAME GeoConvert19 COMMAND GeoConvert -m -p -6 --input-string "s 2746000 1515000") add_test (NAME GeoConvert20 COMMAND GeoConvert -m -p -5 --input-string "s 2746000 1515000") add_test (NAME GeoConvert21 COMMAND GeoConvert -m -p -4 --input-string "s 2746000 1515000") set_tests_properties (GeoConvert19 PROPERTIES PASS_REGULAR_EXPRESSION "^B[\r\n]") set_tests_properties (GeoConvert20 PROPERTIES PASS_REGULAR_EXPRESSION "^BKH[\r\n]") set_tests_properties (GeoConvert21 PROPERTIES PASS_REGULAR_EXPRESSION "^BKH41[\r\n]") add_test (NAME GeodSolve0 COMMAND GeodSolve -i -p 0 --input-string "40.6 -73.8 49d01'N 2d33'E") set_tests_properties (GeodSolve0 PROPERTIES PASS_REGULAR_EXPRESSION "53\\.47022 111\\.59367 5853226") add_test (NAME GeodSolve1 COMMAND GeodSolve -p 0 --input-string "40d38'23\"N 073d46'44\"W 53d30' 5850e3") set_tests_properties (GeodSolve1 PROPERTIES PASS_REGULAR_EXPRESSION "49\\.01467 2\\.56106 111\\.62947") # Check fix for antipodal prolate bug found 2010-09-04 add_test (NAME GeodSolve2 COMMAND GeodSolve -i -p 0 -e 6.4e6 -1/150 --input-string "0.07476 0 -0.07476 180") set_tests_properties (GeodSolve2 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00078 90\\.00078 20106193") # Another check for similar bug add_test (NAME GeodSolve3 COMMAND GeodSolve -i -p 0 -e 6.4e6 -1/150 --input-string "0.1 0 -0.1 180") set_tests_properties (GeodSolve3 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00105 90\\.00105 20106193") # Check fix for short line bug found 2010-05-21 add_test (NAME GeodSolve4 COMMAND GeodSolve -i --input-string "36.493349428792 0 36.49334942879201 .0000008") set_tests_properties (GeodSolve4 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 0\\.072") # Check fix for point2=pole bug found 2010-05-03 (but only with long double) add_test (NAME GeodSolve5 COMMAND GeodSolve -p 0 --input-string "0.01777745589997 30 0 10e6") set_tests_properties (GeodSolve5 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 (NAME GeodSolve6 COMMAND GeodSolve -i --input-string "88.202499451857 0 -88.202499451857 179.981022032992859592") add_test (NAME GeodSolve7 COMMAND GeodSolve -i --input-string "89.262080389218 0 -89.262080389218 179.992207982775375662") add_test (NAME GeodSolve8 COMMAND GeodSolve -i --input-string "89.333123580033 0 -89.333123580032997687 179.99295812360148422") set_tests_properties (GeodSolve6 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 20003898.214") set_tests_properties (GeodSolve7 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 20003925.854") set_tests_properties (GeodSolve8 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 20003926.881") # Check fix for volatile x bug found 2011-06-25 (gcc 4.4.4 x86 -O3) add_test (NAME GeodSolve9 COMMAND GeodSolve -i --input-string "56.320923501171 0 -56.320923501171 179.664747671772880215") set_tests_properties (GeodSolve9 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 19993558.287") # Check fix for adjust tol1_ bug found 2011-06-25 (Visual Studio 10 rel # + debug) add_test (NAME GeodSolve10 COMMAND GeodSolve -i --input-string "52.784459512564 0 -52.784459512563990912 179.634407464943777557") set_tests_properties (GeodSolve10 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 19991596.095") # Check fix for bet2 = -bet1 bug found 2011-06-25 (Visual Studio 10 rel # + debug) add_test (NAME GeodSolve11 COMMAND GeodSolve -i --input-string "48.522876735459 0 -48.52287673545898293 179.599720456223079643") set_tests_properties (GeodSolve11 PROPERTIES PASS_REGULAR_EXPRESSION ".* .* 19989144.774") # Check fix for inverse geodesics on extreme prolate/oblate ellipsoids # Reported 2012-08-29 Stefan Guenther ; fixed # 2012-10-07 add_test (NAME GeodSolve12 COMMAND GeodSolve -i -e 89.8 -1.83 -p 1 --input-string "0 0 -10 160") add_test (NAME GeodSolve13 COMMAND GeodSolve -i -e 89.8 -1.83 -p 1 --input-string "0 0 -10 160" -E) set_tests_properties (GeodSolve12 GeodSolve13 PROPERTIES PASS_REGULAR_EXPRESSION "120\\.27.* 105\\.15.* 266\\.7") if (NOT (GEOGRAPHICLIB_PRECISION EQUAL 4 AND Boost_VERSION LESS 106000)) # mpfr (nan == 0 is true) and boost-quadmath (nan > 0 is true) have # bugs in handling nans, so skip this test. Problems reported on # 2015-03-31, https://svn.boost.org/trac/boost/ticket/11159 (this # might be fixed in Boost 1.60).. MFPR C++ version 3.6.2 fixes its # nan problem. # # Check fix for inverse ignoring lon12 = nan add_test (NAME GeodSolve14 COMMAND GeodSolve -i --input-string "0 0 1 nan") set_tests_properties (GeodSolve14 PROPERTIES PASS_REGULAR_EXPRESSION "nan nan nan") endif() # Initial implementation of Math::eatanhe was wrong for e^2 < 0. This # checks that this is fixed. add_test (NAME GeodSolve15 COMMAND GeodSolve -e 6.4e6 -1/150 -f --input-string "1 2 3 4") add_test (NAME GeodSolve16 COMMAND GeodSolve -e 6.4e6 -1/150 -f --input-string "1 2 3 4" -E) set_tests_properties (GeodSolve15 GeodSolve16 PROPERTIES PASS_REGULAR_EXPRESSION "1\\..* 2\\..* 3\\..* 1\\..* 2\\..* 3\\..* 4\\..* 0\\..* 4\\..* 1\\..* 1\\..* 23700") # Check fix for LONG_UNROLL bug found on 2015-05-07 add_test (NAME GeodSolve17 COMMAND GeodSolve -u --input-string "40 -75 -10 2e7") add_test (NAME GeodSolve18 COMMAND GeodSolve -u --input-string "40 -75 -10 2e7" -E) add_test (NAME GeodSolve19 COMMAND GeodSolve -u -L 40 -75 -10 --input-string "2e7") add_test (NAME GeodSolve20 COMMAND GeodSolve -u -L 40 -75 -10 --input-string "2e7" -E) set_tests_properties (GeodSolve17 GeodSolve18 GeodSolve19 GeodSolve20 PROPERTIES PASS_REGULAR_EXPRESSION "-39\\.[0-9]* -254\\.[0-9]* -170\\.[0-9]*") add_test (NAME GeodSolve21 COMMAND GeodSolve --input-string "40 -75 -10 2e7") add_test (NAME GeodSolve22 COMMAND GeodSolve --input-string "40 -75 -10 2e7" -E) add_test (NAME GeodSolve23 COMMAND GeodSolve -L 40 -75 -10 --input-string "2e7") add_test (NAME GeodSolve24 COMMAND GeodSolve -L 40 -75 -10 --input-string "2e7" -E) set_tests_properties (GeodSolve21 GeodSolve22 GeodSolve23 GeodSolve24 PROPERTIES PASS_REGULAR_EXPRESSION "-39\\.[0-9]* 105\\.[0-9]* -170\\.[0-9]*") # Check fix for inaccurate rounding in DMS::Decode, e.g., verify that # 7:33:36 = 7.56; fixed on 2015-06-11. add_test (NAME GeodSolve25 COMMAND GeodSolve -p 6 --input-string "0 0 7:33:36-7.56 10001965") set_tests_properties (GeodSolve25 PROPERTIES PASS_REGULAR_EXPRESSION "89\\.9[0-9]* 0\\.00000000000 0\\.00000000000") # Check 0/0 problem with area calculation on sphere 2015-09-08 add_test (NAME GeodSolve26 COMMAND GeodSolve -i -f -e 6.4e6 0 --input-string "1 2 3 4") add_test (NAME GeodSolve27 COMMAND GeodSolve -i -f -e 6.4e6 0 --input-string "1 2 3 4" -E) set_tests_properties (GeodSolve26 GeodSolve27 PROPERTIES PASS_REGULAR_EXPRESSION " 49911046115") # Check for bad placement of assignment of r.a12 with |f| > 0.01 (bug in # Java implementation fixed on 2015-05-19). add_test (NAME GeodSolve28 COMMAND GeodSolve -f -e 6.4e6 0.1 -p 3 --input-string "1 2 10 5e6") set_tests_properties (GeodSolve28 PROPERTIES PASS_REGULAR_EXPRESSION " 48.55570690 ") # Check longitude unrolling with inverse calculation 2015-09-16 add_test (NAME GeodSolve29 COMMAND GeodSolve -i -f -p 0 --input-string "0 539 0 181") add_test (NAME GeodSolve30 COMMAND GeodSolve -i -f -p 0 --input-string "0 539 0 181" -E) set_tests_properties (GeodSolve29 GeodSolve30 PROPERTIES PASS_REGULAR_EXPRESSION "0\\..* 179\\..* 90\\..* 0\\..* -179\\..* 90\\..* 222639 ") add_test (NAME GeodSolve31 COMMAND GeodSolve -i -f -p 0 --input-string "0 539 0 181" -u) add_test (NAME GeodSolve32 COMMAND GeodSolve -i -f -p 0 --input-string "0 539 0 181" -u -E) set_tests_properties (GeodSolve31 GeodSolve32 PROPERTIES PASS_REGULAR_EXPRESSION "0\\..* 539\\..* 90\\..* 0\\..* 541\\..* 90\\..* 222639 ") # Check max(-0.0,+0.0) issues 2015-08-22 (triggered by bugs in Octave -- # sind(-0.0) = +0.0 -- and in some version of Visual Studio -- # fmod(-0.0, 360.0) = +0.0. add_test (NAME GeodSolve33 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179") add_test (NAME GeodSolve34 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -E) add_test (NAME GeodSolve35 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179.5") add_test (NAME GeodSolve36 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179.5" -E) add_test (NAME GeodSolve37 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180") add_test (NAME GeodSolve38 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -E) add_test (NAME GeodSolve39 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180") add_test (NAME GeodSolve40 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -E) add_test (NAME GeodSolve41 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -e 6.4e6 0) add_test (NAME GeodSolve42 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -e 6.4e6 0 -E) add_test (NAME GeodSolve43 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -e 6.4e6 0) add_test (NAME GeodSolve44 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -e 6.4e6 0 -E) add_test (NAME GeodSolve45 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -e 6.4e6 0) add_test (NAME GeodSolve46 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -e 6.4e6 0 -E) add_test (NAME GeodSolve47 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -e 6.4e6 -1/300) add_test (NAME GeodSolve48 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 179" -e 6.4e6 -1/300 -E) add_test (NAME GeodSolve49 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -e 6.4e6 -1/300) add_test (NAME GeodSolve50 COMMAND GeodSolve -i -p 0 --input-string "0 0 0 180" -e 6.4e6 -1/300 -E) add_test (NAME GeodSolve51 COMMAND GeodSolve -i -p 0 --input-string "0 0 0.5 180" -e 6.4e6 -1/300) add_test (NAME GeodSolve52 COMMAND GeodSolve -i -p 0 --input-string "0 0 0.5 180" -e 6.4e6 -1/300 -E) add_test (NAME GeodSolve53 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -e 6.4e6 -1/300) add_test (NAME GeodSolve54 COMMAND GeodSolve -i -p 0 --input-string "0 0 1 180" -e 6.4e6 -1/300 -E) set_tests_properties (GeodSolve33 GeodSolve34 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 19926189") set_tests_properties (GeodSolve35 GeodSolve36 PROPERTIES PASS_REGULAR_EXPRESSION "55\\.96650 124\\.03350 19980862") set_tests_properties (GeodSolve37 GeodSolve38 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 20003931") set_tests_properties (GeodSolve39 GeodSolve40 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 19893357") set_tests_properties (GeodSolve41 GeodSolve42 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 19994492") set_tests_properties (GeodSolve43 GeodSolve44 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 20106193") set_tests_properties (GeodSolve45 GeodSolve46 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 19994492") set_tests_properties (GeodSolve47 GeodSolve48 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 19994492") set_tests_properties (GeodSolve49 GeodSolve50 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 20106193") set_tests_properties (GeodSolve51 GeodSolve52 PROPERTIES PASS_REGULAR_EXPRESSION "33\\.02493 146\\.97364 20082617") set_tests_properties (GeodSolve53 GeodSolve54 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 20027270") if (NOT (GEOGRAPHICLIB_PRECISION EQUAL 4 AND Boost_VERSION LESS 106000)) # Check fix for nan + point on equator or pole not returning all nans in # Geodesic::Inverse, found 2015-09-23. add_test (NAME GeodSolve55 COMMAND GeodSolve -i --input-string "nan 0 0 90") add_test (NAME GeodSolve56 COMMAND GeodSolve -i --input-string "nan 0 0 90" -E) add_test (NAME GeodSolve57 COMMAND GeodSolve -i --input-string "nan 0 90 9") add_test (NAME GeodSolve58 COMMAND GeodSolve -i --input-string "nan 0 90 9" -E) set_tests_properties (GeodSolve55 GeodSolve56 GeodSolve57 GeodSolve58 PROPERTIES PASS_REGULAR_EXPRESSION "nan nan nan") endif () # Check for points close with longitudes close to 180 deg apart. add_test (NAME GeodSolve59 COMMAND GeodSolve -i -p 9 --input-string "5 0.00000000000001 10 180") add_test (NAME GeodSolve60 COMMAND GeodSolve -i -p 9 --input-string "5 0.00000000000001 10 180" -E) set_tests_properties (GeodSolve59 GeodSolve60 PROPERTIES PASS_REGULAR_EXPRESSION # Correct values: 0.000000000000037 179.999999999999963 18345191.1743327133 "0\\.0000000000000[34] 179\\.9999999999999[5-7] 18345191\\.17433271[2-6]") # Make sure small negative azimuths are west-going add_test (NAME GeodSolve61 COMMAND GeodSolve -u -p 0 --input-string "45 0 -0.000000000000000003 1e7") add_test (NAME GeodSolve62 COMMAND GeodSolve -u -p 0 -I 45 0 80 -0.000000000000000003 --input-string 1e7) add_test (NAME GeodSolve63 COMMAND GeodSolve -u -p 0 --input-string "45 0 -0.000000000000000003 1e7" -E) add_test (NAME GeodSolve64 COMMAND GeodSolve -u -p 0 -I 45 0 80 -0.000000000000000003 --input-string 1e7 -E) set_tests_properties (GeodSolve61 GeodSolve62 GeodSolve63 GeodSolve64 PROPERTIES PASS_REGULAR_EXPRESSION "45\\.30632 -180\\.00000 -?180\\.00000") # Check for bug in east-going check in GeodesicLine (needed to check for # sign of 0) and sign error in area calculation due to a bogus override # of the code for alp12. Found/fixed on 2015-12-19. add_test (NAME GeodSolve65 COMMAND GeodSolve -I 30 -0.000000000000000001 -31 180 -f -u -p 0 --input-string "1e7;2e7") add_test (NAME GeodSolve66 COMMAND GeodSolve -I 30 -0.000000000000000001 -31 180 -f -u -p 0 --input-string "1e7;2e7" -E) set_tests_properties (GeodSolve65 GeodSolve66 PROPERTIES PASS_REGULAR_EXPRESSION "30\\.00000 -0\\.00000 -?180\\.00000 -60\\.23169 -0\\.00000 -?180\\.00000 10000000 90\\.06544 6363636 -0\\.0012834 0\\.0013749 0[\r\n]+30\\.00000 -0\\.00000 -?180\\.00000 -30\\.03547 -180\\.00000 -0\\.00000 20000000 179\\.96459 54342 -1\\.0045592 -0\\.9954339 127516405431022") # Check for InverseLine if line is slightly west of S and that s13 is # correctly set. add_test (NAME GeodSolve67 COMMAND GeodSolve -u -p 0 -I -5 -0.000000000000002 -10 180 --input-string 2e7) add_test (NAME GeodSolve68 COMMAND GeodSolve -u -p 0 -I -5 -0.000000000000002 -10 180 --input-string 2e7 -E) set_tests_properties (GeodSolve67 GeodSolve68 PROPERTIES PASS_REGULAR_EXPRESSION "4\\.96445 -180\\.00000 -0\\.00000") add_test (NAME GeodSolve69 COMMAND GeodSolve -u -p 0 -I -5 -0.000000000000002 -10 180 --input-string 0.5 -F) add_test (NAME GeodSolve70 COMMAND GeodSolve -u -p 0 -I -5 -0.000000000000002 -10 180 --input-string 0.5 -F -E) set_tests_properties (GeodSolve69 GeodSolve70 PROPERTIES PASS_REGULAR_EXPRESSION "-87\\.52461 -0\\.00000 -180\\.00000") # Check that DirectLine sets s13. add_test (NAME GeodSolve71 COMMAND GeodSolve -D 1 2 45 1e7 -p 0 --input-string 0.5 -F) add_test (NAME GeodSolve72 COMMAND GeodSolve -D 1 2 45 1e7 -p 0 --input-string 0.5 -F) set_tests_properties (GeodSolve71 GeodSolve72 PROPERTIES PASS_REGULAR_EXPRESSION "30\\.92625 37\\.54640 55\\.43104") # Check for backwards from the pole bug reported by Anon on 2016-02-13. # This only affected the Java implementation. It was introduced in Java # version 1.44 and fixed in 1.46-SNAPSHOT on 2016-01-17. # Also the + sign on azi2 is a check on the normalizing of azimuths # (converting -0.0 to +0.0). add_test (NAME GeodSolve73 COMMAND GeodSolve -p 0 --input-string "90 10 180 -1e6") set_tests_properties (GeodSolve73 PROPERTIES PASS_REGULAR_EXPRESSION "81\\.04623 -170\\.00000 0\\.00000") # Check fix for inaccurate areas, bug introduced in v1.46, fixed # 2015-10-16. add_test (NAME GeodSolve74 COMMAND GeodSolve -i -p 10 -f --input-string "54.1589 15.3872 54.1591 15.3877") set_tests_properties (GeodSolve74 PROPERTIES PASS_REGULAR_EXPRESSION # Exact area is 286698586.30197 "54.* 15.* 55\\.72311035.* 54.* 15.* 55\\.72351567.* 39\\.52768638.* 0\\.00035549.* 39\\.52768638.* 0\\.99999999.* 0\\.99999999.* 286698586\\.302") add_test (NAME GeodSolve75 COMMAND GeodSolve -i -p 10 -f --input-string "54.1589 15.3872 54.1591 15.3877" -E) set_tests_properties (GeodSolve75 PROPERTIES PASS_REGULAR_EXPRESSION # Exact area is 286698586.30197, but -E calculation is less accurate "54.* 15.* 55\\.72311035.* 54.* 15.* 55\\.72351567.* 39\\.52768638.* 0\\.00035549.* 39\\.52768638.* 0\\.99999999.* 0\\.99999999.* 286698586\\.(29[89]|30[0-5])") # The distance from Wellington and Salamanca (a classic failure of Vincenty) add_test (NAME GeodSolve76 COMMAND GeodSolve -i -p 6 --input-string "41:19S 174:49E 40:58N 5:30W") add_test (NAME GeodSolve77 COMMAND GeodSolve -i -p 6 --input-string "41:19S 174:49E 40:58N 5:30W" -E) set_tests_properties (GeodSolve76 GeodSolve77 PROPERTIES PASS_REGULAR_EXPRESSION "160\\.39137649664 19\\.50042925176 19960543\\.857179") # An example where the NGS calculator fails to converge add_test (NAME GeodSolve78 COMMAND GeodSolve -i -p 6 --input-string "27.2 0 -27.1 179.5") add_test (NAME GeodSolve79 COMMAND GeodSolve -i -p 6 --input-string "27.2 0 -27.1 179.5" -E) set_tests_properties (GeodSolve78 GeodSolve79 PROPERTIES PASS_REGULAR_EXPRESSION "45\\.82468716758 134\\.22776532670 19974354\\.765767") # Some tests to add code coverage: computing scale in special cases add_test (NAME GeodSolve80 COMMAND GeodSolve -i --input-string "0 0 0 90" -f) set_tests_properties (GeodSolve80 PROPERTIES PASS_REGULAR_EXPRESSION " -0\\.0052842753 -0\\.0052842753 ") add_test (NAME GeodSolve81 COMMAND GeodSolve -i --input-string "0 0 0.000001 0.000001" -f) set_tests_properties (GeodSolve81 PROPERTIES PASS_REGULAR_EXPRESSION " 0\\.157 1\\.0000000000 1\\.0000000000 0") # Tests to add code coverage: zero length geodesics add_test (NAME GeodSolve82 COMMAND GeodSolve -i --input-string "20.001 0 20.001 0" -f) set_tests_properties (GeodSolve82 PROPERTIES PASS_REGULAR_EXPRESSION "20\\.0010* 0\\.0* 180\\.0* 20\\.0010* 0\\.0* 180\\.0* 0\\.0* 0\\.0* 0\\.0* 1\\.0* 1\\.0* -?0") add_test (NAME GeodSolve83 COMMAND GeodSolve -i --input-string "90 0 90 180" -f) set_tests_properties (GeodSolve83 PROPERTIES PASS_REGULAR_EXPRESSION "90\\.0* 0\\.0* 0\\.0* 90\\.0* 180\\.0* 180\\.0* 0\\.0* 0\\.0* 0\\.0* 1\\.0* 1\\.0* 127516405431022") # Tests for python implementation to check fix for range errors with # {fmod,sin,cos}(inf). add_test (NAME GeodSolve84 COMMAND GeodSolve --input-string "0 0 90 inf") add_test (NAME GeodSolve85 COMMAND GeodSolve --input-string "0 0 90 nan") add_test (NAME GeodSolve86 COMMAND GeodSolve --input-string "0 0 inf 1000") add_test (NAME GeodSolve87 COMMAND GeodSolve --input-string "0 0 nan 1000") add_test (NAME GeodSolve88 COMMAND GeodSolve --input-string "0 inf 90 1000") add_test (NAME GeodSolve89 COMMAND GeodSolve --input-string "0 nan 90 1000") add_test (NAME GeodSolve90 COMMAND GeodSolve --input-string "inf 0 90 1000") add_test (NAME GeodSolve91 COMMAND GeodSolve --input-string "nan 0 90 1000") set_tests_properties (GeodSolve84 GeodSolve85 GeodSolve86 GeodSolve87 GeodSolve91 PROPERTIES PASS_REGULAR_EXPRESSION "nan nan nan") set_tests_properties (GeodSolve88 GeodSolve89 PROPERTIES PASS_REGULAR_EXPRESSION "0\\.0* nan 90\\.0*") set_tests_properties (GeodSolve90 PROPERTIES WILL_FAIL ON) # Check fix for inaccurate hypot with python 3.[89]. Problem reported # by agdhruv https://github.com/geopy/geopy/issues/466 ; see # https://bugs.python.org/issue43088 add_test (NAME GeodSolve92 COMMAND GeodSolve -i --input-string "37.757540000000006 -122.47018 37.75754 -122.470177") add_test (NAME GeodSolve93 COMMAND GeodSolve -i --input-string "37.757540000000006 -122.47018 37.75754 -122.470177" -E) set_tests_properties (GeodSolve92 GeodSolve93 PROPERTIES PASS_REGULAR_EXPRESSION "89\\.9999992. 90\\.000001[01]. 0\\.264") # Check fix for pole-encircling bug found 2011-03-16 add_test (NAME Planimeter0 COMMAND Planimeter --input-string "89 0;89 90;89 180;89 270") add_test (NAME Planimeter1 COMMAND Planimeter -r --input-string "-89 0;-89 90;-89 180;-89 270") add_test (NAME Planimeter2 COMMAND Planimeter --input-string "0 -1;-1 0;0 1;1 0") add_test (NAME Planimeter3 COMMAND Planimeter --input-string "90 0; 0 0; 0 90") add_test (NAME Planimeter4 COMMAND Planimeter -l --input-string "90 0; 0 0; 0 90") set_tests_properties (Planimeter0 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 (NAME Planimeter5 COMMAND 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 Planimeter lon12 rounding bug found 2012-12-03 add_test (NAME Planimeter6 COMMAND Planimeter -p 8 --input-string "9 -0.00000000000001;9 180;9 0") add_test (NAME Planimeter7 COMMAND Planimeter -p 8 --input-string "9 0.00000000000001;9 0;9 180") add_test (NAME Planimeter8 COMMAND Planimeter -p 8 --input-string "9 0.00000000000001;9 180;9 0") add_test (NAME Planimeter9 COMMAND Planimeter -p 8 --input-string "9 -0.00000000000001;9 0;9 180") set_tests_properties (Planimeter6 Planimeter7 Planimeter8 Planimeter9 PROPERTIES PASS_REGULAR_EXPRESSION "3 36026861\\.[0-9]+ -?0.0[0-9]+") # Area of Wyoming add_test (NAME Planimeter10 COMMAND Planimeter -R --input-string "41N 111:3W; 41N 104:3W; 45N 104:3W; 45N 111:3W") set_tests_properties (Planimeter10 PROPERTIES PASS_REGULAR_EXPRESSION "4 2029616\\.[0-9]+ 2535883763..\\.") # Area of arctic circle add_test (NAME Planimeter11 COMMAND Planimeter -R --input-string "66:33:44 0; 66:33:44 180") set_tests_properties (Planimeter11 PROPERTIES PASS_REGULAR_EXPRESSION "2 15985058\\.[0-9]+ 212084182523..\\.") add_test (NAME Planimeter12 COMMAND Planimeter --input-string "66:33:44 0; 66:33:44 180") set_tests_properties (Planimeter12 PROPERTIES PASS_REGULAR_EXPRESSION "2 10465729\\.[0-9]+ -?0.0") # Check encircling pole twice add_test (NAME Planimeter13 COMMAND Planimeter --input-string "89 -360; 89 -240; 89 -120; 89 0; 89 120; 89 240") # Check -w fix for Planimeter (bug found/fixed 2016-01-19) add_test (NAME Planimeter14 COMMAND Planimeter --input-string "-360 89;-240 89;-120 89;0 89;120 89;240 89" -w) set_tests_properties (Planimeter13 Planimeter14 PROPERTIES PASS_REGULAR_EXPRESSION "6 1160741\\..* 32415230256\\.") # Some tests to add code coverage: all combinations of -r and -s add_test (NAME Planimeter15 COMMAND Planimeter --input-string "2 1;1 2;3 3") add_test (NAME Planimeter16 COMMAND Planimeter --input-string "2 1;1 2;3 3" -s) add_test (NAME Planimeter17 COMMAND Planimeter --input-string "2 1;1 2;3 3" -r) add_test (NAME Planimeter18 COMMAND Planimeter --input-string "2 1;1 2;3 3" -r -s) set_tests_properties (Planimeter15 Planimeter16 PROPERTIES PASS_REGULAR_EXPRESSION " 18454562325\\.5") # more digits 18454562325.45119 set_tests_properties (Planimeter17 PROPERTIES PASS_REGULAR_EXPRESSION " -18454562325\\.5") set_tests_properties (Planimeter18 PROPERTIES PASS_REGULAR_EXPRESSION " 510047167161763\\.[01]") # 510065621724088.5093-18454562325.45119 # Some test to add code coverage: degerate polygons add_test (NAME Planimeter19 COMMAND Planimeter --input-string "1 1") set_tests_properties (Planimeter19 PROPERTIES PASS_REGULAR_EXPRESSION "1 0\\.0* 0\\.0") add_test (NAME Planimeter20 COMMAND Planimeter --input-string "1 1" -l) set_tests_properties (Planimeter20 PROPERTIES PASS_REGULAR_EXPRESSION "1 0\\.0*") # Some test to add code coverage: multiple circlings of pole set (_t "45 60;45 180;45 -60") # r = 39433884866571.4277 = Area for one circuit # a0 = 510065621724088.5093 = Ellipsoid area add_test (NAME Planimeter21 COMMAND Planimeter --input-string "${_t};${_t};${_t}") add_test (NAME Planimeter22 COMMAND Planimeter --input-string "${_t};${_t};${_t}" -s) add_test (NAME Planimeter23 COMMAND Planimeter --input-string "${_t};${_t};${_t}" -r) add_test (NAME Planimeter24 COMMAND Planimeter --input-string "${_t};${_t};${_t}" -r -s) set_tests_properties (Planimeter21 Planimeter22 PROPERTIES PASS_REGULAR_EXPRESSION " 118301654599714\\.[2-5]") # 3*r set_tests_properties (Planimeter23 PROPERTIES PASS_REGULAR_EXPRESSION " -118301654599714\\.[2-5]") # -3*r set_tests_properties (Planimeter24 PROPERTIES PASS_REGULAR_EXPRESSION " 391763967124374\\.[0-3]") # -3*r+a0 add_test (NAME Planimeter25 COMMAND Planimeter --input-string "${_t};${_t};${_t};${_t}") add_test (NAME Planimeter26 COMMAND Planimeter --input-string "${_t};${_t};${_t};${_t}" -s) add_test (NAME Planimeter27 COMMAND Planimeter --input-string "${_t};${_t};${_t};${_t}" -r) add_test (NAME Planimeter28 COMMAND Planimeter --input-string "${_t};${_t};${_t};${_t}" -r -s) # BUG (found 2018-02-32)! In version 1.49, Planimeter2[56] and # Planimeter27 returned 4*r-a0 and -4*r+a0, resp. Fixed in 1.50 to # return +/-4*r set_tests_properties (Planimeter25 Planimeter26 PROPERTIES PASS_REGULAR_EXPRESSION " 157735539466285\\.[6-9]") # 4*r set_tests_properties (Planimeter27 PROPERTIES PASS_REGULAR_EXPRESSION " -157735539466285\\.[6-9]") # -4*r set_tests_properties (Planimeter28 PROPERTIES PASS_REGULAR_EXPRESSION " 352330082257802\\.[5-9]") # -4*r+a0 # Placeholder to implement check on AddEdge bug: AddPoint(0,0) + # AddEdge(90, 1000) + AddEdge(0, 1000) + AddEdge(-90, 0). The area # should be 1e6. Prior to the fix it was 1e6 - A/2, where A = ellipsoid # area. # add_test (NAME Planimeter29 COMMAND Planimeter ...) # Check fix for AlbersEqualArea::Reverse bug found 2011-05-01 add_test (NAME ConicProj0 COMMAND 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]+") # Check fix for AlbersEqualArea prolate bug found 2012-05-15 add_test (NAME ConicProj1 COMMAND ConicProj -a 0 0 -e 6.4e6 -0.5 -r --input-string "0 8605508") set_tests_properties (ConicProj1 PROPERTIES PASS_REGULAR_EXPRESSION "^85\\.00") # Check fix for LambertConformalConic::Forward bug found 2012-07-14 add_test (NAME ConicProj2 COMMAND ConicProj -c -30 -30 --input-string "-30 0") set_tests_properties (ConicProj2 PROPERTIES PASS_REGULAR_EXPRESSION "^-?0\\.0+ -?0\\.0+ -?0\\.0+ 1\\.0+") # Check fixes for LambertConformalConic::Reverse overflow bugs found 2012-07-14 add_test (NAME ConicProj3 COMMAND ConicProj -r -c 0 0 --input-string "1113195 -1e10") set_tests_properties (ConicProj3 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ 10\\.00[0-9]+ ") add_test (NAME ConicProj4 COMMAND ConicProj -r -c 0 0 --input-string "1113195 inf") set_tests_properties (ConicProj4 PROPERTIES PASS_REGULAR_EXPRESSION "^90\\.0+ 10\\.00[0-9]+ ") add_test (NAME ConicProj5 COMMAND ConicProj -r -c 45 45 --input-string "0 -1e100") set_tests_properties (ConicProj5 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ -?0\\.00[0-9]+ ") add_test (NAME ConicProj6 COMMAND ConicProj -r -c 45 45 --input-string "0 -inf") set_tests_properties (ConicProj6 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ -?0\\.00[0-9]+ ") add_test (NAME ConicProj7 COMMAND ConicProj -r -c 90 90 --input-string "0 -1e150") set_tests_properties (ConicProj7 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ -?0\\.00[0-9]+ ") add_test (NAME ConicProj8 COMMAND ConicProj -r -c 90 90 --input-string "0 -inf") set_tests_properties (ConicProj8 PROPERTIES PASS_REGULAR_EXPRESSION "^-90\\.0+ -?0\\.00[0-9]+ ") # Check fix to infinite loop in AlbersEqualArea with e^2 < -1 (f < 1-sqrt(2)) # Fixed 2021-02-22. add_test (NAME ConicProj9 COMMAND ConicProj -a -10 40 -e 6.4e6 -0.5 -p 0 --input-string "85 10") set_tests_properties (ConicProj9 PROPERTIES TIMEOUT 3 PASS_REGULAR_EXPRESSION "^609861 7566522 ") add_test (NAME CartConvert0 COMMAND CartConvert -e 6.4e6 1/100 -r --input-string "10e3 0 1e3") add_test (NAME CartConvert1 COMMAND 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]+") # Test fix to bad meridian convergence at pole with # TransverseMercatorExact found 2013-06-26 add_test (NAME TransverseMercatorProj0 COMMAND TransverseMercatorProj -k 1 --input-string "90 75") add_test (NAME TransverseMercatorProj1 COMMAND TransverseMercatorProj -k 1 --input-string "90 75" -s) set_tests_properties (TransverseMercatorProj0 TransverseMercatorProj1 PROPERTIES PASS_REGULAR_EXPRESSION "^0\\.0+ 10001965\\.7293[0-9]+ 75\\.0+ 1\\.0+") # Test fix to bad scale at pole with TransverseMercatorExact # found 2013-06-30 (quarter meridian = 10001965.7293127228128889202m) add_test (NAME TransverseMercatorProj2 COMMAND TransverseMercatorProj -k 1 -r --input-string "0 10001965.7293127228") add_test (NAME TransverseMercatorProj3 COMMAND TransverseMercatorProj -k 1 -r --input-string "0 10001965.7293127228" -s) set_tests_properties (TransverseMercatorProj2 TransverseMercatorProj3 PROPERTIES PASS_REGULAR_EXPRESSION "(90\\.0+ 0\\.0+ 0\\.0+|(90\\.0+|89\\.99999999999[0-9]+) -?180\\.0+ -?180\\.0+) (1\\.0000+|0\\.9999+)") # Generic tests for transverse Mercator added 2017-04-15 to check use of # complex arithmetic to do Clenshaw sum. add_test (NAME TransverseMercatorProj4 COMMAND TransverseMercatorProj -e 6.4e6 1/150 --input-string "20 30") add_test (NAME TransverseMercatorProj5 COMMAND TransverseMercatorProj -e 6.4e6 1/150 --input-string "20 30" -s) set_tests_properties (TransverseMercatorProj4 TransverseMercatorProj5 PROPERTIES PASS_REGULAR_EXPRESSION "3266035\\.453860 2518371\\.552676 11\\.207356502141 1\\.134138960741") add_test (NAME TransverseMercatorProj6 COMMAND TransverseMercatorProj -e 6.4e6 1/150 --input-string "3.3e6 2.5e6" -r) add_test (NAME TransverseMercatorProj7 COMMAND TransverseMercatorProj -e 6.4e6 1/150 --input-string "3.3e6 2.5e6" -r -s) set_tests_properties (TransverseMercatorProj6 TransverseMercatorProj7 PROPERTIES PASS_REGULAR_EXPRESSION "19\\.80370996793 30\\.24919702282 11\\.214378172893 1\\.137025775759") # Test fix to bad handling of pole by RhumbSolve -i # Reported 2015-02-24 by Thomas Murray # Supplement with tests of fix to bad areas (nan or inf) for this case # Reported 2018-02-08 by Natalia Sabourova add_test (NAME RhumbSolve0 COMMAND RhumbSolve -p 3 -i --input-string "0 0 90 0") add_test (NAME RhumbSolve1 COMMAND RhumbSolve -p 3 -i --input-string "0 0 90 0" -s) # Treatment of the pole depends on the precision, so only check the area # for doubles if (GEOGRAPHICLIB_PRECISION EQUAL 2) set_tests_properties (RhumbSolve0 RhumbSolve1 PROPERTIES PASS_REGULAR_EXPRESSION "^0\\.0+ 10001965\\.729 0[\r\n]") add_test (NAME RhumbSolve2 COMMAND RhumbSolve -p 3 -i --input-string "0 0 90 30") add_test (NAME RhumbSolve3 COMMAND RhumbSolve -p 3 -i --input-string "0 0 90 30" -s) set_tests_properties (RhumbSolve2 RhumbSolve3 PROPERTIES PASS_REGULAR_EXPRESSION "^0.41222947 10002224.609 21050634712282[\r\n]") else () set_tests_properties (RhumbSolve0 RhumbSolve1 PROPERTIES PASS_REGULAR_EXPRESSION "^0\\.0+ 10001965\\.729 ") endif () # Test fix to CassiniSoldner::Forward bug found 2015-06-20 add_test (NAME GeodesicProj0 COMMAND GeodesicProj -c 0 0 -p 3 --input-string "90 80") set_tests_properties (GeodesicProj0 PROPERTIES PASS_REGULAR_EXPRESSION "^-?0\\.0+ [0-9]+\\.[0-9]+ 170\\.0+ ") if (EXISTS "${_DATADIR}/geoids/egm96-5.pgm") # Check fix for single-cell cache bug found 2010-11-23 add_test (NAME GeoidEval0 COMMAND GeoidEval -n egm96-5 --input-string "0d1 0d1;0d4 0d4") set_tests_properties (GeoidEval0 PROPERTIES PASS_REGULAR_EXPRESSION "^17\\.1[56]..\n17\\.1[45]..") endif () if (EXISTS "${_DATADIR}/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 (NAME MagneticField0 COMMAND MagneticField -n wmm2010 -p 10 -r --input-string "2012.5 -80 240 100e3") add_test (NAME MagneticField1 COMMAND MagneticField -n wmm2010 -p 10 -r -t 2012.5 --input-string "-80 240 100e3") add_test (NAME MagneticField2 COMMAND MagneticField -n wmm2010 -p 10 -r -c 2012.5 -80 100e3 --input-string "240") # In third number, allow a final digit 5 (instead of correct 4) to # accommodate Visual Studio 12 and 14. The relative difference is # "only" 2e-15; on the other hand, this might be a lurking bug in # these compilers. (Visual Studio 10 and 11 are OK.) set_tests_properties (MagneticField0 MagneticField1 MagneticField2 PROPERTIES PASS_REGULAR_EXPRESSION " 5535\\.5249148687 14765\\.3703243050 -50625\\.930547879[45] .*\n.* 20\\.4904268023 1\\.0272592716 83\\.5313962281 ") endif () if (EXISTS "${_DATADIR}/magnetic/emm2015.wmm") # Tests from EMM2015_TEST_VALUES.txt including cases of linear # interpolation and extrapolation. add_test (NAME MagneticField3 COMMAND MagneticField -n emm2015 -r --input-string "2009.2 -85.9 -116.5 0") add_test (NAME MagneticField4 COMMAND MagneticField -n emm2015 -r -c 2009.2 -85.9 0 --input-string -116.5) add_test (NAME MagneticField5 COMMAND MagneticField -n emm2015 -r --input-string "2015.7 78.3 123.7 100e3") add_test (NAME MagneticField6 COMMAND MagneticField -n emm2015 -r -c 2015.7 78.3 100e3 --input-string 123.7) set_tests_properties (MagneticField3 MagneticField4 PROPERTIES PASS_REGULAR_EXPRESSION "79\\.70 -72\\.74 16532\\.1 2956\\.1 16265\\.7 -53210\\.7 55719\\.7\n-0\\.1. 0\\.0. 13\\.1 34\\.1 7\\.1 81\\.7 -74\\.1") set_tests_properties (MagneticField5 MagneticField6 PROPERTIES PASS_REGULAR_EXPRESSION "-8\\.73 86\\.82 3128\\.9 3092\\.6 -474\\.7 56338\\.9 56425\\.8\n-0\\.2. 0\\.0. -20\\.7 -22\\.3 -9\\.2 26\\.5 25\\.3") endif () if (EXISTS "${_DATADIR}/gravity/egm2008.egm") # Verify no overflow at poles with high degree model add_test (NAME Gravity0 COMMAND Gravity -n egm2008 -p 6 --input-string "90 110 0") set_tests_properties (Gravity0 PROPERTIES PASS_REGULAR_EXPRESSION "-0\\.000146 0\\.000078 -9\\.832294") # Check fix for invR bug in GravityCircle found by Mathieu Peyrega on # 2013-04-09 add_test (NAME Gravity1 COMMAND Gravity -n egm2008 -A -c -18 4000 --input-string "-86") set_tests_properties (Gravity1 PROPERTIES PASS_REGULAR_EXPRESSION "-7\\.438 1\\.305 -1\\.563") add_test (NAME Gravity2 COMMAND Gravity -n egm2008 -D -c -18 4000 --input-string "-86") set_tests_properties (Gravity2 PROPERTIES PASS_REGULAR_EXPRESSION "7\\.404 -6\\.168 7\\.616") endif () if (EXISTS "${_DATADIR}/gravity/grs80.egm") # Check close to zero gravity in geostationary orbit add_test (NAME Gravity3 COMMAND Gravity -p 3 -n grs80 --input-string "0 123 35786e3") set_tests_properties (Gravity3 PROPERTIES PASS_REGULAR_EXPRESSION "^-?0\\.000 -?0\\.000 -?0.000") endif () GeographicLib-1.52/tools/Makefile.in0000644000771000077100000010743114064202402017223 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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 VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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) GeodSolve$(EXEEXT) GeodesicProj$(EXEEXT) \ GeoidEval$(EXEEXT) Gravity$(EXEEXT) MagneticField$(EXEEXT) \ Planimeter$(EXEEXT) RhumbSolve$(EXEEXT) \ TransverseMercatorProj$(EXEEXT) subdir = tools 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = 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_GeodSolve_OBJECTS = GeodSolve.$(OBJEXT) GeodSolve_OBJECTS = $(am_GeodSolve_OBJECTS) GeodSolve_LDADD = $(LDADD) GeodSolve_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_RhumbSolve_OBJECTS = RhumbSolve.$(OBJEXT) RhumbSolve_OBJECTS = $(am_RhumbSolve_OBJECTS) RhumbSolve_LDADD = $(LDADD) RhumbSolve_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' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } SCRIPTS = $(sbin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/GeographicLib depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/CartConvert.Po \ ./$(DEPDIR)/ConicProj.Po ./$(DEPDIR)/GeoConvert.Po \ ./$(DEPDIR)/GeodSolve.Po ./$(DEPDIR)/GeodesicProj.Po \ ./$(DEPDIR)/GeoidEval.Po ./$(DEPDIR)/Gravity.Po \ ./$(DEPDIR)/MagneticField.Po ./$(DEPDIR)/Planimeter.Po \ ./$(DEPDIR)/RhumbSolve.Po \ ./$(DEPDIR)/TransverseMercatorProj.Po am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(CartConvert_SOURCES) $(ConicProj_SOURCES) \ $(GeoConvert_SOURCES) $(GeodSolve_SOURCES) \ $(GeodesicProj_SOURCES) $(GeoidEval_SOURCES) \ $(Gravity_SOURCES) $(MagneticField_SOURCES) \ $(Planimeter_SOURCES) $(RhumbSolve_SOURCES) \ $(TransverseMercatorProj_SOURCES) DIST_SOURCES = $(CartConvert_SOURCES) $(ConicProj_SOURCES) \ $(GeoConvert_SOURCES) $(GeodSolve_SOURCES) \ $(GeodesicProj_SOURCES) $(GeoidEval_SOURCES) \ $(Gravity_SOURCES) $(MagneticField_SOURCES) \ $(Planimeter_SOURCES) $(RhumbSolve_SOURCES) \ $(TransverseMercatorProj_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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@ pkgconfigdir = @pkgconfigdir@ 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 \ -I$(top_builddir)/man -I$(top_srcdir)/man -Wall -Wextra 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 GeodSolve_SOURCES = GeodSolve.cpp \ ../man/GeodSolve.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Geodesic.hpp \ ../include/GeographicLib/GeodesicExact.hpp \ ../include/GeographicLib/GeodesicLine.hpp \ ../include/GeographicLib/GeodesicLineExact.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/Ellipsoid.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 RhumbSolve_SOURCES = RhumbSolve.cpp \ ../man/RhumbSolve.usage \ ../include/GeographicLib/Config.h \ ../include/GeographicLib/Constants.hpp \ ../include/GeographicLib/DMS.hpp \ ../include/GeographicLib/Ellipsoid.hpp \ ../include/GeographicLib/Math.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 tests.cmake \ 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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ 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) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ 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) $(EXTRA_CartConvert_DEPENDENCIES) @rm -f CartConvert$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(CartConvert_OBJECTS) $(CartConvert_LDADD) $(LIBS) ConicProj$(EXEEXT): $(ConicProj_OBJECTS) $(ConicProj_DEPENDENCIES) $(EXTRA_ConicProj_DEPENDENCIES) @rm -f ConicProj$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(ConicProj_OBJECTS) $(ConicProj_LDADD) $(LIBS) GeoConvert$(EXEEXT): $(GeoConvert_OBJECTS) $(GeoConvert_DEPENDENCIES) $(EXTRA_GeoConvert_DEPENDENCIES) @rm -f GeoConvert$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(GeoConvert_OBJECTS) $(GeoConvert_LDADD) $(LIBS) GeodSolve$(EXEEXT): $(GeodSolve_OBJECTS) $(GeodSolve_DEPENDENCIES) $(EXTRA_GeodSolve_DEPENDENCIES) @rm -f GeodSolve$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(GeodSolve_OBJECTS) $(GeodSolve_LDADD) $(LIBS) GeodesicProj$(EXEEXT): $(GeodesicProj_OBJECTS) $(GeodesicProj_DEPENDENCIES) $(EXTRA_GeodesicProj_DEPENDENCIES) @rm -f GeodesicProj$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(GeodesicProj_OBJECTS) $(GeodesicProj_LDADD) $(LIBS) GeoidEval$(EXEEXT): $(GeoidEval_OBJECTS) $(GeoidEval_DEPENDENCIES) $(EXTRA_GeoidEval_DEPENDENCIES) @rm -f GeoidEval$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(GeoidEval_OBJECTS) $(GeoidEval_LDADD) $(LIBS) Gravity$(EXEEXT): $(Gravity_OBJECTS) $(Gravity_DEPENDENCIES) $(EXTRA_Gravity_DEPENDENCIES) @rm -f Gravity$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(Gravity_OBJECTS) $(Gravity_LDADD) $(LIBS) MagneticField$(EXEEXT): $(MagneticField_OBJECTS) $(MagneticField_DEPENDENCIES) $(EXTRA_MagneticField_DEPENDENCIES) @rm -f MagneticField$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(MagneticField_OBJECTS) $(MagneticField_LDADD) $(LIBS) Planimeter$(EXEEXT): $(Planimeter_OBJECTS) $(Planimeter_DEPENDENCIES) $(EXTRA_Planimeter_DEPENDENCIES) @rm -f Planimeter$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(Planimeter_OBJECTS) $(Planimeter_LDADD) $(LIBS) RhumbSolve$(EXEEXT): $(RhumbSolve_OBJECTS) $(RhumbSolve_DEPENDENCIES) $(EXTRA_RhumbSolve_DEPENDENCIES) @rm -f RhumbSolve$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(RhumbSolve_OBJECTS) $(RhumbSolve_LDADD) $(LIBS) TransverseMercatorProj$(EXEEXT): $(TransverseMercatorProj_OBJECTS) $(TransverseMercatorProj_DEPENDENCIES) $(EXTRA_TransverseMercatorProj_DEPENDENCIES) @rm -f TransverseMercatorProj$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(TransverseMercatorProj_OBJECTS) $(TransverseMercatorProj_LDADD) $(LIBS) install-sbinSCRIPTS: $(sbin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ 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)'`; \ dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CartConvert.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConicProj.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoConvert.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodSolve.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeodesicProj.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoidEval.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Gravity.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MagneticField.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Planimeter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RhumbSolve.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TransverseMercatorProj.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ 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-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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 -f ./$(DEPDIR)/CartConvert.Po -rm -f ./$(DEPDIR)/ConicProj.Po -rm -f ./$(DEPDIR)/GeoConvert.Po -rm -f ./$(DEPDIR)/GeodSolve.Po -rm -f ./$(DEPDIR)/GeodesicProj.Po -rm -f ./$(DEPDIR)/GeoidEval.Po -rm -f ./$(DEPDIR)/Gravity.Po -rm -f ./$(DEPDIR)/MagneticField.Po -rm -f ./$(DEPDIR)/Planimeter.Po -rm -f ./$(DEPDIR)/RhumbSolve.Po -rm -f ./$(DEPDIR)/TransverseMercatorProj.Po -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 -f ./$(DEPDIR)/CartConvert.Po -rm -f ./$(DEPDIR)/ConicProj.Po -rm -f ./$(DEPDIR)/GeoConvert.Po -rm -f ./$(DEPDIR)/GeodSolve.Po -rm -f ./$(DEPDIR)/GeodesicProj.Po -rm -f ./$(DEPDIR)/GeoidEval.Po -rm -f ./$(DEPDIR)/Gravity.Po -rm -f ./$(DEPDIR)/MagneticField.Po -rm -f ./$(DEPDIR)/Planimeter.Po -rm -f ./$(DEPDIR)/RhumbSolve.Po -rm -f ./$(DEPDIR)/TransverseMercatorProj.Po -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 TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am 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 tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-sbinSCRIPTS .PRECIOUS: Makefile geographiclib-get-geoids: geographiclib-get-geoids.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-gravity: geographiclib-get-gravity.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(geographiclib_data)%" $< > $@ chmod +x $@ geographiclib-get-magnetic: geographiclib-get-magnetic.sh sed -e "s%@GEOGRAPHICLIB_DATA@%$(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.52/windows/CartConvert-vc10.vcxproj0000644000771000077100000002006014064202371022123 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/CartConvert-vc10x.vcxproj0000644000771000077100000001067014064202371022321 0ustar ckarneyckarney Debug Win32 Release Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65} Win32Proj CartConvert CartConvert Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/ConicProj-vc10.vcxproj0000644000771000077100000002005014064202371021556 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/ConicProj-vc10x.vcxproj0000644000771000077100000001066014064202371021754 0ustar ckarneyckarney Debug Win32 Release Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744} Win32Proj ConicProj ConicProj Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/GeoConvert-vc10.vcxproj0000644000771000077100000002005414064202371021747 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/GeoConvert-vc10x.vcxproj0000644000771000077100000001066414064202371022145 0ustar ckarneyckarney Debug Win32 Release Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034} Win32Proj GeoConvert GeoConvert Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/GeodSolve-vc10.vcxproj0000644000771000077100000002005014064202371021557 0ustar ckarneyckarney Debug Win32 Debug x64 Release Win32 Release x64 {F1B64F66-7B95-4087-9619-4ABC20BEB591} Win32Proj GeodSolve GeodSolve 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/GeodSolve-vc10x.vcxproj0000644000771000077100000001066014064202371021755 0ustar ckarneyckarney Debug Win32 Release Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591} Win32Proj GeodSolve GeodSolve Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/GeodesicProj-vc10.vcxproj0000644000771000077100000002006414064202371022252 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/GeodesicProj-vc10x.vcxproj0000644000771000077100000001067414064202371022450 0ustar ckarneyckarney Debug Win32 Release Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A} Win32Proj GeodesicProj GeodesicProj Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/Geographic-vc10.vcxproj0000644000771000077100000002762314064202371021755 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level4 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level4 WIN32;NDEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level4 WIN32;NDEBUG;%(PreprocessorDefinitions) NotUsing ../include true GeographicLib-1.52/windows/Geographic-vc10x.vcxproj0000644000771000077100000002137414064202371022142 0ustar ckarneyckarney Debug Win32 Release Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} v4.0 ManagedCProj Geographic Geographic StaticLibrary true false NotSet StaticLibrary false false NotSet false $(ProjectName)_d false Level4 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level4 WIN32;NDEBUG;%(PreprocessorDefinitions) NotUsing ../include true GeographicLib-1.52/windows/Geographic-vc13n.vcxproj0000644000771000077100000003011014064202371022117 0ustar ckarneyckarney Debug Win32 Debug x64 Release Win32 Release x64 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} v4.5 ManagedCProj Geographic Geographic StaticLibrary true false NotSet v120 StaticLibrary true false NotSet v120 StaticLibrary false false NotSet v120 StaticLibrary false false NotSet v120 true $(ProjectName)_d true $(ProjectName)_d $(SolutionDir)$(Configuration)64\ $(Configuration)64\ false false $(SolutionDir)$(Configuration)64\ $(Configuration)64\ Level4 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level4 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level4 WIN32;NDEBUG;%(PreprocessorDefinitions) NotUsing ../include true Level4 WIN32;NDEBUG;%(PreprocessorDefinitions) NotUsing ../include true GeographicLib-1.52/windows/GeographicLib-vc10.sln0000644000771000077100000003611614064202371021502 0ustar ckarneyckarneyMicrosoft 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("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{E6598B23-7D6F-4801-8579-C0C6BEBDE659}" 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}") = "GeodSolve", "GeodSolve-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 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RhumbSolve", "RhumbSolve-vc10.vcxproj", "{57A786B5-042F-46BD-BBC6-74148C3F961F}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {0FC0DED7-C708-468A-9E29-E7F245EE0C1C} = {0FC0DED7-C708-468A-9E29-E7F245EE0C1C} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet", "dotnet", "{ED7891B2-897F-4B32-87C9-1FB393720C62}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NETGeographic", "NETGeographic-vc10.vcxproj", "{BC1ADBEC-537D-487E-AF21-8B7025AAF46D}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projections", "../dotnet/Projections/Projections.csproj", "{74B48389-E1D1-491F-B198-ADD4878C3F2B}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} 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 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Debug|Win32.ActiveCfg = Debug|Win32 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Debug|Win32.Build.0 = Debug|Win32 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Debug|x64.ActiveCfg = Debug|x64 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Debug|x64.Build.0 = Debug|x64 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Release|Win32.ActiveCfg = Release|Win32 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Release|Win32.Build.0 = Release|Win32 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Release|x64.ActiveCfg = Release|x64 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Release|x64.Build.0 = Release|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|Win32.ActiveCfg = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|Win32.Build.0 = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|x64.ActiveCfg = Debug|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|x64.Build.0 = Debug|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|Win32.ActiveCfg = Release|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|Win32.Build.0 = Release|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|x64.ActiveCfg = Release|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|x64.Build.0 = Release|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|Win32.ActiveCfg = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|Win32.Build.0 = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x64.ActiveCfg = Debug|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x64.Build.0 = Debug|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|Win32.ActiveCfg = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|Win32.Build.0 = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x64.ActiveCfg = Release|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {F1B64F66-7B95-4087-9619-4ABC20BEB591} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {0507FE91-AD45-4630-88EF-DABFA9A02FB4} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {73FED050-34B7-40EE-96FA-6EABA84F6F9B} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {AAA7F386-D98F-4E1C-BA16-628CEF1DB440} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {62483C58-6125-4DB8-889D-23F5CB1D9744} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {3D185FB1-192C-457B-A327-27CFAEB82D8A} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {0FC0DED7-C708-468A-9E29-E7F245EE0C1C} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {57A786B5-042F-46BD-BBC6-74148C3F961F} = {E6598B23-7D6F-4801-8579-C0C6BEBDE659} {BC1ADBEC-537D-487E-AF21-8B7025AAF46D} = {ED7891B2-897F-4B32-87C9-1FB393720C62} {74B48389-E1D1-491F-B198-ADD4878C3F2B} = {ED7891B2-897F-4B32-87C9-1FB393720C62} EndGlobalSection EndGlobal GeographicLib-1.52/windows/GeographicLib-vc10x.sln0000644000771000077100000002054614064202371021672 0ustar ckarneyckarneyMicrosoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geographic", "Geographic-vc10x.vcxproj", "{4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GeoConvert", "GeoConvert-vc10x.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}") = "GeodSolve", "GeodSolve-vc10x.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-vc10x.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-vc10x.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-vc10x.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-vc10x.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-vc10x.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-vc10x.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-vc10x.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-vc10x.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 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RhumbSolve", "RhumbSolve-vc10x.vcxproj", "{57A786B5-042F-46BD-BBC6-74148C3F961F}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} {0FC0DED7-C708-468A-9E29-E7F245EE0C1C} = {0FC0DED7-C708-468A-9E29-E7F245EE0C1C} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 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}.Release|Win32.ActiveCfg = Release|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {C7BBC1C8-0E3A-4338-B47F-9DE092DC7034}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {F1B64F66-7B95-4087-9619-4ABC20BEB591}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {699D2AD1-5545-4FE8-AF72-7D5AAF5D8F65}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {2E0C4271-25A7-4A94-8112-7DA0D1A8AF9A}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {62483C58-6125-4DB8-889D-23F5CB1D9744}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A}.Release|Win32.Build.0 = Release|Win32 {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}.Release|Win32.ActiveCfg = Release|Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C}.Release|Win32.Build.0 = Release|Win32 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Debug|Win32.ActiveCfg = Debug|Win32 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Debug|Win32.Build.0 = Debug|Win32 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Release|Win32.ActiveCfg = Release|Win32 {57A786B5-042F-46BD-BBC6-74148C3F961F}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal GeographicLib-1.52/windows/GeoidEval-vc10.vcxproj0000644000771000077100000002005014064202371021527 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/GeoidEval-vc10x.vcxproj0000644000771000077100000001066014064202371021725 0ustar ckarneyckarney Debug Win32 Release Win32 {0507FE91-AD45-4630-88EF-DABFA9A02FB4} Win32Proj GeoidEval GeoidEval Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/Gravity-vc10.vcxproj0000644000771000077100000002004014064202371021314 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/Gravity-vc10x.vcxproj0000644000771000077100000001065014064202371021512 0ustar ckarneyckarney Debug Win32 Release Win32 {0FC0DED7-C708-468A-9E29-E7F245EE0C1C} Win32Proj Gravity Gravity Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/MagneticField-vc10.vcxproj0000644000771000077100000002007014064202371022365 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/MagneticField-vc10x.vcxproj0000644000771000077100000001070014064202371022554 0ustar ckarneyckarney Debug Win32 Release Win32 {3D185FB1-192C-457B-A327-27CFAEB82D8A} Win32Proj MagneticField MagneticField Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/NETGeographic-vc10.sln0000644000771000077100000000702014064202371021412 0ustar ckarneyckarney Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NETGeographic", "NETGeographic-vc10.vcxproj", "{BC1ADBEC-537D-487E-AF21-8B7025AAF46D}" ProjectSection(ProjectDependencies) = postProject {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} = {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projections", "..\dotnet\Projections\Projections.csproj", "{74B48389-E1D1-491F-B198-ADD4878C3F2B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geographic", "Geographic-vc10.vcxproj", "{4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Win32 = Release|Win32 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|Win32.ActiveCfg = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|Win32.Build.0 = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|x64.ActiveCfg = Debug|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|x64.Build.0 = Debug|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|x86.ActiveCfg = Debug|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|Win32.ActiveCfg = Release|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|Win32.Build.0 = Release|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|x64.ActiveCfg = Release|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|x64.Build.0 = Release|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|x86.ActiveCfg = Release|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|Win32.ActiveCfg = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|Win32.Build.0 = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x64.ActiveCfg = Debug|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x64.Build.0 = Debug|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x86.ActiveCfg = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x86.Build.0 = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|Win32.ActiveCfg = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|Win32.Build.0 = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x64.ActiveCfg = Release|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x64.Build.0 = Release|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x86.ActiveCfg = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x86.Build.0 = Release|x86 {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}.Debug|x86.ActiveCfg = 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 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|x86.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal GeographicLib-1.52/windows/NETGeographic-vc10.vcxproj0000644000771000077100000003275114064202371022322 0ustar ckarneyckarney Debug Win32 Debug x64 Release Win32 Release x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D} v4.0 ManagedCProj NETGeographic NETGeographic DynamicLibrary true true Unicode DynamicLibrary true true Unicode DynamicLibrary false true Unicode DynamicLibrary false true Unicode true $(ProjectName)_d $(Configuration)\dotnet\ true $(ProjectName)_d $(SolutionDir)$(Configuration)64\ $(Configuration)64\dotnet\ false $(Configuration)\dotnet\ false $(SolutionDir)$(Configuration)64\ $(Configuration)64\dotnet\ Level4 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) Use ../include true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) Use ..\include true Geographic_d.lib $(OutDir) Level4 WIN32;NDEBUG;%(PreprocessorDefinitions) Use ..\include true Geographic.lib $(OutDir) Level4 WIN32;NDEBUG;%(PreprocessorDefinitions) Use ..\include true Geographic.lib $(OutDir) Create Create Create Create {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} GeographicLib-1.52/windows/NETGeographic-vc13.sln0000644000771000077100000001162114064202371021417 0ustar ckarneyckarney Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.30723.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NETGeographic", "NETGeographic-vc13.vcxproj", "{BC1ADBEC-537D-487E-AF21-8B7025AAF46D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projections-vs13", "..\dotnet\Projections\Projections-vs13.csproj", "{74B48389-E1D1-491F-B198-ADD4878C3F2B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geographic", "Geographic-vc13n.vcxproj", "{4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Mixed Platforms = Debug|Mixed Platforms Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Mixed Platforms = Release|Mixed Platforms Release|Win32 = Release|Win32 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|Win32.ActiveCfg = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|Win32.Build.0 = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|x64.ActiveCfg = Debug|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|x64.Build.0 = Debug|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|x86.ActiveCfg = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Debug|x86.Build.0 = Debug|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|Mixed Platforms.Build.0 = Release|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|Win32.ActiveCfg = Release|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|Win32.Build.0 = Release|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|x64.ActiveCfg = Release|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|x64.Build.0 = Release|x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|x86.ActiveCfg = Release|Win32 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D}.Release|x86.Build.0 = Release|Win32 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|Mixed Platforms.Build.0 = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|Win32.ActiveCfg = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|Win32.Build.0 = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x64.ActiveCfg = Debug|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x64.Build.0 = Debug|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x86.ActiveCfg = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Debug|x86.Build.0 = Debug|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|Mixed Platforms.ActiveCfg = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|Mixed Platforms.Build.0 = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|Win32.ActiveCfg = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|Win32.Build.0 = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x64.ActiveCfg = Release|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x64.Build.0 = Release|x64 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x86.ActiveCfg = Release|x86 {74B48389-E1D1-491F-B198-ADD4878C3F2B}.Release|x86.Build.0 = Release|x86 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|Mixed Platforms.Build.0 = Debug|Win32 {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}.Debug|x86.ActiveCfg = Debug|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Debug|x86.Build.0 = Debug|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|Mixed Platforms.Build.0 = Release|Win32 {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 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|x86.ActiveCfg = Release|Win32 {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal GeographicLib-1.52/windows/NETGeographic-vc13.vcxproj0000644000771000077100000003323614064202371022324 0ustar ckarneyckarney Debug Win32 Debug x64 Release Win32 Release x64 {BC1ADBEC-537D-487E-AF21-8B7025AAF46D} v4.5 ManagedCProj NETGeographic NETGeographic DynamicLibrary true true Unicode v120 DynamicLibrary true true Unicode v120 DynamicLibrary false true Unicode v120 DynamicLibrary false true Unicode v120 true $(ProjectName)_d $(Configuration)\dotnet\ true $(ProjectName)_d $(SolutionDir)$(Configuration)64\ $(Configuration)64\dotnet\ false $(Configuration)\dotnet\ false $(SolutionDir)$(Configuration)64\ $(Configuration)64\dotnet\ Level4 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) Use ../include true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;%(PreprocessorDefinitions) Use ..\include true Geographic_d.lib $(OutDir) Level4 WIN32;NDEBUG;%(PreprocessorDefinitions) Use ..\include true Geographic.lib $(OutDir) Level4 WIN32;NDEBUG;%(PreprocessorDefinitions) Use ..\include true Geographic.lib $(OutDir) Create Create Create Create {4CFBCD6C-956C-42BC-A863-3C60F3ED9CC1} GeographicLib-1.52/windows/Planimeter-vc10.vcxproj0000644000771000077100000002005414064202371021774 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/Planimeter-vc10x.vcxproj0000644000771000077100000001066414064202371022172 0ustar ckarneyckarney Debug Win32 Release Win32 {AAA7F386-D98F-4E1C-BA16-628CEF1DB440} Win32Proj Planimeter Planimeter Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/RhumbSolve-vc10.vcxproj0000644000771000077100000002005414064202371021762 0ustar ckarneyckarney Debug Win32 Debug x64 Release Win32 Release x64 {57A786B5-042F-46BD-BBC6-74148C3F961F} Win32Proj RhumbSolve RhumbSolve 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/RhumbSolve-vc10x.vcxproj0000644000771000077100000001066414064202371022160 0ustar ckarneyckarney Debug Win32 Release Win32 {57A786B5-042F-46BD-BBC6-74148C3F961F} Win32Proj RhumbSolve RhumbSolve Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/TransverseMercatorProj-vc10.vcxproj0000644000771000077100000002013414064202371024357 0ustar ckarneyckarney 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\ Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/windows/TransverseMercatorProj-vc10x.vcxproj0000644000771000077100000001074414064202371024555 0ustar ckarneyckarney Debug Win32 Release Win32 {73FED050-34B7-40EE-96FA-6EABA84F6F9B} Win32Proj TransverseMercatorProj TransverseMercatorProj Application true NotSet Application false true NotSet false false Level4 Disabled WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true Geographic_d.lib $(OutDir) Level4 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) ../include;../man Console true true true Geographic.lib $(OutDir) GeographicLib-1.52/wrapper/00README.txt0000644000771000077100000000217214064202371017335 0ustar ckarneyckarneyHere are some examples of calling the C++ library from C, MATLAB, and python. Although the geodesic capabilities of GeographicLib have been implemented natively in several languages. There are no plans to do the same for its other capabilities since this leads to a large continuing obligation for maintenance and documentation. (Note however that thet MATLAB/Octave library includes additional capabilities, UTM, MGRS, etc.) An alternative strategy is to call the C++ library directly from another language, possibly via some "wrapper" routines. This done by NETGeographicLib to provide access from C#. This was relatively easy because of the tight integration of C# and C++ with Visual Studio on Windows systems. Providing a similar interface for other languages is challenging because the overall interface that GeographicLib exposes is reasonably large and because the details often depend on the target system. Nevertheless, this can be a good strategy for a user who only want to call a few GeographicLib routines from another language. Please contribute other examples, either for the languages given here or for other languages. GeographicLib-1.52/wrapper/C/00README.txt0000644000771000077100000000307114064202371017516 0ustar ckarneyckarneyThe geodesic routines in GeographicLib have been implemented as a native C library. See https://geographiclib.sourceforge.io/html/C/ It is also possible to call the C++ version of GeographicLib directly from C and this directory contains a small example, which convert heights above the geoid to heights above the ellipsoid. More information on calling C++ from C, see https://isocpp.org/wiki/faq/mixing-c-and-cpp To build and install this interface, do mkdir BUILD cd BUILD cmake .. make This assumes that you have installed GeographicLib somewhere that cmake can find it. If you want just to use the version of GeographicLib that you have built in the top-level BUILD directory, include, e.g., -D GeographicLib_DIR=../../BUILD in the invocation of cmake (the directory is relative to the source directory, wrapper/C). To convert 20m above the geoid at 42N 75W to a height above the ellipsoid, use $ echo 42 -75 20 | ./geoidtest -10.672 Notes: * The geoid data (egm2008-1) should be installed somewhere that GeographicLib knows about. * This prescription applies to Linux machines. Similar steps can be used on Windows and MacOSX machines. * It is essential that the application be linked with the C++ compiler, so that the C++ runtime library is included. * In this example, the main program is compiled with the C compiler. In more complicated situations, it may be necessary to use the C++ compiler. This is necessary to get static initializations of C++ classes performed. (However, GeographicLib doesn't need any static initialization.) GeographicLib-1.52/wrapper/C/CMakeLists.txt0000644000771000077100000000263414064202371020424 0ustar ckarneyckarneyproject (geoidtest) cmake_minimum_required (VERSION 3.1.0) # 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 () # Make the compiler more picky. if (MSVC) string (REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") string (REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") else () set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") endif () find_package (GeographicLib REQUIRED COMPONENTS SHARED) add_executable (${PROJECT_NAME} ${PROJECT_NAME}.c cgeoid.cpp) target_link_libraries (${PROJECT_NAME} ${GeographicLib_LIBRARIES}) get_target_property (GEOGRAPHICLIB_LIB_TYPE ${GeographicLib_LIBRARIES} TYPE) if (GEOGRAPHICLIB_LIB_TYPE STREQUAL "SHARED_LIBRARY") if (WIN32) add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CFG_INTDIR} COMMENT "Installing shared library in build tree") else () # Set the run time path for shared libraries for non-Windows machines. set_target_properties (${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) endif () endif () GeographicLib-1.52/wrapper/C/cgeoid.cpp0000644000771000077100000000060014064202371017611 0ustar ckarneyckarney#include "cgeoid.h" #include "GeographicLib/Geoid.hpp" extern "C" double HeightAboveEllipsoid(double lat, double lon, double h) { try { // Declare static so that g is only constructed once static const GeographicLib::Geoid g("egm2008-1"); return h + GeographicLib::Geoid::GEOIDTOELLIPSOID * g(lat, lon); } catch (...) { return GeographicLib::Math::NaN(); } } GeographicLib-1.52/wrapper/C/cgeoid.h0000644000771000077100000000025514064202371017264 0ustar ckarneyckarney#if !defined(CGEOID_H) #define CGEOID_H 1 #if defined(__cplusplus) extern "C" #endif double HeightAboveEllipsoid(double lat, double lon, double h); #endif /* CGEOID_H */ GeographicLib-1.52/wrapper/C/geoidtest.c0000644000771000077100000000043414064202371020013 0ustar ckarneyckarney#include #include "cgeoid.h" #if defined(_MSC_VER) /* Squelch warnings about scanf */ # pragma warning (disable: 4996) #endif int main() { double lat, lon, h; while(scanf("%lf %lf %lf", &lat, &lon, &h) == 3) printf("%.3f\n", HeightAboveEllipsoid(lat, lon, h)); } GeographicLib-1.52/wrapper/Excel/00README.txt0000644000771000077100000000632114064202371020375 0ustar ckarneyckarneyYou can call GeographicLib functions from Excel. Thanks to Thomas Warner for showing me how. This prescription has only been tested for Excel running on a Windows machine. Please let me know if you figure out how to get this working on MacOS versions of Excel. Here's the overview (A) Write and compile little interface routines to invoke the functionality you want. (B) Copy the resulting DLLs to where Excel can find them. (C) Write an interface script in Visual Basic. This tells Visual Basic about your interfrace routines and it includes definitions of the actual functions you will see exposed in Excel. Here are the step-by-step instructions for compiling and using the sample routines given here (which solve the direct and inverse geodesic problems and the corresponding rhumb line problems): (1) Install binary distribution for GeographicLib (either 64-bit or 32-bit to match your version of Excel). (2) Install a recent version of cmake. (3) Start a command prompt window and run mkdir BUILD cd BUILD cmake -G "Visual Studio 16" -A x64 .. This configures your build. Any of Visual Studio 14, 15, or 16 (corresponding the VS 2015, 2017, 2019) will work. If your Excel is 32-bit, change "-A x64" to "-A win32". If necessary include -D CMAKE_PREFIX_PATH=DIR to specify where GeographicLib is installed (specified when you ran the GeographicLib installer). Compile the interface with cmake --build . --config Release (4) Copy Release\cgeodesic.dll # the interface routines Release\Geographic.dll # the main GeographicLib library to directory where the Excel executable lives. You can find this directory by launching Excel, launching Task Manager, right-clicking on Excel within Task Manager and selecting Open file location. It's probably something like C:\Program Files\Microsoft Office\root\Office16 and you will probably need administrator privileges to do the copy. If it's in "Program Files (x86)", then you have a 32-bit version of Excel and you need to compile your interface routines in 32-bit by specitying "-A win32" when you first run cmake. (5) Open the Excel workbook within which you would like to use the geodesic and rhumb routines. Type Alt-F11 to open Excel's Visual Basic editor. In the left sidebar, right-click on VBAProject (%yourworksheetname%) and select Import File Browse to Geodesic.bas, select it and click Open Save your Workbook as Excel Macro-Enabled Workbook (*.xlsm) (6) You will now have 10 new functions available: Solve the direct geodesic problem for lat2: geodesic_direct_lat2(lat1, lon1, azi1, s12) lon2: geodesic_direct_lon2(lat1, lon1, azi1, s12) azi2: geodesic_direct_azi2(lat1, lon1, azi1, s12) Solve the inverse geodesic problem for s12: geodesic_inverse_s12(lat1, lon1, lat2, lon2) azi1: geodesic_inverse_azi1(lat1, lon1, lat2, lon2) azi2: geodesic_inverse_azi2(lat1, lon1, lat2, lon2) Solve the direct rhumb problem for lat2: rhumb_direct_lat2(lat1, lon1, azi12, s12) lon2: rhumb_direct_lon2(lat1, lon1, azi12, s12) Solve the inverse rhumb problem for s12: rhumb_inverse_s12(lat1, lon1, lat2, lon2) azi12: rhumb_inverse_azi12(lat1, lon1, lat2, lon2) Latitudes, longitudes, and azimuths are in degrees. Distances are in meters. GeographicLib-1.52/wrapper/Excel/CMakeLists.txt0000644000771000077100000000370214064202371021277 0ustar ckarneyckarneyproject (cgeodesic) cmake_minimum_required (VERSION 3.7.0) # 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 () # Make the compiler more picky. if (MSVC) string (REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") string (REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") else () set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") message (WARNING "This has only been tested on Windows") endif () find_package (GeographicLib 1.51 REQUIRED COMPONENTS SHARED) set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) add_library (${PROJECT_NAME} SHARED ${PROJECT_NAME}.cpp) target_link_libraries (${PROJECT_NAME} ${GeographicLib_LIBRARIES}) if (WIN32) if (CMAKE_SIZEOF_VOID_P EQUAL 4) set (INSTALL_MSG "copy DLLs fron ${CMAKE_CFG_INTDIR} to C:\\Program Files (x86)\\Microsoft Office\\root\\Office16") else () set (INSTALL_MSG "copy DLLs from ${CMAKE_CFG_INTDIR} to C:\\Program Files\\Microsoft Office\\root\\Office16") endif () elseif (APPLE) set (INSTALL_MSG "copy DYLIBs from ${CMAKE_CFG_INTDIR} to /Library/Application Support/Microsoft") endif () get_target_property (GEOGRAPHICLIB_LIB_TYPE ${GeographicLib_LIBRARIES} TYPE) if (GEOGRAPHICLIB_LIB_TYPE STREQUAL "SHARED_LIBRARY") if (TRUE) add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CFG_INTDIR} COMMENT "Installing shared library in build tree ${INSTALL_MSG}") else () # Set the run time path for shared libraries for non-Windows machines. set_target_properties (${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) endif () endif () GeographicLib-1.52/wrapper/Excel/Geodesic.bas0000644000771000077100000001132314064202371020746 0ustar ckarneyckarneyAttribute VB_Name = "Geodesic" Option Explicit ' Declare the DLL functions Private Declare PtrSafe Sub gdirect Lib "cgeodesic.dll" _ (ByVal lat1 As Double, ByVal lon1 As Double, _ ByVal azi1 As Double, ByVal s12 As Double, _ ByRef lat2 As Double, ByRef lon2 As Double, ByRef azi2 As Double) Private Declare PtrSafe Sub ginverse Lib "cgeodesic.dll" _ (ByVal lat1 As Double, ByVal lon1 As Double, _ ByVal lat2 As Double, ByVal lon2 As Double, _ ByRef s12 As Double, ByRef azi1 As Double, ByRef azi2 As Double) Private Declare PtrSafe Sub rdirect Lib "cgeodesic.dll" _ (ByVal lat1 As Double, ByVal lon1 As Double, _ ByVal azi12 As Double, ByVal s12 As Double, _ ByRef lat2 As Double, ByRef lon2 As Double) Private Declare PtrSafe Sub rinverse Lib "cgeodesic.dll" _ (ByVal lat1 As Double, ByVal lon1 As Double, _ ByVal lat2 As Double, ByVal lon2 As Double, _ ByRef s12 As Double, ByRef azi12 As Double) ' Define the custom worksheet functions that call the DLL functions Function geodesic_direct_lat2(lat1 As Double, lon1 As Double, _ azi1 As Double, s12 As Double) As Double Attribute geodesic_direct_lat2.VB_Description = _ "Solves direct geodesic problem for lat2." Dim lat2 As Double Dim lon2 As Double Dim azi2 As Double Call gdirect(lat1, lon1, azi1, s12, lat2, lon2, azi2) geodesic_direct_lat2 = lat2 End Function Function geodesic_direct_lon2(lat1 As Double, lon1 As Double, _ azi1 As Double, s12 As Double) As Double Attribute geodesic_direct_lon2.VB_Description = _ "Solves direct geodesic problem for lon2." Dim lat2 As Double Dim lon2 As Double Dim azi2 As Double Call gdirect(lat1, lon1, azi1, s12, lat2, lon2, azi2) geodesic_direct_lon2 = lon2 End Function Function geodesic_direct_azi2(lat1 As Double, lon1 As Double, _ azi1 As Double, s12 As Double) As Double Attribute geodesic_direct_azi2.VB_Description = _ "Solves direct geodesic problem for azi2." Dim lat2 As Double Dim lon2 As Double Dim azi2 As Double Call gdirect(lat1, lon1, azi1, s12, lat2, lon2, azi2) geodesic_direct_azi2 = azi2 End Function Function geodesic_inverse_s12(lat1 As Double, lon1 As Double, _ lat2 As Double, lon2 As Double) As Double Attribute geodesic_inverse_s12.VB_Description = _ "Solves inverse geodesic problem for s12." Dim s12 As Double Dim azi1 As Double Dim azi2 As Double Call ginverse(lat1, lon1, lat2, lon2, s12, azi1, azi2) geodesic_inverse_s12 = s12 End Function Function geodesic_inverse_azi1(lat1 As Double, lon1 As Double, _ lat2 As Double, lon2 As Double) As Double Attribute geodesic_inverse_azi1.VB_Description = _ "Solves inverse geodesic problem for azi1." Dim s12 As Double Dim azi1 As Double Dim azi2 As Double Call ginverse(lat1, lon1, lat2, lon2, s12, azi1, azi2) geodesic_inverse_azi1 = azi1 End Function Function geodesic_inverse_azi2(lat1 As Double, lon1 As Double, _ lat2 As Double, lon2 As Double) As Double Attribute geodesic_inverse_azi2.VB_Description = _ "Solves inverse geodesic problem for azi2." Dim s12 As Double Dim azi1 As Double Dim azi2 As Double Call ginverse(lat1, lon1, lat2, lon2, s12, azi1, azi2) geodesic_inverse_azi2 = azi2 End Function Function rhumb_direct_lat2(lat1 As Double, lon1 As Double, _ azi12 As Double, s12 As Double) As Double Attribute rhumb_direct_lat2.VB_Description = _ "Solves direct rhumb problem for lat2." Dim lat2 As Double Dim lon2 As Double Call rdirect(lat1, lon1, azi12, s12, lat2, lon2) rhumb_direct_lat2 = lat2 End Function Function rhumb_direct_lon2(lat1 As Double, lon1 As Double, _ azi12 As Double, s12 As Double) As Double Attribute rhumb_direct_lon2.VB_Description = _ "Solves direct rhumb problem for lon2." Dim lat2 As Double Dim lon2 As Double Call rdirect(lat1, lon1, azi12, s12, lat2, lon2) rhumb_direct_lon2 = lon2 End Function Function rhumb_inverse_s12(lat1 As Double, lon1 As Double, _ lat2 As Double, lon2 As Double) As Double Attribute rhumb_inverse_s12.VB_Description = _ "Solves inverse rhumb problem for s12." Dim s12 As Double Dim azi12 As Double Call rinverse(lat1, lon1, lat2, lon2, s12, azi12) rhumb_inverse_s12 = s12 End Function Function rhumb_inverse_azi12(lat1 As Double, lon1 As Double, _ lat2 As Double, lon2 As Double) As Double Attribute rhumb_inverse_azi12.VB_Description = _ "Solves inverse rhumb problem for azi12." Dim s12 As Double Dim azi12 As Double Call rinverse(lat1, lon1, lat2, lon2, s12, azi12) rhumb_inverse_azi12 = azi12 End Function GeographicLib-1.52/wrapper/Excel/cgeodesic.cpp0000644000771000077100000000213114064202371021163 0ustar ckarneyckarney#include "cgeodesic.h" #include "GeographicLib/Geodesic.hpp" #include "GeographicLib/Rhumb.hpp" extern "C" { void gdirect(double lat1, double lon1, double azi1, double s12, double& lat2, double& lon2, double& azi2) { GeographicLib::Geodesic::WGS84().Direct(lat1, lon1, azi1, s12, lat2, lon2, azi2); } void ginverse(double lat1, double lon1, double lat2, double lon2, double& s12, double& azi1, double& azi2) { GeographicLib::Geodesic::WGS84().Inverse(lat1, lon1, lat2, lon2, s12, azi1, azi2); } void rdirect(double lat1, double lon1, double azi12, double s12, double& lat2, double& lon2) { GeographicLib::Rhumb::WGS84().Direct(lat1, lon1, azi12, s12, lat2, lon2); } void rinverse(double lat1, double lon1, double lat2, double lon2, double& s12, double& azi12) { GeographicLib::Rhumb::WGS84().Inverse(lat1, lon1, lat2, lon2, s12, azi12); } } GeographicLib-1.52/wrapper/Excel/cgeodesic.h0000644000771000077100000000117214064202371020634 0ustar ckarneyckarney#if !defined(CGEODESIC_H) #define CGEODESIC_H 1 #if defined(__cplusplus) extern "C" { #endif void gdirect(double lat1, double lon1, double azi1, double s12, double& lat2, double& lon2, double& azi2); void ginverse(double lat1, double lon1, double lat2, double lon2, double& s12, double& azi1, double& azi2); void rdirect(double lat1, double lon1, double azi12, double s12, double& lat2, double& lon2); void rinverse(double lat1, double lon1, double lat2, double lon2, double& s12, double& azi12); #if defined(__cplusplus) } #endif #endif /* CGEODESIC_H */ GeographicLib-1.52/wrapper/js/00README.txt0000644000771000077100000000076214064202371017754 0ustar ckarneyckarneyThe geodesic routines in GeographicLib have been implemented in JavaScript library. See https://geographiclib.sourceforge.io/html/js William Wall has posted a method of automatically translating the C++ code into JavaScript https://sourceforge.net/p/geographiclib/discussion/1026620/thread/f6f6b9ff/ This will let you use other capabilities of GeographicLib in JavaScript. This is implemented in OpenSphere ASM https://github.com/ngageoint/opensphere-asm GeographicLib-1.52/wrapper/matlab/00README.txt0000644000771000077100000000274314064202371020601 0ustar ckarneyckarneyThe Matlab Central Package https://www.mathworks.com/matlabcentral/fileexchange/50605 provide a native Matlab/Octave implementation of a subset of GeographicLib. It is also possible to call the C++ GeographicLib library directly from Matlab and Octave. This gives you access to the full range of GeographicLib's capabilities. In order to make use of this facility, it is necessary to write some interface code. The files in this directory provide a sample of such interface code. This example solves the inverse geodesic problem for ellipsoids with arbitrary flattening. (The code geoddistance.m does this as native Matlab code; but it is limited to ellipsoids with a smaller flattening.) For full details on how to write the interface code, see https://www.mathworks.com/help/matlab/write-cc-mex-files.html To compile the interface code, start Matlab or Octave and run, e.g., mex -setup C++ help geographiclibinterface geographiclibinterface help geodesicinverse geodesicinverse([40.6, -73.8, 51.6, -0.5]) ans = 5.1199e+01 1.0782e+02 5.5518e+06 The first command allows you to select the compiler to use (which should be the same as that used to compile GeographicLib). These routines just offer a simple interface to the corresponding C++ class. Use the help function to get documentation, help geodesicinverse Unfortunately, the help function does not work for compiled functions in Octave; in this case, just list the .m file, e.g., type geodesicinverse.m GeographicLib-1.52/wrapper/matlab/geodesicinverse.cpp0000644000771000077100000000703014064202371022617 0ustar ckarneyckarney/** * \file geodesicinverse.cpp * \brief Matlab mex file for geographic to UTM/UPS conversions * * Copyright (c) Charles Karney (2010-2013) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ **********************************************************************/ // 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 #include #include #include #include using namespace std; using namespace GeographicLib; template void compute(double a, double f, mwSize m, const double* latlong, double* geodesic, double* aux) { const double* lat1 = latlong; const double* lon1 = latlong + m; const double* lat2 = latlong + 2*m; const double* lon2 = latlong + 3*m; double* azi1 = geodesic; double* azi2 = geodesic + m; double* s12 = geodesic + 2*m; double* a12 = NULL; double* m12 = NULL; double* M12 = NULL; double* M21 = NULL; double* S12 = NULL; if (aux) { a12 = aux; m12 = aux + m; M12 = aux + 2*m; M21 = aux + 3*m; S12 = aux + 4*m; } const G g(a, f); for (mwIndex i = 0; i < m; ++i) { if (abs(lat1[i]) <= 90 && lon1[i] >= -540 && lon1[i] < 540 && abs(lat2[i]) <= 90 && lon2[i] >= -540 && lon2[i] < 540) { 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]); } } } 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 equatorial 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("Equatorial 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]); } mwSize m = mxGetM(prhs[0]); const double* latlong = mxGetPr(prhs[0]); double* geodesic = mxGetPr(plhs[0] = mxCreateDoubleMatrix(m, 3, mxREAL)); std::fill(geodesic, geodesic + 3*m, Math::NaN()); double* aux = nlhs == 2 ? mxGetPr(plhs[1] = mxCreateDoubleMatrix(m, 5, mxREAL)) : NULL; if (aux) std::fill(aux, aux + 5*m, Math::NaN()); try { if (std::abs(f) <= 0.02) compute(a, f, m, latlong, geodesic, aux); else compute(a, f, m, latlong, geodesic, aux); } catch (const std::exception& e) { mexErrMsgTxt(e.what()); } } GeographicLib-1.52/wrapper/matlab/geodesicinverse.m0000644000771000077100000000224714064202371022276 0ustar ckarneyckarneyfunction geodesicinverse(~, ~, ~) %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 = equatorial radius (meters) % f = flattening (0 means a sphere) % If a and f are omitted, the WGS84 values are used. % % A native MATLAB implementation is available as GEODDISTANCE. % % See also GEODDISTANCE. error('Error: executing .m file instead of compiled routine'); end GeographicLib-1.52/wrapper/matlab/geographiclibinterface.m0000644000771000077100000000412514064202371023575 0ustar ckarneyckarneyfunction 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 % Octave 3.6.4 and g++ 4.8.3 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 % Matlab 2013b and Visual Studio 2012 under Windows % Matlab 2014b and Mac OSX 10.10 (Yosemite) % % Run 'mex -setup' to configure the C++ compiler for Matlab to use. funs = { 'geodesicinverse' }; lib='Geographic'; 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 || ismac 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.52/wrapper/python/00README.txt0000644000771000077100000000506514064202371020662 0ustar ckarneyckarneyThe geodesic routines in GeographicLib have been implemented as a native Python library. See https://geographiclib.sourceforge.io/html/python/ It is also possible to call the C++ version of GeographicLib directly from Python and this directory contains a small example, PyGeographicLib.cpp, which uses boost-python and the Geoid class to convert heights above the geoid to heights above the ellipsoid. More information on calling boost-python, see https://www.boost.org/doc/libs/release/libs/python An alternative to boost-python is provided by Cython. For more information, see below. To build and install this interface, do mkdir BUILD cd BUILD cmake -D CMAKE_INSTALL_PREFIX=~/.local .. make make install This assumes that you have installed GeographicLib somewhere that cmake can find it. If you want just to use the version of GeographicLib that you have built in the top-level BUILD directory, include, e.g., -D GeographicLib_DIR=../../BUILD in the invocation of cmake (the directory is relative to the source directory, wrapper/python). "make install" installs PyGeographicLib in ~/.local/lib/python2.7/site-packages which is in the default search path for python 2.7. To convert 20m above the geoid at 42N 75W to a height above the ellipsoid, do $ python >>> from PyGeographicLib import Geoid >>> geoid = Geoid("egm2008-1") >>> geoid.EllipsoidHeight(42, -75, 20) -10.671887499999997 >>> help(Geoid.EllipsoidHeight) Notes: * The geoid data (egm2008-1) should be installed somewhere that GeographicLib knows about. * This prescription applies to Linux machines. Similar steps can be used on Windows and MacOSX machines. * You will need the packages boost-python, boost-devel, python, and python-devel installed. * CMakeLists.txt specifies the version of python to look for (version 2.7). This must match that used in boost-python. To check do, e.g., ldd /usr/lib64/libboost_python.so * CmakeLists.txt looks for a shared-library version of GeographicLib. This is the default with cmake build on non-Windows platforms. On Windows, use the cmake variable GEOGRAPHICLIB_LIB_TYPE to specify building a shared library. Acknowledgment: Thanks to Jonathan Takahashi for the sample code in PyGeographicLib.cpp and the commands needed to compile and link this. An alternative to boost-python is provided by Cython. See https::/cython.org Sergey Serebryakov offers the github project https://github.com/megaserg/geographiclib-cython-bindings which provides a fast python interface to the geodesic routines. GeographicLib-1.52/wrapper/python/CMakeLists.txt0000644000771000077100000000366714064202371021572 0ustar ckarneyckarneyproject (PyGeographicLib) cmake_minimum_required (VERSION 3.1.0) # 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 () # Make the compiler more picky. if (MSVC) string (REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") else () set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") endif () # The version of python that boost-python uses. Also used for the # installation directory. set (PYTHON_VERSION 2.7) # Requires python + python devel find_package (PythonLibs ${PYTHON_VERSION} REQUIRED) # Required boost-python + boost-devel find_package (Boost REQUIRED COMPONENTS python) find_package (GeographicLib REQUIRED COMPONENTS SHARED) include_directories (${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}) add_library (${PROJECT_NAME} MODULE ${PROJECT_NAME}.cpp) get_target_property (GEOGRAPHICLIB_LIB_TYPE ${GeographicLib_LIBRARIES} TYPE) if (GEOGRAPHICLIB_LIB_TYPE STREQUAL "SHARED_LIBRARY") if (WIN32) add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CFG_INTDIR} COMMENT "Installing shared library in build tree") else () # Set the run time path for shared libraries for non-Windows machines. set_target_properties (${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) endif () endif () # Don't include the "lib" prefix on the output name set_target_properties (${PROJECT_NAME} PROPERTIES PREFIX "") target_link_libraries (${PROJECT_NAME} ${GeographicLib_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) install (TARGETS ${PROJECT_NAME} LIBRARY # if CMAKE_INSTALL_PREFIX=~/.local then this specifies a directory in # the default path. DESTINATION lib/python${PYTHON_VERSION}/site-packages) GeographicLib-1.52/wrapper/python/PyGeographicLib.cpp0000644000771000077100000000106314064202371022532 0ustar ckarneyckarney#include #include using namespace boost::python; using namespace GeographicLib; double EllipsoidHeight(Geoid& geoid, double lat, double lon, double hmsl) { return hmsl + Geoid::GEOIDTOELLIPSOID * geoid(lat, lon); } BOOST_PYTHON_MODULE(PyGeographicLib) { class_("Geoid", init()) .def("EllipsoidHeight", &EllipsoidHeight, "Return geoid height:\n\ input: lat, lon, height_above_geoid\n\ output: height_above_ellipsoid") ; } GeographicLib-1.52/m4/pkg.m40000644000771000077100000002402614064202371015364 0ustar ckarneyckarney# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # 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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # PKG_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable pkgconfigdir as the location where a module # should install pkg-config .pc files. By default the directory is # $libdir/pkgconfig, but the default can be changed by passing # DIRECTORY. The user can override through the --with-pkgconfigdir # parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_INSTALLDIR # PKG_NOARCH_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable noarch_pkgconfigdir as the location where a # module should install arch-independent pkg-config .pc files. By # default the directory is $datadir/pkgconfig, but the default can be # changed by passing DIRECTORY. The user can override through the # --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_NOARCH_INSTALLDIR # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------- # Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])# PKG_CHECK_VAR # PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, # [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], # [DESCRIPTION], [DEFAULT]) # # Prepare a "--with-" configure option using the lowercase [VARIABLE-PREFIX] # name, merging the behaviour of AC_ARG_WITH and PKG_CHECK_MODULES in a single # macro # # -------------------------------------------------------------- AC_DEFUN([PKG_WITH_MODULES], [ m4_pushdef([with_arg], m4_tolower([$1])) m4_pushdef([description], [m4_default([$5], [build with ]with_arg[ support])]) m4_pushdef([def_arg], [m4_default([$6], [auto])]) m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) m4_case(def_arg, [yes],[m4_pushdef([with_without], [--without-]with_arg)], [m4_pushdef([with_without],[--with-]with_arg)]) AC_ARG_WITH(with_arg, AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, [AS_TR_SH([with_]with_arg)=def_arg]) AS_CASE([$AS_TR_SH([with_]with_arg)], [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], [auto],[PKG_CHECK_MODULES([$1],[$2], [m4_n([def_action_if_found]) $3], [m4_n([def_action_if_not_found]) $4])]) m4_popdef([with_arg]) m4_popdef([description]) m4_popdef([def_arg]) ]) dnl PKG_WITH_MODULES # PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, # [DESCRIPTION], [DEFAULT]) # # Convenience macro to trigger AM_CONDITIONAL after # PKG_WITH_MODULES check. # # HAVE_[VARIABLE-PREFIX] is exported as make variable. # # -------------------------------------------------------------- AC_DEFUN([PKG_HAVE_WITH_MODULES], [ PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) AM_CONDITIONAL([HAVE_][$1], [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) ]) # PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, # [DESCRIPTION], [DEFAULT]) # # Convenience macro to run AM_CONDITIONAL and AC_DEFINE after # PKG_WITH_MODULES check. # # HAVE_[VARIABLE-PREFIX] is exported as make and preprocessor variable. # # -------------------------------------------------------------- AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], [ PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) ]) GeographicLib-1.52/m4/libtool.m40000644000771000077100000112530614064202375016257 0ustar ckarneyckarney# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 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) 2014 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 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 this program. If not, see . ]) # serial 58 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.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK 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_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _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([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl 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 m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that 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 set != "${COLLECT_NAMES+set}"; 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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) 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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) 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 0 = "$lt_write_fail" && 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) 2011 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 yes = "$silent" && 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 that 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 # Generated automatically by $as_me ($PACKAGE) $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. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _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 set != "${COLLECT_NAMES+set}"; 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) 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' 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)], [Go], [_LT_LANG(GO)], [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 m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _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([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) 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 there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; 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 -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; 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 yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; 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 no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # 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 yes = "$lt_cv_ld_force_load"; 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\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) 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*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; 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 yes != "$lt_cv_apple_cc_single_mod"; 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 set = "${lt_cv_aix_libpath+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 that will find a shell with a builtin # printf (that 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], [AS_HELP_STRING([--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 yes = "$GCC"; 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 where 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 no = "$enable_libtool_lock" || 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 what ABI is being produced by ac_compile, and set mode # options accordingly. 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 what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; 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* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. 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*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; 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" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; 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 yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. 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*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) 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 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; 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 bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_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" ## exclude from sc_useless_quotes_in_assignment # 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 yes = "[$]$2"; 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 yes = "[$]$2"; 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; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # 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 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; 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" && \ test undefined != "$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`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 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 yes = "$cross_compiling"; 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 -fvisibility=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 yes != "$enable_dlopen"; 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 ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) 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 no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && 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 yes = "$lt_cv_dlopen_self"; 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 no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; 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 no = "$hard_links"; 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 where 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 yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; 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 relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; 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_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _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 m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; 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` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac 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" elif test -n "$lt_multi_os_dir"; then 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 AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; 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 # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # 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' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # 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' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac 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%'\''`; $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 # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor 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 ;; 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[[23]].*) 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$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' 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 ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor 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=no 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 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; 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 # correct to gnu/linux during the next big refactor 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 yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor 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 ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # 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 dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor 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" # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) 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 # correct to gnu/linux during the next big refactor 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* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi 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 shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec 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' ;; 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 # correct to gnu/linux during the next big refactor 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 yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor 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=sco 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 yes = "$with_gnu_ld"; 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 # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor 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 no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _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], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that 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 that 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 no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; 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 yes = "$with_gnu_ld"; 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 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [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 # that 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. if ( 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 ;; 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 glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | 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* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; 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 ;; os2*) 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 # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) 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 no != "$lt_cv_path_NM"; 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 -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) 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 one 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 yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # 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 yes = "$GCC"; 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 ia64 = "$host_cpu"; 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 if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # 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"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$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"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/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, # D for any global variable and I for any imported 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};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,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 can'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* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$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 yes = "$pipe_works"; 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_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _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_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _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 yes = "$GXX"; 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 ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; 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']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; 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 ia64 = "$host_cpu"; 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 ia64 != "$host_cpu"; 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 | 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 yes = "$GCC"; 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 ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; 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']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; 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 ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; 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 ia64 = "$host_cpu"; 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 ;; 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' case $cc_basename in 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' ;; esac ;; 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']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; 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 | 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' ;; tcc*) # Fabrice Bellard et al's Tiny 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)='-static' ;; 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\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # 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\ F* | *Sun*Fortran*) _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 ' ;; *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,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; 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 that 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 GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _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_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 yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) 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 yes = "$with_gnu_ld"; 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 yes = "$lt_use_gnu_ld_interface"; 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 | $SED -e 's/([^)]\+)\s\+//' 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 ia64 != "$host_cpu"; 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, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); 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 ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $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 linux-dietlibc = "$host_os"; 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 no = "$tmp_diet" 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' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-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 yes = "$supports_anon_versioning"; 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 tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; 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)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; 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 cannot *** 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 no = "$_LT_TAGVAR(ld_shlibs, $1)"; 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 yes = "$GCC" && 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 ia64 = "$host_cpu"; 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 GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; 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 yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; 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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; 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 yes = "$with_gnu_ld"; 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 _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $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(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _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 ;; # 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 yes = "$GCC"; 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 "x$output_objdir/$soname" = "x$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 "x$output_objdir/$soname" = "x$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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; 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 yes = "$GCC"; 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 yes = "$lt_cv_irix_exported_symbol"; 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 ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; 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* | bitrig*) 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__`"; 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 _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' 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 shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 sequent = "$host_vendor"; 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 yes = "$GCC"; 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 CANNOT 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 yes = "$GCC"; 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 sni = "$host_vendor"; 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 no = "$_LT_TAGVAR(ld_shlibs, $1)" && 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 yes,yes = "$GCC,$enable_shared"; 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_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 what 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac 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 yes = "$enable_shared" || 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 no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); 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_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 yes != "$_lt_caught_CXX_error"; 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 yes = "$GXX"; 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 yes = "$GXX"; 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 yes = "$with_gnu_ld"; 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 ia64 = "$host_cpu"; 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive 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 if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; 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 yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # 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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; 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 yes = "$with_gnu_ld"; 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 _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $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, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); 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) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; 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 ;; freebsd2.*) # 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 ;; 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 "x$output_objdir/$soname" = "x$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 yes = "$GXX"; 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 "x$output_objdir/$soname" = "x$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 no = "$with_gnu_ld"; 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 yes = "$GXX"; then if test no = "$with_gnu_ld"; 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 yes = "$GXX"; then if test no = "$with_gnu_ld"; 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 | 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 yes = "$supports_anon_versioning"; 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 ;; openbsd* | bitrig*) 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__`"; 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 yes,no = "$GXX,$with_gnu_ld"; 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 yes,no = "$GXX,$with_gnu_ld"; 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 $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 $wl-h $wl$soname -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 $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 $wl-h $wl$soname -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 CANNOT 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 no = "$_LT_TAGVAR(ld_shlibs, $1)" && 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 yes != "$_lt_caught_CXX_error" 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 @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@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 ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; 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 x-L = "$p" || test x-R = "$p"; 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 no = "$pre_test_object_deps_done"; 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 no = "$pre_test_object_deps_done"; 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)= ;; 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 no = "$F77"; 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_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 yes != "$_lt_disable_F77"; 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac 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 yes = "$enable_shared" || 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 yes != "$_lt_disable_F77" 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 no = "$FC"; 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_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 yes != "$_lt_disable_FC"; 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac 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 yes = "$enable_shared" || 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 yes != "$_lt_disable_FC" 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_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # 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=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go 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_GO_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 set = "${GCJFLAGS+set}" || 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_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # 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 10 -lt "$lt_ac_count" && 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], [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_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what 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.52/m4/ltoptions.m40000644000771000077100000003426214064202375016645 0ustar ckarneyckarney# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 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 8 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_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _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_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _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@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [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.52/m4/ltsugar.m40000644000771000077100000001044014064202375016263 0ustar ckarneyckarney# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 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.52/m4/ltversion.m40000644000771000077100000000127314064202375016633 0ustar ckarneyckarney# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 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 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) GeographicLib-1.52/m4/lt~obsolete.m40000644000771000077100000001377414064202375017171 0ustar ckarneyckarney# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 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.52/ltmain.sh0000644000771000077100000117106714064202374015655 0ustar ckarneyckarney#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 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 this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 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. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # 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. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES 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 . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! 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 # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! 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 ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_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 # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_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 '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. 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. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # 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 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # 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" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_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 "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # 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. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # 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 "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_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 "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_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_append 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_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || 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_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd 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 -z "$func_relative_path_tlibdir"; 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 -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # 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 () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_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. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # 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). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet 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 () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet 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 () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" 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 () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 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. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # 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. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --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 --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_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) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "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 yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; 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 } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # 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 # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # 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 test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; 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." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. 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= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # 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 | func_generated_by_libtool_p } # 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 yes = "$lalib_p" } # 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 () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # 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 () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs 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 () { $debug_cmd 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 () { $debug_cmd 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 yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; 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 "$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 () { $debug_cmd # 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 () { $debug_cmd 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 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd $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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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 () { $debug_cmd 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_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # 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 | *.go | *.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 yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot 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 yes = "$build_old_libs"; 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 no = "$pic_mode" && test pass_all != "$deplibs_check_method"; 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 no = "$compiler_c_o"; 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 yes = "$need_locks"; 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 warn = "$need_locks"; 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 yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; 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 warn = "$need_locks" && 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 yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; 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 warn = "$need_locks" && 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 no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && 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 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -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 () { $debug_cmd # 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 $opt_dry_run; then # 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 else 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 fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd 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_quiet && 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 finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # 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=false 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=: ;; -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-m = "X$prev" && 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=: if $isdir; 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 ;; os2*) 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 yes = "$build_old_libs"; 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=: 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'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; 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_quiet || { 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_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_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 install = "$opt_mode" && 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 () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; 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) $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 can'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 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; 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 func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' 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[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi 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" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; 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" "${nlist}I"' # 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_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 () { $debug_cmd 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 () { $debug_cmd 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_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 () { $debug_cmd 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 case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) 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 } }'` ;; esac 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 () { $debug_cmd 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 () { $debug_cmd 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 that possess that section. Heuristic: eliminate # all those that 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_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 () { $debug_cmd 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 () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; 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 yes = "$lock_old_archive_extraction"; 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 () { $debug_cmd 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` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result 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 "$sed_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 where 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) $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/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that 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) $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 () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac 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 yes = "$fast_install"; 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 yes = "$shlibpath_overrides_runpath" && 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 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* 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_platform || defined ... */ #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 #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 (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]; size_t 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 = (size_t) (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 (STREQ (str, pat)) *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 size_t 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) { size_t orig_value_len = strlen (orig_value); size_t 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 #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\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 -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' 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 () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd 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 # what 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 that 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= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false 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 yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && 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) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; 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 ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. 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 none = "$pic_object" && test none = "$non_pic_object"; 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 none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; 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 dlprefiles = "$prev"; 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 none != "$non_pic_object"; 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 none = "$pic_object"; 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 ;; os2dllname) os2dllname=$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 rpath = "$prev"; 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-export-symbols = "X$arg"; 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-lc = "X$arg" || test X-lm = "X$arg"; 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-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && 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-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm 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|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 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 ;; -os2dllname) prev=os2dllname 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 # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang -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*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ -specs=*) 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 ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # 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 none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; 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 dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; 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 none = "$pic_object"; 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 dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; 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 yes = "$export_dynamic" && 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\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" 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 lib = "$linkmode"; 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=false 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 lib,link = "$linkmode,$pass"; 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 lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; 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 dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; 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 .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # 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 yes = "$allow_libtool_libs_with_static_runtimes"; 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=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; 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 conv = "$pass" && 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 conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; 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 link = "$pass"; 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 conv = "$pass"; 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=false 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=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else 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." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; 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=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # 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 lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; 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 prog != "$linkmode" && test lib != "$linkmode"; 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 yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; 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 dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" 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 yes = "$installed"; 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 yes = "$hardcode_automatic" && 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 dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; 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 lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; 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 prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: 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 $linkalldeplibs; 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 prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || 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 $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && 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 built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; 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 yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; 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 lib = "$linkmode" && test yes = "$hardcode_into_libs"; 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* | *os2*) 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 prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; 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 cannot # 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 no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # 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 yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; 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 prog = "$linkmode"; 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 yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; 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 prog = "$linkmode"; 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 prog = "$linkmode"; 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 unsupported != "$hardcode_direct"; 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 yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; 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 cannot 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 yes = "$module"; 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 no = "$build_old_libs"; 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 lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; 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 no = "$link_static" && 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 no != "$link_all_deplibs"; 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 link = "$pass"; then if test prog = "$linkmode"; 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 dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # 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= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=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 # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # 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 prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; 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 no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; 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 pass_all != "$deplibs_check_method"; 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 no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; 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 # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|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" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; 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 0 -ne "$loop"; 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) # correct to gnu/linux during the next big refactor 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 0 -ne "$loop"; 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 ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. 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 no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; 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 -n "$precious_files_regex"; 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 yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; 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 yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; 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 yes = "$build_libtool_libs"; 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 yes = "$build_libtool_need_lc"; 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 yes = "$allow_libtool_libs_with_static_runtimes"; 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 yes = "$allow_libtool_libs_with_static_runtimes"; 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 none = "$deplibs_check_method"; 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 yes = "$droppeddeps"; then if test yes = "$module"; 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 no = "$build_old_libs"; 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 no = "$allow_undefined"; 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 no = "$build_old_libs"; 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 yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || 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 eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" 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 relink = "$opt_mode" || 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 func_dll_def_p "$export_symbols" || { # 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 ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || 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 yes = "$try_normal_branch" \ && { 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 : != "$skipped_export"; 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 : != "$skipped_export" && 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 yes = "$compiler_needs_object" && 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 yes = "$thread_safe" && 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 relink = "$opt_mode"; 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 yes = "$module" && 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 : != "$skipped_export" && 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 : != "$skipped_export" && test yes = "$with_gnu_ld"; 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 : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; 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 -z "$objlist" || 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 1 -eq "$k"; 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 ${skipped_export-false} && { 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 } 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_quiet || { 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 relink = "$opt_mode"; 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 ${skipped_export-false} && { 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 } 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 yes = "$module" && 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=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { 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 relink = "$opt_mode"; 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 relink = "$opt_mode"; 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 yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; 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= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags 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 yes = "$build_libtool_libs" || 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 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 test yes = "$build_libtool_libs" || { 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 } if test -n "$pic_flag" || test default != "$pic_mode"; 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" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && 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 CXX = "$tagname"; 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 yes = "$build_old_libs"; 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@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # 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 } 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 yes = "$no_install"; 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 case $hardcode_action,$fast_install in relink,*) # 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" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # 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 case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac 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 yes = "$build_libtool_libs"; 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 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result 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 -z "$oldobjs"; 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 yes = "$build_old_libs" && 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 yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; 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 func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` 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 -n "$bindir"; 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) $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 cannot 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 no,yes = "$installed,$need_relink"; 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 } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false 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=: ;; -*) 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 . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; 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 $rmforce; 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" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || 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 none != "$pic_object"; 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 none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; 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 yes = "$fast_install" && 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 } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi 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 # where 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: GeographicLib-1.52/compile0000755000771000077100000001635014064202375015404 0ustar ckarneyckarney#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: GeographicLib-1.52/config.guess0000755000771000077100000012617314064202375016353 0ustar ckarneyckarney#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-08-29' # 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 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -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 1992-2018 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 # 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. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15 trap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0 set_cc_for_build() { : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 { 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" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$driver" 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 } # 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 ; 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 case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # 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 tuples: *-*-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=`(uname -p 2>/dev/null || \ "/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 ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-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) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) 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 # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; 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/[-_].*//' | cut -d. -f1,2` ;; 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}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$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 ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 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`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; 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.*:*) UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" case `isainfo -b` in 32) echo i386-pc-solaris2"$UNAME_REL" ;; 64) echo x86_64-pc-solaris2"$UNAME_REL" ;; esac 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) 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 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:*:[4567]) 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/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` 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:4.4BSD:*) 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 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 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:*:*) 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 ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi else echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys 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 ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-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-$LIBC`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 "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 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=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) 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-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) 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-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" 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-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" 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.*:*) 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 configure 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 ;; x86_64:Haiku:*:*) echo x86_64-unknown-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 ;; SX-ACE:SUPER-UX:*:*) echo sxace-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 set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then 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 case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi 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 ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-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. # shellcheck disable=SC2154 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 ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&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 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: GeographicLib-1.52/config.sub0000755000771000077100000007530414064202375016015 0ustar ckarneyckarney#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-08-29' # 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 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # 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: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # 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 or ALIAS Canonicalize a configuration name. Options: -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 1992-2018 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 # Split fields of configuration type IFS="-" read -r field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 os=$maybe_os ;; android-linux) basic_machine=$field1-unknown os=linux-android ;; *) basic_machine=$field1-$field2 os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any patern case $field1-$field2 in decstation-3100) basic_machine=mips-dec os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | 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* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= ;; *) basic_machine=$field1 os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc os=bsd ;; a29khif) basic_machine=a29k-amd os=udi ;; adobe68k) basic_machine=m68010-adobe os=scout ;; alliant) basic_machine=fx80-alliant os= ;; altos | altos3068) basic_machine=m68k-altos os= ;; am29k) basic_machine=a29k-none os=bsd ;; amdahl) basic_machine=580-amdahl os=sysv ;; amiga) basic_machine=m68k-unknown os= ;; 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 ;; 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) basic_machine=j90-cray os=unicos ;; crds | unos) basic_machine=m68k-crds os= ;; da30) basic_machine=m68k-da30 os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec os= ;; delta88) basic_machine=m88k-motorola os=sysv3 ;; dicos) basic_machine=i686-pc os=dicos ;; djgpp) basic_machine=i586-pc os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=ose ;; gmicro) basic_machine=tron-gmicro os=sysv ;; go32) basic_machine=i386-pc os=go32 ;; 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 ;; hppaosf) basic_machine=hppa1.1-hp os=osf ;; hppro) basic_machine=hppa1.1-hp os=proelf ;; i386mach) basic_machine=i386-mach os=mach ;; vsta) basic_machine=i386-pc os=vsta ;; isi68 | isi) basic_machine=m68k-isi os=sysv ;; m68knommu) basic_machine=m68k-unknown os=linux ;; magnum | m3230) basic_machine=mips-mips os=sysv ;; merlin) basic_machine=ns32k-utek os=sysv ;; mingw64) basic_machine=x86_64-pc os=mingw64 ;; mingw32) basic_machine=i686-pc os=mingw32 ;; mingw32ce) basic_machine=arm-unknown os=mingw32ce ;; monitor) basic_machine=m68k-rom68k os=coff ;; morphos) basic_machine=powerpc-unknown os=morphos ;; moxiebox) basic_machine=moxie-unknown os=moxiebox ;; msdos) basic_machine=i386-pc os=msdos ;; msys) basic_machine=i686-pc os=msys ;; mvs) basic_machine=i370-ibm os=mvs ;; nacl) basic_machine=le32-unknown os=nacl ;; ncr3000) basic_machine=i486-ncr os=sysv4 ;; netbsd386) basic_machine=i386-pc 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 ;; necv70) basic_machine=v70-nec os=sysv ;; 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 ;; os400) basic_machine=powerpc-ibm os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=ose ;; os68k) basic_machine=m68k-none os=os68k ;; paragon) basic_machine=i860-intel os=osf ;; parisc) basic_machine=hppa-unknown os=linux ;; pw32) basic_machine=i586-unknown os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=rdos ;; rdos32) basic_machine=i386-pc os=rdos ;; rom68k) basic_machine=m68k-rom68k os=coff ;; sa29200) basic_machine=a29k-amd os=udi ;; sei) basic_machine=mips-sei os=seiux ;; sequent) basic_machine=i386-sequent os= ;; sps7) basic_machine=m68k-bull os=sysv2 ;; st2000) basic_machine=m68k-tandem os= ;; stratus) basic_machine=i860-stratus os=sysv4 ;; sun2) basic_machine=m68000-sun os= ;; sun2os3) basic_machine=m68000-sun os=sunos3 ;; sun2os4) basic_machine=m68000-sun os=sunos4 ;; sun3) basic_machine=m68k-sun os= ;; sun3os3) basic_machine=m68k-sun os=sunos3 ;; sun3os4) basic_machine=m68k-sun os=sunos4 ;; sun4) basic_machine=sparc-sun os= ;; sun4os3) basic_machine=sparc-sun os=sunos3 ;; sun4os4) basic_machine=sparc-sun os=sunos4 ;; sun4sol2) basic_machine=sparc-sun os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun os= ;; 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 ;; toad1) basic_machine=pdp10-xkl os=tops20 ;; 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 ;; vxworks960) basic_machine=i960-wrs os=vxworks ;; vxworks68) basic_machine=m68k-wrs os=vxworks ;; vxworks29k) basic_machine=a29k-wrs os=vxworks ;; xbox) basic_machine=i686-pc os=mingw32 ;; ymp) basic_machine=ymp-cray os=unicos ;; *) basic_machine=$1 os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # 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) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi os=${os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray os=${os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $os in irix*) ;; *) os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony os=newsos ;; next | m*-next) cpu=m68k vendor=next case $os in nextstep* ) ;; ns2*) os=nextstep2 ;; *) os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde os=${os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) IFS="-" read -r cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=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 ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` ;; sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; # Now 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* | esix* | aix* | cnk* | sunos | sunos[34]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ | linux-newlib* | linux-musl* | linux-uclibc* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \ | os2* | vos* | palmos* | uclinux* | nucleus* \ | morphos* | superux* | rtmk* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) case $cpu in x86 | i*86) ;; *) os=nto-$os ;; esac ;; hiux*) os=hiuxwe2 ;; nto-qnx*) ;; nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; sim | xray | os68k* | v88r* \ | windows* | osx | abug | netware* | os9* \ | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; linux-dietlibc) os=linux-dietlibc ;; linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynx*) os=lynxos ;; mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; 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 ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; zvmoe) os=zvmoe ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $cpu in arm*) os=eabi ;; *) os=elf ;; esac ;; nacl*) ;; ios) ;; none) ;; *-eabi) ;; *) 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 $cpu-$vendor in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) os=linux ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) 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 ;; 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 ;; pru-*) os=elf ;; *-be) os=beos ;; *-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 ;; *-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 ;; *-wrs) os=vxworks ;; *) 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. case $vendor 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 ;; clix*) vendor=intergraph ;; 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 ;; esac echo "$cpu-$vendor-$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: GeographicLib-1.52/install-sh0000755000771000077100000003643514064202375016040 0ustar ckarneyckarney#!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # 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. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # 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_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 is_target_a_directory=possibly 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 *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi 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 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac 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 if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 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 problematic for 'test' and other utilities. 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 # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac 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. ;; *) # Note that $RANDOM variable is not portable (e.g. dash); Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 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 oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && 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=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_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 && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $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` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && 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 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: GeographicLib-1.52/missing0000755000771000077100000001533614064202375015430 0ustar ckarneyckarney#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written 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 case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man 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 # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: GeographicLib-1.52/depcomp0000755000771000077100000005602014064202375015401 0ustar ckarneyckarney#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 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 outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} 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" # Avoid interferences from the environment. gccflag= dashmflag= # 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 if test "$depmode" = msvc7msys; then # This is just like msvc7 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=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc 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 -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## 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). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - 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 -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # 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. ## 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. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -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 -ne 0; then 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 ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # 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 ;; 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. set_dir_from "$object" set_base_from "$object" 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 -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then 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. set_dir_from "$object" set_base_from "$object" 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 -ne 0; then 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,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_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. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool 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$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # 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 ;; #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|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | 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" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | 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::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$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 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: GeographicLib-1.52/configure0000755000771000077100000223451014064202401015725 0ustar ckarneyckarney#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for GeographicLib 1.52. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 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 # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # 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 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+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} 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 test -x / || 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 : export CONFIG_SHELL # 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 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+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 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_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_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; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # 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 -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' 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 as_test_x='test -x' as_executable_p=as_fn_executable_p # 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.52' PACKAGE_STRING='GeographicLib 1.52' 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 pkgconfigdir PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG HAVE_PODPROGS_FALSE HAVE_PODPROGS_TRUE COL POD2HTML POD2MAN HAVE_DOXYGEN_FALSE HAVE_DOXYGEN_TRUE DOXYGEN CXXCPP LT_SYS_LIBRARY_PATH 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 HAVE_CXX11 am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE 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 GEOGRAPHICLIB_VERSION_PATCH GEOGRAPHICLIB_VERSION_MINOR GEOGRAPHICLIB_VERSION_MAJOR AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V 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 am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock with_pkgconfigdir ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC LT_SYS_LIBRARY_PATH CXXCPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR' # 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 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.52 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.52:";; 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-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --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[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --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). --with-pkgconfigdir pkg-config installation directory ['${libdir}/pkgconfig'] 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 LT_SYS_LIBRARY_PATH User-defined run-time library search path. CXXCPP C++ preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path 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.52 generated by GNU Autoconf 2.69 Copyright (C) 2012 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 || 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 || 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_cxx_try_run LINENO # ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_cxx_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_cxx_try_run 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.52, which was generated by GNU Autoconf 2.69. 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.16' # 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 as_fn_executable_p "$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; } # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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 if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done 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; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file 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 --is-lightweight"; then am_missing_run="$MISSING " 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+set}" != 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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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; } 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 as_fn_executable_p "$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 # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' 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.52' 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"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi GEOGRAPHICLIB_VERSION_MAJOR=1 GEOGRAPHICLIB_VERSION_MINOR=52 GEOGRAPHICLIB_VERSION_PATCH=0 cat >>confdefs.h <<_ACEOF #define GEOGRAPHICLIB_VERSION_MAJOR $GEOGRAPHICLIB_VERSION_MAJOR _ACEOF cat >>confdefs.h <<_ACEOF #define GEOGRAPHICLIB_VERSION_MINOR $GEOGRAPHICLIB_VERSION_MINOR _ACEOF cat >>confdefs.h <<_ACEOF #define GEOGRAPHICLIB_VERSION_PATCH $GEOGRAPHICLIB_VERSION_PATCH _ACEOF { $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=21 LT_REVISION=0 LT_AGE=2 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # 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='\' am__nodep='_no' 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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 struct stat; /* 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 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 $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" 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". rm -rf conftest.dir 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 10 /bin/sh. echo '/* dummy */' > 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 ;; msvc7 | msvc7msys | 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 as_fn_executable_p "$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 as_fn_executable_p "$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". rm -rf conftest.dir 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 10 /bin/sh. echo '/* dummy */' > 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 ;; msvc7 | msvc7msys | 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 ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=true 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 ac_success=no if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 $as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } if eval \${$cachevar+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_CXX="$CXX" CXX="$CXX $switch" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual void f() {} }; struct Derived : public Base { virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval $cachevar=yes else eval $cachevar=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXX="$ac_save_CXX" fi eval ac_res=\$$cachevar { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done if test x$ac_success = xyes; then break fi done 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 x$ax_cxx_compile_cxx11_required = xtrue; then if test x$ac_success = xno; then as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 fi fi if test x$ac_success = xno; then HAVE_CXX11=0 { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 $as_echo "$as_me: No compiler with C++11 support was found" >&6;} else HAVE_CXX11=1 $as_echo "#define HAVE_CXX11 1" >>confdefs.h 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.6' macro_revision='2.4.6' 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" as_fn_executable_p "$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" as_fn_executable_p "$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" as_fn_executable_p "$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" as_fn_executable_p "$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 no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; 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 yes = "$with_gnu_ld"; 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 # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) 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 no != "$lt_cv_path_NM"; 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 as_fn_executable_p "$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 as_fn_executable_p "$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 -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) 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; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # 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 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; 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" && \ test undefined != "$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`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 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"} 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 yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; 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 as_fn_executable_p "$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 as_fn_executable_p "$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 # that 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. if ( 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 ;; 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 glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | 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* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; 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 ;; os2*) 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 as_fn_executable_p "$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 as_fn_executable_p "$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 one 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 as_fn_executable_p "$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 as_fn_executable_p "$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 0 -eq "$ac_status"; 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 0 -ne "$ac_status"; 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 no = "$lt_cv_ar_at_file"; 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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_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 ia64 = "$host_cpu"; 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 if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # 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"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$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"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/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, # D for any global variable and I for any imported 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};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,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 can'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* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$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 yes = "$pipe_works"; 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 yes = "$GCC"; 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; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_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 dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || 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 what ABI is being produced by ac_compile, and set mode # options accordingly. 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 what ABI is being produced by ac_compile, and set linker # options accordingly. 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 yes = "$lt_cv_prog_gnu_ld"; 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* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. 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 emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. 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*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; 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" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; 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 yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. 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*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) 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 as_fn_executable_p "$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 as_fn_executable_p "$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 yes != "$lt_cv_path_mainfest_tool"; 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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; 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 -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; 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 yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; 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 no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; 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; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # 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 shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # 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 set != "${COLLECT_NAMES+set}"; 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 func_cc_basename $compiler cc_basename=$func_cc_basename_result # 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 yes = "$GCC"; 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" ## exclude from sc_useless_quotes_in_assignment # 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 yes = "$lt_cv_prog_compiler_rtti_exceptions"; 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 yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; 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' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; 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 ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; 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 ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; 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' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; 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 | 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' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; 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\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # 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\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; 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 that 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" ## exclude from sc_useless_quotes_in_assignment # 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 yes = "$lt_cv_prog_compiler_pic_works"; 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 yes = "$lt_cv_prog_compiler_static_works"; 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 no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; 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 no = "$hard_links"; 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_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 yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) 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 yes = "$with_gnu_ld"; 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 yes = "$lt_use_gnu_ld_interface"; 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 | $SED -e 's/(^)\+)\s\+//' 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 ia64 != "$host_cpu"; 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, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; 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 ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=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 linux-dietlibc = "$host_os"; 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 no = "$tmp_diet" 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' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-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 yes = "$supports_anon_versioning"; 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 tcc*) export_dynamic_flag_spec='-rdynamic' ;; 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='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; 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 cannot *** 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 no = "$ld_shlibs"; 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 yes = "$GCC" && 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 ia64 = "$host_cpu"; 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 GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; 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 yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; 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 set = "${lt_cv_aix_libpath+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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; 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 set = "${lt_cv_aix_libpath+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 yes = "$with_gnu_ld"; 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 archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $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 exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' 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 yes = "$lt_cv_ld_force_load"; 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*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; 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 ;; # 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 yes = "$GCC"; 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 "x$output_objdir/$soname" = "x$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 "x$output_objdir/$soname" = "x$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 yes,no = "$GCC,$with_gnu_ld"; 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 no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$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 yes,no = "$GCC,$with_gnu_ld"; 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 yes = "$lt_cv_prog_compiler__b"; 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 no = "$with_gnu_ld"; 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 yes = "$GCC"; 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 yes = "$lt_cv_irix_exported_symbol"; 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 ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; 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* | bitrig*) 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__`"; 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 archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 yes = "$GCC"; 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 sequent = "$host_vendor"; 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 yes = "$GCC"; 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 CANNOT 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 yes = "$GCC"; 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 sni = "$host_vendor"; 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 no = "$ld_shlibs" && 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 yes,yes = "$GCC,$enable_shared"; 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 yes = "$GCC"; 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` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac 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" elif test -n "$lt_multi_os_dir"; then 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 # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; 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 # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # 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' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # 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' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac 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%'\''`; $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 # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor 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 ;; 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[23].*) 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$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' 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 ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor 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=no 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 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; 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 # correct to gnu/linux during the next big refactor 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 yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor 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 ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # 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 dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor 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" # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) 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 # correct to gnu/linux during the next big refactor 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* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi 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 shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec 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' ;; 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 # correct to gnu/linux during the next big refactor 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 yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor 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=sco 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 yes = "$with_gnu_ld"; 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 # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor 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 no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $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 yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; 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 relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; 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 ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) 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 no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && 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 yes = "$cross_compiling"; 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 -fvisibility=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 yes = "$lt_cv_dlopen_self"; 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 yes = "$cross_compiling"; 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 -fvisibility=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 what 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 no = "$can_build_shared" && 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 yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac 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 yes = "$enable_shared" || 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 no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); 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_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 yes != "$_lt_caught_CXX_error"; 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 func_cc_basename $compiler cc_basename=$func_cc_basename_result if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test yes = "$GXX"; 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 no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; 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 yes = "$with_gnu_ld"; 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 yes = "$with_gnu_ld"; 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 ia64 = "$host_cpu"; 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 # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive 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 if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; 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,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no ;; esac if test yes = "$GXX"; 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 yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; 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 yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' 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,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. no_undefined_flag_CXX='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. if test set = "${lt_cv_aix_libpath+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 -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; 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 set = "${lt_cv_aix_libpath+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 yes = "$with_gnu_ld"; 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 archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' 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,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $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, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; 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 yes = "$lt_cv_ld_force_load"; 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*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; 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 yes != "$lt_cv_apple_cc_single_mod"; 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 ;; os2*) hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_minus_L_CXX=yes allow_undefined_flag_CXX=unsupported shrext_cmds=.dll archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes ;; 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 ;; freebsd2.*) # 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 ;; 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 "x$output_objdir/$soname" = "x$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 yes = "$GXX"; 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 "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; 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 yes = "$GXX"; then if test no = "$with_gnu_ld"; 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 yes = "$GXX"; then if test no = "$with_gnu_ld"; 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 | 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 yes = "$supports_anon_versioning"; 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 ;; openbsd* | bitrig*) 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__`"; 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 yes,no = "$GXX,$with_gnu_ld"; 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 yes,no = "$GXX,$with_gnu_ld"; 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 $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 $wl-h $wl$soname -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 $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 $wl-h $wl$soname -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 CANNOT 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 no = "$ld_shlibs_CXX" && 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" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; 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 x-L = "$p" || test x-R = "$p"; 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 no = "$pre_test_object_deps_done"; 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 no = "$pre_test_object_deps_done"; 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= ;; 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 yes = "$GXX"; 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 ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi lt_prog_compiler_pic_CXX='-fPIC' ;; 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' case $host_os in os2*) lt_prog_compiler_static_CXX='$wl-static' ;; esac ;; 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 ia64 = "$host_cpu"; 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 ia64 != "$host_cpu"; 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 | 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 that 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" ## exclude from sc_useless_quotes_in_assignment # 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 yes = "$lt_cv_prog_compiler_pic_works_CXX"; 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 yes = "$lt_cv_prog_compiler_static_works_CXX"; 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 no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; 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 no = "$hard_links"; 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 GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. 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) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) 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 no = "$ld_shlibs_CXX" && 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 yes,yes = "$GCC,$enable_shared"; 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 # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; 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 # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # 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' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # 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' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac 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%'\''`; $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 # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor 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 ;; 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[23].*) 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$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' 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 ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor 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=no 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 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; 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 # correct to gnu/linux during the next big refactor 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 yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor 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 ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # 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 dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec_CXX='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor 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" # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) 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 # correct to gnu/linux during the next big refactor 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* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi 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 shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec 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' ;; 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 # correct to gnu/linux during the next big refactor 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 yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor 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=sco 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 yes = "$with_gnu_ld"; 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 # correct to gnu/linux during the next big refactor 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 # correct to gnu/linux during the next big refactor 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 no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $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 yes = "$hardcode_automatic_CXX"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct_CXX" && # 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 no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && test no != "$hardcode_minus_L_CXX"; 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 relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; 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 yes != "$_lt_caught_CXX_error" 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: 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 # Checks for long double { $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 test_array [0]; ; return 0; } _ACEOF if ac_fn_cxx_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 # 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_cxx_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_cxx_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_cxx_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_cxx_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_cxx_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_cxx_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_cxx_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 # Check flag for accurate arithmetic with Intel compiler. This is # needed to stop the compiler from ignoring parentheses in expressions # like (a + b) + c and from simplifying 0.0 + x to x (which is wrong if # x = -0.0). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -fp-model precise -diag-disable=11074,11076" >&5 $as_echo_n "checking whether C++ compiler accepts -fp-model precise -diag-disable=11074,11076... " >&6; } if ${ax_cv_check_cxxflags__Werror__fp_model_precise__diag_disable_11074_11076+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -fp-model precise -diag-disable=11074,11076" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ax_cv_check_cxxflags__Werror__fp_model_precise__diag_disable_11074_11076=yes else ax_cv_check_cxxflags__Werror__fp_model_precise__diag_disable_11074_11076=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__fp_model_precise__diag_disable_11074_11076" >&5 $as_echo "$ax_cv_check_cxxflags__Werror__fp_model_precise__diag_disable_11074_11076" >&6; } if test "x$ax_cv_check_cxxflags__Werror__fp_model_precise__diag_disable_11074_11076" = xyes; then : CXXFLAGS="$CXXFLAGS -fp-model precise -diag-disable=11074,11076" else : fi # Check for doxygen. Version 1.8.7 or later needed for … for ac_prog in doxygen 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_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DOXYGEN"; then ac_cv_prog_DOXYGEN="$DOXYGEN" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DOXYGEN="$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 DOXYGEN=$ac_cv_prog_DOXYGEN if test -n "$DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 $as_echo "$DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DOXYGEN" && break done if test "$DOXYGEN" && test `"$DOXYGEN" --version | sed 's/\b\([0-9]\)\b/0\1/g'` '>' 01.08.06.99; then HAVE_DOXYGEN_TRUE= HAVE_DOXYGEN_FALSE='#' else HAVE_DOXYGEN_TRUE='#' HAVE_DOXYGEN_FALSE= fi for ac_prog in pod2man 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_POD2MAN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$POD2MAN"; then ac_cv_prog_POD2MAN="$POD2MAN" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_POD2MAN="$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 POD2MAN=$ac_cv_prog_POD2MAN if test -n "$POD2MAN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $POD2MAN" >&5 $as_echo "$POD2MAN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$POD2MAN" && break done for ac_prog in pod2html 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_POD2HTML+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$POD2HTML"; then ac_cv_prog_POD2HTML="$POD2HTML" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_POD2HTML="$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 POD2HTML=$ac_cv_prog_POD2HTML if test -n "$POD2HTML"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $POD2HTML" >&5 $as_echo "$POD2HTML" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$POD2HTML" && break done for ac_prog in col 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_COL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$COL"; then ac_cv_prog_COL="$COL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_COL="$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 COL=$ac_cv_prog_COL if test -n "$COL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COL" >&5 $as_echo "$COL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$COL" && break done if test "$POD2MAN" -a "$POD2HTML" -a "$COL"; then HAVE_PODPROGS_TRUE= HAVE_PODPROGS_FALSE='#' else HAVE_PODPROGS_TRUE='#' HAVE_PODPROGS_FALSE= fi ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile tools/Makefile doc/Makefile js/Makefile man/Makefile matlab/Makefile python/Makefile cmake/Makefile examples/Makefile" if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $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 ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $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 ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" 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 PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; 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" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi # Check whether --with-pkgconfigdir was given. if test "${with_pkgconfigdir+set}" = set; then : withval=$with_pkgconfigdir; else with_pkgconfigdir='${libdir}/pkgconfig' fi pkgconfigdir=$with_pkgconfigdir ac_config_files="$ac_config_files cmake/geographiclib.pc:cmake/project.pc.in" 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } 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 if test -z "${HAVE_DOXYGEN_TRUE}" && test -z "${HAVE_DOXYGEN_FALSE}"; then as_fn_error $? "conditional \"HAVE_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_PODPROGS_TRUE}" && test -z "${HAVE_PODPROGS_FALSE}"; then as_fn_error $? "conditional \"HAVE_PODPROGS\" 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 -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' 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 # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # 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.52, which was generated by GNU Autoconf 2.69. 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.52 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 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" MAKE="${MAKE-make}" # 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"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $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_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $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"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $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"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $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_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"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $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_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 \ PATH_SEPARATOR \ 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_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ 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_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_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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) 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 \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ 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\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that 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' 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" ;; "js/Makefile") CONFIG_FILES="$CONFIG_FILES js/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" ;; "cmake/geographiclib.pc") CONFIG_FILES="$CONFIG_FILES cmake/geographiclib.pc:cmake/project.pc.in" ;; *) 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"" || { # Older Autoconf 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. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that 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 # Generated automatically by $as_me ($PACKAGE) $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. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 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 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 this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### 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 # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # 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 into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # 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 # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # 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 where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # 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 # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # 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 # 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 cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _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 set != "${COLLECT_NAMES+set}"; 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) 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 # 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.52/aclocal.m40000644000771000077100000020250214064202401015650 0ustar ckarneyckarney# generated automatically by aclocal 1.16.2 -*- Autoconf -*- # Copyright (C) 1996-2020 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_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. 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'.])]) # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 6 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html # =========================================================================== # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the specified # version of the C++ standard. If necessary, add switches to CXX and # CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) # or '14' (for the C++14 standard). # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. # -std=c++11). If neither is specified, you get whatever works, with # preference for an extended mode. # # The third argument, if specified 'mandatory' or if left unspecified, # indicates that baseline support for the specified C++ standard is # required and that the macro should error out if no mode with that # support is found. If specified 'optional', then configuration proceeds # regardless, after defining HAVE_CXX${VERSION} if and only if a # supporting mode is found. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # Copyright (c) 2016, 2018 Krzesimir Nowak # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 10 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], [$1], [14], [ax_cxx_compile_alternatives="14 1y"], [$1], [17], [ax_cxx_compile_alternatives="17 1z"], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], [$2], [ext], [], [$2], [noext], [], [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], [$3], [optional], [ax_cxx_compile_cxx$1_required=false], [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) AC_LANG_PUSH([C++])dnl ac_success=no m4_if([$2], [noext], [], [dnl if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do switch="-std=gnu++${alternative}" cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done fi]) m4_if([$2], [ext], [], [dnl if test x$ac_success = xno; then dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl Cray's crayCC needs "-h std=c++11" for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done if test x$ac_success = xyes; then break fi done fi]) AC_LANG_POP([C++]) if test x$ax_cxx_compile_cxx$1_required = xtrue; then if test x$ac_success = xno; then AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) fi fi if test x$ac_success = xno; then HAVE_CXX$1=0 AC_MSG_NOTICE([No compiler with C++$1 support was found]) else HAVE_CXX$1=1 AC_DEFINE(HAVE_CXX$1,1, [define if the compiler supports basic C++$1 syntax]) fi AC_SUBST(HAVE_CXX$1) ]) dnl Test body for checking C++11 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 ) dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 ) m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 ) dnl Tests for new features in C++11 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual void f() {} }; struct Derived : public Base { virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L ]]) dnl Tests for new features in C++14 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ // If the compiler admits that it is not ready for C++14, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201402L #error "This is not a C++14 compiler" #else namespace cxx14 { namespace test_polymorphic_lambdas { int test() { const auto lambda = [](auto&&... args){ const auto istiny = [](auto x){ return (sizeof(x) == 1UL) ? 1 : 0; }; const int aretiny[] = { istiny(args)... }; return aretiny[0]; }; return lambda(1, 1L, 1.0f, '1'); } } namespace test_binary_literals { constexpr auto ivii = 0b0000000000101010; static_assert(ivii == 42, "wrong value"); } namespace test_generalized_constexpr { template < typename CharT > constexpr unsigned long strlen_c(const CharT *const s) noexcept { auto length = 0UL; for (auto p = s; *p; ++p) ++length; return length; } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("x") == 1UL, ""); static_assert(strlen_c("test") == 4UL, ""); static_assert(strlen_c("another\0test") == 7UL, ""); } namespace test_lambda_init_capture { int test() { auto x = 0; const auto lambda1 = [a = x](int b){ return a + b; }; const auto lambda2 = [a = lambda1(x)](){ return a; }; return lambda2(); } } namespace test_digit_separators { constexpr auto ten_million = 100'000'000; static_assert(ten_million == 100000000, ""); } namespace test_return_type_deduction { auto f(int& x) { return x; } decltype(auto) g(int& x) { return x; } template < typename T1, typename T2 > struct is_same { static constexpr auto value = false; }; template < typename T > struct is_same { static constexpr auto value = true; }; int test() { auto x = 0; static_assert(is_same::value, ""); static_assert(is_same::value, ""); return x; } } } // namespace cxx14 #endif // __cplusplus >= 201402L ]]) dnl Tests for new features in C++17 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ // If the compiler admits that it is not ready for C++17, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201703L #error "This is not a C++17 compiler" #else #include #include #include namespace cxx17 { namespace test_constexpr_lambdas { constexpr int foo = [](){return 42;}(); } namespace test::nested_namespace::definitions { } namespace test_fold_expression { template int multiply(Args... args) { return (args * ... * 1); } template bool all(Args... args) { return (args && ...); } } namespace test_extended_static_assert { static_assert (true); } namespace test_auto_brace_init_list { auto foo = {5}; auto bar {5}; static_assert(std::is_same, decltype(foo)>::value); static_assert(std::is_same::value); } namespace test_typename_in_template_template_parameter { template typename X> struct D; } namespace test_fallthrough_nodiscard_maybe_unused_attributes { int f1() { return 42; } [[nodiscard]] int f2() { [[maybe_unused]] auto unused = f1(); switch (f1()) { case 17: f1(); [[fallthrough]]; case 42: f1(); } return f1(); } } namespace test_extended_aggregate_initialization { struct base1 { int b1, b2 = 42; }; struct base2 { base2() { b3 = 42; } int b3; }; struct derived : base1, base2 { int d; }; derived d1 {{1, 2}, {}, 4}; // full initialization derived d2 {{}, {}, 4}; // value-initialized bases } namespace test_general_range_based_for_loop { struct iter { int i; int& operator* () { return i; } const int& operator* () const { return i; } iter& operator++() { ++i; return *this; } }; struct sentinel { int i; }; bool operator== (const iter& i, const sentinel& s) { return i.i == s.i; } bool operator!= (const iter& i, const sentinel& s) { return !(i == s); } struct range { iter begin() const { return {0}; } sentinel end() const { return {5}; } }; void f() { range r {}; for (auto i : r) { [[maybe_unused]] auto v = i; } } } namespace test_lambda_capture_asterisk_this_by_value { struct t { int i; int foo() { return [*this]() { return i; }(); } }; } namespace test_enum_class_construction { enum class byte : unsigned char {}; byte foo {42}; } namespace test_constexpr_if { template int f () { if constexpr(cond) { return 13; } else { return 42; } } } namespace test_selection_statement_with_initializer { int f() { return 13; } int f2() { if (auto i = f(); i > 0) { return 3; } switch (auto i = f(); i + 4) { case 17: return 2; default: return 1; } } } namespace test_template_argument_deduction_for_class_templates { template struct pair { pair (T1 p1, T2 p2) : m1 {p1}, m2 {p2} {} T1 m1; T2 m2; }; void f() { [[maybe_unused]] auto p = pair{13, 42u}; } } namespace test_non_type_auto_template_parameters { template struct B {}; B<5> b1; B<'a'> b2; } namespace test_structured_bindings { int arr[2] = { 1, 2 }; std::pair pr = { 1, 2 }; auto f1() -> int(&)[2] { return arr; } auto f2() -> std::pair& { return pr; } struct S { int x1 : 2; volatile double y1; }; S f3() { return {}; } auto [ x1, y1 ] = f1(); auto& [ xr1, yr1 ] = f1(); auto [ x2, y2 ] = f2(); auto& [ xr2, yr2 ] = f2(); const auto [ x3, y3 ] = f3(); } namespace test_exception_spec_type_system { struct Good {}; struct Bad {}; void g1() noexcept; void g2(); template Bad f(T*, T*); template Good f(T1*, T2*); static_assert (std::is_same_v); } namespace test_inline_variables { template void f(T) {} template inline T g(T) { return T{}; } template<> inline void f<>(int) {} template<> int g<>(int) { return 5; } } } // namespace cxx17 #endif // __cplusplus < 201703L ]]) # ============================================================================= # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html # ============================================================================= # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the C++11 # standard; if necessary, add switches to CXX and CXXCPP to enable # support. # # This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX # macro with the version set to C++11. The two optional arguments are # forwarded literally as the second and third argument respectively. # Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for # more information. If you want to use this macro, you also need to # download the ax_cxx_compile_stdcxx.m4 file. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik # Copyright (c) 2012 Zack Weinberg # Copyright (c) 2013 Roy Stogner # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov # Copyright (c) 2015 Paul Norman # Copyright (c) 2015 Moritz Klammler # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 18 AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) # Copyright (C) 2002-2020 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.16' 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.16.2], [], [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.16.2])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-2020 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], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2020 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_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$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-2020 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. # 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", "OBJC", "OBJCXX", "UPC", or "GJC". # 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 m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" 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". rm -rf conftest.dir 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 10 /bin/sh. echo '/* dummy */' > 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 ;; msvc7 | msvc7msys | 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], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2020 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_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf 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. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _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. # This creates each '.Po' and '.Plo' makefile fragment that we'll 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" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2020 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 macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # 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.65])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], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) 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], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [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([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). 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])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro 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 # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) 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-2020 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+set}" != 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-2020 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. # 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-2020 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_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 enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]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 ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2020 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_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2020 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_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 is modern enough. # If it is, 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 --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2020 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_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])]) # Copyright (C) 1999-2020 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_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2020 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_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2020 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_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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 if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done 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]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2020 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_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2020 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-2020 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_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-2020 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_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. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} 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]) m4_include([m4/pkg.m4]) GeographicLib-1.52/Makefile.in0000644000771000077100000007452414064202402016071 0ustar ckarneyckarney# Makefile.in generated by automake 1.16.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 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 VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = . 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)/m4/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) 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 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in \ $(top_srcdir)/include/GeographicLib/Config-ac.h.in AUTHORS \ INSTALL NEWS compile config.guess config.sub depcomp \ install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_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 DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COL = @COL@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@ GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@ GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ 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@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POD2HTML = @POD2HTML@ POD2MAN = @POD2MAN@ 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@ pkgconfigdir = @pkgconfigdir@ 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 js include matlab python cmake examples EXTRA_DIST = AUTHORS 00README.txt LICENSE.txt NEWS INSTALL README.md \ Makefile.mk CMakeLists.txt windows maxima doc legacy java js dotnet \ wrapper # Install the pkg-config file; the directory is set using # PKG_INSTALLDIR in configure.ac. pkgconfig_DATA = cmake/geographiclib.pc all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(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 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__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ 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 @test -f $@ || rm -f include/GeographicLib/stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) include/GeographicLib/stamp-h1 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 install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ 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) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_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*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(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/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(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__post_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: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { 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 $(DATA) all-local installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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-pkgconfigDATA 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: uninstall-pkgconfigDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \ dist-tarZ dist-xz dist-zip dist-zstd 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-pkgconfigDATA 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-am uninstall \ uninstall-am uninstall-pkgconfigDATA .PRECIOUS: Makefile dist-hook: rm -rf $(distdir)/doc/html $(distdir)/doc/manpages \ $(distdir)/doc/GeographicLib.dox find $(distdir)/maxima -type f -name '*.lsp' | xargs rm -rf rm -rf $(distdir)/java/targets find $(distdir)/java -type f -name '*.class' | xargs rm -rf find $(distdir)/wrapper -mindepth 2 -type d | xargs rm -rf find $(distdir)/wrapper -type f -name '*.o' -o -name '*.mex*' | \ xargs rm -f 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 sed -e "s/Unconfigured/$(PACKAGE_VERSION)/" \ -e "s/MAJOR .*/MAJOR ${GEOGRAPHICLIB_VERSION_MAJOR}/" \ -e "s/MINOR .*/MINOR ${GEOGRAPHICLIB_VERSION_MINOR}/" \ -e "s/PATCH .*/PATCH ${GEOGRAPHICLIB_VERSION_PATCH}/" \ $(top_srcdir)/include/GeographicLib/Config.h > \ $(distdir)/include/GeographicLib/Config.h # Custom rules all-local: man doc install-data-local: install-doc doc: man $(MAKE) -C doc doc install-doc: $(MAKE) -C doc install-doc man: $(MAKE) -C man man .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.52/Makefile0000644000771000077100000000002414064202407015451 0ustar ckarneyckarneyinclude Makefile.mk

Online documentation for the @TOOL@ utility is available at
https://geographiclib.sourceforge.io/@PROJECT_VERSION@/@TOOL@.1.html.

You will be redirected there. Click on the link to go there directly.