|
Hi,
Has anyone written or seen any code to produce a surface plot or isometric (xyz) bar graph, preferably for 10000+ points, in a view? I've got a few ideas, but if the work's already been done, clearly it'd save a lot of pain, and I'm lacking ideas at the moment on the best way to make the plotting of 10000+ points efficient, given that only a fraction of them will effectively turn into pixels on the screen.
Any help would be hugely appreciated.
Thanks,
Phil.
He is no fool, who gives what he cannot keep, to gain that which he cannot lose.
|
|
|
|
|
Gday,
I've seen a openGL tute that makes a mesh then sticks a texture-map on it before displacing the flag with a sine wave along it's length.
It seems to be about the same thing, just that rather than using the sin function combined with a points distance from the flag origin to calculate the displacement, you apply your data-set to the dispalacement of each point.
You could just use Gouraud shading to interpolate the colour (instead of texture mapping, that is) between each point in the mesh, setting the colour of each vertex in the mesh based on it's height.
It's the first tute on the page here: http://nehe.gamedev.net/tutorial/lessons_11__15/28001/[^]
|
|
|
|
|
Brilliant! I've not really known about OpenGL, but the flood gates of 3D graphing are now open!! Lessons 34 and 47 also do similar things, so thanks very much for this introduction.
|
|
|
|
|
Hope you enjoy the series as much as so many of the rest of us already have.
One day you're playing with a triangle, the next with particles the day after you're trying to remember what you were supposed to be doing away from the computer.
|
|
|
|
|
sounds like fun
i'd do it by setting a minimum width for the bars, so it would typically show view_width / bar_min_width bars.
each bar shown will then represent a window of total_points / displayed_bars data points.
the height of each bar could be an average of the points in the window it represents, or the min, or the max. or, for sheer performance, just use the first sample from each window.
and if your input data is floating point, to speed the bar height calculations, you could generate an integer array that pre-scales the data points values into the 0..max_bar_height range.
|
|
|
|
|
Thanks Chris, very useful thoughts.
|
|
|
|
|
why the function strstr used in C ?
|
|
|
|
|
If you spend some time with the documentation[^] you will learn many useful features.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
why? Simply to search for a string in another string.
Watched code never compiles.
|
|
|
|
|
strstr() finds a substring in a string. use it to search inside string elements.
#include <stdio.h>
#include <string.h>
main()
{
char mainString[]="string to search";
char strstr_sub_string_to_search[]="to";
if ( strstr(mainString, strstr_sub_string_to_search)) puts("strstr() found Substring in main string\n");
else puts("strstr() did not find Substring in main string\n");
return 0;
}
|
|
|
|
|
|
I want to get the range of a line cursor in.
VBA code (word2010) looks like this:
================================================
ActiveDocument.Bookmarks.Item("\LINE").Range
C++ code looks like this:
================================================
CBookmarks oBookMarks = oDoc.get_Bookmarks();
VARIANT varName;
varName.vt = VT_BYREF|VT_I1;
char buff[6] = {"\\LINE"};
varName.pcVal = buff;
CBookmark0 oBookMark = oBookMarks.Item(&varName);
VBA code works perfectly but C++ code triggers some exception(required members does not exist).
Anyone knows why? I really appriciate for your help.
|
|
|
|
|
You are passing a string using the VARIANT pcVal member. Strings are usually passed using the bstrVal member with type VT_BSTR . When using MFC, you may use the COleVariant type which creates a VT_BSTR when passing a string:
CBookmark0 oBookMark = oBookMarks.Item(COleVariant(_T("\\LINE")));
Another error may be the name of the used function oBookmarks.Item() . Please check if this functions exists. If you have imported a typelib, see the generated header file. With C++ OLE automation, many item access function are named GetItem() and SetItem() .
|
|
|
|
|
thanks very much. the problem is solved. The reason is that I used the wrong VARIANT type.(I am puzzled on using VARIANT)
|
|
|
|
|
Hi,
i am using a CTreeCtrl ,but when tree have so many items scrollbar is not working properly.
items at the end of tree not diplay and hash line also not visible properly please help me what can i do here?
thanks.
|
|
|
|
|
|
|
|
How does one write code to make drawings in the Windows main client area of a Win32 C++ app?
I found an example online that uses the "eclipse" API but when I put it in my program, the IDE complained so it would not compile.
|
|
|
|
|
You can use the Windows GDI functions like Rectangle , Ellipse , TextOut , LineTo , MoveTo etc. to draw in the window. Each of these functions take a device context (DC) as its first parameter. It is this device context that determines where the drawing appears. In your case use the GetDC function with the handle to the window to get the device context of the window where you want to draw.
|
|
|
|
|
You can use either of the GDI or GDI+[^] graphics functions, or any of the newer more advanced libraries. Getting familiar with GDI or GDI+ would be a good starting point.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
In a general win32 program you should handle the WM_PAINT (and maybe the WM_ERASEBKGND) message of the windows you want to paint. In WM_PAINT you might get a HDC handle to draw on (with GDI functions[^]). If you are not working with a framework that gives you a HDC to draw on then you have to call BeginPaint()[^] and EndPaint()[^] in your WM_PAINT handler and beginpaint gives you a HDC draw on before you call EndPaint().
Its important to draw you window from the WM_PAINT handler because the surface of your window might get lost any time (at least this was the case before 3D accelerated desktops) for example when someone brings a window in front of your window and then it switches back to your window. In this case windows might send a WM_PAINT to your window to redraw its surface and the thing you drew on it will disappear if you don't redraw it from the WM_PAINT. You can't assume that the thing you draw on a window remains there if you perform drawing from outside the WM_PAINT handler.
|
|
|
|
|
For simple drawings, go with GDI... it'll give you a basic understanding of how Windows draws things. Obviously, this isn't really suitable for complex graphics, but it's a great starting point for someone with no experience with graphics development.
|
|
|
|
|
Dear frnds im trying to create http client application in c/c++ which call webservice using only url of webservice and soap
but i dont know how to do it in c/c++
can any one help me
Thanks
Sangam
|
|
|
|
|