Figure 2.3 The positions of some projected points
Figure 2.3 The positions of some projected points Plotting these points by hand using a 2D graphics program (figure 2.3), you can see that they seem to make sense. Projecting the point 0,0,0 places a point at the center of the screen (160,120). While you have symmetry about the corners of the cube, increasing the Z-coordinate appears to move the two opposing corners (1,1,1 and -1,-1,1) closer to the viewer. Taking a look at the projectPointfunction again, you can see it uses the following parameters: Input point x, y, and z coordinates Center of the screen Sin and cosine of the viewer s angle of view Distance of the screen from the viewer Model scaling factor This very simple projection function is adequate for simple 3D projection. As you become more familiar with Java 3D, you will see that it includes far more powerful projection abilities. These allow you to render to stereo displays (such as head-mounted displays) or perform parallel projections. (In parallel projections, parallel lines remain parallel after projection.) 2.2.2 Comparing output Look at the outputs from MyJava3D and Java 3D again (figure 2.4). They are very different so Java 3D must be doing a lot more than projecting points and drawing lines: Triangles are drawn filled; you cannot see the edges of the triangles. Nice lighting effect can be seen in the curve of the hand. Background colors are different. Performance is much better measured by comparing the number of frames rendered per second. 16
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services