Hi there,

  I have an IMO fairly straightforward method for doing this that I wrote 
for use in my own flow modelling code. The idea is that you create a matrix 
(vector of vectors in my case) containing refs all initialized to some base 
value (e.g., 0). Then I wrap my with-animation macro around a call to the 
toplevel simulation function which will manipulate those refs internally. 
with-animation will spawn a JFrame that shows the matrix with a green (low) 
to red (high) color ramp with an automatically adjusting legend along the 
bottom. The image of the matrix is refreshed by its own thread once every 
*animation-sleep-ms*. All the drawing and refreshing code is available in a 
namespace within one of my own projects that I haven't yet broken into its 
own library, but I suppose I could do that easily enough if this approach 
sounded useful to you.

Right now you can see the code I am talking about here:

  https://github.com/lambdatronic/clj-span/blob/master/src/clj_span/gui.clj

You would just pull in that namespace and the ones it depends on (feel free 
to copy them from my project or make the whole thing a dependency of your 
code). Then you would call it like so:

(with-animation :numbers 0.0 matrix1 matrix2
  (run-my-simulation matrix1 matrix2))

The idea is that run-my-simulation (your code) will manipulate the refs in 
these two different matrices, and then with-animation (my code) will render 
them in two panels side-by-side with matching legends and color ramps, so 
you can see their differences. I had built it this way because I needed to 
compare flow results under two different scenarios and only wanted to run 
the simulation once with both scenarios happening in parallel. If you just 
needed to show a single matrix, it should be pretty obvious what to comment 
out of the with-animation macro.

Good luck and happy hacking,
  ~Gary


On Monday, June 17, 2013 3:17:01 AM UTC-4, vemv wrote:
>
> I'm implementing a program D. Hofstadter describes in *Fluid Concepts: *
> https://github.com/vemv/jumbo/* *Even in the original text, 
> concurrency/parallelism is a crucial part of the domain so Clojure is super 
> well-suited.
>
> While visualising the carried-in process is not a goal of the project, 
> providing a rendering of the 'entities' of the modelled world would help a 
> lot explaining my program to others (which I have to).
>
> The thing is - I haven't ever done significant graphics programming - I 
> don't know e.g. what libraries to use, how to create smooth movements, keep 
> the code high-level... and sadly I don't have a lot of time in my hands.
>
> Would anyone knowledgeable in the matter mind coding a quick-and-dirty 
> solution for me? I could buy you a couple books in exchange hahaha. You'd 
> have exactly one week, and I of course would provide all needed 
> information/feedback.
>
> Feel free to reply here or contact me at vemv [at] vemv [dot] net.
>
> Thanks for your time!
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to