looking for simple 3d plotting program

Alexey Shuvaev shuvaev at physik.uni-wuerzburg.de
Thu Apr 8 19:21:10 UTC 2010


On Thu, Apr 08, 2010 at 11:05:15AM -0400, Robert Huff wrote:
> 
> Robert Huff writes:
> 
> >  	I have a project for which I need to produce a {gif, jpg, png}
> >  of a 3d space, with labled axes, and plot a small number (<25 ??) of
> >  points within it, either with labels or as icons.
> >  	Two constraints:
> >  	Current code is written in C.
> 
> 	I expressed myself badly.  What I should have said was:
> 
> 	It must be usable via C function calls.
> 
Not the best and the most elegant way to achieve this, but...
you can try math/gnuplot. It can do 3d.
-------------- next part --------------
CC=gcc
CCFLAGS= -g -Wall 
LDFLAGS= -lm -lpthread

target= testgnuplot
objects= testgnuplot.o gnuplot.o

all: $(target)

$(target): $(objects) 
	$(CC) $(LDFLAGS) $(objects) -o $@ 

%.o: %.c
	$(CC) $(CCFLAGS) -c $< -o $@

clean:
	rm -f $(objects)
	rm -f $(target)
-------------- next part --------------
gnuplot.c implements a helper function that invokes gnuplot
to display the acquired data. 

You need to have the gnuplot package installed to take advantage
of this function.

You can reuse it in your program by adding the gnuplot.c and 
gnuplot.h files to your project and calling the function:

int sendDataToGnuplot(int handle, float x0, float dX,
                      double *buffer, int nbOfPointsPerCh,
                      int nbOfCh);

handle is the handle of the acquisition session returned by _PdAquireSubsystem.
x0 is the origin of the x axis
dX is the increment between each points on the x axis
buffer contains the acquired data
nbOfPointsPerCh contains the number of sampels acquired for each channel
nbOfCh contains the number of channels
		      


More information about the freebsd-ports mailing list