This page is optimized for mobile devices, if you would prefer the desktop version just click here

1.13 Game 2302-0135: venturing into a 3d world  (Page 21/30)

A graphical user interface

A GUI is provided that allows the user to specify the following items and click a Replot button to cause the drawing to change:

  • Number Points
  • Number Loops
  • Rotate around Z (deg)
  • Rotate around X (deg)
  • Rotate around Y (deg)
  • X Anchor point
  • Y Anchor point
  • Z Anchor point

Again, the 3D GUI in Figure 13 looks similar to the 2D GUI in Figure 7 . The big difference is that the 2D GUI in Figure 7 allows only for rotation around one axis, and only two coordinate values can be specified for the location ofthe anchor point.

As before, changing the number of points causes the number of vertices that describe the geometric object to change. Changing the number of loops causes thenumber of lines that are drawn to connect the vertices to change.

The geometric object can be rotated in any or all of three dimensions around an anchor point. Entering a non-zero value in one or more of the Rotate fields causes the object to be rotated by the specified angle or angles aroundthe anchor point.

The anchor point is initially specified to be at the origin, but the location of the anchor point can be changed by the user. If the anchor point is at theorigin, the image is rotated around the origin.

Geometric object with 12 vertices, 4 loops, and no rotations

As a baseline case, Figure 14 shows the string-art geometric object with 12 vertices, 4 loops, and no rotations. At this point, the geometric object is aninfinitely thin disk in the x-y plane centered on the origin. Note the break in color between yellow and blue that occurs where the circle crosses the positivex-axis.

Figure 14 Geometric object with 12 vertices, 4 loops, and no rotations.

The rotation angle must be specified in degrees with a positive angle being given by the right-hand rule as applied to the axis around which the image is being rotated.

Rotation around one axis only

Figure 15 , Figure 16 , and Figure 17 show the results of rotating the object around only one axis at a time with the anchor point at the origin.

Figure 15 shows the result of rotating the object around the z-axis only by an angle of 60degrees.

Figure 15 Rotation around the z-axis only.

This results in the object still being in the x-y plane, but it has been rotated counter-clockwise by 60 degrees. Compare Figure 15 with Figure 14 and note how the color break between yellow and blue has moved around to be near theintersection of the circle and the positive y-axis.

Rotation around the x-axis only

Figure 16 shows the result of rotating the object around only the x-axis with a rotation angle of -60 degrees.

Figure 16 Rotation around the x-axis only.

The object is still a disk, but that disk is no longer in the x-y plane. Instead, it has been tilted so that it is now closer to the x-z plane than tothe x-y plane. Unfortunately, the oblique parallel projection does not make it practical to do any quantitative measurements on the image.

Rotation around the y-axis only

Figure 17 shows the result of rotating the object around only the y-axis with a rotation angle of -60 degrees.

<< Chapter < Page Page > Chapter >>

Read also:

OpenStax, Game 2302 - mathematical applications for game development. OpenStax CNX. Jan 09, 2016 Download for free at https://legacy.cnx.org/content/col11450/1.33
Google Play and the Google Play logo are trademarks of Google Inc.
Jobilize.com uses cookies to ensure that you get the best experience. By continuing to use Jobilize.com web-site, you agree to the Terms of Use and Privacy Policy.