<?xml version="1.0" encoding="iso-8859-1" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" 
"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd" > 
<?xml-stylesheet type="text/css" href="intro-dojox.gfx3d.css"?> 
<html  
xmlns="http://www.w3.org/1999/xhtml"  
><head><title>Introduction to dojox.gfx3d library</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html)" /> 
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html)" /> 
<!-- xhtml,mathml-,mozilla --> 
<meta name="src" content="intro-dojox.gfx3d.tex" /> 
<meta name="date" content="2007-06-20 17:47:00" /> 
<link rel="stylesheet" type="text/css" href="intro-dojox.gfx3d.css" /> 
</head><body 
>
   <div class="maketitle">



<h2 class="titleHead">Introduction to dojox.gfx3d library</h2>
<div class="author" ><span 
class="cmr-12">Kun Xi</span></div>
<br />
<div class="date" ><span 
class="cmr-12">June 20, 2007</span></div>
   </div>
   <table width="100%" 
class="abstract"><tr><td 
>
<div class="center" 
>
<!--l. 15--><p class="noindent">
</p><!--l. 15--><p class="noindent"><span 
class="cmbx-9">Abstract</span></p></div>
     <!--l. 16--><p class="indent">    <span 
class="cmr-9">dojox.gfx3d is proposed to render 3D objects in web browser, this</span>
     <span 
class="cmr-9">introduction states the reasoning, desigh philosophy and unleashes some</span>
     <span 
class="cmr-9">implementation details for the users to have a better understanding how</span>
     <span 
class="cmr-9">this library works.</span>
</p>
</td></tr></table>
   <h3 class="sectionHead"><span class="titlemark">1   </span> <a 
 id="x1-10001"></a>History of Graphic Library</h3>
<!--l. 20--><p class="noindent">dojo.gfx library has been developed since the Dojo Summer of Code 2006, This 2D
graphics library provides a uni&#xFB01;ed interface to manipulate the vector graphics, with
95% behavior consistence for SVG and VML render engines, across Mozilla Firefox,
Safari, Opera and Microsoft Internet Explorer. Chart developers show great interest
in dojo.gfx for data visualization and they encourage us to extend the library to
support three dimension objects.
</p><!--l. 23--><p class="indent">   <span 
class="cmti-10">dojox.gfx3d </span>is the new library for this feature request. Careful readers may
notice the subtle name change: dojo.gfx is developed in dojotoolkit 0.4 code
base, using <span 
class="cmti-10">dojo </span>namespace; and dojox.gfx3d is proposed to work in dojo
0.9 code base only, using <span 
class="cmti-10">dojox </span>namespace. To make things even worse, we
have migrated dojo.gfx to the 0.9 code base and rename it as dojox.gfx2d.
In short, dojo.gfx and dojox.gfx2d refer to 2D graphics library, with the
same functionality but in different code base, dojox.gfx3d is the 3D graphics
library.
</p><!--l. 26--><p class="indent">   Notice: all the names are subject to change since we are in quite a early
stage.

</p><!--l. 28--><p class="noindent">
</p>
   <h3 class="sectionHead"><span class="titlemark">2   </span> <a 
 id="x1-20002"></a>Fundamental of Computer Graphics</h3>
<!--l. 29--><p class="noindent">Mathematically, three dimensional object is represented by sets of points
<!--l. 29--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>.
The coordination can be translated, rotated and scaled, i.e <span 
class="cmti-10">world</span>
<span 
class="cmti-10">transfrom</span><span class="footnote-mark"><a 
href="intro-dojox.gfx3d2.xml#fn1x0"><!--l. 29--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >1</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-2001f1"></a>
in 3D domain; then 3D objects are projected to 2D shapes for presentation, aka
<span 
class="cmti-10">Camera transform</span>.
</p>
   <h4 class="subsectionHead"><span class="titlemark">2.1   </span> <a 
 id="x1-30002.1"></a>World Transform</h4>
<!--l. 32--><p class="noindent">World transform is quite useful for the users. Consider the following scenario: a
rotated cube, You may go through all troubles to calculate the coordinations
manually; or create an &#x201C;normal&#x201D; cubic, and then apply a set of world transformation
to move it to the right position.
</p><!--l. 34--><p class="indent">   The world transform matrix consists &#xFB01;ve matrices:
</p>
   <div class="math-display"><!--l. 35--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mstyle mathvariant="bold"><mi 
>T</mi></mstyle> <mo 
class="MathClass-rel">=</mo> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mi 
>x</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mi 
>y</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mi 
>z</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd></mtr> <!--llll--></mtable>                                                                                                 </mrow></mfenced><!--mstyle 
class="mbox"--><mtext class="textrm" mathvariant="normal" >-&#x00A0;translation&#x00A0;matrix</mtext><!--/mstyle-->
</mrow></math></div>
<!--l. 43--><p class="nopar">
</p>

   <div class="par-math-display"><!--l. 45--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mstyle mathvariant="bold"><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>x</mi></mrow></msub 
></mstyle> <mo 
class="MathClass-rel">=</mo> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>     </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B1;</mi></mtd><mtd 
class="array"  columnalign="left"> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B1;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B1;</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B1;</mi>   </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>     </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd></mtr> <!--llll--></mtable>                                                                                    </mrow></mfenced><!--mstyle 
class="mbox"--><mtext class="textrm" mathvariant="normal" >-&#x00A0;rotation&#x00A0;about&#x00A0;the&#x00A0;x-axis</mtext><!--/mstyle-->
</mrow></math></div>
<!--l. 54--><p class="nopar">
</p>
   <div class="par-math-display"><!--l. 56--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mstyle mathvariant="bold"><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>y</mi></mrow></msub 
></mstyle> <mo 
class="MathClass-rel">=</mo> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B2;</mi>   </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B2;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>     </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B2;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B2;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>     </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd></mtr> <!--llll--></mtable>                                                                                     </mrow></mfenced><!--mstyle 
class="mbox"--><mtext class="textrm" mathvariant="normal" >-&#x00A0;rotation&#x00A0;about&#x00A0;the&#x00A0;y-axis</mtext><!--/mstyle-->
</mrow></math></div>
<!--l. 65--><p class="nopar">
</p>

   <div class="par-math-display"><!--l. 67--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mstyle mathvariant="bold"><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>z</mi></mrow></msub 
></mstyle> <mo 
class="MathClass-rel">=</mo> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B3;</mi></mtd><mtd 
class="array"  columnalign="left"> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B3;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B3;</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B3;</mi>   </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>    </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>    </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd></mtr> <!--llll--></mtable>                                                                                     </mrow></mfenced><!--mstyle 
class="mbox"--><mtext class="textrm" mathvariant="normal" >-&#x00A0;rotation&#x00A0;about&#x00A0;the&#x00A0;z-axis</mtext><!--/mstyle-->
</mrow></math></div>
<!--l. 75--><p class="nopar">
</p>
   <div class="par-math-display"><!--l. 77--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mstyle mathvariant="bold"><mi 
>S</mi></mstyle> <mo 
class="MathClass-rel">=</mo> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><msub><mrow 
><mi 
>S</mi></mrow><mrow 
><mi 
>x</mi></mrow></msub 
></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><msub><mrow 
><mi 
>S</mi></mrow><mrow 
><mi 
>y</mi></mrow></msub 
></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><msub><mrow 
><mi 
>S</mi></mrow><mrow 
><mi 
>z</mi></mrow></msub 
></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd></mtr> <!--llll--></mtable>                                                                                            </mrow></mfenced><!--mstyle 
class="mbox"--><mtext class="textrm" mathvariant="normal" >-&#x00A0;scale&#x00A0;matrix</mtext><!--/mstyle-->
</mrow></math></div>
<!--l. 85--><p class="nopar">
</p><!--l. 88--><p class="indent">   We take the OpenGL convention for the world transform, the world transformation
matrix is de&#xFB01;ned as:
</p>
   <table width="100%" 
class="equation"><tr><td>

<!--tex4ht:inline--><!--l. 89--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" >
                     <mstyle 
   id="x1-3001r1"  class="label" ></mstyle><!--endlabel--><mstyle mathvariant="bold"><mi 
>W</mi></mstyle> <mo 
class="MathClass-rel">=</mo> <mstyle mathvariant="bold"><mi 
>T</mi></mstyle> <mo 
class="MathClass-bin">&#x00D7;</mo><mstyle mathvariant="bold"><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>x</mi></mrow></msub 
></mstyle> <mo 
class="MathClass-bin">&#x00D7;</mo><mstyle mathvariant="bold"><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>y</mi></mrow></msub 
></mstyle> <mo 
class="MathClass-bin">&#x00D7;</mo><mstyle mathvariant="bold"><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>z</mi></mrow></msub 
></mstyle> <mo 
class="MathClass-bin">&#x00D7;</mo><mstyle mathvariant="bold"><mi 
>S</mi></mstyle>
</math>
<!--l. 91--><p class="nopar"></p></td><td class="eq-no">(1)</td></tr></table>
<!--l. 91--><p class="nopar">
</p><!--l. 93--><p class="indent">   <span 
class="cmti-10">Note: The order of the transfrom matrix is arbitary</span>
</p><!--l. 95--><p class="indent">   And we apply the world transform matrix on the left side of the corordination
<!--l. 95--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math> to get the new
coordination<!--l. 95--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><msup><mrow 
><mi 
>x</mi></mrow><mrow 
><mi 
>&#x2032;</mi></mrow></msup 
><mo 
class="MathClass-punc">,</mo><msup><mrow 
><mi 
>y</mi></mrow><mrow 
><mi 
>&#x2032;</mi></mrow></msup 
><mo 
class="MathClass-punc">,</mo><msup><mrow 
><mi 
>z</mi></mrow><mrow 
><mi 
>&#x2032;</mi></mrow></msup 
><mo 
class="MathClass-close">)</mo></math>:
</p>
   <table width="100%" 
class="equation"><tr><td>
<!--tex4ht:inline--><!--l. 97--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" >
<mstyle 
   id="x1-3002r2"  class="label" ></mstyle><!--endlabel--> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><msup><mrow 
><mi 
>x</mi></mrow><mrow 
><mi 
>&#x2032;</mi></mrow></msup 
></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><msup><mrow 
><mi 
>y</mi></mrow><mrow 
><mi 
>&#x2032;</mi></mrow></msup 
></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><msup><mrow 
><mi 
>z</mi></mrow><mrow 
><mi 
>&#x2032;</mi></mrow></msup 
></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mi 
>c</mi> </mtd></mtr>  <!--l--></mtable>                                                                                    </mrow></mfenced> <mo 
class="MathClass-rel">=</mo> <mstyle mathvariant="bold"><mi 
>W</mi></mstyle><mo 
class="MathClass-bin">&#x00D7;</mo><mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mi 
>x</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mi 
>y</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mi 
>z</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd></mtr>   <!--l--></mtable>                                                                                                   </mrow></mfenced>
</math>
<!--l. 112--><p class="nopar"></p></td><td class="eq-no">(2)</td></tr></table>
<!--l. 112--><p class="nopar">
</p><!--l. 116--><p class="noindent">
</p>
   <h4 class="subsectionHead"><span class="titlemark">2.2   </span> <a 
 id="x1-40002.2"></a>Camera Transform</h4>
<!--l. 117--><p class="noindent">How the 3D object looks like in 2D surface is determined
by <span 
class="cmti-10">where we stand  </span>and <span 
class="cmti-10">from which angle we take the</span>
<span 
class="cmti-10">view</span><span class="footnote-mark"><a 
href="intro-dojox.gfx3d3.xml#fn2x0"><!--l. 117--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >2</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-4001f2"></a>.
</p><!--l. 119--><p class="indent">   <span 
class="cmti-10">Isometric projection </span>is used in dojox.gfx3d to project the transformed 3D objects
to 2D shapes, which is much simpler than <span 
class="cmti-10">persepctive projection </span>and still
widely used in the pseudo 3D games. The identity camera transform casts
<!--l. 119--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math> to
<!--l. 119--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-close">)</mo></math>,
you may imagine parallel lights from the Z-axis casting the shadow to
<!--l. 119--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mi 
>X</mi> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>Y</mi> </math> plate.

If we transform, rotate the plate, the casted coordinations may change, i.e the idea of
<span 
class="cmti-10">camera transform</span>.
</p>
   <div class="math-display"><!--l. 120--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mi 
>C</mi><mi 
>T</mi> <mo 
class="MathClass-rel">=</mo> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>x</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>y</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>z</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>1</mn>    </mtd></mtr> <!--llll--></mtable>                                                                                              </mrow></mfenced><!--mstyle 
class="mbox"--><mtext class="textrm" mathvariant="normal" >-&#x00A0;inverse&#x00A0;object&#x00A0;translation</mtext><!--/mstyle-->
</mrow></math></div>
<!--l. 128--><p class="nopar">
</p>
   <div class="par-math-display"><!--l. 130--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mi 
>C</mi><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>x</mi></mrow></msub 
> <mo 
class="MathClass-rel">=</mo> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>     </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B1;</mi>   </mtd><mtd 
class="array"  columnalign="left"><mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B1;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B1;</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B1;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>     </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd></mtr> <!--llll--></mtable>                                                                                    </mrow></mfenced><!--mstyle 
class="mbox"--><mtext class="textrm" mathvariant="normal" >-&#x00A0;inverse&#x00A0;rotation&#x00A0;about&#x00A0;the&#x00A0;x-axis</mtext><!--/mstyle-->
</mrow></math></div>
<!--l. 139--><p class="nopar">
</p>

   <div class="par-math-display"><!--l. 141--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mi 
>C</mi><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>y</mi></mrow></msub 
> <mo 
class="MathClass-rel">=</mo> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B2;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B2;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>     </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B2;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B2;</mi>   </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>     </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>        </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd></mtr> <!--llll--></mtable>                                                                                     </mrow></mfenced><!--mstyle 
class="mbox"--><mtext class="textrm" mathvariant="normal" >-&#x00A0;inverse&#x00A0;rotation&#x00A0;about&#x00A0;the&#x00A0;y-axis</mtext><!--/mstyle-->
</mrow></math></div>
<!--l. 150--><p class="nopar">
</p>
   <div class="par-math-display"><!--l. 152--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mi 
>C</mi><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>z</mi></mrow></msub 
> <mo 
class="MathClass-rel">=</mo> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B3;</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B3;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mi 
>s</mi><mi 
>i</mi><mi 
>n</mi><mi 
>&#x03B3;</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>c</mi><mi 
>o</mi><mi 
>s</mi><mi 
>&#x03B3;</mi></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>    </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>    </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>    </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>    </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn></mtd><mtd 
class="array"  columnalign="left"><mn>1</mn></mtd></mtr> <!--llll--></mtable>                                                                                         </mrow></mfenced><!--mstyle 
class="mbox"--><mtext class="textrm" mathvariant="normal" >-&#x00A0;inverse&#x00A0;rotation&#x00A0;about&#x00A0;the&#x00A0;z-axis</mtext><!--/mstyle-->
</mrow></math></div>
<!--l. 160--><p class="nopar">
</p><!--l. 162--><p class="indent">   The camera transform matrix is de&#xFB01;ned
as<span class="footnote-mark"><a 
href="intro-dojox.gfx3d4.xml#fn3x0"><!--l. 162--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >3</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-4002f3"></a>:
</p>
   <table width="100%" 
class="equation"><tr><td>

<!--tex4ht:inline--><!--l. 163--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" >
                   <mstyle 
   id="x1-4003r3"  class="label" ></mstyle><!--endlabel--><mi 
>C</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>C</mi><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>x</mi></mrow></msub 
> <mo 
class="MathClass-bin">&#x00D7;</mo> <mi 
>C</mi><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>y</mi></mrow></msub 
> <mo 
class="MathClass-bin">&#x00D7;</mo> <mi 
>C</mi><msub><mrow 
><mi 
>R</mi></mrow><mrow 
><mi 
>z</mi></mrow></msub 
> <mo 
class="MathClass-bin">&#x00D7;</mo> <mi 
>C</mi><mi 
>T</mi>
</math>
<!--l. 165--><p class="nopar"></p></td><td class="eq-no">(3)</td></tr></table>
<!--l. 165--><p class="nopar">
</p><!--l. 167--><p class="indent">   The overall transfrom matrix is:
</p>
   <table width="100%" 
class="equation"><tr><td>
<!--tex4ht:inline--><!--l. 168--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" >
                            <mstyle 
   id="x1-4004r4"  class="label" ></mstyle><!--endlabel--><mi 
>M</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>C</mi> <mo 
class="MathClass-bin">&#x00D7;</mo> <mi 
>T</mi>
</math>
<!--l. 170--><p class="nopar"></p></td><td class="eq-no">(4)</td></tr></table>
<!--l. 170--><p class="nopar">
</p>
   <h3 class="sectionHead"><span class="titlemark">3   </span> <a 
 id="x1-50003"></a>Design Philosophy</h3>
<!--l. 175--><p class="noindent">Unlike dojo.gfx, there is no native 3D render engine available in the main stream web
browsers so far, so dojox.gfx3d will project the 3D objects to 2D shapes, then
render the surface using gradients and patterns to mimic the lighting and
texture.
</p><!--l. 177--><p class="noindent">
</p>
   <h4 class="subsectionHead"><span class="titlemark">3.1   </span> <a 
 id="x1-60003.1"></a>Viewport</h4>
<!--l. 179--><p class="noindent"><span 
class="cmti-10">dojox.gfx3d.Viewport  </span>(<span 
class="cmti-10">Viewport  </span>in the
following<span class="footnote-mark"><a 
href="intro-dojox.gfx3d5.xml#fn4x0"><!--l. 179--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >4</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-6001f4"></a>)
is the container for all 3D objects, created by the exported static function,
<span 
class="cmti-10">createViewport</span>:

</p>
   <table width="100%" 
class="verbatim"><tr class="verbatim"><td 
class="verbatim"><div class="verbatim">
&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.createViewport(parentNode,&#x00A0;width,&#x00A0;height)
</div>
</td></tr></table>
<!--l. 182--><p class="nopar">
</p><!--l. 184--><p class="noindent">Viewport would expose the following interfaces to create basic 3D objects:

</p>
   <table width="100%" 
class="verbatim"><tr class="verbatim"><td 
class="verbatim"><div class="verbatim">
&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.createLine(start,&#x00A0;end)
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.createPath(path)
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.createTriangle(a,&#x00A0;b,&#x00A0;c)
</div>
</td></tr></table>
<!--l. 189--><p class="nopar">
</p><!--l. 191--><p class="noindent">and some high level objects as well:

</p>
   <table width="100%" 
class="verbatim"><tr class="verbatim"><td 
class="verbatim"><div class="verbatim">
&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.createCube(upper,&#x00A0;lower)
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.createCylinder(top,&#x00A0;bottom,&#x00A0;r)
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.createPipe(path,&#x00A0;r)
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.createCone(top,&#x00A0;bottom,&#x00A0;r)
</div>
</td></tr></table>
<!--l. 197--><p class="nopar">
</p><!--l. 200--><p class="noindent">Viewport is the container of 3D objects, and also the environment and viewport.

</p>
   <table width="100%" 
class="verbatim"><tr class="verbatim"><td 
class="verbatim"><div class="verbatim">
&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.setCamera(camera)
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.addLighting(lighting)
</div>
</td></tr></table>
<!--l. 204--><p class="nopar">
</p><!--l. 206--><p class="noindent">We  may  steal  more  ideas  from
Pov-Ray<span class="footnote-mark"><a 
href="intro-dojox.gfx3d6.xml#fn5x0"><!--l. 206--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >5</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-6002f5"></a>
</p><!--l. 208--><p class="indent">   Viewport is also our home-brewed 3D engine, with the folowing services
exported:

</p>
   <table width="100%" 
class="verbatim"><tr class="verbatim"><td 
class="verbatim"><div class="verbatim">
&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.applyCameraTransform(point)
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;dojox.gfx3d.Viewport.renderLighting(surface,&#x00A0;texture)
</div>
</td></tr></table>
<!--l. 212--><p class="nopar">
</p>
   <h4 class="subsectionHead"><span class="titlemark">3.2   </span> <a 
 id="x1-70003.2"></a>Scene</h4>
<!--l. 217--><p class="noindent"><span 
class="cmti-10">dojox.gfx3d.Scene</span>(<span 
class="cmti-10">Scene </span>in the following) is a container for Scene objects and other
3D objects, equivalent to <span 
class="cmti-10">dojo.gfx.Group</span>. Users can group several 3D objects and
apply the world transformation to them in one shot. Scene also supports to create 3D
objects.
</p><!--l. 220--><p class="noindent">
</p>
   <h4 class="subsectionHead"><span class="titlemark">3.3   </span> <a 
 id="x1-80003.3"></a>Object</h4>
<!--l. 221--><p class="noindent"><span 
class="cmti-10">dojox.gfx3d.Object</span>(<span 
class="cmti-10">Object </span>in the following) is the base class for other 3D objects,
equivalent to <span 
class="cmti-10">dojo.gfx.Shape</span>. Here are the available attributes:
     </p><dl class="description"><dt class="description">
<span 
class="cmbx-10">Node</span> </dt><dd 
class="description">the attached DOM node
     </dd><dt class="description">
<span 
class="cmbx-10">Object</span> </dt><dd 
class="description">interface  for  the  users  to  manipulate  the  3D  object.  For  example,
     dojox.gfx3d.Triangle&#x2019;s Object is the triple (a, b, c)
     </dd><dt class="description">
<span 
class="cmbx-10">Texture</span> </dt><dd 
class="description">used to render the surface<span class="footnote-mark"><a 
href="intro-dojox.gfx3d7.xml#fn6x0"><!--l. 225--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >6</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-8001f6"></a>
     </dd><dt class="description">
<span 
class="cmbx-10">Stroke</span> </dt><dd 
class="description">stroke attribute for the line
     </dd><dt class="description">
<span 
class="cmbx-10">Transform</span> </dt><dd 
class="description">world transform matrix</dd></dl>
<!--l. 231--><p class="indent">   The following 3D objects are derived from Object: </p>
     <ul class="itemize1">
     <li class="itemize">dojox.gfx3d.Line
     </li>
     <li class="itemize">dojox.gfx3d.Path
     </li>
     <li class="itemize">dojox.gfx3d.Triangle

     </li>
     <li class="itemize">dojox.gfx3d.Cube
     </li>
     <li class="itemize">dojox.gfx3d.Cylinder
     </li>
     <li class="itemize">dojox.gfx3d.Cone
     </li>
     <li class="itemize">dojox.gfx3d.Pipe</li></ul>
<!--l. 242--><p class="noindent">
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.3.1   </span> <a 
 id="x1-90003.3.1"></a>Line</h5>
<!--l. 243--><p class="noindent"><span 
class="cmti-10">Line </span>is described as start<!--l. 243--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>
and end <!--l. 243--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>.
The texture attribute only supports dojox.gfx3d.Texture.Hollow, compliant to the
Object interface.
</p><!--l. 245--><p class="noindent">
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.3.2   </span> <a 
 id="x1-100003.3.2"></a>Path</h5>
<!--l. 246--><p class="noindent"><span 
class="cmti-10">Path </span>supports two mode as dojo.gfx.Path does, <span 
class="cmti-10">Absolute </span>and <span 
class="cmti-10">Relative</span>. In Relative
mode, the coordination is the offset of current position, while in Absolute mode, the
coordination is the absolute corordination in the 3D space. Only a subset of drawing
commands are supported:
     </p><dl class="description"><dt class="description">
<span 
class="cmbx-10">moveTo</span> </dt><dd 
class="description">move current postion to the new position
     </dd><dt class="description">
<span 
class="cmbx-10">lineTo</span> </dt><dd 
class="description">draw a line from current position to a new position
     </dd><dt class="description">
<span 
class="cmbx-10">curveTo</span> </dt><dd 
class="description">draw a bezier curve in 3D space.</dd></dl>
<!--l. 252--><p class="noindent">The texture attribute only supports dojox.gfx3d.Texture.Hollow
</p><!--l. 254--><p class="noindent">
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.3.3   </span> <a 
 id="x1-110003.3.3"></a>Triangle</h5>
<!--l. 255--><p class="noindent"><span 
class="cmti-10">Triangle </span>is the fundamental element to build more complicated 3D objects, described
as a <!--l. 255--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>,
b <!--l. 255--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>, c
<!--l. 255--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>. The
texture attribute supports all dojox.gfx3d.Texture.*.

</p><!--l. 257--><p class="noindent">
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.3.4   </span> <a 
 id="x1-120003.3.4"></a>Cube</h5>
<!--l. 258--><p class="noindent"><span 
class="cmti-10">Cube</span><span class="footnote-mark"><a 
href="intro-dojox.gfx3d8.xml#fn7x0"><!--l. 258--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >7</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-12001f7"></a>
is de&#xFB01;ned by the two vertices in the diagram, uppper
<!--l. 258--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math> and
lower <!--l. 258--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>,
each surface is perpendicular to one of axises.
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.3.5   </span> <a 
 id="x1-130003.3.5"></a>Cylinder</h5>
<!--l. 261--><p class="noindent"><span 
class="cmti-10">Cylinder </span>is de&#xFB01;ned as top <!--l. 261--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>,
bottom <!--l. 261--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>
and r (radius). top, bottom are the corordinations of the center of top, bottom
surfaces.
</p><!--l. 263--><p class="noindent">
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.3.6   </span> <a 
 id="x1-140003.3.6"></a>Cone</h5>
<!--l. 264--><p class="noindent"><span 
class="cmti-10">Cone</span><span class="footnote-mark"><a 
href="intro-dojox.gfx3d9.xml#fn8x0"><!--l. 264--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >8</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-14001f8"></a>
is de&#xFB01;ned as top <!--l. 264--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>,
bottom <!--l. 264--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">(</mo><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mo 
class="MathClass-close">)</mo></math>
and r (radius). top is the coordination of the tip of cone; bottom is the corordinations
of the center of bottom surface; r is the radius of the bottom surface.
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.3.7   </span> <a 
 id="x1-150003.3.7"></a>Pipe</h5>
<!--l. 267--><p class="noindent"><span 
class="cmti-10">Pipe</span><span class="footnote-mark"><a 
href="intro-dojox.gfx3d10.xml#fn9x0"><!--l. 267--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >9</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-15001f9"></a>
may stir the interest of Chart developers. It is charactized by 3D Path with r(radius)
and texture.
</p>
   <h4 class="subsectionHead"><span class="titlemark">3.4   </span> <a 
 id="x1-160003.4"></a>Interoperation</h4>
<!--l. 270--><p class="noindent">To integrate the dojox.gfx2d and dojox.gfx3d, we are going to derive
dojox.gfx3d.Viewport from dojox.gfx2d.Shape, in another word, Viewport is regarded as
yet another 2D shape. This may sound ridiculous, but logically, the 3D space is a 2D
canvas with a rich set of command, just as dojox.gfx2d.Path is; pragmatically, this
enable users to aggregate more than one Viewport into Surface, a good candidate for

subgraphic<span class="footnote-mark"><a 
href="intro-dojox.gfx3d11.xml#fn10x0"><!--l. 270--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
></mrow><mrow 
><!--mstyle 
class="mbox"--><mtext >10</mtext><!--/mstyle--></mrow></msup 
></math></a></span><a 
 id="x1-16001f10"></a>.
</p>
   <h4 class="subsectionHead"><span class="titlemark">3.5   </span> <a 
 id="x1-170003.5"></a>Meta</h4>
<!--l. 273--><p class="noindent">All meta data used to describe 3D objects is discussed here.
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.5.1   </span> <a 
 id="x1-180003.5.1"></a>Transform matrix</h5>
<!--l. 275--><p class="noindent">Transform matrix is de&#xFB01;ned as:
</p>
   <div class="math-display"><!--l. 276--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
<mfenced separators="" 
open="["  close="]" ><mrow><mtable  align="axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="left"><mi 
>x</mi><mi 
>x</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>x</mi><mi 
>y</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>x</mi><mi 
>z</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>d</mi><mi 
>x</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mi 
>y</mi><mi 
>x</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>y</mi><mi 
>y</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>y</mi><mi 
>z</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>d</mi><mi 
>y</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mi 
>z</mi><mi 
>x</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>z</mi><mi 
>y</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>z</mi><mi 
>z</mi></mtd><mtd 
class="array"  columnalign="left"><mi 
>d</mi><mi 
>z</mi></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>0</mn>  </mtd><mtd 
class="array"  columnalign="left"><mn>1</mn>  </mtd></mtr> <!--llll--></mtable>                                                                                          </mrow></mfenced>
</mrow></math></div>
<!--l. 283--><p class="nopar">
so the 3D transform matrix in dojox.gfx3d is de&#xFB01;ned as a dictionary:
<!--l. 284--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">{</mo><mi 
>x</mi><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>x</mi><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>x</mi><mi 
>z</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>y</mi><mi 
>z</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>z</mi><mi 
>z</mi><mo 
class="MathClass-punc">,</mo><mi 
>d</mi><mi 
>x</mi><mo 
class="MathClass-punc">,</mo><mi 
>d</mi><mi 
>y</mi><mo 
class="MathClass-punc">,</mo><mi 
>d</mi><mi 
>z</mi><mo 
class="MathClass-close">}</mo></math>
</p><!--l. 286--><p class="noindent">
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.5.2   </span> <a 
 id="x1-190003.5.2"></a>Lighting</h5>
<!--l. 287--><p class="noindent">TODO
</p><!--l. 289--><p class="noindent">
</p>
   <h5 class="subsubsectionHead"><span class="titlemark">3.5.3   </span> <a 
 id="x1-200003.5.3"></a>Texture</h5>
<!--l. 290--><p class="noindent">The following textures are supported:
     </p><dl class="description"><dt class="description">
<span 
class="cmbx-10">Solid</span> </dt><dd 
class="description">Solid color <!--l. 292--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">{</mo><mi 
>r</mi><mo 
class="MathClass-punc">,</mo><mi 
>g</mi><mo 
class="MathClass-punc">,</mo><mi 
>b</mi><mo 
class="MathClass-punc">,</mo><mi 
>a</mi><mi 
>l</mi><mi 
>p</mi><mi 
>h</mi><mi 
>a</mi><mo 
class="MathClass-close">}</mo></math>,
     alpha indicates the transparency.

     </dd><dt class="description">
<span 
class="cmbx-10">Hollow</span> </dt><dd 
class="description">Specialized Solid, aka <!--l. 293--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mo 
class="MathClass-open">{</mo><mi 
>r</mi> <mo 
class="MathClass-punc">:</mo> <mn>2</mn><mn>5</mn><mn>5</mn><mo 
class="MathClass-punc">,</mo><mi 
>g</mi> <mo 
class="MathClass-punc">:</mo> <mn>2</mn><mn>5</mn><mn>5</mn><mo 
class="MathClass-punc">,</mo><mi 
>b</mi> <mo 
class="MathClass-punc">:</mo> <mn>2</mn><mn>5</mn><mn>5</mn><mo 
class="MathClass-punc">,</mo><mi 
>a</mi><mi 
>l</mi><mi 
>p</mi><mi 
>h</mi><mi 
>a</mi> <mo 
class="MathClass-punc">:</mo> <mn>1</mn><mo 
class="MathClass-punc">.</mo><mn>0</mn><mo 
class="MathClass-close">}</mo></math></dd></dl>
<!--l. 297--><p class="noindent">
</p>
   <h3 class="sectionHead"><span class="titlemark">4   </span> <a 
 id="x1-210004"></a>Implementation Notes</h3>
<!--l. 298--><p class="noindent">This section discusses the detail plan to implement dojox.gfx3d.
</p><!--l. 300--><p class="noindent">
</p>
   <h4 class="subsectionHead"><span class="titlemark">4.1   </span> <a 
 id="x1-220004.1"></a>Projection</h4>
<!--l. 301--><p class="noindent">This is the design dilemma for Viewport class. Space holds the camera transform
matrix and lighting vector, 3D objects hold the object data, and virtually knows best
how to draw itself.
</p><!--l. 303--><p class="indent">   The &#xFB01;rst approach is to encapsulate the drawing capacity in each
object class, and associate a Space reference. The object class calls
dojo.gfx.Sapce.applyCameraTransform to project itself into 2D space, renders
the surface using dojo.gfx.Viewport.renderLighting. This approach would
not work if we take the z-order and shadow cast from other objects into
account.
</p><!--l. 305--><p class="indent">   The second approach is to offload the rendering to Viewport. The Viewport would
iterate all 3D objects and only render what are in our horizon and compute the
shadow cast from other objects. The main obstacle for this approach is how Viewport
knows to render the object:
     </p><dl class="description"><dt class="description">
<span 
class="cmbx-10">Abstract 3D objects to fundamental objects like surface, line</span> </dt><dd 
class="description">The
     object submits a set of surfaces, lines to Viewport, then let Surface do all
     the work. Though any surface can be approxmated by polygons or NURB
     surface theoretically, it is really overkill for simple object like cylinder,
     cone; and quite computation-extensive.
     </dd><dt class="description">
<span 
class="cmbx-10">Object exposes callback functions for Viewport</span> </dt><dd 
class="description">Object  class  generally
     has a better understanding the object data.</dd></dl>
<!--l. 311--><p class="indent">   dojox.gfx3d.Object exposes the following callback functions for Sapce to render
itself:
     </p><dl class="description"><dt class="description">
<span 
class="cmbx-10">dojox.gfx3d.Object.getShadows(lightings)</span> </dt><dd 
class="description">Based   on   the   Viewport&#x2019;s
     lighting vectors, the shadow vector cast from the object itself.
     </dd><dt class="description">
<span 
class="cmbx-10">dojox.gfx3d.Object.render(camera, lightings, shadows)</span> </dt><dd 
class="description">Based
     on Viewport&#x2019;s camera transform matrix, the object is projected to 2D
     surface, using lighting vector, global shadow vectors to render the surface.</dd></dl>

<!--l. 317--><p class="indent">   A preliminary approach ignores the shadow, so only the lighting and z-order are
considered.
</p><!--l. 319--><p class="noindent">
</p>
   <h3 class="sectionHead"><span class="titlemark">5   </span> <a 
 id="x1-230005"></a>Conclusion</h3>
<!--l. 320--><p class="noindent">dojox.gfx3d rocks. </p> 
</body> 
</html> 



