Processing

About a year-and-a-half ago I was toying with Processing, which is sort of like a scripting language for graphical applications – for those of you who don’t know, and wrote some plugins for it. I started tinkering with it because I was interested in doing something interesting with the SuddenMotionSensor (SMS) that’s built into every Apple Laptop and thought that Processing will make cool graphs of the readings easier – which it did.

I found that the SMS input plugin that was on the site did not work according to my standards, so I wrote one that uses SMSlib from Seismac rather than Unimotion. Using that I built the sketch that I had wanted to from the beginning which graphs the readings in 3d:  SMS sketch

I also have an extended one that draws a line around the origin on an imaginary 3d sphere that points to the exact location that the reading at that moment in time was. This line recedes over time and is colored by combining the relative strengths of all 3 dimensions (the one that the axis are using) into one color: SMS Sketch2

Then I wanted this graph to be always visible so I thought why not draw it into the applicaion’s icon in the dock, or even the tray on the top right (in OSX). So I wrote one plugin that lets you draw into the application’s dock icon in Mac OSX and one that draw into an icon in the tray – which even works in windows. The tray plugin only renders in b/w under OSX sadly, because it is a feature of Java 1.6 and the Apple GUI guidelines state that icons in the tray shouldbe black and white. Here is a sketch that draws the same 3d graph of the SMS readings into the app’s icon in the dock: screencap2.

Fullscreen capture: .

These were all built back in the day with P5 beta 0149. Recently I came across processing again, because I found out that there is now a script version of it – processing.js and got interested in it again. I realized that the current P5 version broke my plugins and set out to fix them. Along the way I had to fix SMSlib to work under Snow Leopard in x64 as well, but now all three plugins work with Processing 1.0.9 under OSX 10.6 and Java 1.6 in full x64 mode. All three plugins along with the sketches can be found on my public me.com page: Dock plugin, Tray plugin and SMSlib plugin. And here is the SMS 3d sketch’s source.

I recently came across this Seismometer widget for the Dashboard and thought I can do it better. I am currently writing a 2d version of the sketch and will turn it into a Dashboard widget using processing.js soon. Sadly, processing.js can only render in 2d as of now, so the 3d SMS sketch does not work. I am also pondering some more interesting ways of displaying the readings in 2d as well as 3d. I will post any new sketches or ideas here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: