Source for sample code referenced in http://trianglefan.wordpress.com posts.