Yet another cube

Web June 22nd, 2007

It took me a little while to hack the dojox.gfx3d framework. Though there is tons of work to be done, I need to mask the unexpected functions, clean the code, add more comments, and explore more advanced features like lightings, textures, and we might refactor the code later, I still feel quite excited to release the sneak preview of dojox.gfx3d: Yet another cube.

Yet another cube



This is the test case run in Firefox 2.0.0.4 on my Gentoo box, it is 100% sure not working in MSIE. You can grab the snapshot from here.

Before we code, we document

Web June 20th, 2007

Before rolling-up sleeves to make my hands dirty, I would like to document each step we take: the design philosophy, implementation challenge, refactory to keep the community updated what I am doing in this summer.

Here is the draft of Introduction to dojox.gfx3d library, which will be eventually merged into the API document, and become much less verbose. Now it is wordy since I am trying to explain the detailed information about what is under the hood and why we take the specific approach to cope with this problem.

For best user-experience, please download PDF or DVI; or you may read it online here, if you are using Firefox 1.5 or later with MathML fonts installed, here is another online version; last but not the least, if you would like to contribute to this document, and send feedback for us, here is the LaTEX source.

Though I am using LaTeX, I am not “old school” enough, I am using Kile to edit and build the LaTex. And I still could not figure out how to use latex2html to generate one page HTML or put all the footnotes in one page when using TeX4ht, if you have any clue to do so, please leave me a message in the comments. Thanks.

dojo.gfx 3d proof-of-concept implementation

Web May 19th, 2007

This is the first proof-of-concept implementation of dojo.gfx 3d support. Just copy test3d.html to $dojo/trunk/tests/gfx/, and launch any SVG-based browser, Mozilla Firefox is preferred, and you would found a cube like this:

Cube SVG



This is a quite quick-n-dirty implementation, the Path3d class is more or less a hybrid of dojo.gfx.Path and dojo.gfx.path.Path, operations are copied from here and there with modification to meet our needs. The main contribution of this test is

  • Test case itself, we may use the same interface to manipulate the 3D objects
  • cameraTransform, the mapping of 3D space to 2D surface

We are probably inspired by this lousy implementation for its weakness:

  • Separate the 3D and 2D domain - this is essential since we want to reuse the interface as much as possible, for example, 3D space’s path syntax is the same as 2D’s with different number of arguments.
  • Move shared functions to infrastructure layer, then we can reuse it in both 2D and 3D domains
  • Move the matrix operation to dojo.gfx.matrix.3d namespace
  • Attach more meta data to the SVG DOM node, for example, original (x, y, z) path, transform, x, y, z axis’s rotation, scaling matrix for further transformation. CAUTION: this is quite computation extensive
  • Attach - this could be a big problem. When attaching a dojo.gfx object to existed SVG node, we need to differentiate the domains by using the meta data mentioned above.

I think I need to consult with my mentor for more details about refactoring.

dojo.gfx 3D support kicks off

Web May 15th, 2007

dojo.gfx has aroused some buzz in the community, we are moving forward to the next step, 3D support in dojo.gfx library. Before any JavaScript coding, I would like to develop some utilities for verification and visualization.

The most convenient tool for 3D plotting in my humble opinion is gnuplot; it is free, and available in Linux, Windows and Mac OSX. Here is a simple example to plot the cube from (0, 0, 0) to (1,1,1):

gnuplot> set view 60, 30
gnuplot> splot “cube.plt” using 1:2:3 with lines

The default output is X11, you can even rotate the world coordination by using mouse to take a different view. And you may generate the PNG output for printing by setting up the terminal to png:

gnuplot> set terminal png
gnuplot> set output “cube.png”
gnuplot> splot “cube” using 1:2:3 with lines

Read the rest of this entry »

Dojo 2D demo: Trend

Web August 29th, 2006

This is probably the very first demo application for Dojo 2D. Due to the requirement of Dojo toolkit, the demo is placed in one dedicated page. You can access it from here.

Dynamic Trend fetches Google’s stock price as the monitored data, it is better to checkout the demo when NYSE is still open, i.e 8:00 AM to 4:00 PM EST.

UPDATE: for unknown reason, MSIE does not work if the demo is integrated into the Wordpress framework. Here is the raw HTML document.

  • Using dojo.io.bind instead of XMLHttpRequest, MSIE works
  • Add wrapup support
  • Fix some small bugs