provided by: 
Originally published at Internet.comJava Programming Notes # 1552 * Preface * General * Viewing tip * Figures * Listings * Supplementary material * General background information * Preview * Experimental Results * Discussion and sample code * Run the program * Summary * What's next? * Download * Resources * Complete program listing * Copyright * About the author -----------------------------------
Preface
General
Part of a series
This lesson is part of a series designed to start with Java 3D basics and work up to some very complicated programs, such as the program that I explained in the earlier lesson titled "Understanding Lighting in the Java 3D API" (see Resources).
The first lesson in this series was titled "Back to Basics in the Java 3D API". The previous lesson was titled "Understanding Transforms in Java 2D." This lesson is titled "Understanding Transforms in Java 3D."
My current plan is for future lessons to deal with user and object interaction, advanced animation, and textures in Java 3D.
What you will learn
In this lesson, you will learn to understand transforms in Java 3D. You will also learn how to write Java 3D code that makes use of that understanding.
Compiling and running Java 3D programs
In order to compile and run programs using the Java 3D API, you will need to download and install the Java 3D API software. As of the date of this writing, version 1.5.0 is available for download.
In addition, you will need to download and install either Microsoft DirectX or OpenGL. All of the sample programs in this series of tutorials were developed and tested using Microsoft DirectX. They were not tested using OpenGL.
Viewing tip
I recommend that you open another copy of this document in a separate browser window and use the following links to easily find and view the figures and listings while you are reading about them.
Figures
* Figure 1. Visible objects in Java 3D. * Figure 2. A sphere rendered in 3D with its skin intact. * Figure 3. A sphere rendered in 3D without its skin. * Figure 4. Two renderings of the Alice ice skater. * Figure 5. Matrix operations for the three basic Java 2D transforms. * Figure 6. Matrix operations for the five 3D transforms. * Figure 7. BranchGroup hierarchy for the program named Java3D010. * Figure 8. Sample screen output and user input GUI for Java3D010. * Figure 9. Translation followed by rotation. * Figure 10. Transform matrices for parameters shown in Figure 9. * Figure 11. Rotation ffollowed by translation. * Figure 12. Translation followed by rotation followed by translation and scale.
Listings
* Listing 1. The method named translate. * Listing 2. The method named scale. * Listing 3. The method named displayMatrix. * Listing 4. The method named getAxesGroup. * Listing 5. Beginning of the constructor for the class named Scene. * Listing 6. Create and prepare two ColorCube objects. * Listing 7. Add visible axes to the blueCubeGroup. * Listing 8. Create and display a scaling transform. * Listing 9. Create and display a translation transform. * Listing 10. Create and display a rotation transform. * Listing 11. Create and add another set of axes. * Listing 12. Create and display another translation transform. * Listing 13. Complete the hierarchy. * Listing 14. Complete the constructor and the classes. * Listing 15. Listing for the program named Java3D010.
Supplementary material
I recommend that you also study the other lessons in my extensive collection of online Java tutorials. You will find a consolidated index at www.DickBaldwin.com.
General background information
Types of transforms of interest
This lesson will be concerned with transforms of the following types: * Scaling * Translation * Rotation
Prerequisite background knowledge
To understand transforms in either 2D or 3D (particularly the rotation transform) you need to have some understanding of trigonometry. I'm sorry, but that is simply the way that it is. In addition, it will be helpful if you have some knowledge of matrices and matrix algebra.
While I will do my best to help you understand transforms, trying to teach you the requisite background knowledge is beyond the scope of this tutorial. I will provide only a brief discussion of the requisite background. For technical background, I recommend that you study the previous lesson titled "Understanding Transforms in Java 2D" and the articles titled "Trigonometry", "Planar transformations", "Spatial transformations", and "A little algebra" (see Resources).
Visible objects in Java 3D
Just to get us started, Figure 1 shows some spheres produced using Java 3D. The quality of the rendering of the yellow and white spheres in Figure 1 was purposely kept low to cause the facets to be visible.
Figure 1. Visible objects in Java 3D.
Constructed using a mesh
Visible objects in 3D are typically constructed by constructing a mesh of inter-connected polygons (usually triangles) and then covering that mesh with a skin. For example, Figure 2 shows a sphere rendered in 3D with its skin intact.
Figure 2. A sphere rendered in 3D with its skin
Author: Richard G. Baldwin
Read article at Internet.com site