May 26th, 2013

An exercise of the Tesseract.

My employer before Perceptive Software had a logo that ‘could have been’ a Tesseract.

Source code available here on GoogelSVN.

Screen Shot 2013-06-23 at 8.15.02 PM



Random Dot Stereogram

January 6th, 2013

It has been a few years since I was fascinated over random dot sterograms; 3D without glasses or special technology, just have to cross your eyes.. and a headache afterward. :)

Thanks to GPU Gems-chapter 41, here is some javascript to produce the RDS pair of a box.  Source code is available on GoogleSVN.

Animating Text

November 26th, 2012

Exercising basic html-javascript text with animation.  Using cubic spline to draw top and bottom curves for text to travel in.  Mouse-click into div to insert curve anchor points.  Source code is available on GitHub.

WPF STL decoder

September 26th, 2012

For my most recent enrichment, this is my first exercise using WPF.  I am implementing a STL binary decoder in C#.  Will work on the ascii decoder next.

Visual Studio 2008 DecoderExercise project available on GoogleSVN.


FTPWebRequest in VB.NET

September 21st, 2012

One of the nice thing about Visual Studio is your language choice.  Regardless of your preference for C#, C++ or VB, the underlining API is the same.  So, it is a surprise to me that the FTPWebRequest example is missing a VB implementation.  As an exercise assigned, I am porting the C# example into VB for those whom feel left out.  Here is my dialog application that allows you to navigate to a directory, connect to ftp server and put file(s) onto server.  For test comparison, I have also make the sample code into a DLL for testing.  Here is my class library of the MSDN-C# example.

Screen Shot 2012-09-21 at 9.30.25 AM

How interpolation show their effect in frequency domain…

September 9th, 2012

An interesting LinkedIn discussion brought on by Zhonghai Deng.  Here is my exercise displaying frequency plots for 2X interpolation via nearest-neighbor, linear, and cubic.  The original image is a rect function (10 pixels x 1 pixels)  All interpolated images are scaled 2X to (20 pixels x 1 pixel) with Adobe photoshop.  See the result sinc function comparison and/or download the mathematica file and source images.

Android-Flex accelerometer sketch 2

September 4th, 2012

Made some minor enhancement on the year old android application, XLOsketch.  Like the first implementation, accelerometer is required.

Screen Shot 2012-09-04 at 6.56.15 PM

Correction from version 1.0, the drawing path appropriately draws downward as you would expect with gravity.  The steeper the angle, the faster it travels.

IMAG0135Also, there is a pause-continue option.  When paused, user has the control to change the stroke thickness.


Project Source code is available on GoogleSVN.  Or download from Android marketplace (Google play).

Screen Shot 2012-09-04 at 3.35.25 PM

Might you advice on Rhino v4 ?

August 21st, 2012

Prerequisite to building a Rhino plugin, I need to validate my understanding of the sketchfab upload process. I begin with a python script from the API page, my new token and a sample lamp OBJ file.


type in ‘pythonw upload.py’ and a successful upload delivers a screen dump of the file transfer along with an id and validating success confirmation.

pythonUpload1My credential works and now I am ready to write my own uploader test in C#.  From the API and python script, I gather the four necessary steps; 1) load CAD file, 2) convert to base64, 3) build JSON, 4) upload/post JSON.

Rhino v4 supports plugin development with Visual Studio 2008, C#, VB and C++.  The simplest for me is a C# dialog application with default controls and OpenFileDialog module.

Using FileStream, CAD file is read in as a byte array.

Since some CAD files (STL, PLY) can be in binary or ASCII format, a base64 conversion is used.  Thanks to C#, the conversion is available in the System.Convert library.

Screen Shot 2012-08-21 at 7.38.57 AMFollowing Sketchfab API, I am creating a JSON string with  below function.  After conversion to a byte array, HttpWebRequest uploads my content to sketchfab server.

Screen Shot 2012-08-21 at 7.43.04 AMUpon a successful upload, I receive a confirmation id and ‘success : true’.


It is exciting working on my first Rhino plugin with C#, Visual Studio 2008.  The body of code samples is massive (over 150+).  From McNeel’s dialog example, I am able to incorporate the test code user interface.

plugin2The challenge is getting access to the mesh data.  It seems that each example requires user to select data and I am at a loss how.  Might you share some wisdom ?  Here is my source code for ExporterTest and RhinoExporter (experiment).


Happy to have found the most recent Rhino 5 API documentation online.

sketchfab – exporter test

August 12th, 2012

Exciting opportunity to develop exporter(s) for sketchfab.  The offer is to implement exporter plugin(s) for popular CAD software in exchange for sketchfab account for a year.  There are already three such implementations: AutoDesk-3dMax, Blender and Google-SketchUp.  I am looking into Rhino and Meshlab.

Rhino v5 beta is available in Mac OSX and Windows.  Python scripting is a big feature I have been anticipating for sometime.  Sadly, I did not witness its functionality in OSX beta WIP.  Any suggestion(s) ?  Windows Rhino v5 is only available for licensed Rhino users.  So, I downloaded Rhino v4 evaluation which does not support python.  Pray to the Rhino deity that the documentation and SDK is excellent and writing a C# plugin will be a cinch !

Meshlab is an open source project with seemingly good documentation on wiki.  But apparently there is nothing under ‘plugin’ ?  I did find these plugin examples and this official documentation which includes instruction on C++ plugin development as well as the project location and compile.  Meshlab is compiled with QT.  Might QT Creator be the magical tool I seek ?

Before the actual implementation, I thought to make a prototype.  The API specification is available on sketchfab, token is provided upon sign up.  My prototype is in C#; got it working quickly (praise to a good language, tools and user community, thank you!)  So, here is the Visual Studio 2005 C# application for uploading your CAD file to sketchfab.  Feel free to use this source code for your next exporter implementation (if it is helpful).

Screen Shot 2012-08-12 at 4.56.25 PM

Loading local OBJ file, javascript

August 10th, 2012

Last year I implemented four decoders (wireframe-basic) for formats: STL, PLY, OFF and OBJ.  The decoders were based on Devon Govett’s bmp decoder.  The bmp decoder loaded binary data via AJAX and type cast as uint8Array.

Screen Shot 2012-08-22 at 8.09.29 AM

Unfortunately, IE9 and prior versions didn’t support uint8Array type (IE10 does, horay) !  So, for the ASCII only CAD formats (OBJ, OFF), I re-wrote their decoders to keep the returned data in ASCII.

Screen Shot 2012-08-22 at 8.12.29 AMI extracted the AJAX into its own common Loader class for re-usability across multiple decoders.  In addition, thanks to Eric Bidelman’s article on local file access, I am adding local file load capability to the Loader class in my OBJ decoder.

Screen Shot 2012-08-22 at 8.22.02 AM

A byproduct of handling ASCII data is the possibility of line parsing with Regular Expression as I have learned from Three.js’ very own Mr. Doob.  This is somewhat put into practice in my work-in-progress Three.js-OFF-decoder.

Source code is available on Github – OBJDecoder, Github – OFFDecoder.