summaryrefslogtreecommitdiff
path: root/tests/harness/funcsdump.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-26 20:05:20 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-26 20:05:20 +0100
commit375d87a9b0ec1cf2fffd705adb870c86144d2400 (patch)
tree1e8e05e7cd58686628d0f4622622456613a42e4d /tests/harness/funcsdump.cxx
parent45425dd047b791fe63f13a46a3251c529cfffc94 (diff)
Replace the C++ implementation with the Rust port
The Rust port (formerly gipfel-rs) is now the official successor to the FLTK/GSL C++ code base. This squashes the port into a single commit and removes the C++ sources (they remain in the git history below). Layout: crates/gipfel-core headless core: hills, panorama geometry, projections (maxima-generated derivatives), pure-Rust LM fit, gipfel: JPEG comment + EXIF I/O, profiles, stitching crates/gipfel-cli command-line tools (export, info, stitch, profiles) crates/gipfel-app Cosmic DE (libcosmic) GUI, binary name `gipfel` codegen/ maxima scripts + regen.sh for the projection code tests/ golden files + C++ reference harnesses (historical) The original README is kept for now; it will be updated to describe the Rust build. gipfel.dat, AUTHORS, ChangeLog and NEWS are unchanged.
Diffstat (limited to 'tests/harness/funcsdump.cxx')
-rw-r--r--tests/harness/funcsdump.cxx60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/harness/funcsdump.cxx b/tests/harness/funcsdump.cxx
new file mode 100644
index 0000000..b416f2c
--- /dev/null
+++ b/tests/harness/funcsdump.cxx
@@ -0,0 +1,60 @@
+// Golden dump of the maxima-generated projection functions (C reference).
+// The `#define` trick turns the generated class methods into free functions.
+#include <stdio.h>
+#include <math.h>
+
+static double sec(double a) { return 1.0 / cos(a); }
+
+// gen_golden.sh copies the generated files with the class scope replaced:
+// ProjectionRectilinear::rect_mac_x -> rect_mac_x, ProjectionCylindrical::rect_mac_x -> cyl_mac_x
+#include "rect_funcs.cxx"
+#include "cyl_funcs.cxx"
+
+int main(void) {
+ for (int k = 0; k < 200; k++) {
+ double kk = (double) k;
+ double c_view = -3.0 + 0.03 * kk;
+ double c_nick = 0.10 * sin(0.11 * kk);
+ double c_tilt = 0.05 * cos(0.07 * kk);
+ double scale = 2000.0 + 37.0 * fmod(kk, 19.0);
+ double k0 = 0.001 * sin(0.31 * kk);
+ double k1 = 0.0001 * cos(0.17 * kk);
+ double x0 = 50.0 * sin(0.13 * kk);
+ double m_view = c_view + 0.5 * sin(0.23 * kk);
+ double m_nick = 0.05 * cos(0.19 * kk);
+
+ printf("%.17g %.17g %.17g %.17g %.17g %.17g %.17g %.17g %.17g ",
+ rect_mac_x(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_y(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_x_dc_view(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_x_dc_nick(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_x_dc_tilt(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_x_dscale(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_x_dk0(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_x_dk1(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_x_dx0(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick));
+ printf("%.17g %.17g %.17g %.17g %.17g %.17g %.17g ",
+ rect_mac_y_dc_view(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_y_dc_nick(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_y_dc_tilt(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_y_dscale(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_y_dk0(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_y_dk1(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ rect_mac_y_dx0(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick));
+
+ printf("%.17g %.17g ",
+ cyl_mac_x(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ cyl_mac_y(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick));
+ printf("%.17g %.17g %.17g %.17g ",
+ cyl_mac_x_dc_view(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ cyl_mac_x_dc_nick(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ cyl_mac_x_dc_tilt(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ cyl_mac_x_dscale(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick));
+ printf("%.17g %.17g %.17g %.17g\n",
+ cyl_mac_y_dc_view(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ cyl_mac_y_dc_nick(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ cyl_mac_y_dc_tilt(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick),
+ cyl_mac_y_dscale(c_view, c_nick, c_tilt, scale, k0, k1, x0, m_view, m_nick));
+ }
+ return 0;
+}