Results 1 to 3 of 3

Thread: Ideas for a project using a 2D plot

  1. #1
    Join Date
    Nov 2015
    Posts
    2
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Ideas for a project using a 2D plot

    Hello everyone, I'm totally new with Qt and I have a project assigned of making a wave-expansion simulator often known as "ripple tank". The software should allow the user to visualize sound waves expanding in a room, getting reflected, etc...
    Also the user should be able to insert walls and sound sources in the scene and those walls and sound sources need also to be printed on top of the image.
    The representation has to be a plot with every pixel representing a node. Every node has a determined pressure level which varies during the time.

    The idea is:
    1-Calculation of the value of every node in the graph (float)
    2-Assign an RGB value to every presure value
    3-Print the matrix

    .The matrix (graph) could be around 1000*1000 pixels
    .The frame rate should be minimum 30 fps

    A lot of CPU is used for the calculation of the pressure values itself.

    My main question is which function could I use to represent the matrix. I tried draw2Dpixels but I have seen in many places that this is a slow solution. Does someone have a good tip?

    I link an applet which makes a very similar function to the program I must implement.

    Thanks in advance!

    http://www.falstad.com/ripple/

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,067
    Thanks
    233
    Thanked 649 Times in 639 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Ideas for a project using a 2D plot

    You might look at Qwt, especially the QwtPlotSpectrogram class. There is a learning curve for Qwt, but maybe you can adapt the example program for your needs.

    You will have a very difficult time to calculate 1 million pressure values at a 30fps rate, and an even more difficult time to update a plot with that many values so quickly. I know from experience in trying to perform bilinear interpolation on a 2D data array of 1000 x 1000 pixels that it can take a second or more for *one* update, and bilinear interpolation is a much simpler computational problem than you face with multiple sound sources, walls, reflections, multiple frequencies and amplitudes, and so forth.

    Have fun.

    Edit: I am surprised that the applet can run so quickly. There must be tricks to the computation that aren't obvious, or maybe the applet is using the GPU to perform some of the calculation.

  3. The following user says thank you to d_stranz for this useful post:

    noobsOfQt (16th November 2015)

  4. #3
    Join Date
    Nov 2015
    Posts
    2
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Ideas for a project using a 2D plot

    Thanks d_stranz, sorry for replaying so late I did not get a notification of your answer to my mail. You are right, the applet runs really fast. For the calculation I use the TLM method which simplifies a lot everything. You basically actualize the values of each pixel having a source (field[source_position]=field[source_position]+sin(xxxx)) and then you go from pixel to pixel and their value is "spreaded" to the North, west, east and south pixels. You don't simulate each "ray" independently so it is basically not heavier having reflections or more sources. You did scare me with the one second
    I'll check Qwt then.

Similar Threads

  1. gathering ideas
    By rambo83 in forum Qwt
    Replies: 0
    Last Post: 18th November 2009, 08:03
  2. printing an application - any ideas?
    By lamera in forum Qt Programming
    Replies: 2
    Last Post: 1st November 2008, 13:48
  3. Ideas for Project
    By dosto.walla in forum Qt Programming
    Replies: 4
    Last Post: 21st October 2008, 16:33
  4. ideas for skinned widgets
    By kernel_panic in forum Qt Programming
    Replies: 5
    Last Post: 20th August 2007, 12:33
  5. P2P ideas please....
    By chaosgeorge in forum Qt Programming
    Replies: 4
    Last Post: 10th December 2006, 15:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.