Important: Please read the Qt Code of Conduct -

Best way to develop 3D math functions visualization

  • Greetings,
    I'm a long time Qt user, but I never approached this problem before.
    What's currently the best way to implement a 3D function visualiser?
    The problem is simple: I've a 2 dim math function (DeJong, Rosenbrock, you name it) and I need to produce a visual representation of it under a given range.
    Ideally, it should be able to generate the points on the fly, in order to keep the same resolution disregarding the zoom level (I'll pass the function to the widget, and it will produce a smooth plot).
    Features like gradient-color and the possibility to (programmatically) add/remove some points (namely colored markers) on it is also nice to have.

    As far as I've seen some solutions should involve the use of QwtPlot3D or some widgets types provided by Qt5, but I'm not really sure what's the best option given my problem, and I hope someone can give me some hints about it.


  • Qt Data Visualization covers the plotting part, calculating the points is up to you though

  • @VRonin said in Best way to develop 3D math functions visualization:

    Qt Data Visualization covers the plotting part, calculating the points is up to you though

    What you mean calculating the points?
    I've already implemented the functions I need to plot.
    Let's say all of them share the common interface function that return the y value given the coordinate (x,z)

    double compute(double x, double z) const;

    So computing the constituent points of the surface is not an issue, the problem is to visualise that surface given an implementation of the quoted C++ function.

    EDIT: This is the closest example of what I'm looking for, however it works on a finite number of samples (ok) that need to be filled with ground values (not ok) instead of being generated on fly (so no infinite resolution).
    Worst case scenario, I've to intercept the zooming signal (assuming he's providing me one) and re-generate each point everytime I zoom in/out.
    It's doable, but I'm wondering if I'm missing an already implemented feature that do this for me.

  • as VRonin mentioned Qt Data Visualization is one methode.
    Here is some 3d-surface exampe
    If you are using eigen3 for the math part whats really nice for developping is some pretty-printers, that can plot data from eigen-vectors during debugging.
    If you are interested in the scripts i can upload them (i have them on another machine not here atm)

Log in to reply