From a37f69c480d6d741da749ca277b60085f53236e0 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (l)" <j.wuttke@fz-juelich.de> Date: Wed, 8 Mar 2017 21:27:57 +0100 Subject: [PATCH] Refined curve plotting good enough. --- pub/CHANGELOG | 2 ++ pub/itest/curveplot.f2t | 3 ++- pub/lib/plot.cpp | 8 ++------ pub/plot/dualplot.cpp | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pub/CHANGELOG b/pub/CHANGELOG index 9e4afe41..e55ae2f9 100644 --- a/pub/CHANGELOG +++ b/pub/CHANGELOG @@ -3,10 +3,12 @@ Release 2.3.6a of : - Bug fixes: - Restored ability to load files from outside the current working directory - New functionality: + - Command crp to restrict plot range - New integral operations firstwith, lastwith - Improved functionality: - Commands gp, gf let user confirm or overwrite graphic file name - Integral operations now return integers when appropriate + - Cleaner implementation of refined curve plotting - Code cleanup: - fname_divide replaced by functions from std::experimental::filesystem diff --git a/pub/itest/curveplot.f2t b/pub/itest/curveplot.f2t index 68770b00..a623f388 100755 --- a/pub/itest/curveplot.f2t +++ b/pub/itest/curveplot.f2t @@ -1,6 +1,7 @@ #!/usr/bin/env frida ! rm -f /tmp/fridatestplot.ps pshead="g3wallpaper.ps" +gnc 100 cca p0+p1*t g0 gx 0 1 @@ -24,7 +25,7 @@ p gfa /tmp/fridatestplot.ps op0 768.34 op1 0 -crp t<.523||.524<t&&t<.613||.625<t +crp t<.52||.53<t&&t<.61||.65<t gya p gfa /tmp/fridatestplot.ps diff --git a/pub/lib/plot.cpp b/pub/lib/plot.cpp index 4cb57b53..41b5570f 100644 --- a/pub/lib/plot.cpp +++ b/pub/lib/plot.cpp @@ -278,7 +278,6 @@ public: int plot_curve_refine(CPlot* plot, const COlc* fc, int k, int j, int cstyle) { - printf( "\nDEBUG REFINE\n" ); auto x2p = [&](const vector<double>& x) -> vector<CPt> { vector<double> y = PCAST<const CObjVecDbl>(fc->eval_curve(x, k, j, false))->v; vector<int> inRange = fc->eval_prange(x, k, j)->v; @@ -304,13 +303,11 @@ int plot_curve_refine(CPlot* plot, const COlc* fc, int k, int j, int cstyle) // refinement loop: vector<CPt> pp; - for (int iref=0; iref<13 && pp.size() < plot->maxpoints; ++iref) { + for (int iref=0; iref<20 && pp.size() < plot->maxpoints; ++iref) { vector<CPt> pn = x2p(xn); - printf( "DEBUG %2i #pp=%6zu #pn=%6zu\n", iref, pp.size(), pn.size() ); pp = triv::merge_sorted(pp, pn, pt_order); xn.clear(); - // detect jumps: auto a = pp.begin(); auto b = pp.begin()+1; vector<CPt> po = { *a }; @@ -323,7 +320,7 @@ int plot_curve_refine(CPlot* plot, const COlc* fc, int k, int j, int cstyle) if (c<pp.end() && c->code==0) { if ( std::abs( ((b->xp-a->xp)*c->yp +(c->xp-b->xp)*a->yp) - /(c->xp-a->xp) - b->yp ) < 1e-6 ) + /(c->xp-a->xp) - b->yp ) < 1e-6 ) // it's linear continue; // don't copy *b to po } if (hypot(b->xp - a->xp, b->yp - a->yp)>1e-1) @@ -331,7 +328,6 @@ int plot_curve_refine(CPlot* plot, const COlc* fc, int k, int j, int cstyle) } po.push_back( *b ); } - printf( "DEBUG -> #pp=%6zu #po=%6zu #xn=%6zu\n", pp.size(), po.size(), xn.size() ); pp = po; if (!xn.size()) break; diff --git a/pub/plot/dualplot.cpp b/pub/plot/dualplot.cpp index 322f42f6..580f281e 100644 --- a/pub/plot/dualplot.cpp +++ b/pub/plot/dualplot.cpp @@ -39,7 +39,7 @@ CPlot::CPlot(int _iPlot, bool _logx, bool _logy) , Y("y", _logy) , maxpoints(20000) , with_errors(true) - , equipoints(49) + , equipoints(120) , refine(true) { // == Initialization for Gnuplot == -- GitLab