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 /docs/source/development/reference/cpp/cpp_general.rst | |
| 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 'docs/source/development/reference/cpp/cpp_general.rst')
0 files changed, 0 insertions, 0 deletions
