C ++ library for drawing graphics

Can anyone suggest me a nice, free, easy-to-use library for C ++ that allows you to draw a math function in a window for Microsoft windows? (e.g. parabola x ^ 2 + 5x + 3 = 0)

+4
source share
8 answers

Another option based on wxWidgets, wxArt2D , it has tons of good functions for drawing mathematical functions in the form of curves, as you could easily pass this object y = 140 * cos (x / 20) + 80 * cos (x * 2 / 20) + 40 * cos (x * 4/20) " and it will get drawn, it's awesome! Check out these screenshots , there are some curves drawn by equations in string format!

+2
source

Since you need a ready-made build widget, use Qwt .

He uses Qt.

You can use Qt directly, as in contero's answer, without Qwt, since the task is quite simple. However, Qwt has many built-in graphical functions, and the use is simple.

plot

+16
source

I wrote a program like this using Qt. Qt is great once you configure it, but it may take a little effort if you have never used it (like OpenGL, DirectX, etc.).

You can create a QImage and set it to any background color, and then run your program by the pixel width of the image by the pixel that calls your function to get the y value. Roughly speaking:

for (int i = 0; i < imageWidth; i++) { image->setPixel(i, yourFunction(i), lineColor); } 

Once you have created your QImage, you can bind it to QLabel using setPixmap (). Once you have connected it, you can display the image in a layout.

+5
source

Another option is wxMathPlot , which is wxWidgets . On this website:
The main functions of wxMathPlot:

  • Fully mouse-controlled control: pan, zoom, scroll, window positioning.
  • Print class. A.
  • Screenshot with saving the chart window (BMP, PNG and JPEG formats).
  • We impose moving boxes with indication of the coordinates of the legend or mouse.
  • Can set margins to avoid diagrams to cover axis labels.
  • Flexible axis positioning
  • A series of useful layers for directly displaying data from an STL vector, moving objects, a covariance ellipse, raster images, etc.
  • Multi-platform: wxWidgets works everywhere.
+4
source

You mentioned your language (C ++) and platform (Windows), but there are frameworks available for writing a Windows C ++ application: Qt, MFC, C ++ Builder ... In addition, C and C ++ can interact practically with everyone, so your decision about which graphics library to use will depend on what framework you use for your user interface, and on which external interfaces or dependencies you are ready to submit:

+1
source

You can also use GDI / +, OpenGL, Direct3D, Direct2D if using Vista / 7. There are many.

0
source

Definitely gnuplot, and the gnuplot ++ library

0
source

I created a tool for creating graphics and published it a few hours ago.

https://www.youtube.com/watch?v=xD080qQVaD8&feature=youtu.be

https://github.com/burlachenkok/plotter_plusplus

To use this tool, you can use a desktop computer to display graphics.

Your target project can be launched anywhere in any language on any platform - to update graphics just send data over the network.

0
source

Source: https://habr.com/ru/post/1341022/


All Articles