Polar Plots (repost)
-
All, Has anyone here done any work with polar plots and graphs in vc++. If so can you give me any tips as to how to start? Any graphics classes out there that have implemented polar plots etc? Thanks in advance. Sorry for the repost - for some reason it thought I hit the submit button before I started the main part of this message... John
-
All, Has anyone here done any work with polar plots and graphs in vc++. If so can you give me any tips as to how to start? Any graphics classes out there that have implemented polar plots etc? Thanks in advance. Sorry for the repost - for some reason it thought I hit the submit button before I started the main part of this message... John
I haven't done it in C++ but what do you need to know? The math behind it or drawing to the window?
"We have done so much in the last 2 years, and it doesn't happen by standing around with your finger in your ear, hoping everyone thinks that that's nice." - Donald Rumsfeld
Jason Henderson
blog -
I haven't done it in C++ but what do you need to know? The math behind it or drawing to the window?
"We have done so much in the last 2 years, and it doesn't happen by standing around with your finger in your ear, hoping everyone thinks that that's nice." - Donald Rumsfeld
Jason Henderson
blogMainly drawing to the window...I think :) For a variety of reasons I've been tasked to port a Matlab script (and add more functionality) to vc++. I've got my coordinate data, and in looking into Matlab, it seems like they just draw a circle, translate the polar coordinates to xy and draw lines in the circle. There's got to be more to it than that. I don't know how to start drawing this in a window (dialog). Can I do this in a dialog, or do I need a view and a DC? If so, can I put a view in a dialog? Any help or pointers in the right direction would be appreciated! Thanks John
-
Mainly drawing to the window...I think :) For a variety of reasons I've been tasked to port a Matlab script (and add more functionality) to vc++. I've got my coordinate data, and in looking into Matlab, it seems like they just draw a circle, translate the polar coordinates to xy and draw lines in the circle. There's got to be more to it than that. I don't know how to start drawing this in a window (dialog). Can I do this in a dialog, or do I need a view and a DC? If so, can I put a view in a dialog? Any help or pointers in the right direction would be appreciated! Thanks John
Step one is to get a DC. Alternatively, you can pass in an HWND and obtain one. You do not need a view - just a DC that you can obtain window coordinates from. A polar to window coords conversion function will come in handy too. Good luck. The Ten Commandments For C Programmers
-
Mainly drawing to the window...I think :) For a variety of reasons I've been tasked to port a Matlab script (and add more functionality) to vc++. I've got my coordinate data, and in looking into Matlab, it seems like they just draw a circle, translate the polar coordinates to xy and draw lines in the circle. There's got to be more to it than that. I don't know how to start drawing this in a window (dialog). Can I do this in a dialog, or do I need a view and a DC? If so, can I put a view in a dialog? Any help or pointers in the right direction would be appreciated! Thanks John
Hi John 1) first you need a DC to the dialog - I suggest you add an empty control to the dialog first, and get the DC from the control. That way your coordiante system is relative to the control(drawing area) this make life easier. 2) create a "polar transform" method that is fast and efficient. - this transform will be called every single time any rendering or user interaction with the graph occurrs so BE efficient. - All incomming polar data is to be formatted through this transform and the resulting cartesian data will be rendered in your offset DC fron the control. There is of course a lot more to it, especially when you consider user interaction, zooming, flicker free panning etc. But that is all pretty standard stuff. If you want to see a very good example of an XY or polar plot, check out our company website at homepage - www.zsystems.ca Active x - www.zsystems.ca/devtools.htm ZAX download - http://www.zsystems.ca/downloads.htm Download the ZAX demo and play around with the XY/Polar plot in there. If you have any questions on how we did anything, feel free to contact me directly. Good luck George W Software Developer www.zsystems.ca
-
Mainly drawing to the window...I think :) For a variety of reasons I've been tasked to port a Matlab script (and add more functionality) to vc++. I've got my coordinate data, and in looking into Matlab, it seems like they just draw a circle, translate the polar coordinates to xy and draw lines in the circle. There's got to be more to it than that. I don't know how to start drawing this in a window (dialog). Can I do this in a dialog, or do I need a view and a DC? If so, can I put a view in a dialog? Any help or pointers in the right direction would be appreciated! Thanks John
Thanks for the advice guys! This will give me a starting point. I may have more questions... John
-
All, Has anyone here done any work with polar plots and graphs in vc++. If so can you give me any tips as to how to start? Any graphics classes out there that have implemented polar plots etc? Thanks in advance. Sorry for the repost - for some reason it thought I hit the submit button before I started the main part of this message... John
John - I don't know how deep your pockets are, but you may want to look into a third party library. That might be faster and a lot easier than building your own charting capability. you might check out the Dundas Chart gizmo; it's advertised here on Code Project.
Software Zen:
delete this;