From d77fbff752eb4bb877eafba80a74673e2d393cf5 Mon Sep 17 00:00:00 2001 From: zvezdochiot Date: Sun, 19 Dec 2021 01:59:30 +0300 Subject: [PATCH] 2.9: use mean in coordinate deformation --- Makefile | 21 +++++++++++++++- README.md | 2 ++ doc/CHANGELOG | 16 +++++++++++++ man/man1/geodeform500.1 | 4 +++- man/man1/geofindkey.1 | 2 +- man/man1/geofindkey2p.1 | 2 +- man/man1/geositer500.1 | 2 +- man/man1/geoszbtoyxh.1 | 2 +- src/geodeform500.c | 53 ++++++++++++++++++++++++++++++++++------- src/geofindkey.c | 6 ++--- src/geofindkey2p.c | 6 ++--- src/geositer500.c | 6 ++--- src/geoszbtoyxh.c | 6 ++--- 13 files changed, 102 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 0863c3c..45b4e60 100644 --- a/Makefile +++ b/Makefile @@ -14,13 +14,15 @@ REL = 2 PREFIX = /usr/local INSTALL = install LN = ln -fs +GROFF2PDF = groff -m man -T pdf +RM = rm -f .PHONY: all clean install all: $(PROGS) clean: - rm -f $(PROGS) + $(RM) $(PROGS) man_*.pdf $(PROGNAME1): $(SRCS)/$(PROGNAME1).c $(CPP) $(CFLAGS) $^ -o $@ $(LIBS) @@ -37,6 +39,23 @@ $(PROGNAME4): $(SRCS)/$(PROGNAME4).c $(PROGNAME5): $(SRCS)/$(PROGNAME5).c $(CPP) $(CFLAGS) $^ -o $@ $(LIBS) +manual: man_$(PROGNAME1).pdf man_$(PROGNAME2).pdf man_$(PROGNAME3).pdf man_$(PROGNAME4).pdf man_$(PROGNAME5).pdf + +man_$(PROGNAME1).pdf: man/man1/$(PROGNAME1).1 + $(GROFF2PDF) $^ > $@ + +man_$(PROGNAME2).pdf: man/man1/$(PROGNAME2).1 + $(GROFF2PDF) $^ > $@ + +man_$(PROGNAME3).pdf: man/man1/$(PROGNAME3).1 + $(GROFF2PDF) $^ > $@ + +man_$(PROGNAME4).pdf: man/man1/$(PROGNAME4).1 + $(GROFF2PDF) $^ > $@ + +man_$(PROGNAME5).pdf: man/man1/$(PROGNAME5).1 + $(GROFF2PDF) $^ > $@ + install: $(PROGS) $(INSTALL) -d $(PREFIX)/bin $(INSTALL) -m 0755 $(PROGS) $(PREFIX)/bin/ diff --git a/README.md b/README.md index 022aa38..01bdefd 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,8 @@ Exec finding unknown distances: Result gpsout.dat: ``` +Mean: 3 +M 2508.9040 5588.8650 124.2887 2508.7340 5589.0163 124.5183 Deformation coordinate base: 3 (CONST) A 2303.4430 5622.9030 149.3070 2302.8540 5623.2230 148.8560 diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 8228394..82a52f1 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -2,6 +2,22 @@ Name: GeoFindKey OldName: FindKey URL: https://github.com/Geo-Linux-Calculations/geofindkey +2.9 + + use mean in coordinate deformation + +2.8 + + add atmospheric refractive index + +2.7 + + deformation of coordinates by the "unit spheres" method. + +2.6 + + rescale to sea level + 2.5 dZ of radius Earth diff --git a/man/man1/geodeform500.1 b/man/man1/geodeform500.1 index 1a91c3b..82596ca 100644 --- a/man/man1/geodeform500.1 +++ b/man/man1/geodeform500.1 @@ -1,4 +1,4 @@ -.TH "GeoDeform500" 1 2.8 "15 Dec 2021" "User Manual" +.TH "GeoDeform500" 1 2.9 "19 Dec 2021" "User Manual" .SH NAME geodeform500 @@ -45,6 +45,8 @@ input-file .TP report-file (sample): + Mean: 3 + M 2508.9040 5588.8650 124.2887 2508.7340 5589.0163 124.5183 Deformation coordinate base: 3 (CONST) A 2303.4430 5622.9030 149.3070 2302.8540 5623.2230 148.8560 diff --git a/man/man1/geofindkey.1 b/man/man1/geofindkey.1 index 6b0092e..c39aeca 100644 --- a/man/man1/geofindkey.1 +++ b/man/man1/geofindkey.1 @@ -1,4 +1,4 @@ -.TH "GeoFindKey" 1 2.8 "15 Dec 2021" "User Manual" +.TH "GeoFindKey" 1 2.9 "19 Dec 2021" "User Manual" .SH NAME geofindkey diff --git a/man/man1/geofindkey2p.1 b/man/man1/geofindkey2p.1 index 6ad6283..b982c92 100644 --- a/man/man1/geofindkey2p.1 +++ b/man/man1/geofindkey2p.1 @@ -1,4 +1,4 @@ -.TH "GeoFindKey2Pow" 1 2.8 "15 Dec 2021" "User Manual" +.TH "GeoFindKey2Pow" 1 2.9 "19 Dec 2021" "User Manual" .SH NAME geofindkey2p diff --git a/man/man1/geositer500.1 b/man/man1/geositer500.1 index db8d3b3..5306ca7 100644 --- a/man/man1/geositer500.1 +++ b/man/man1/geositer500.1 @@ -1,4 +1,4 @@ -.TH "GeoSIter500" 1 2.8 "15 Dec 2021" "User Manual" +.TH "GeoSIter500" 1 2.9 "19 Dec 2021" "User Manual" .SH NAME geositer500 diff --git a/man/man1/geoszbtoyxh.1 b/man/man1/geoszbtoyxh.1 index e8583a5..5baeae1 100644 --- a/man/man1/geoszbtoyxh.1 +++ b/man/man1/geoszbtoyxh.1 @@ -1,4 +1,4 @@ -.TH "GeoSZBtoYXH" 1 2.8 "15 Dec 2021" "User Manual" +.TH "GeoSZBtoYXH" 1 2.9 "19 Dec 2021" "User Manual" .SH NAME geoszbtoyxh diff --git a/src/geodeform500.c b/src/geodeform500.c index c47261f..e677c0d 100644 --- a/src/geodeform500.c +++ b/src/geodeform500.c @@ -1,7 +1,7 @@ /* Name: geodeform500.c -Version: 2.8 -Date: 2021-12-15 +Version: 2.9 +Date: 2021-12-19 Author: zvezdochiot (https://github.com/zvezdochiot) * build: @@ -30,6 +30,8 @@ C* 2748.808 5314.058 109.855 * output file gpsout.dat: * +Mean: 3 +M 2508.9040 5588.8650 124.2887 2508.7340 5589.0163 124.5183 Deformation coordinate base: 3 (CONST) A 2303.4430 5622.9030 149.3070 2302.8540 5623.2230 148.8560 @@ -57,7 +59,7 @@ C* 2748.8080 5314.0580 109.8550 2749.1000 5314.5570 110.5850 #include #define PNAME "GeoDeform500" -#define PVERSION "2.8" +#define PVERSION "2.9" #define defEps 0.000001 #define defMode "CONST" @@ -94,6 +96,8 @@ void geodeform500usage() fprintf(stderr, " C* 2748.808 5314.058 109.855\n"); fprintf(stderr, "\n"); fprintf(stderr, "report-file(sample):\n"); + fprintf(stderr, " Mean: 3\n"); + fprintf(stderr, " M 2508.9040 5588.8650 124.2887 2508.7340 5589.0163 124.5183\n"); fprintf(stderr, " Deformation coordinate base: 3\n"); fprintf(stderr, " (CONST)\n"); fprintf(stderr, " A 2303.4430 5622.9030 149.3070 2302.8540 5623.2230 148.8560\n"); @@ -116,7 +120,7 @@ void geodeform500usage() int main(int argc, char *argv[]) { char buf[1024], name[32], format4[128], format7[128]; - double x[3], y[3], wgt, dy[3]; + double x[3], y[3], xcp[3], ycp[3], wgt, dy[3]; double xd[1500], dxd[1500], r2, r2d[500], w[500], s; unsigned n, i, j, k; int np; @@ -175,6 +179,39 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + for (j = 0; j < 3; j++) + { + xcp[j] = 0.0; + ycp[j] = 0.0; + } + n = 0; + s = 0; + while (fgets(buf, 1024, fp0) != NULL) + { + np = sscanf(buf, "%s %lf %lf %lf %lf %lf %lf %lf", name, &x[0], &x[1], &x[2], &y[0], &y[1], &y[2], &wgt); + if (np >= 8) + { + for (i = 0; i < 3; i++) + { + xcp[i] += (x[i] * wgt); + ycp[i] += (y[i] * wgt); + } + s += wgt; + n++; + } + } + if (s > 0.0) + { + for (j = 0; j < 3; j++) + { + xcp[j] /= s; + ycp[j] /= s; + } + } + fprintf(fp1, "Mean: %d\n", n); + fprintf(fp1, format7, "M", xcp[0], xcp[1], xcp[2], ycp[0], ycp[1], ycp[2]); + rewind(fp0); + n = 0; for (j = 0; j < 1500; j++) { @@ -192,7 +229,7 @@ int main(int argc, char *argv[]) for (i = 0; i < 3; i++) { xd[j + i] = x[i]; - dxd[j + i] = y[i] - x[i]; + dxd[j + i] = (y[i] - ycp[i]) - (x[i] - xcp[i]); r2 += (dxd[i + j] * dxd[i + j]); } r2d[n] = r2 * wgt; @@ -210,7 +247,7 @@ int main(int argc, char *argv[]) np = sscanf(buf, "%s %lf %lf %lf %lf %lf %lf %lf", name, &x[0], &x[1], &x[2], &y[0], &y[1], &y[2], &wgt); if (np >= 4) { - s = 0; + s = 0.0; for (i = 0; i < n; i++) { if (r2d[i] >= 0.0) @@ -233,7 +270,7 @@ int main(int argc, char *argv[]) w[i] = 0.0; } } - if (s > 0) + if (s > 0.0) { s = 1.0 / s; for (i = 0; i < n; i++) @@ -249,7 +286,7 @@ int main(int argc, char *argv[]) dy[i] += dxd[k] * w[j]; k += 3; } - y[i] = x[i] + dy[i]; + y[i] = x[i] + dy[i] + (ycp[i] - xcp[i]); } } else diff --git a/src/geofindkey.c b/src/geofindkey.c index a5e1ba0..41d5302 100644 --- a/src/geofindkey.c +++ b/src/geofindkey.c @@ -1,8 +1,8 @@ /* Name: geofindkey.c OldName: findkey.c -Version: 2.8 -Date: 2021-12-15 +Version: 2.9 +Date: 2021-12-19 Author: Игорь Белов (https://gis-lab.info/forum/memberlist.php?mode=viewprofile&u=10457) Author: zvezdochiot (https://github.com/zvezdochiot) Author: Zoltan Siki (https://github.com/zsiki) @@ -62,7 +62,7 @@ output file report.dat: #include #define PNAME "GeoFindKey" -#define PVERSION "2.8" +#define PVERSION "2.9" #define defMScale "NORM" #define defREarth 6370009.0 diff --git a/src/geofindkey2p.c b/src/geofindkey2p.c index 0390fb2..4d9048b 100644 --- a/src/geofindkey2p.c +++ b/src/geofindkey2p.c @@ -1,7 +1,7 @@ /* Name: geofindkey2p.c -Version: 2.8 -Date: 2021-12-15 +Version: 2.9 +Date: 2021-12-19 Author: zvezdochiot (https://github.com/zvezdochiot) * build: @@ -61,7 +61,7 @@ output file report.dat: #include #define PNAME "GeoFindKey2Pow" -#define PVERSION "2.8" +#define PVERSION "2.9" void geofindkey2ptitle() { diff --git a/src/geositer500.c b/src/geositer500.c index 287276d..c71e4a7 100644 --- a/src/geositer500.c +++ b/src/geositer500.c @@ -1,7 +1,7 @@ /* Name: geositer500.c -Version: 2.8 -Date: 2021-12-15 +Version: 2.9 +Date: 2021-12-19 Author: zvezdochiot (https://github.com/zvezdochiot) Author: Zoltan Siki (https://github.com/zsiki) * @@ -54,7 +54,7 @@ OKD-12 3.8890 288.39138889 133.60805556 #include #define PNAME "GeoSIter500" -#define PVERSION "2.8" +#define PVERSION "2.9" #define defREarth 6370009.0 #define defUnits "DEG" diff --git a/src/geoszbtoyxh.c b/src/geoszbtoyxh.c index 3c11467..06966a4 100644 --- a/src/geoszbtoyxh.c +++ b/src/geoszbtoyxh.c @@ -1,7 +1,7 @@ /* Name: geoszbtoyxh.c -Version: 2.8 -Date: 2021-12-15 +Version: 2.9 +Date: 2021-12-19 Author: zvezdochiot (https://github.com/zvezdochiot) Author: Zoltan Siki (https://github.com/zsiki) * @@ -55,7 +55,7 @@ OKD-12 -2.6721 2.5453 1.2270 #include #define PNAME "GeoSZBtoYXH" -#define PVERSION "2.8" +#define PVERSION "2.9" #define defREarth 6370009.0 #define defUnits "DEG"