Q: visualisation for simple animations (e.g. cel. automata)?

D

Diego Virasoro

Hello,
I would need to create a very simple visualisation for some scientific
work I am doing. Basically I need to draw points in a 2D graph (and
specify which colours to use) and each time the user presses the
spacebar it should move to the next iteration and show (say with a
line) where everyone is.

What would be the simplest way to go about this?

The first priority is simplicity followed by easy to learn. I don't
need either a powerful system nor something that looks pretty (I am
the only one who'll use it ^_^).

thank you in advance

Diego
 
P

Phlip

Diego said:
Hello,
I would need to create a very simple visualisation for some scientific
work I am doing. Basically I need to draw points in a 2D graph (and
specify which colours to use) and each time the user presses the
spacebar it should move to the next iteration and show (say with a
line) where everyone is.

What would be the simplest way to go about this?

Any GUI tool with the word "canvas" in it, such as TkCanvas.
 
C

Chris Lowis

What would be the simplest way to go about this?

It'll probably help to use an existing graphing package, as this will
take care of some of the tricky things for you such as scaling of axis
limits and plot styles.

Perhaps Gnuplot would work? Depending on which OS you are using it can
be easy to set up and use from Ruby, but you will have to become a
little familiar with Gnuplot to be able to control some things. I wrote
about using Gnuplot with Ruby recently:
http://blog.chrislowis.co.uk/2008/12/01/curve-fit-with-ruby-gsl.html

Hope this helps,

Chris
 
J

Joachim Pense

Diego Virasoro (in comp.lang.ruby):
Hello,
I would need to create a very simple visualisation for some scientific
work I am doing. Basically I need to draw points in a 2D graph (and
specify which colours to use) and each time the user presses the
spacebar it should move to the next iteration and show (say with a
line) where everyone is.

What would be the simplest way to go about this?

The first priority is simplicity followed by easy to learn. I don't
need either a powerful system nor something that looks pretty (I am
the only one who'll use it ^_^).

The Ming library <http://www.libming.net/> allows you to generate Flash SWF
files, and there is a Ruby interface package
<http://mingruby.rubyforge.org/>,
look here <http://rubyforge.org/news/?group_id=428> for latest versions.

The documentation is not really existent, though. You have to look into the
(numerous) example files that come with the package, and look up the
corresponding functions in the Perl interface doc
<http://www.libming.net/docs/perl/index.html>.

I just downloaded and installed it and want to use it to learn both Ruby and
Flash.

Joachim
 
P

Philippe Lang

Diego said:
Hello,
I would need to create a very simple visualisation for some
scientific work I am doing. Basically I need to draw points in a 2D
graph (and specify which colours to use) and each time the user
presses the spacebar it should move to the next iteration and show
(say with a line) where everyone is. =20
=20
What would be the simplest way to go about this?
=20
The first priority is simplicity followed by easy to learn. I don't
need either a powerful system nor something that looks pretty (I am
the only one who'll use it ^_^). =20

Hi,

Have a look at FXRuby, a great and easy to use library.

As a tutorial, you can have a look at this:
http://www.attiksystem.ch/index.php/2008/02/21/double-buffering-in-fxrub
y/

Regards,

Philippe
 
J

Joel VanderWerf

Phlip said:
Any GUI tool with the word "canvas" in it, such as TkCanvas.

TkCanvas is pretty good for 2D animations. I've used it in engineering
tools (including as a plug-in block for a simulink-based tool for a car
company).

I developed a general tool called tkar that runs as a standalone process:

http://path.berkeley.edu/~vjoel/vis/tkar/

It's based on ruby/tk, but you can feed it data from anywhere, not just
ruby code. It accepts data from pipes and sockets. Your controlling
process can decide when to send data, so you would probably handle
spacebar events on the upstream end of the socket.

It handles basic user interaction fairly well, allowing pan, zoom,
click, drag-n-drop (the latter two send the commands back out the
socket, so you can control the effects).

For an overview, see

http://path.berkeley.edu/~vjoel/vis/tkar/tkar.html

and of course the movie

http://path.berkeley.edu/~vjoel/vis/tkar/movie.gif

Full docs--most importantly the data stream protocol and shape defs--are in

http://path.berkeley.edu/~vjoel/vis/tkar/doc/

The program itself is all one file:

http://path.berkeley.edu/~vjoel/vis/tkar/tkarpi.rb

This simulink plugin is quite nice--beats the native simulink 2D
animation, and is just about as flexible as the simulink plotter block.
But probably not of interest on this list.

HTH.
 
J

Joel VanderWerf

Joel said:
TkCanvas is pretty good for 2D animations.

On second thought...

Writing ruby/tk code directly (rather than over a socket as I suggested)
is probably a better idea for an animation that's this simple.

- tkar is especially good if you want to define some complex shapes and
then move them about, rotate them, change their shape params, etc.

- using ruby/tk directly may be better if you have a grid of colored
squares and just want to change each square's color over time. Probably
there's even an example you could adapt.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top