如何在C ++中绘制函数 [英] How to draw functions in C++

查看:197
本文介绍了如何在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 ! )

我会考虑两个选项:

  • 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆