-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40231a4
commit 4a16f2e
Showing
6 changed files
with
225 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
.TH "helmdiff3d" 1 1.0.1 "11 Feb 2021" "User Manual" | ||
|
||
.SH NAME | ||
helmdiff3d | ||
|
||
.SH DESCRIPTION | ||
Diff 3D Helmert transformation Tool | ||
|
||
.SH SYNOPSIS | ||
helmdiff3d [xyz_src_infilename] [xyz_dest_infilename] [xyz_diff_outfilename] | ||
|
||
.SH FILES | ||
.TP | ||
xyz data file format: | ||
|
||
x[1] y[1] z[1] | ||
.. .. .. | ||
.. .. .. | ||
x[n] y[n] z[n] | ||
|
||
.SH EXAMPLE | ||
export EXAMP=/usr/share/doc/helmert3d/examples/ | ||
|
||
helmparms3d $EXAMP/testpoints_src.txt $EXAMP/testpoints_dest.txt testparms.txt | ||
helmert3d $EXAMP/testpoints_src.txt testparms.txt destpoints.txt | ||
helmdiff3d $EXAMP/testpoints_dest.txt destpoints.txt diffpoints.txt | ||
|
||
.SH COPYRIGHT | ||
helmert3d: | ||
|
||
Copyright (c) 2020 U. Niethammer | ||
|
||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
||
.SH SEE ALSO | ||
helmparms3d(1), | ||
helmert3d(1) | ||
|
||
.SH CONTACT | ||
Website: https://github.com/dr-ni/helmert3d | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* Copyright (C) 2011 U. Niethammer, http://helmparms3d.sourceforge.net/ | ||
* | ||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#include "helmert3d.h" | ||
|
||
static size_t get_m_size(char *filename) | ||
{ | ||
FILE *ptsfile; | ||
char buf[256]; | ||
size_t linecount=0; | ||
|
||
memset(buf, 0, sizeof(buf)); | ||
ptsfile = fopen( filename, "r"); | ||
if(ptsfile == NULL) | ||
{ | ||
fprintf(stderr,"Error opening %s\r\n",filename); | ||
exit(EXIT_FAILURE); | ||
} | ||
// Count points | ||
while(fgets( buf, 128, ptsfile)!=NULL) | ||
{ | ||
if( strcmp(buf,"\n") != 0 && strcmp(buf,"\r\n") != 0 && strcmp(buf,"\0") != 0) | ||
{ | ||
linecount++; | ||
} | ||
else | ||
{ | ||
fprintf(stderr,"Error, %s: wrong data format\n",filename); | ||
exit(EXIT_FAILURE); | ||
} | ||
} | ||
(void)fclose(ptsfile); | ||
return(linecount); | ||
} | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
FILE *ifile; | ||
FILE *cfile; | ||
FILE *ofile; | ||
char *ifilename = ""; | ||
char *cfilename = ""; | ||
char *ofilename = "diff.xyz"; | ||
char ibuf[256], cbuf[256]; | ||
double xs=0.0, ys=0.0, zs=0.0; | ||
double xc=0.0, yc=0.0, zc=0.0; | ||
double xout=0.0, yout=0.0, zout=0.0; | ||
size_t l=0; | ||
int stat=0; | ||
|
||
fprintf(stdout,"\n*******************************\n"); | ||
fprintf(stdout, "* helmdiff3d v%s *\n",VERS); | ||
fprintf(stdout, "* (c) U. Niethammer 2020 *\n"); | ||
fprintf(stdout, "*******************************\n"); | ||
|
||
if(argc < 3) | ||
{ | ||
fprintf(stdout,"\nSyntax: %s [xyz_src_infilename] [xyz_dest_infilename] [xyz_diff_outfilename]\n\n",argv[0]); | ||
fprintf(stdout,"xyz data file format:\n"); | ||
fprintf(stdout," x[1] y[1] z[1]\n .. .. ..\n .. .. ..\n x[n] y[n] z[n]\n\n"); | ||
exit(EXIT_FAILURE); | ||
} | ||
fprintf(stdout,"Reading points...\n"); | ||
ifilename = argv[1]; | ||
l = get_m_size(ifilename); | ||
fprintf(stdout,"Found %lu points\n",(unsigned long)l); | ||
ifile = fopen( ifilename, "r"); | ||
if(ifile == NULL) | ||
{ | ||
fprintf(stderr,"Error opening %s\n",ifilename); | ||
exit(EXIT_FAILURE); | ||
} | ||
cfilename = argv[2]; | ||
l = get_m_size(cfilename); | ||
fprintf(stdout,"Found %lu points\n",(unsigned long)l); | ||
cfile = fopen( cfilename, "r"); | ||
if(cfile == NULL) | ||
{ | ||
fprintf(stderr,"Error opening %s\n",cfilename); | ||
exit(EXIT_FAILURE); | ||
} | ||
if(argc > 3) | ||
{ | ||
ofilename = argv[3]; | ||
} | ||
ofile = fopen( ofilename, "w"); | ||
if(ofile == NULL) | ||
{ | ||
fprintf(stderr,"Error writing %s\n",ofilename); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
fprintf(stdout,"Starting diff...\n"); | ||
while(fgets( ibuf, 128, ifile)!=NULL && fgets( cbuf, 128, cfile)!=NULL) | ||
{ | ||
stat=sscanf( ibuf, "%lf %lf %lf", &xs, &ys, &zs); | ||
if(stat != 3) | ||
{ | ||
fprintf(stderr,"Error wrong data format in %s\n",ifilename); | ||
exit(EXIT_FAILURE); | ||
} | ||
stat=sscanf( cbuf, "%lf %lf %lf", &xc, &yc, &zc); | ||
if(stat != 3) | ||
{ | ||
fprintf(stderr,"Error wrong data format in %s\n",cfilename); | ||
exit(EXIT_FAILURE); | ||
} | ||
xout=xs-xc; | ||
yout=ys-yc; | ||
zout=zs-zc; | ||
fprintf(ofile,"%lf %lf %lf\n", xout , yout , zout); | ||
} | ||
fprintf(stdout,"...done\nResults written to %s\n", ofilename); | ||
(void)fclose(ifile); | ||
(void)fclose(cfile); | ||
(void)fclose(ofile); | ||
return(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Copyright (C) 2011 U. Niethammer, http://helmparms3d.sourceforge.net/ | ||
* | ||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#ifndef HELMERT3D_H | ||
#define HELMERT3D_H | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#define VERS "1.0.1" | ||
#define DEBUG 0 | ||
|
||
#endif // HELMERT3D_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4a16f2e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ Added utility for comparing the resulting coordinates.