graphcurses

Curses 2D graph generator
git clone git://git.christosmarg.xyz/graphcurses.git
Log | Files | Refs | README | LICENSE

commit 54361dc6f04ce4894fc672e1913030cac4701390
parent 6705bdfe95f7d8d042b814867427be672ed4c633
Author: Christos Margiolis <christos@margiolis.net>
Date:   Thu,  7 May 2020 21:36:22 +0300

minor changes

Diffstat:
Mbin/graphcurses | 0
Mobj/main.o | 0
Mobj/plane.o | 0
Msrc/main.cpp | 5++---
Msrc/plane.cpp | 5++---
Msrc/plane.h | 14+++++++-------
6 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/bin/graphcurses b/bin/graphcurses Binary files differ. diff --git a/obj/main.o b/obj/main.o Binary files differ. diff --git a/obj/plane.o b/obj/plane.o Binary files differ. diff --git a/src/main.cpp b/src/main.cpp @@ -1,8 +1,6 @@ #include "plane.h" static void *f = nullptr; -static void *df = nullptr; -static float evalf(float x) {return evaluator_evaluate_x(f, x);} static void init_curses(); static void getfunc(char *buffer, Plane& plane); @@ -15,7 +13,8 @@ int main(int argc, char **argv) Plane plane; plane.restore_zoom(); validate_expression(plane); - std::function<float(float)> yfunc = evalf; + std::function<float(float)> yfunc = + [](float x){return evaluator_evaluate_x(f, x);}; int key = 0; while (key != 'q') diff --git a/src/plane.cpp b/src/plane.cpp @@ -2,7 +2,8 @@ Plane::Plane() :ymin(YMIN_PLANE), ymax(YMAX_PLANE), xmin(XMIN_PLANE), xmax(XMAX_PLANE), - xscale(XSCALE_PLANE), yscale(YSCALE_PLANE), ymaxs(getmaxy(stdscr)), xmaxs(getmaxx(stdscr)) {} + xscale(XSCALE_PLANE), yscale(YSCALE_PLANE), ymaxs(getmaxy(stdscr)), + xmaxs(getmaxx(stdscr)) {} void Plane::restore_zoom() { @@ -26,7 +27,6 @@ void Plane::draw_axes() float plotx = xmin + xstep * i; int tick = fabs(fmod(plotx, xscale)) < xstep; mvaddch(y0, i, tick ? ACS_PLUS : ACS_HLINE); - // add numbering } for (int i = 0; i < ymaxs; i++) @@ -34,7 +34,6 @@ void Plane::draw_axes() float ploty = ymin + ystep * i; int tick = fabs(fmod(ploty, yscale)) < ystep; mvaddch(i, x0, tick ? ACS_PLUS : ACS_VLINE); - // add numbering } } diff --git a/src/plane.h b/src/plane.h @@ -7,16 +7,16 @@ #include <matheval.h> #include <ncurses.h> -constexpr float XMIN_PLANE = -2.0f*M_PI; -constexpr float XMAX_PLANE = 2.0f*M_PI; -constexpr float YMIN_PLANE = -M_PI; -constexpr float YMAX_PLANE = M_PI; -constexpr float XSCALE_PLANE = 1.0f; -constexpr float YSCALE_PLANE = 1.0f; - class Plane { private: + const float XMIN_PLANE = -2.0f*M_PI; + const float XMAX_PLANE = 2.0f*M_PI; + const float YMIN_PLANE = -M_PI; + const float YMAX_PLANE = M_PI; + const float XSCALE_PLANE = 1.0f; + const float YSCALE_PLANE = 1.0f; + float ymin, ymax; float xmin, xmax; float xscale, yscale;