Ruby 3d Function Animation Demo using gnuplotrb



Sample Image

Sample Image

First the ruby file was executed using the netbeans IDE. In netbeans IDE after creating a new ruby project: Tools, Ruby Gems, add the gem "gnuplotrb" to the project. Executing the ruby project created a series of files gnuplot_gem00000.png, gnuplot_gem00001.png, etc. Then the first file was opened in virtualdub and the frame rate changed to 20 (video, frame rate) and then saved as avi, then Moyea Video4Web Converter was used to convert it to a small flv file.

The ruby script uses four functions, three of them take as a parameter "iteratorNum" and time to yield x and y and z coordinates respectively, these are generatorFnX, generatorFnY, generatorFnZ. The time function (generatorFnT) just takes iteratorNum as a parameter. As iteratorNum is varied linearly, this results in different values of x,y,z,t being generated. To create the plot, each entry of a time array is passed into the x,y,z generator functions along with every occurance of iteratorNum. Then this is repeated for every entry in the time array. This generates a sequence of images which are turned into a video. In fact the time array does not affect the time at which it is displayed, since it is the linear increasing index of the time array, not its contents, which determines the time sequence.

A future task could be to swap the contents of the functions around so that the functions for time,x,y,z could be interchanged to see what effect that has.

Web Page Author Information

Web Page by Jevan Pipitone
14 August 2017

Contact Details

You can use, copy, or download any of my material as long as you add a link to the web page