|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jreality.util.CameraUtility
public class CameraUtility
A collection of static methods related to specifying camera transformations of various kinds.
Field Summary | |
---|---|
static Matrix |
cameraOrientation
|
static Matrix |
inverseCameraOrientation
|
static int |
LEFT_EYE
|
static int |
MIDDLE_EYE
|
static int |
RIGHT_EYE
|
Method Summary | |
---|---|
static void |
encompass(SceneGraphPath avatarPath,
SceneGraphPath scene,
SceneGraphPath cameraPath)
|
static void |
encompass(SceneGraphPath avatarPath,
SceneGraphPath scene,
SceneGraphPath cameraPath,
double margin,
int metric)
A method for encompassing the scene. |
static void |
encompass(Viewer viewer)
|
static void |
encompass(Viewer viewer,
SceneGraphComponent sgc,
boolean setStereoParameters)
Encompass the world displayed by a viewer and possibly set derived parameters in the camera. |
static double |
getAspectRatio(Viewer v)
Determine the aspect ratio of the output window of a viewer. |
static Camera |
getCamera(Viewer v)
Determine the camera for this viewer. |
static SceneGraphComponent |
getCameraNode(Viewer v)
Determine the SceneGraphComponent which contains the camera for this viewer. |
static double[] |
getCameraToNDC(Camera cam,
double aspectRatio)
|
static double[] |
getCameraToNDC(Camera cam,
double aspectRatio,
int which)
Calculate a 4x4 projection matrix for this camera. |
static double[] |
getCameraToNDC(Camera cam,
double aspectRatio,
int which,
int metric)
|
static double[] |
getCameraToNDC(Viewer v)
Calculate the camera to NDC (normalized device coordinates) transformation for a given viewer. |
static double[] |
getEyePosition(Camera cam,
int which)
A method required for calculating cam2NDC for a CAVE-like environment. |
static double[] |
getNDCToCamera(Camera cam,
double aspectRatio)
|
static double[] |
getNDCToCamera(Viewer v)
|
static double[][] |
getNearViewport(Viewer v)
|
static Rectangle2D |
getOffAxisViewPort(Camera cam,
Rectangle2D viewPort,
double[] eyePosition)
A method required for calculating cam2NDC transformation for an off-axis camera. |
static Rectangle2D |
getViewport(Camera cam,
double aspectRatio)
Determine the viewport of the given camera: the intersection of the viewing frustum with the z=1 plane. |
static void |
loadPreferences(Camera cam)
|
static void |
savePreferences(Camera cam)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static Matrix cameraOrientation
public static Matrix inverseCameraOrientation
public static final int MIDDLE_EYE
public static final int LEFT_EYE
public static final int RIGHT_EYE
Method Detail |
---|
public static Camera getCamera(Viewer v)
v
-
public static SceneGraphComponent getCameraNode(Viewer v)
v
-
public static void encompass(Viewer viewer)
camera
- viewer
- public static void encompass(Viewer viewer, SceneGraphComponent sgc, boolean setStereoParameters)
viewer
- sgc
- setStereoParameters
- public static double getAspectRatio(Viewer v)
v
-
public static double[] getCameraToNDC(Viewer v)
v
-
public static double[] getCameraToNDC(Camera cam, double aspectRatio)
cam
- aspectRatio
-
public static double[] getCameraToNDC(Camera cam, double aspectRatio, int which)
MIDDLE_EYE
, calculate a
normal "monocular" camera. If which is LEFT_EYE
or RIGHT_EYE,
, calculate the
projection matrix corresponding to the given eye of a stere-ocular camera. The stereo case can be derived
from the monocular case as follows.
Define V to be the intersection of the viewing frustum with the plane z = focus (See #setFocus(double)
).
Second, define the positions Pl = (d,0,0,0) and Pr = (-d,0,0,0) where d = eyeSeparation/2.0 (See
#setEyeSeparationMeters(double)
). Then the position of the left eye in
camera coordinates is O.Pl (where O is the camera's orientation matrix (See #setOrientationMatrix(double[])
), or the identity
matrix if none has been set) and similarly for the right eye. Then the viewing frustum for the left eye is the unique viewing frustum determined by
the position at the left (right) eye and the rectangle V; similarly for the right eye.
In plain English, the monocular, left, and right views all show the same picture if the world lies in the z = focus plane. This plane is in fact the focal plane in this sense.
Note that the orientationMatrix is only non-trivial in the case of virtual environments such as the PORTAL or CAVE. * @deprecated
which
-
public static double[] getCameraToNDC(Camera cam, double aspectRatio, int which, int metric)
public static double[] getEyePosition(Camera cam, int which)
cam
- which
-
public static Rectangle2D getOffAxisViewPort(Camera cam, Rectangle2D viewPort, double[] eyePosition)
cam
- viewPort
- eyePosition
-
public static Rectangle2D getViewport(Camera cam, double aspectRatio)
cam
- aspectRatio
-
public static double[][] getNearViewport(Viewer v)
public static double[] getNDCToCamera(Viewer v)
public static double[] getNDCToCamera(Camera cam, double aspectRatio)
public static void encompass(SceneGraphPath avatarPath, SceneGraphPath scene, SceneGraphPath cameraPath)
public static void encompass(SceneGraphPath avatarPath, SceneGraphPath scene, SceneGraphPath cameraPath, double margin, int metric)
avatarPath
- scene
- cameraPath
- margin
- metric
- public static void loadPreferences(Camera cam)
public static void savePreferences(Camera cam)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |