anlijiu / SdlGrapher

A small program to render math functions as charts with SDL2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SdlGrapher

SdlGrapher is a small program to render math functions as Charts built with SDL2 library. The goal is also to demonstrate floating-point precision errors, that's why i didn't do any border / scaling checks.

Features

  • Horizontal / vertical scrolling.
  • Scaling with mouse wheel.
  • No rendering if the math function returns NaN or Infinity.
  • Movable axises. Screen => Math, Math => Screen unit converters.
  • Automatically calculate scale and axis position based on interval of the math function.
  • Pixel perfect rendering.

Screenshots

f(x) = x ^ 2

Parabola demo

f(x) = 1 / x

Log demo

f(x) = log(x)

Log demo

f(x) = sqrt(x)

Log demo

f(x) = sin(x)

Sin demo

f(x) = sqrt(x) * sin(x)

Sin demo

f(x) = 3 * sin(x / 4) - 2 / sin(2 * x)

Sin2 demo

About

A small program to render math functions as charts with SDL2.

License:MIT License


Languages

Language:C++ 94.4%Language:CMake 5.6%