de.javagl.swogl
Class PickingUtils

java.lang.Object
  extended by de.javagl.swogl.PickingUtils

public class PickingUtils
extends java.lang.Object

Utility methods for picking


Method Summary
static Ray computePickingRay(Camera camera, View view, int x, int y)
          Compute a picking Ray from the given screen coordinates based on the given Camera and View.
static Ray computePickingRay(javax.vecmath.Matrix4f viewMatrix, javax.vecmath.Matrix4f projectionMatrix, java.awt.Rectangle viewport, int x, int y)
          Compute a picking ray given the view matrix, projection matrix, viewport and position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

computePickingRay

public static Ray computePickingRay(Camera camera,
                                    View view,
                                    int x,
                                    int y)
Compute a picking Ray from the given screen coordinates based on the given Camera and View.

Parameters:
camera - The camera
view - The view
x - The x coordinate
y - The y coordinate
Returns:
The picking ray.

computePickingRay

public static Ray computePickingRay(javax.vecmath.Matrix4f viewMatrix,
                                    javax.vecmath.Matrix4f projectionMatrix,
                                    java.awt.Rectangle viewport,
                                    int x,
                                    int y)
Compute a picking ray given the view matrix, projection matrix, viewport and position. The view matrix contains the inverse of the matrix containing the rotation and translation for the camera. The projectionMatrix contains solely the perspective projection transformation. The viewport describes the rectangle that the picking occurs in. The x and y coordinates are the position where the picking ray should start, in screen coordinates.

Parameters:
viewMatrix - The view matrix
projectionMatrix - The projection matrix
viewport - The viewport
x - The x position
y - The y position
Returns:
The picking ray