net.sf.j3d.threeD.raytracer.camera
Class OrthographicCamera

java.lang.Object
  extended by net.sf.j3d.threeD.raytracer.camera.OrthographicCamera
All Implemented Interfaces:
Camera
Direct Known Subclasses:
PinholeCamera

public class OrthographicCamera
extends Object
implements Camera

The OrthographicCamera class provides an orthographic porjection camera. The camera location is, as expected, the location from which the camera views, represented as a vector. This value is by default at the origin. The viewing direction is a vector that represents the direction the camera is viewing. This value is by default aligned to the positive Z axis, or (0.0, 0.0, 1.0). The up direction is a vector that represents the orientation of the camera's "up." This value is by default aligned with the positive y axis or (0.0, 1.0, 0.0). The projection dimensions of the camera are the dimensions of the viewing plane.

Author:
Mike Murray

Constructor Summary
OrthographicCamera()
          Constructs a new OrthographicCamera object with the defaults described above.
OrthographicCamera(Vector location, Vector viewDirection, Vector upDirection)
          Constructs an OrthographicCamera object with the specified location, viewing direction, and up direction, but with default projection dimensions as specified above.
OrthographicCamera(Vector location, Vector viewDirection, Vector upDirection, double projectionX, double projectionY)
           
 
Method Summary
 Vector getLocation()
          Returns the location of this PinholeCamera object as a Vector object.
 double getProjectionHeight()
          Returns the projection height of this PinholeCamera object as a double value.
 double getProjectionWidth()
          Returns the projection width of this PinholeCamera object as a double value.
 TransformMatrix getRotationMatrix()
           
 Vector getUpDirection()
          Returns the up direction of this PinholeCamera object as a Vector object.
 Vector getViewDirection()
          Calls the getViewingDirection() method and returns the result.
 Vector getViewingDirection()
          Returns the viewing direction of this PinholeCamera object as a Vector object.
 Ray rayAt(double i, double j, int screenWidth, int screenHeight)
           
 void setLocation(Vector location)
          Sets the location of this OrthographicCamera object to the specified location.
 void setProjectionDimensions(double projectionX, double projectionY)
          Sets the projection dimensions to the specified projection dimensions.
 void setProjectionHeight(double projectionY)
          Sets the projection height of this OrthographicCamera object to the specified projection height.
 void setProjectionWidth(double projectionX)
          Sets the projection width of this OrthographicCamera object to the specified projection width.
 void setUpDirection(Vector upDirection)
          Sets the up direction of this PinholeCamera object to the specified up direction.
 void setViewDirection(Vector viewDirection)
          Calls the setViewingDirection() method.
 void setViewingDirection(Vector viewDirection)
          Sets the viewing direction of this PinholeCamera object to the specified viewing direction.
 void updateUVW()
          Updates the orthonormal vectors used to describe camera space for this OrthographicCamera object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrthographicCamera

public OrthographicCamera()
Constructs a new OrthographicCamera object with the defaults described above.


OrthographicCamera

public OrthographicCamera(Vector location,
                          Vector viewDirection,
                          Vector upDirection)
Constructs an OrthographicCamera object with the specified location, viewing direction, and up direction, but with default projection dimensions as specified above.

Parameters:
location - Camera location.
viewDirection - Camera viewing direction.
upDirection - Camera up direction.

OrthographicCamera

public OrthographicCamera(Vector location,
                          Vector viewDirection,
                          Vector upDirection,
                          double projectionX,
                          double projectionY)
Method Detail

setLocation

public void setLocation(Vector location)
Sets the location of this OrthographicCamera object to the specified location.


setViewDirection

public void setViewDirection(Vector viewDirection)
Calls the setViewingDirection() method.


setViewingDirection

public void setViewingDirection(Vector viewDirection)
Sets the viewing direction of this PinholeCamera object to the specified viewing direction. This method automatically updates the camera coordinate system vectors.


setUpDirection

public void setUpDirection(Vector upDirection)
Sets the up direction of this PinholeCamera object to the specified up direction. This method automatically updates the camera coordinate system vectors.


setProjectionDimensions

public void setProjectionDimensions(double projectionX,
                                    double projectionY)
Sets the projection dimensions to the specified projection dimensions.


setProjectionWidth

public void setProjectionWidth(double projectionX)
Sets the projection width of this OrthographicCamera object to the specified projection width.


setProjectionHeight

public void setProjectionHeight(double projectionY)
Sets the projection height of this OrthographicCamera object to the specified projection height.


updateUVW

public void updateUVW()
Updates the orthonormal vectors used to describe camera space for this OrthographicCamera object.


getLocation

public Vector getLocation()
Returns the location of this PinholeCamera object as a Vector object.


getViewDirection

public Vector getViewDirection()
Calls the getViewingDirection() method and returns the result.


getViewingDirection

public Vector getViewingDirection()
Returns the viewing direction of this PinholeCamera object as a Vector object.


getUpDirection

public Vector getUpDirection()
Returns the up direction of this PinholeCamera object as a Vector object.


getProjectionWidth

public double getProjectionWidth()
Returns the projection width of this PinholeCamera object as a double value.


getProjectionHeight

public double getProjectionHeight()
Returns the projection height of this PinholeCamera object as a double value.


getRotationMatrix

public TransformMatrix getRotationMatrix()
Returns:
A TransformMatrix object that can be used to convert coordinates in the coordinate system described by this Camera object to the standard x, y, z coordinates.

rayAt

public Ray rayAt(double i,
                 double j,
                 int screenWidth,
                 int screenHeight)
Specified by:
rayAt in interface Camera
Parameters:
i - X coordinate of pixel.
j - Y coordinate of pixel.
screenWidth - Width of image.
screenHeight - Height of image.
Returns:
A Ray object that represents the viewing ray at (i, j)
See Also:
Camera.rayAt(double, double, int, int)