JamesBremner / windex

A header only modern c++ wrapper for the windows API.
BSD 2-Clause "Simplified" License
11 stars 2 forks source link

What is the optimal way to pass an array of doubles to trace.set() ? #9

Closed JamesBremner closed 9 months ago

JamesBremner commented 9 months ago

Do not use arrays. std::vector is far superior.

Take a look at the demo code

https://github.com/JamesBremner/windex/blob/876045eaa2dd8c41720ce09d06f4a8e0f8601f20/demo/demo.cpp#L642

drmcnelson commented 9 months ago

I have no choice. The data arrives a frame at a time, with fixed lengths. It is like reading one row from a camera 100 times per second.

The data is more or less collected directly into something equivalent to this:

    double frames[NUMBER_OF_RING_SLOTS][NUMBER_OF_PIXELS];

I can make the ring a set of vectors, but I think it is the same problem.

It is either

A) How do I efficiently transfer the data to a vector and reuse the vector for new data?

or,

B) Is there a way to pass frames as double *, to the graphics?

Thank you

drmcnelson commented 9 months ago

P/S It seems like array would be a better fit to this kind of data.

JamesBremner commented 9 months ago

I have developed over 20 applications ( https://ravenspoint.wordpress.com/2012/09/25/speaker-to-robots/ ) that accept data from various devices that arrives in frames. Storing the data that arrives in a vector is ALWAYS the better way to go.

I will add some frame handling code to complot so you can see how this can be done most effectively. I will add an issue to complot to discuss this in detail. If you post to that issue some details of your frame makeup then I can make the demo code more relevant to your particular case.

This is no longer a windex issue, so closing.