Re: [GD-DEVEL] Re: plotting data c++

[email protected] (Ethan Merritt)
Newsgroups php.gd.devel
Organization University of Washington
Message-ID <[email protected]>
On Friday 01 February 2008 06:11, Bill Frost wrote:
> Hi guys,
> 
> This has always sounded to me like an ideal gdLib application.
> 
> I had a bit of spare time today and I was intrigued by the problem. I dug
> out some existing C++ code and modified it a bit and it now plots Patolfo's
> data points as a square wave in JPEG format. If I keep the number of samples
> at 256 but vary the number of terms from a high, such as 128, a square wave
> is generated. If the number of terms is then set low, such as 8, a
> sinusoidal-square wave is generated. Looks nice as a curved plot!


By the way..
I should have mentioned this earlier, but there is a nice applet at

   http://www.jhu.edu/~signals/fourier2/

that does this job.  I use it in teaching Fourier series.
A more sophisticated 2D Fourier applet is also available as part
of Kevin Cowtan's tutorial on Fourier analysis in crystallography

   http://www.ysbl.york.ac.uk/~cowtan/sfapplet/sfintro.html


Neither of these has anything in particular to do with libgd, of course,
but if your primary interest was the application itself maybe these
are of use.

	Ethan







 
> Selecting 256 samples with 128 terms runs in 0.093 seconds on a Centrino, as
> gdLib / C++ is very fast.
> 
> Note that it is a utility, not a GUI application. It runs Padolfo's test
> data application and opens the file using the operating system's default
> JPEG handler (typically Windows Picture and Fax Viewer).
> 
> It:
> 
> * runs the sample algorithm,
> * saves the sample data to a file and closes it (normally user-supplied)
> * re opens the file
> * extracts all data into a class, finding max and min values
> * sets up a device context in gdLib, with some scaling
> * creates the JPEG and thumbnail
> * iterates the class and plots each x, y to a pixel
> * scales and labels the axis
> 
> 
> I've just fixed a rather embarrassing buffer overrun and I need to do a
> little code clean up and make the JPEG slightly more aesthetic. Then I'll
> post the source as a royalty free utility (seeing Padolfo wrote the main
> algorithm!) as an example of using gdLib. Comments welcome once I have done
> this as I am by no means an expert on gdLib and I still don't really know
> what FFT is all about.
> 
> Cheers,
> 
> Bill
> 
> -----Original Message-----
> From: Patolfo [mailto:[email protected]] 
> Sent: Thursday, 31 January 2008 10:15 AM
> To: Bill Frost; [email protected]
> Subject: [GD-DEVEL] Re: plotting data c++
> 
> ok guys here is the problem again, i am plotting x,y data, floats to be 
> precise, must be in C, C++, the hardway, no perl or python just know how 
> to us perl a little, the idea is to have the application data to do the 
> approximation of a square wave by means of fourier series, the job is 
> done, now the problem is the gui, well i tried tk with perl and 
> everything went smootly, till the part of converting perl to C, and 
> including the interpreter and all that stuff, truly i did not get it 
> right so it freezes and is buggy, so well back in track i found my self 
> on the same road, just C, the gui I plan to do them with windowsapi they 
> are the lesser problem, mingw, but the plotting data per se is the
> biggest problem, i tried reading the wiki for libgd, and let me tell you 
> it is not for noobs, or at least not for the dumbest as me.
> 
> The algorithm says more or less:
> number or harmonics, number of data points, using gui, some routines, 
> and then we have and arbitrary number of data with a max value of 1 and 
> the minimum of 0, arranged in pairs of x,y,
> 
> i have the suspicion it is straightforward, but i seem to fail, i am 
> still googling, found koolplot, which i think uses libgd, did not work 
> for my mingw, so, any directions where to look...
> 
> -- 
> GD Devel Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
Ethan A Merritt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.