Class Camera

java.lang.Object
  extended by Camera

public class Camera
extends java.lang.Object

This class represents a viewpoint and a (limited) view plane.


Field Summary
static int DEFAULT_IMAGE_HEIGHT
           
static int DEFAULT_IMAGE_WIDTH
           
 
Constructor Summary
Camera()
          Creates an empty Camera.
Camera(java.lang.String title)
          Creates an empty Camera with the specified title.
Camera(java.lang.String title, Vector4 pos, Vector4 dir, Vector4 up, float focal, float fov, java.awt.image.BufferedImage im)
          Creates a new Camera with the specified parameters.
 
Method Summary
 Vector4 getDir()
          Returns the view direction relative to the view point.
 float getFocalLength()
          Returns the focal length (in meters).
 float getFov()
          Returns the field-of-view (in degrees).
 java.awt.image.BufferedImage getImage()
          Returns the image seen by the Camera.
 Vector4 getPos()
          Returns the position in world coordinates.
 int getRGB(int x, int y)
          Returns the color of the specified pixel in the image of this camera.
 java.lang.String getTitle()
          Returns the title.
 Vector4 getUp()
          Returns the "up" direction relative to the view point.
 void resetImage()
          Resets the image seen by this Camera to an empty one.
 java.lang.String toString()
          Returns the title.
 void update(java.lang.String title, Vector4 pos, Vector4 dir, Vector4 up, float focal, float fov, java.awt.image.BufferedImage im)
          Updates this Camera with the supplied data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_IMAGE_WIDTH

public static final int DEFAULT_IMAGE_WIDTH
See Also:
Constant Field Values

DEFAULT_IMAGE_HEIGHT

public static final int DEFAULT_IMAGE_HEIGHT
See Also:
Constant Field Values
Constructor Detail

Camera

public Camera()
Creates an empty Camera.


Camera

public Camera(java.lang.String title,
              Vector4 pos,
              Vector4 dir,
              Vector4 up,
              float focal,
              float fov,
              java.awt.image.BufferedImage im)
Creates a new Camera with the specified parameters.

Parameters:
title - the title of the Camera.
pos - the position of the Camera in world coordinates.
dir - the direction of the Camera relative to the view point.
up - the "up" direction of the Camera relative to the view point.
focal - the focal length (in meters, assuming world coordinate units is meters) of the Camera.
fov - the field-of-view of the Camera in degrees.
im - the BufferedImage representing the limited view plane of this Camera.

Camera

public Camera(java.lang.String title)
Creates an empty Camera with the specified title.

Parameters:
title - the title of the Camera.
Method Detail

update

public void update(java.lang.String title,
                   Vector4 pos,
                   Vector4 dir,
                   Vector4 up,
                   float focal,
                   float fov,
                   java.awt.image.BufferedImage im)
Updates this Camera with the supplied data.

Parameters:
title - the title of the Camera.
pos - the position of the Camera in world coordinates.
dir - the direction of the Camera relative to the view point.
up - the "up" direction of the Camera relative to the view point.
focal - the focal length (in meters, assuming world coordinate units is meters) of the Camera.
fov - the field-of-view of the Camera in degrees.
im - the BufferedImage representing the limited view plane of this Camera.

toString

public java.lang.String toString()
Returns the title.

Overrides:
toString in class java.lang.Object
Returns:
the title.

getTitle

public java.lang.String getTitle()
Returns the title.

Returns:
the title.

getPos

public Vector4 getPos()
Returns the position in world coordinates.

Returns:
the position.

getDir

public Vector4 getDir()
Returns the view direction relative to the view point.

Returns:
the view direction.

getUp

public Vector4 getUp()
Returns the "up" direction relative to the view point.

Returns:
the "up" direction.

getFocalLength

public float getFocalLength()
Returns the focal length (in meters).

Returns:
the focal length.

getFov

public float getFov()
Returns the field-of-view (in degrees).

Returns:
the field-of-view.

getImage

public java.awt.image.BufferedImage getImage()
Returns the image seen by the Camera.

Returns:
the image of this Camera.

resetImage

public void resetImage()
Resets the image seen by this Camera to an empty one.


getRGB

public int getRGB(int x,
                  int y)
Returns the color of the specified pixel in the image of this camera.

Parameters:
x - the X-coordinate of the pixel.
y - the Y-coordinate of the pixel.
Returns:
the color of the specified pixel as an int with ARGB format and 8 bits per component. If the supplied coordinates lie outside of the image, Integer.MAX_VALUE is returned.