## com.croftsoft.core.media.j3d Class Transform3DLib

```java.lang.Object com.croftsoft.core.media.j3d.Transform3DLib
```

`public class Transform3DLibextends Object`

Static method library to manipulate Transform3D data. Primarily focuses on transforming a view through the 6 degrees of freedom.

Reference:

Foley, et al., Computer Graphics: Principles and Practice. Provides the mathematics for the 3D rotation matrices.

Version:
1998-12-06
Author:
David Wallace Croft

Field Summary
`static int` `X`
Relative X axis
`static int` `Y`
Relative Y axis
`static int` `Z`
Relative Z axis

Method Summary
`static boolean` ```viewKeyPressed(javax.media.j3d.Transform3D transform3D, KeyEvent keyEvent, double deltaRotation, double deltaTranslation)```
Transforms the view based upon a user keyboard input.
`static void` ```viewPitch(javax.media.j3d.Transform3D transform3D, double radians)```
Pitches the view by a given number of radians.
`static void` ```viewRoll(javax.media.j3d.Transform3D transform3D, double radians)```
Rolls the view by a given number of radians.
`static void` ```viewRotate(javax.media.j3d.Transform3D transform3D, javax.vecmath.Matrix3d rotation)```
Rotates the view by the given rotation matrix.
`static void` ```viewTranslate(javax.media.j3d.Transform3D transform3D, int dimension, double distance)```
Translates the view by a given distance along a relative axis.
`static void` ```viewYaw(javax.media.j3d.Transform3D transform3D, double radians)```
Yaws the view by a given number of radians.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### X

`public static final int X`
Relative X axis

Constant Field Values

### Y

`public static final int Y`
Relative Y axis

Constant Field Values

### Z

`public static final int Z`
Relative Z axis

Constant Field Values
Method Detail

### viewRotate

```public static void viewRotate(javax.media.j3d.Transform3D transform3D,
javax.vecmath.Matrix3d rotation)```
Rotates the view by the given rotation matrix.

Parameters:
`transform3D` - The transform containing the current rotation matrix.
`rotation` - The rotation matrix to be muliplied.

### viewPitch

```public static void viewPitch(javax.media.j3d.Transform3D transform3D,
Pitches the view by a given number of radians.

Parameters:
`transform3D` - The transform containing the current rotation matrix.
`radians` - The angle to rotate the transform about its relative X axis.

### viewYaw

```public static void viewYaw(javax.media.j3d.Transform3D transform3D,
Yaws the view by a given number of radians.

Parameters:
`transform3D` - The transform containing the current rotation matrix.
`radians` - The angle to rotate the transform about its relative Y axis.

### viewRoll

```public static void viewRoll(javax.media.j3d.Transform3D transform3D,
Rolls the view by a given number of radians.

Parameters:
`transform3D` - The transform containing the current rotation matrix.
`radians` - The angle to rotate the transform about its relative Z axis.

### viewTranslate

```public static void viewTranslate(javax.media.j3d.Transform3D transform3D,
int dimension,
double distance)```
Translates the view by a given distance along a relative axis.

Parameters:
`transform3D` - The transform containing the current rotation and translation matrix.
`dimension` - The relative axis to translate along. Use the public constants X, Y, and Z provided by this class.

### viewKeyPressed

```public static boolean viewKeyPressed(javax.media.j3d.Transform3D transform3D,
KeyEvent keyEvent,
double deltaRotation,
double deltaTranslation)```
Transforms the view based upon a user keyboard input.

Parameters:
`transform3D` - The transform containing the current rotation and translation matrices, usually the user's view transform.
`keyEvent` - Arrow keys in combination with no other key, the Shift key, or the Alt key will rotate or translate the transform about the relative X, Y, and Z axes respectively for 6 degrees of freedom.
`deltaRotation` - The number of radians to rotate the view upon a keyboard input.
`deltaTranslation` - The distance to translate the view upon a keyboard input.
Returns:
Returns true if any changes were made to transform3D argument.