简体   繁体   中英

Tools for plotting QVector3D data?

I have a series of points (x,y,z) that I would like to plot as a vector in a 3D plane. Something like this.

I am successfully using QCustomPlot elsewhere, but the documentation says it cannot be used for 3D plots. Googling turned up QwtPlot3D, but it hasn't been maintained since 2007, as far as I can tell, and I don't want to run into any problems since I'm using Qt5. I was also looking at QtCharts but can't seem to find any example of plotting x,y,z data points.

Does anyone have tips for including a 3D graph in my C++/Qt application? Is there a tool that would work better with Python with Qt, rather than C++? Or another technology entirely? This graph will be part of a larger UI.

This might help, though I haven't used it:

http://doc.qt.io/QtDataVisualization/

Spend a little time looking into OpenGL . To display OpenGL scenes in Qt you would use QGLWidget (for Qt 4.x) or QOpenGLWidget (for Qt 5.x). OpenGL allows you to write graphics that run on a GPU card, meaning you can tap into the same horsepower used for 3D video games. Given time and inclination, you can build up a good 3D graphics library.

https://www.opengl.org/

http://doc.qt.io/qt-5/qopenglwidget.html

The Qt tutorials can help, but you'll also want to read other OpenGL tutorials. Here are some tutorials targeting older versions of Qt:

ftp://ftp.informatik.hu-berlin.de/pub1/Mirrors/ftp.troll.no/QT/pub/developerguides/qtopengltutorial/OpenGLTutorial.pdf

http://www.decom.ufop.br/sibgrapi2012/eproceedings/tutorials/t3-survey_paper.pdf

Tutorials tend to start with "immediate mode" examples, meaning the CPU is continually involved with updating data and writing that data to the GPU. As soon as you grasp the basics you'll want to implement "retained mode" code, meaning (very loosely) that the GPU manages the data and the need for CPU resources is minimized.

All that said, getting into OpenGL is a commitment. If you want the user to be able to change the viewpoint of the chart, or zoom in/out, or mouse over a plot to check individual values, etc., then it will take some time to implement. For a standard that's so widely use it's odd that the documentation and available textbooks aren't better--don't expect to find the OpenGL textbook equivalent of Kernighan & Ritchie or the Perl camel book.

There may be some Qt 3D graphing project somewhere that enjoys active development, and with luck maybe some other SO user will know about one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM