如何在C ++中绘制函数 [英] How to draw functions in C++
问题描述
我想在C ++中创建函数图表。谁能帮助我开始?假设我想绘制函数y = x(它是通过点(0,0)(1,1)(2,2).....(20,20)的直线)等等)
我该怎么办呢? (如果你还建议如何绘制y& x轴,它是更好的)
对不起,但它不是在书上(好的文字建议是欢迎,顺便: - )C + +)是主要参考游戏图形。
唯一严重的引用我的问题,我能够找到是这样:
I would like to create charts of functions in C++. Can anyone help me in getting started ? Let's suppose I want to draw the function y=x ( it is a straight line passing through the points (0,0) (1,1) (2,2) ..... (20,20) etc. ) How could I do it ? ( If you also suggest how to draw the y & x axes it is even better ) Sorry but it is not on books ( good texts recommendations are welcome, by the way :-) C++ ) and on the net there are references mainly to game graphics. The only serious reference to my problem I was able to find is this: somewhat related question asked in this very forum ( God bless, we have stackoverflow ! )
我会考虑两个选项:
- 你可能需要一个外部库。 OpenGL是一个解决方案,还有 Qt ,这可能更容易学习和更大(和更强大的)。
- 如果您能够输出一个文件并用另一个程序读取,最简单的方法是简单地写一个ASCII文件,是与八度(免费)。
- If you want to do everything in C++, you will probably need an external library. OpenGL is a solution, there is also Qt, which is probably easier to learn and larger (and more powerful).
- If you can afford to output a file and read it with another program, the easiest way is to simply write an ASCII file with the coordinates of the points and plot is with Octave (free).
这篇关于如何在C ++中绘制函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!