需要快速c++ qt/qwt 散点图

发布于 2024-11-18 19:33:21 字数 398 浏览 3 评论 0原文

我有大量 2D 点(大约 300 万对),我需要在基于 Qt 的应用程序中以合理的速度进行渲染。

我尝试过使用 QGraphicsScene,但即使在 400000 个图元上它也非常慢,所以我正在研究 qwt 库。

它的 sourceforge 页面上有一个 散点图示例屏幕截图,它看起来正是我所需要的,但我既找不到任何可用于此数据的实际代码,也找不到 qwt 文档中的相应 API - 它只提到了不同类型的曲线。

因此,最好能获得一些有关散点图示例的指导以及有关其性能的一些建议。 也欢迎提出其他可以处理如此大量数据的与 c++ qt 兼容的绘图库的建议。

I have a huge array of 2D points (about 3 millions of pairs), which I need to render with reasonable speed in a Qt-based application.

I've tried using QGraphicsScene, but its very slow even on 400000 primitives, so I was looking into the qwt library instead.

It has a scatter plot example screenshot on its sourceforge page, which looks like exactly what I need, but I cannot find neither any kind of actual code that can be used for this data, nor an according API in qwt docs - it mentions only different types of curves.

So it would be good to get some pointers for scatter plot examples and some advice on its performance.
Suggestions for other c++ qt-compatible plotting libraries which can cope with this amount of data are also welcome.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心清如水 2024-11-25 19:33:21

散点图包含在“realtime”示例中:您需要的是IncrementalPlot类。
我还建议绘制所有 300 万个点是不合理的,因为现代屏幕只有大约 200 万个像素:) 因此,最好预先通过将相邻点合并为一个阈值来简化绘图,该阈值取决于缩放系数。

Scatter plot is contained in the "realtime" example: what you want is the IncrementalPlot class.
I'd also suggest that drawing all the 3 million points isn't reasonable, since modern screens have only about 2 million pixels :) Thus it seems better to simplify the plot beforehand by merging the adjacent points into one with a threshold dependent on the zoom factor.

北渚 2024-11-25 19:33:21

正如 viens 指出的,生成 300 万个点的散点图可能不是一个好主意。

我使用 OpenGL 生成 30.000 点的 3D 散点图,取得了良好的性能。
OpenGL 速度很快并且与 Qt 集成良好。然而,它是一个低级 API,迫使您进行大量繁琐的编码。

VTK 可能是另一种选择。

As viens pointed out, generating scatter plots with 3 million points is probably not a good idea.

I have achieved good performance generating 3D scatter plots with 30.000 points using OpenGL.
OpenGL is fast and integrates well with Qt. However, it is a low level API that forces you to do a lot of tedious coding.

VTK may be another option.

泡沫很甜 2024-11-25 19:33:21

MathGL 是免费的 (GPL) 跨平台绘图库。它是用 C++ 编写的,并有 Qt 小部件。而且它的速度相当快,但是 300 万个点……在我的笔记本电脑上绘制大约需要 30 秒。

MathGL is free (GPL) cross-platform plotting library. It was written in C++ and have Qt widget. Also it is rather fast, but 3 millions points ... it take about 30 seconds to plot in my laptop.

盛夏尉蓝 2024-11-25 19:33:21

您建议像 @vines 所说的那样使用 OpenGL,特别是利用或显示列表 glGenList 或顶点缓冲区。几百万个点作为基元顶点应该不那么困难。

You'd suggest using OpenGL as @vines said, and in particular exploiting or display lists glGenList or vertex buffers. Some million points as primitives vertices shouldn't be that difficult.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文