Hello.

I've created a program which calculates points which belong to a specific graph, such as Archimedes spiral, Logarithmic spiral, Cardioid etc. The program generates an array with coordinates. Technically coordinates are polar, but I can convert them to cartesian by using polar() function.

Question is - how do i draw points if I know their polar OR cartesian coordinates (either one works)? I have Borland 5.02 and Dev C++ (latest release) at the moment.

I can't do this on my Borland compiler because it does not support BGI. I was told OpenGL would work, but it seems like something too big for me to handle. I've installed Dev C++, but it lacked graphics.h library. I installed it separately, according to a guide, but it still does not work.

All in all, I'm stuck. Spent whole yesterday on this, and I haven't made progress..

Any help is appreciated.

Here is one way to do it. You might want to install VC++ 2010 Express or Code::Blocks instead of using Dev-C++.

Thank you. I'll make a post later once(if) I run into some issues.

Is this Plot Graphic Library compatible with Code::Blocks?

PGL requires GDI+ to be installed, this is the guide for that. The underlined part makes me think the answer is no.
Install GDI+ (part of Microsoft SDK).
Download Gdiplus.dll and make sure it is in the path,
Recompile the source, it will build .lib in the lib directory and the .dll in the bin directory
Add the directory with PGL binaries to your path. (by default it is C:\Program Files\PGL\bin)
Add the include directory and lib directory to Visual C++ include/lib directories.
Make sure the headers are available

And I can't install Visual C++ Express because it requires Windows XP SP3, which I can't install due to incompatibility with some other software I have.

>>And I can't install Visual C++ Express because it requires Windows XP SP3

That's the minimum os. It works great on Windows 7 Home Premium, which I use. What version of MS-Windows are you currently using?

GDI is included in Microsoft Windows SDK which is most likely compatible with all (or most) compilers for MS-Windows operating system.

[edit]Just discovered that the files require MFC, which is not suppported by the Express version of VC++ 2010 nor any non-Microsoft compiler. So this is probably not a library that you can use except to study the source code to find out how to plot charts.

I ended up installing Visual C++ Express 2005. And I have also installed Code::Blocks. Why not.

I have also downloaded Platform SDK Redistributable: GDI+ from microsoft.com.

Following the installation guide here is troublesome though.

1 Install GDI+ (part of Microsoft SDK).
2 Download Gdiplus.dll and make sure it is in the path,
3 Recompile the source, it will build .lib in the lib directory and the .dll in the bin directory
4 Add the directory with PGL binaries to your path. (by default it is C:\Program Files\PGL\bin)
5 Add the include directory and lib directory to Visual C++ include/lib directories.
6 Make sure the headers are available

1 - done, I installed it in program files/gdi, because it did not say anything about installing in specific location.
2 - I don't understand this one.
... Wait... does it mean the path in:
my computer-->properties-->advanced-->system environment variables? It is currently set to where my php installation is. I guess I can change that.
3 - I don't understand this one. What am I supposed to compile? My guess would be pgllib_src folder. It contains microsoft visual studio solution 2002 file. I can open it with Visual Studio 2008, but I get warnings due to conversion. Running it ends up with 146 errors and 105 warnings.
4 - if 2 is what I think it is then I understand
5 - I understand
6 - I don't understand this one.

If someone could re-word what I'm supposed to do to install PGL, it will be much appreciated.

And I feel as stupid as...

Do you have the VC++ 2005 Professional version? If you have Express then you can forget Gdiplus.dll because it requires MFC as I said in my previous post.

>>2 - I don't understand this one
It means your computer's PATH entironment variable. If you don't know how to change the path, in Windows 7 (maybe Vista too), do this:
Start --> System --> Advanced System Settings --> Environment Variables. That will allow you to change the PATH environment variable. But be careful not to delete anything.

>>3. If you do not have the Pro or better version of the compiler than that will fail and there is no other solution. You are just SOL.

Ahh, I did not see your edit. I have the Express version. Which means I have to look for another solution.
I might be totally off, but I think that my installation of Visual Studio 2008 contains MFC?

Sadly outta luck. Indeed.
I thought that 2 days should be plenty of time to find a way to draw some dots on the screen. I guess I'll just hand in the code I have, even though the program does not draw anything. Everything else I had to do works fine, except for the drawing part.

Don't give up. It is easy to do this as long as you stay away from Microsoft products (you are experiencing their tactics of giving away the Express version to sucker people into buying the full version.. just like a pill-pusher).

You said you have Borland... is this Borland C++Builder 5? If it is, all you need to do is click New Project -> VCL Application -> New Form ..something like that. Then you will get a blank Windows' form. Then you can put onto the form a component called TChart that you will find in one of the panels of the component library. Put the TChart on the form, scale it to the size you like, double-click on it and change the settings to customize it. Then click on the form again, see "events" in the object inspector, find the event called "OnShow", double-click in the white space next to it, you will be directed to any empty function called OnShow() and add the code to plot your graph there (to add points, it is something like myChart->AddXYPair(), but I'm not sure). But handing in code that only works for Borland C++Builder and the VCL is probably not the best thing.

Alternatively, you can use SDL with SDL_draw. Which is going to be easy and much better than graphics.h or anything of the like. You can create a window of the size you like and draw whatever your imagination can produce.

If you just need to obtain the graphs.. not necessarily having the C++ code to generate them.. then just save the data to a file with X and Y columns, import it in "MS Excel" and plot the graphs. Or, use "matlab", the exact same way. Or, use "octave" if you want a free software for the same purpose as matlab.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.