用Qt c++绘制光滑曲线
Drawing smooth curve with Qt C++
我有一组点要绘制,它们的坐标存储在
中QVector<double> x(200), y(200);
我想把它们和一些光滑的曲线连接起来,比如样条。或者在结点之间设置更大的点阵列也足够了。我的尝试是
customPlot->addGraph();
customPlot->graph(0)->setData(x, y);
customPlot->graph(0)->setPen(QPen(Qt::blue));
customPlot->xAxis->setLabel("Index");
customPlot->yAxis->setLabel("Amplitude");
customPlot->xAxis->setRange(0, 200);
customPlot->yAxis->setRange(-3, 3);
我尝试了QPainterPath类,但它不起作用。请帮帮我。
UPD:我现在正在看QEasingCurve类,这些函数可能有帮助,但作者没有提供示例,我不知道如何使用它们
从代码中我可以看出您正在使用QtCharts
有一个QSplineSeries,你可以使用它做你想要的。
相关文章:
- QuadTree只在窗口的右上角绘制
- 绘制旋转的三角形
- 使用 SFML 绘制曲线会给出错误的形状
- 使用 c++ 在 OpenGL 中绘制贝塞尔曲线的切线
- 如何绘制一条光滑的曲线,该线经过QT中的几个点
- 绘制 NURBS 曲线
- 如何在cocos2dx中绘制任意曲线
- 在 qt 中绘制图形和自定义绘图库绘制曲线
- 在 2D 坐标系上绘制曲线轨迹
- 是否可以使用 SFML 绘制曲线
- 如何在Qt中绘制由画笔填充的开放曲线
- 在QML中绘制一条虚线和虚线贝塞尔曲线
- C++如何使用setpixel函数绘制色调曲线(gamma)到图形
- 发布覆盖c++类绘制曲线
- 在OpenGL中绘制有限细分的贝塞尔曲线
- 用Qt c++绘制光滑曲线
- 如何在OpenGL中使用浮点值用c++绘制贝塞尔曲线
- 用cocos2d-x绘制平滑的贝塞尔曲线
- 应该重新绘制B样条曲线,而不删除窗口的所有其余部分
- 如何绘制近似于原始曲线的曲线