Share this Page URL
Help

Chapter 13. CUSTOMIZING SIZE, LOCATION, ... > The TransformGroup Class (javax.medi... - Pg. 439

CUSTOMIZING SIZE, LOCATION, AND ORIENTATION 439 This would multiply Y and Z by 3, but X by 7, which would stretch the sphere more along the hori- zontal axis than along the up-down or front-back axes. Rotations are more complex and are based on the sine and cosine values for the angle of rotation. The details are beyond the scope of this chapter but can be found in any good graphics textbook. The only thing you need to know at this point is that a rotation will produce a particular set of values in the top left three-by-three submatrix of a Transform3D object. This introduces an interesting problem--since the same part of the matrix is used to store both the scaling and the rotation, how do you separate them? The short answer is that you generally don't need to. Once the Transform3D is built, it simply gets used to transform points. However, if you want to modify just the rotation or just the scale, you need to be able to access them separately. For the most part, Java 3D handles this for you. When you call a method on a Transform3D object that changes the rotation, for example, Java 3D will internally factor out the scale (a process known as Singular Value Decomposition, or SVD), then apply the rotation, and then reapply the scale. Some- thing similar happens when you change the scale-the original scale is factored out, and the new scale is applied in its place while keeping the rotation the same.