iicm.utils3d
Class Camera

java.lang.Object
  extended by iicm.utils3d.Camera

public class Camera
extends java.lang.Object

Camera - camera control Copyright (c) 1996,97 IICM

Version:
1.0, changed: 5 May 97
Author:
Michael Pichler

Field Summary
protected  Quaternion orientation_
           
protected  float[] position_
           
(package private) static int X
           
(package private) static int Y
           
(package private) static int Z
           
 
Constructor Summary
Camera()
           
 
Method Summary
 void approachNormal(float[] poi, float[] normal, float krot)
          approach a surface normal vector. adjust line of sight by a fraction of k to approach the negative surface normal vector (away from it if k < 0). normal must be normalized.
 void approachPosition(float[] poi, float ktran, float hither)
          approach a target position. move a fraction of k of the distance between current position and target position towards the target (away from target if k < 0). do not go nearer to target than near clipping plane hither.
 void interpolateViews(Camera cam1, Camera cam2, float t)
          calculates a new camera position and orientation between the two viewpoints, defined by the Cameras cam1 & cam2.
 void interpolateViews(float[] pos1, Quaternion or1, float[] pos2, Quaternion or2, float t)
          calculates a new camera position and orientation between the two viewpoints, defined by the two pairs of position and orientation.
 void levelize()
          make the Camera leveled with ground plane
 void printValues(java.io.PrintStream os)
          print camera values
 void reset()
          reset the Camera to its default position/orientation
 void rotateXYcenter(float l2r, float t2b, float[] center)
          rotate horizontally and vertically about arbitrary center.
 void rotateXYposition(float l2r, float t2b)
          rotate horizontally and vertical around camera position.
 void setCamera(float viewangle, float winaspect, float hither, float yon)
          set Camera via GE3D
 void translateVec(float[] tran)
          translate camera along a given vector
 void translateVP(float x, float y, float aspect, float scale)
          translate camera parallel to viewing plane
 void untilt()
          untilt the Camera (up is (0, 1, 0))
 Ray viewingRay(float fx, float fy, float viewangle, float winaspect, float near, float far)
          get the viewing ray (for picking). direction is not normalized.
 void zoomOut(float f)
          zoom (dolly) camera (away from viewing plane)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

position_

protected float[] position_

orientation_

protected Quaternion orientation_

X

static final int X
See Also:
Constant Field Values

Y

static final int Y
See Also:
Constant Field Values

Z

static final int Z
See Also:
Constant Field Values
Constructor Detail

Camera

public Camera()
Method Detail

reset

public void reset()
reset the Camera to its default position/orientation


levelize

public void levelize()
make the Camera leveled with ground plane


untilt

public void untilt()
untilt the Camera (up is (0, 1, 0))


setCamera

public void setCamera(float viewangle,
                      float winaspect,
                      float hither,
                      float yon)
set Camera via GE3D

Parameters:
viewangle - vertical field of view
winaspect - window aspect (width/height)
hither - near clipping plane
yon - far clipping plane

zoomOut

public void zoomOut(float f)
zoom (dolly) camera (away from viewing plane)


translateVP

public void translateVP(float x,
                        float y,
                        float aspect,
                        float scale)
translate camera parallel to viewing plane


translateVec

public void translateVec(float[] tran)
translate camera along a given vector


rotateXYposition

public void rotateXYposition(float l2r,
                             float t2b)
rotate horizontally and vertical around camera position. (angles given in radians)


rotateXYcenter

public void rotateXYcenter(float l2r,
                           float t2b,
                           float[] center)
rotate horizontally and vertically about arbitrary center. (angles given in radians)


approachPosition

public void approachPosition(float[] poi,
                             float ktran,
                             float hither)
approach a target position. move a fraction of k of the distance between current position and target position towards the target (away from target if k < 0). do not go nearer to target than near clipping plane hither.


approachNormal

public void approachNormal(float[] poi,
                           float[] normal,
                           float krot)
approach a surface normal vector. adjust line of sight by a fraction of k to approach the negative surface normal vector (away from it if k < 0). normal must be normalized. does not change camera tilt.

See Also:
interpolateViews(iicm.utils3d.Camera, iicm.utils3d.Camera, float)

interpolateViews

public void interpolateViews(Camera cam1,
                             Camera cam2,
                             float t)
calculates a new camera position and orientation between the two viewpoints, defined by the Cameras cam1 & cam2.


interpolateViews

public void interpolateViews(float[] pos1,
                             Quaternion or1,
                             float[] pos2,
                             Quaternion or2,
                             float t)
calculates a new camera position and orientation between the two viewpoints, defined by the two pairs of position and orientation.


viewingRay

public Ray viewingRay(float fx,
                      float fy,
                      float viewangle,
                      float winaspect,
                      float near,
                      float far)
get the viewing ray (for picking). direction is not normalized.

Parameters:
fx - horicontal fraction (0 = left, 1 = right)
fy - vertical fraction (0 = bottom, 1 = top) viewplane, winaspect, near, far clipping planes not managed by Camera itself (see #setCamera)

printValues

public void printValues(java.io.PrintStream os)
print camera values