de.javagl.swogl.scene
Class CameraUtils

java.lang.Object
  extended by de.javagl.swogl.scene.CameraUtils

public class CameraUtils
extends java.lang.Object

A class containing utility methods for Camera operations.


Method Summary
static void adjustDistance(MutableCamera camera, float height)
          Adjust the distance between the eye point and the view point.
static javax.vecmath.Matrix4f computeCameraMatrix(Camera camera)
          Returns the matrix for the given camera.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

adjustDistance

public static void adjustDistance(MutableCamera camera,
                                  float height)
Adjust the distance between the eye point and the view point. This method will move the eye point (along the line through the current eye point and the view point) so that an object with the given height is completely visible.

This method is mainly intended to move the eye point of a camera from its initial configuration along the negative z-axis to a position where a rectangle with the specified height is completely visible.

Calling this method with a camera pointing along the negative z-axis and the height of the rendering component has the effect of showing the x-y-plane in its actual size (in pixels).

Parameters:
camera - The camera
height - The height that should be visible

computeCameraMatrix

public static javax.vecmath.Matrix4f computeCameraMatrix(Camera camera)
Returns the matrix for the given camera. The orientation described by the matrix will be taken from the view point, eye point and up vector, and the translation will be computed from the eye point.

Parameters:
camera - The camera
Returns:
The camera matrix