Digital Quilling

When I saw “quilled paper” images the first time, I was certain they were fake. The bright colours and meticulously spiralled paper bits looked impossible (or at least impossibly tedious) to manufacture by hand. They are most assuredly real – most backwards image searches lead to Yulia Brodskaya, who does immaculate, gorgeous quilling work with incredible subtlety and variation. Here’s a couple of her pieces.

There’s no way on earth I’m going to find the time to sit down and master something like this, but the work is so beautiful and I’d love to produce something like this, so I did the next best nerdy thing, and wrote some MaxScripts to generate faux Quilling out of Illustrator vector files. Here’s an early preview, without fancy colouring.

And up close…

If you’re paying really close attention, you’ll notice that all of my paper bits form closed shapes – whereas a lot of Yulia’s curls are open and usually terminate in cute little spirals. My first go at generating procedural spirals off the ends of shapes looked terrible. I think it’s the kind of thing you need to be judicious about – at some point some artistry is required. (Although I haven’t quite given up on perfecting this yet) The digital bits are at least a lot less fidgety than real paper, and it’s super fast – to create the shape file I just subtracted an artsy wingding from a bold-font J, and one minute thirty seconds later I had a GI rendering of fake paper curls. There’s colour, texture, and lighting yet to get polished up, but the early stuff is promising.

Sorting French Accented Characters in Javascript

I work at a bilingual university, and ran into a javascript puzzle when I was trying to do some fancy table sorting in French. Accented characters, because they have a really high ascii value, kept ending up at the end of my lists! I asked around and strangely nobody had run into this problem before – mostly our data is sorted properly before it gets to us by the SQL server or whatever data source we’re using. That wasn’t a luxury I had since I was reading from a user-generated XML file that’s in no order whatsoever.

I bounced a couple of ridiculous, difficult ideas off of a friend before I realized there’s a way to manually substitute the normal sorting tool logic with your own, and luckily there’s an accent-aware string comparison method called localeCompare() that handles the heavy lifting for us. Here’s some example code that should explain itself!

 // Start off with an array of strings
 var fruits = ["Banana", "Orange", "Apple", "Mango"];
 // Add a few curveballs to the array - French words!
 fruits.push("étudiant");
 fruits.push("éléphant");
 fruits.push("à l'heure");
 // Normally, in English, we can just use sort() to sort an array.
 fruits.sort();
 // Unfortunately, this puts all the high-ascii accented characters at the end!
 // Apple, Banana, Mango, Orange, à l'heure, éléphant, étudiant
 // SO WRONG!
 // So we can code our own sorting function! Here I give it a name. We pass in
 // a and b, variables used by the sort routine to compare between neighboring
 // array elements.
 function frsort(a,b) {
 // We're comparing each a & b pair using the localeCompare string method,
 // which takes into account the accents and their sort order in most accented 
 // latin-based languages by default. You can actually specify regional
 // language rules with another parameter, but I leave that as a research
 // task for the reader.
 return a.localeCompare(b);
 // When we hand this information back to the sort routine, it can properly
 // order our list.
 }
 // Now we call the sort routine with a new parameter - our frsort function.
 fruits.sort(frsort);
 // Now we're getting somewhere! Success!
 // à l'heure, Apple, Banana, éléphant, étudiant, Mango, Orange

You can write your own custom sort routines to sort anything arbitrarily – sort functions are a really interesting subject and allow all kinds of neat customizations! Be warned though – different JavaScript implementations have minor sort function differences. (Chrome seems to have taken a while to catch on to localeCompare, and it may not work on older versions.)

I’m sortof disappointed that accented characters aren’t handled better by the default sorting algorithm – it makes JavaScript (and by corollary, the application & ajax rich web) suddenly feel really anglo-centric to me. I guess there are performance issues when you have to look up every character in a table vs just taking it’s ascii value into account.

The Brainscoop

I’ve been gushing to my friends all year about a Youtube science show called “The Brainscoop“, featuring plucky and curious Emily Graslie, an assistant at the University of Montana Zoological museum. Over the course of 40 (so far) episodes, she teaches us about biology through actual dissections of a number of large mammals, shows us the background goings-on at the tiny campus museum, and eagerly answers questions about guts and bugs and other gross stuff. It’s one of the most entertainingly charming and unflinchingly hands-on science shows I’ve ever watched, going places television nature shows traditionally shy away from. This is real science in action – solving mysteries and getting your hands dirty in the process.

As the episodes roll along, Emily’s personal story arc is fascinating to watch – she goes from goofy nerd discovered on a Hank Green (of vlogbrothers fame) visit to a university, to pro on-camera personality backed by mysterious deep-pocketed Heather Hsu, to Chicago Field Museum’s Chief Curiosity Correspondent. Her personal story comes to the forefront in this latest, emotionally stirring episode “Farewell, Montana“- one I consider high art.

There’s so much going on here – without watching the previous episodes I’m not sure how much you’ll pick up on, but I’ve only rarely seen a youtube video provoke so much emotion.¬† Her stress over the real possibility of the collection facing neglect (exacerbated by her feelings around leaving) feels really immediate. Excellent, excellent storytelling. Fascinating story. I am literally on the edge of my seat over a bunch of jars full of shrews.

Mosaika!

Natasha and I finally managed to find ourselves downtown late on a weeknight, so we headed up to Parliament Hill to join the (surprisingly large!) crowd assembled on the lawn to watch Mosaika, a projected art show on the face of the Parliament Buildings.

Overall it was pretty neat – we’ve seen this kind of thing done before (notably at the docks in Quebec, where the huge grain silos become a projection screen) and it lived up to our expectations. The history lesson may have been a little fuzzy, but the presentation was slick and it was paced quickly enough to keep us interested. Every so often they’d just saturate the whole building in vivid colours to a chorus of Oohs and Aaahs. The poppies scene seemed to go over especially well.

I wasn’t surprised to find out Montreal’s Moment Factory were behind the production – I’ve been following their work for a while and I’m starting to definitely recognize their style. I’m not sure they had their star players on this one – most of the effects were pretty basic stuff.¬† They rely heavily on simple illustrations, animated in After Effects with layer transformations – and now and then a particle effect thrown in for fun. It’s one of those things I’d be more impressed with if I knew less about it. Worth checking out, though!

Kinect Coolness

I suppose you’re supposed to play it cool when you do something neat, but I have to admit I impressed myself this weekend when I finally got data out of the Microsoft Kinect. I may have shouted “Woot woot” a few times. Rad times were had. I drank a root beer float.

This is the Tron version of me, made up out of depth pixels scanned using the kinect “structured light” camera. There’s a bit of a trick to getting the colour image and 3d points to line up properly – around my shoulders you can see the texture is a bit off. (I’m using a fudge factor to nudge it into place elsewhere in the image) I was wrestling with driver code on the PC for a long time and then when I moved to the Mac it just _worked_.

I’m working now on meshing the data and dumping it out to a 3d format I can use in 3DStudio, but don’t expect to hear much about it for a while since I’m a bit out of my depth (haha, pun) when I’m working with marching cube algorithms or whatever. It’s a good excuse to learn!

Really really later on down the road, I’d like to be doing portrait photography with it, generating depth of field and effects based on image depth. I’ve seen some other people doing something similar, and I’m really excited by their results.