|
||||||||||
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 the jReality Camera class.
Most of the methods involve calculating various transformations related to the camera and an instance of Viewer.
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)
Deprecated. See EncompassFactory , which additionally allows control of setting camera parameters. |
static void |
encompass(Viewer viewer)
|
static void |
encompass(Viewer viewer,
SceneGraphComponent sgc,
boolean setStereoParameters)
Deprecated. |
static void |
encompass(Viewer viewer,
SceneGraphComponent sgc,
boolean setStereoParameters,
int metric)
|
static void |
encompassNew(Viewer v)
|
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 |
getNDCExtent(double[] o2ndc)
|
static double[] |
getNDCToCamera(Camera cam,
double aspectRatio)
|
static double[] |
getNDCToCamera(Viewer v)
|
static double[][] |
getNearViewport(Viewer v)
|
static java.awt.geom.Rectangle2D |
getOffAxisViewPort(Camera cam,
java.awt.geom.Rectangle2D viewPort,
double[] eyePosition)
A method required for calculating cam2NDC transformation for an off-axis camera. |
static double |
getScalingFactor(double[] o2w,
int metric)
|
static java.awt.geom.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 encompassNew(Viewer v)
camera
- viewer
- public static void encompass(Viewer viewer)
@Deprecated public static void encompass(Viewer viewer, SceneGraphComponent sgc, boolean setStereoParameters)
viewer
- sgc
- setStereoParameters
- public static void encompass(Viewer viewer, SceneGraphComponent sgc, boolean setStereoParameters, int metric)
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 java.awt.geom.Rectangle2D getOffAxisViewPort(Camera cam, java.awt.geom.Rectangle2D viewPort, double[] eyePosition)
cam
- viewPort
- eyePosition
-
public static java.awt.geom.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)
EncompassFactory
, which additionally allows control of setting camera parameters.
avatarPath
- scene
- cameraPath
- margin
- metric
- public static void loadPreferences(Camera cam)
public static void savePreferences(Camera cam)
public static double getNDCExtent(double[] o2ndc)
o2ndc
- object to normalized device coordinate transformation
public static double getScalingFactor(double[] o2w, int metric)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |