G
Gavin Kistner
The Springz library allows you to attach two objects together (in 2D
space) with a spring, and simulate how they pull/push each other.
Boring when used between two objects, it becomes interesting when you
attach thousands of springs with different strenghts and distances
between hundreds of nodes, and let the simulation determine the best
configuration of those nodes. (I wrote this library specifically to
create a social network diagram from a large amount of data. I had
written it first in Javascript + SVG, and it was working, but too
slowly: 3 hours to render the first frame, and 12+ hours for each frame
after that.)
Despite the very visual nature of this application, this library
doesn't know jack about graphics; it just knows how to push/pull
theoretical objects around in theoretical 2D space. Making this visible
to the user is up to you. (My application reads in XML data and then
outputs a few frames of SVG pre-rendered animation.)
The documentation for the Springz class lists the key features at the
top of it.
You can read this laboriously-written documentation, and download the
file itself, from:
http://phrogz.net/RubyLibs/ (click on Springz.rb under the Files
listing).
If you happen to have the Adobe SVG plugin (freely avail for
Win/Mac/Linux/Solaris) installed, you can see the JS version of this
library in action at http://phrogz.net/SVG/SpringzTest.svg -- click the
green rectangle to start the simulation, and then drag objects around
and/or click the orange button to scatter them about.
WANTED: If anyone is a matrix/math geek and knows of speedier ways to
do what I'm laboriously calculating, I'd love to trade a few emails.
Enjoy!
space) with a spring, and simulate how they pull/push each other.
Boring when used between two objects, it becomes interesting when you
attach thousands of springs with different strenghts and distances
between hundreds of nodes, and let the simulation determine the best
configuration of those nodes. (I wrote this library specifically to
create a social network diagram from a large amount of data. I had
written it first in Javascript + SVG, and it was working, but too
slowly: 3 hours to render the first frame, and 12+ hours for each frame
after that.)
Despite the very visual nature of this application, this library
doesn't know jack about graphics; it just knows how to push/pull
theoretical objects around in theoretical 2D space. Making this visible
to the user is up to you. (My application reads in XML data and then
outputs a few frames of SVG pre-rendered animation.)
The documentation for the Springz class lists the key features at the
top of it.
You can read this laboriously-written documentation, and download the
file itself, from:
http://phrogz.net/RubyLibs/ (click on Springz.rb under the Files
listing).
If you happen to have the Adobe SVG plugin (freely avail for
Win/Mac/Linux/Solaris) installed, you can see the JS version of this
library in action at http://phrogz.net/SVG/SpringzTest.svg -- click the
green rectangle to start the simulation, and then drag objects around
and/or click the orange button to scatter them about.
WANTED: If anyone is a matrix/math geek and knows of speedier ways to
do what I'm laboriously calculating, I'd love to trade a few emails.
Enjoy!