Skip to content
Snippets Groups Projects
Commit a37f69c4 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Refined curve plotting good enough.

parent b087be60
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
#!/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
......
......@@ -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;
......
......@@ -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 ==
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment