HTML and CSS Reference
In-Depth Information
Figure 16-1. 3D points and lines
When you really model 3D solids, you want to remove all the black dots. The simple solution is to set the
radius of each Ball3d instance to 0, like so:
var ball = new Ball3d(0);
You can see the results of this in Figure 16-2.
Figure 16-2. 3D lines with invisible points
But if you look at the Ball3d class definition, you see that parts of the code are now superfluous. The
properties scaleX , scaleY , and visible are irrelevant for an invisible point, because there's nothing
there to see or scale. In fact, the entire class is primarily a convenient place to store drawing commands.
Because a 3D point needs to keep track of only a few properties, we can create another, simpler, class to
contain the values we need. Additionally, the perspective and coordinate rotation functions have been
 
Search WWH ::




Custom Search