The first dimension of this vector is the angle of the data so there are 360 angles, and the second dimension is the bins of the data in which there are 512 bins per angle. Each bin has a value from 0 to 15 to determine the intensity of the bin. So basically, when this is all display, there will be a circle of data, with varying colors of intensity at each bin.
What is the best approach to doing this in MFC? Can anyone provide sample code on how they would draw this on the screen?
If I understood what you want, the basic idea would be to calculate
the points of the polygon for each angle/bin, and fill it with the
appropriate color. The code below should calculate the points:
Thanks for the response. I took this code, and I tried to make it work, but nothing was displaying on the screen. So I started debugging the points, and here is an example of my 4 points:
CPoint stores x and y values as type ints. The result of
Code:
pts[0].x = r1 * cos(angle1);
is a double which is then stored into an int! If you look at the first few values actually calculated as double before being stored, they have values between about 0 and 1 - so are stored in pts as 0 and 1 when converted to int!
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
As 2kaud mentioned, there will be some problems with int versus double.
What are your values for angles , bins , bin_inc , and , angle_inc ?
I am a bit concerned that with that many bins/angle combinations, you
could get a number of points which should be distinct (as double) becoming
the same when converted to int.
Attached is a sample image I made using OpenGL() graphics with 25 angles
and 25 bins and using random colors. Is this the type of plot you want ?
This is very slow. I assume that using dcMemory speeds it up considerably.
If not, you might consider a higher performance graphics system.
You mentioned radar. That could mean a lot of things when it comes to
visualization. One way to speed it up. Just draw the basic outline, and
only draw the pixels that have something in it.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.