diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-04-11 19:32:50 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-04-11 19:37:55 +0200 |
| commit | 78c1df51e0621a4e0b2314f3af9478627e018db3 (patch) | |
| tree | a48fefc050aa9c8b1f4571dcc52fd2588dc3d628 /test/gie/more_builtins.gie | |
| parent | 21ebdfb89bc4b222c4fb78815971b19192a2a09e (diff) | |
| download | PROJ-78c1df51e0621a4e0b2314f3af9478627e018db3.tar.gz PROJ-78c1df51e0621a4e0b2314f3af9478627e018db3.zip | |
Inverse cart: speed-up computation by 33%
Saves 2 sincos() and 1 atan2() calls.
With the following bench
```
#include "proj.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
if( argc != 2 ) {
fprintf(stderr, "Usage: bench_inv_cart fwd/inv\n");
exit(1);
}
PJ* p = proj_create(0, "+proj=cart");
const int dir = strcmp(argv[1], "inv") == 0 ? PJ_INV : PJ_FWD;
PJ_COORD coord;
if( dir == PJ_FWD )
{
coord.xyz.x = 3.14159/2;
coord.xyz.y = 3.14159/2;
coord.xyz.z = 100;
}
else
{
coord.xyz.x = 3e6;
coord.xyz.y = 3e6;
coord.xyz.z = 3e6;
}
for(int i = 0; i < 10* 1024 * 1024; i++ )
{
proj_trans(p, dir, coord);
}
proj_destroy(p);
return 0;
}
```
On Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Time before: 2.37s
Time after: 1.57s
Diffstat (limited to 'test/gie/more_builtins.gie')
| -rw-r--r-- | test/gie/more_builtins.gie | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie index a3e9d398..323b85c1 100644 --- a/test/gie/more_builtins.gie +++ b/test/gie/more_builtins.gie @@ -840,6 +840,12 @@ expect 180 0 0 accept 0 0 0 expect 0 90 -6356752.314140356 +accept 0 0 1e-6 +expect 0 90 -6356752.314139356 + +accept 0 0 -1e-6 +expect 0 -90 -6356752.314139356 + ------------------------------------------------------------------------------- # Test handling of endianness of NTv2 grids |
