aboutsummaryrefslogtreecommitdiff
path: root/src/projections/tmerc.cpp
AgeCommit message (Collapse)Author
2020-12-15Remap ENOMEM from PROJ_ERR_INVALID_OP to PROJ_ERR_OTHEREven Rouault
2020-12-15tmerc exact: set errno to PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN ↵Even Rouault
when it returns invalid coordinate
2020-12-15Revise error codes to have a reduced set exposed in the public API.Even Rouault
Fixes #2482 And also add proj_context_errno_string() Revise gie 'expect failure errno XXXX' strings
2020-11-29Spherical tmerc forward: do not restrict to [-90,90] longitude rangeEven Rouault
The restriction was a copy&paste from the Evenden/Snyder approximate ellipsoidal implementation, but the spherical one is exact, so this restriction isn't needed. Also tune a bit the handling of lat=0, |lon| > 90
2020-11-29Inverse tmerc spherical: fix wrong sign of latitude when lat_0 is used ↵Even Rouault
(fixes #2468) Corrected formula given by @evanmiller
2020-11-20Remove old pj_ memory (de)allocation functionsKristian Evers
Gone are pj_malloc, pj_calloc, pj_dalloc and pj_dealloc. Their primary function as API memory functions in proj_api.h is no longer there and the other use as a workaround for old errno problems is no longer valid either. Replaced with malloc and free across the codebase.
2020-11-20Remove pj_ctx_* functions and use their proj_context counterpartsKristian Evers
2020-09-27tmerc: setup_exact(): do not recompute third flattening already available as ↵Even Rouault
P->n
2020-08-19Revert compiler generated Fused Multiply Addition optimized routines (#2327)Even Rouault
Fixes #2326 Partially reverts commit b84c9d0cb61f3bd561da6092e15e294ae7e410e0 to remove the use of the gcc 6 mechanism of generated multiple versions of functions with different optimization flags, which was found to causes crashes when dlopen'ing PROJ on CentOS 7.8 with gcc 8.3.1
2020-05-09scripts/fix_typos.sh: fix URLs to dictionaries, and fix typos spottedEven Rouault
2020-04-21Typo fixes in code comments [ci skip]Even Rouault
2020-04-16Merge pull request #2030 from rouault/auto_sel_of_tmerc_algEven Rouault
tmerc/utm: add a +algo=auto/evenden_snyder/poder_engsager parameter
2020-04-15tmerc/utm: add a +algo=auto/evenden_snyder/poder_engsager parameterEven Rouault
The default remains +alg=poder_engsager. This default value can be changed in proj.ini +algo=auto will use Evenden Synder implementation if the error in doing so remains below 0.1 mm on Earth-sized ellipsoid
2020-04-13Extended tmerc: speed-up forward path by ~5%Even Rouault
Saves a useless sqrt() call
2020-04-06autoconf build: fix build on Alpine 3.11 where ↵Even Rouault
__attribute__((target_clones("fma","default"))) doesn't work for some reason
2020-04-06Move inline code for optimize mlfn from tmerc to mlfn.hpp to avoid code ↵Even Rouault
duplication
2020-03-29Merge pull request #2039 from rouault/speedup_snyder_tmercEven Rouault
Approximate tmerc (Snyder): speed optimizations
2020-03-29Merge pull request #2036 from rouault/speedup_poder_engsager_tmercEven Rouault
Extended tmerc (Poder/Engsager): speed optimizations
2020-03-10utm/ups: make sure to set errno to PJD_ERR_ELLIPSOID_USE_REQUIRED if es==0Even Rouault
ENOMEM was wrongly set after setting PJD_ERR_ELLIPSOID_USE_REQUIRED Note: it is a bit strange to forbid the pure spherical case whereas the maths would allow it. I presume this is due to the typical usage of those methods.
2020-03-09Approximate tmerc (Snyder): speed optimizationsEven Rouault
fwd: 7% faster on Core-i7@2.6GHz (with FMA triggered), 22% faster on GCE Xeon@2GHz (with FMA) inv: 31% faster on Core-i7@2.6GHz (with FMA triggered), 60% faster on GCE Xeon@2GHz (with FMA) The optimizations consists in different things: - optionaly use the FMA (Fused Multiply Addition) instruction set with gcc >= 6. Binaries are generated with the standard instruction set (SSE/SSE2), and with one variant with FMA, and the appropriate version is selected automatically at runtime. This gives a modest speedup, but measurable. The speedup is more obvious on lower clocked CPU. - inline mlfn and inv_mlfn - for inv_mlfn avoid recomputation of sin()/cos() at each iteration stage, by observing that the argument changes in modest way at each iteration, and using approximation of sin()/cos(). The differences due to that approximation are way below the 1e-11 tolerance threshold. Different in results are neglectable (only found in areas where the approximations of the Snyder formulas are already no longer valid) Before: $ echo 8e5 9e6 | src/proj -d 12 +proj=utm +zone=31 -I +approx | src/proj -d 12 +proj=utm +zone=31 +approx 799997.896522093331 8999999.520601103082 $ echo 8e5 5e6 | src/proj -d 12 +proj=utm +zone=31 -I +approx | src/proj -d 12 +proj=utm +zone=31 +approx 800000.000007762224 4999999.999971268699 $ echo 18e5 9e6 | src/proj -d 12 +proj=utm +zone=31 -I +approx | src/proj -d 12 +proj=utm +zone=31 +approx 1079182.990696100984 8661150.574729491025 $ echo 18e5 5e6 | src/proj -d 12 +proj=utm +zone=31 -I +approx | src/proj -d 12 +proj=utm +zone=31 +approx 1799997.510861013783 4999999.567328464240 After: $ echo 8e5 9e6 | src/proj -d 12 +proj=utm +zone=31 -I +approx | src/proj -d 12 +proj=utm +zone=31 +approx 799997.896522093331 8999999.520601103082 $ echo 8e5 5e6 | src/proj -d 12 +proj=utm +zone=31 -I +approx | src/proj -d 12 +proj=utm +zone=31 +approx 800000.000007762224 4999999.999971268699 $ echo 18e5 9e6 | src/proj -d 12 +proj=utm +zone=31 -I +approx | src/proj -d 12 +proj=utm +zone=31 +approx 1079182.990696124267 8661150.574729502201 $ echo 18e5 5e6 | src/proj -d 12 +proj=utm +zone=31 -I +approx | src/proj -d 12 +proj=utm +zone=31 +approx 1799997.510861013783 4999999.567328464240
2020-03-09Extended tmerc (Poder/Engsager): speed optimizationsEven Rouault
fwd: 52% faster on Core-i7@2.6GHz, 40% faster on GCE Xeon@2GHz inv: 24% faster on Core-i7@2.6GHz, 36% faster on GCE Xeon@2GHz Those speed-ups are obtained due to elimination of a number of transcendental functions (atan, sincos, cosh, sinh), through the use of usual trigonometric/hyperbolic formulas. The numeric results before/after seem identical at worse up to 14 decimal digits, which is way beyond the apparent accuracy of the computations On a point, far from central meridian, where round-tripping is not so great: Before: echo "81 1" | src/proj -d 18 +proj=utm +zone=31 | src/proj -d 18 -I +proj=utm +zone=31 80.999994286593448578 0.999987970918421620 After: $ echo "81 1" | src/proj -d 18 +proj=utm +zone=31 | src/proj -d 18 -I +proj=utm +zone=31 80.999994286593448578 0.999987970918422175 The benchmarking program used is: ``` #include "proj.h" #include <stdlib.h> #include <stdio.h> #include <string.h> int main(int argc, char* argv[]) { if( argc != 3 ) { fprintf(stderr, "Usage: bench quoted_proj_string fwd/inv\n"); exit(1); } PJ* p = proj_create(0, argv[1]); const int dir = strcmp(argv[2], "inv") == 0 ? PJ_INV : PJ_FWD; PJ_COORD coord; if( dir == PJ_FWD ) { coord.xy.x = 0.5; // rad coord.xy.y = 0.5; // rad } else { coord.xy.x = 450000; // m coord.xy.y = 5000000; // m } for(int i = 0; i < 40 * 1000* 1000; i++) proj_trans(p, dir, coord); proj_destroy(p); return 0; } ```
2020-03-08src/projections/: remove assignments in expression and multiple statements ↵Even Rouault
per line Should hopefully result in no change in results, and hopefully more readable code...
2019-09-18Delete proj_math.h. Replace includes by <math.h>; we'll see if anyoneCharles Karney
needs <limits.h>. Update scripts/reference_exported_symbols.txt and src/proj_symbol_rename.h.
2019-03-24tmerc inverse: avoid division by zeroEven Rouault
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13893 Credit to OSS Fuzz
2019-02-11Make tmerc an alias for etmerc. (#1234)Kristian Evers
* Make tmerc an alias for etmerc This switches the algorithm used in tmerc to the Poder/Engsager tmerc algorithm. The original tmerc algorithm of Evenden/Snyder origin can still be accessed by adding the +approx flag when initializing a tmerc projection. The +approx flag can also be used when initializing UTM projections, in which case the Evenden/Snyder algorithm is used as well. If a tmerc projection is instantiated on a spherical earth the Evenden/Snyder algorithm is used as well since the Poder/Engsager algorithm is only defined on the ellipsoid. +proj=etmerc can still be instantiated for backwards compatibility reasons. Co-authored-by: Kristian Evers <kristianevers@gmail.com> Co-authored-by: Even Rouault <even.rouault@spatialys.com>
2018-12-30Merge projects.h into proj_internal.hEven Rouault
2018-12-30projects.h: remove deprecated XY, XYZ, LP, LPZ, UV, UVW, projUV and projUVW ↵Even Rouault
structures
2018-12-26cpp conversion: remove useless pj_, PJ_ and proj_ filename prefixesEven Rouault