Skip to content

Commit

Permalink
1.0.6: Proj string output
Browse files Browse the repository at this point in the history
  • Loading branch information
zvezdochiot committed Jun 26, 2022
1 parent d394723 commit 6e9ec0d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/helmeltrans.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int main(int argc, char* argv[])
exit(EXIT_FAILURE);
}
command = argv[1];
if (!strcmp(command,"xyz"))
if (!strcmp(command,"xyz"))
{
fprintf(stdout,"B-L-H -> X-Y-Z...\n");
}
Expand Down Expand Up @@ -124,7 +124,7 @@ int main(int argc, char* argv[])
}
else
ofile = stdout;

if(ofile == NULL)
{
fprintf(stderr,"Error writing %s\n",ofilename);
Expand All @@ -142,9 +142,9 @@ int main(int argc, char* argv[])
fprintf(stdout,"Ellipsoid %s, a = %lf, b = %lf\n", name, a, b);
a2 = a * a;
b2 = b * b;
ro = M_PI / 180.0;
roi = 180.0 / M_PI;
if (!strcmp(command,"xyz"))
ro = DEG2RAD;
roi = RAD2DEG;
if (!strcmp(command,"xyz"))
{
while(fgets( ibuf, 256, ifile)!=NULL)
{
Expand Down
5 changes: 4 additions & 1 deletion src/helmert3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define VERS "1.0.5"
#define VERS "1.0.6"
#define C_AUTHOR "U. Niethammer"
#define C_YEAR "2021"
#define DEBUG 0
#define DEG2RAD (M_PI / 180.0)
#define RAD2DEG (180 / M_PI)
#define RAD2SEC (RAD2DEG * 3600)

#endif // HELMERT3D_H
9 changes: 8 additions & 1 deletion src/helmparms3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ int main(int argc, char* argv[])
double **R_mat=NULL;
double trace1=0.0, trace2=0.0;
double scal=0.0, ppm=0.0;
double rx=0.0, ry=0.0, rz=0.0;
FILE *outfile;

fprintf(stdout,"\n*******************************\n");
Expand Down Expand Up @@ -514,7 +515,7 @@ int main(int argc, char* argv[])
fprintf(stderr,"Error writing %s\n",out_param_name);
exit(EXIT_FAILURE);
}

matrix_init(n, m, src_mat_T);
matrix_transpose(n, n, R_mat, src_mat_T);
fprintf(stdout,"R =\n");
Expand All @@ -529,6 +530,12 @@ int main(int argc, char* argv[])

fprintf(stdout,"s = %10.10lf (= %10.10lf ppm)\n\n",scal, ppm);

rx = 0.5 * (src_mat_T[2][1] - src_mat_T[1][2]) * RAD2SEC;
ry = 0.5 * (src_mat_T[0][2] - src_mat_T[2][0]) * RAD2SEC;
rz = 0.5 * (src_mat_T[1][0] - src_mat_T[0][1]) * RAD2SEC;
fprintf(stdout,"Proj string:\n");
fprintf(stdout,"+towgs84=%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f\n\n", T_vec[0], T_vec[1], T_vec[2], rx, ry, rz, ppm);

if(argc < 4)
{
fprintf(stdout,"Results matrix:\n");
Expand Down

1 comment on commit 6e9ec0d

@zvezdochiot
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.