Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

weilanddavid

macrumors newbie
Original poster
Oct 22, 2006
16
0
What is the best (basic) approach to graphically representing the output of C++ programs (in Xcode)? Anything from plotting a basic graph (y=f(x)) to constructing an animation of some process that evolves over time. Two-dimensional is sufficient for now. Best place to begin? Many thanks for suggestions, David
OS X 10.4.8, 1.83 GHz Macbook, XCode 2.4.1
 

garethlewis2

macrumors 6502
Dec 6, 2006
277
1
You could create a Cocoa wrapper project. This would comprise a button labelled something like runit, along with an NSView class that would graph your data. The runit button would execute your C++ program in an NSThread or similar and your NSView would receive notification alerts to state that more output is ready to be drawn.

There are probably simpler alternatives, I'm just putting an idea forward.
 
Write the data / function to a text file and use gnuplot (http://www.versiontracker.com/dyn/moreinfo/macosx/1849).

If you have never used it before, there is an excellent reference / tutorial at this site http://t16web.lanl.gov/Kawano/gnuplot/index-e.html.

It is quick, easy and works every time, and it will do 3 dimensions, too.

Quicktime and a whole host of other apps can build animations from a series of images.

A little bit of shell scripting can connect all these bits together very quickly.
 

weilanddavid

macrumors newbie
Original poster
Oct 22, 2006
16
0
ummm, you're over my head. :confused: let me try another guess. run the c program and put the data into a file. then write a java program (i've never written anything in java, so i'm just guessing here) to read the file and draw it appropriately. one of my goals is to produce publication quality diagrams, so creating an actual picture file is important as well. so, two questions here. 1. separating the computation and the drawing into two separate programs a good idea? 2. is java the best way for beginner to 'draw'?
 

weilanddavid

macrumors newbie
Original poster
Oct 22, 2006
16
0
wrote my last reply before reading AlmostThere. sounds good, i'll look into it. thanks, david
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
hi

Last time I looked there were a few programs in the Maths and Science section of the Downloads area on the Apple site that will plot graphs from data files.

b e n
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.