Thursday, 3 March 2011

Using Kinect to control Jmol - Part III

Part I, II.

The final step is to get hacking on Jmol itself. We need to add support for reading hand locations from the OSC port, and then to spin or rotate the molecule based on the x, y, z coordinates of the hands.

(1) Follow the instructions on the Jmol wiki to install Eclipse, checkout the Jmol code from subversion, and compile it.

(2) Deep down in Jmol/src/org/openscience/jmol/app, you will find Replace this with one of the versions I've placed in a github repository. The master branch is simply the original; the other branches are different interfaces. (This code is based on work by some combination of Dan Hagon, Sam Adams and Bob Hanson.)

(3) These files have an additional dependency on JavaOSC. You can find the jar in the lib directory of the available here. To add the jar file to your CLASSPATH in eclipse, right-click on Jmol, Properties, Run/Debug Settings, Jmol, Edit, Classpath, Jmol, Add External JARS, and navigate to the Jar file (oh Eclipse, how we love you).

(4) Run Jmol from inside Eclipse, max out the screen, and wave your arms around.

And so there you go...hopefully this will get other people interested in hacking some Kinect into chemistry software. Only this last post was Jmol-specific; the general idea could be used to control any software.

1 comment:

ric said...

Thanks Noel, it's an extremely nice hack, I really loved these posts.