|
Rings Version 0.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectthreeD.raytracer.engine.Camera
A Camera object represents a camera in 3d. A Camera object stores the location, viewing direction, up direction, focal length, and projection dimensions which are used for rendering. When constructing a Camera object you must make these specifications carefully. 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 focal length of the camera can be thought of as the distance from the camera location to the projection. The focal length is also the tangent of half the vertical field of view. The projection dimensions are the dimensions of the projection that the camera will produce. By default the projection dimensions are set so that the horizontal field of view is approx. 120 degrees and the vertical field of view is approx. 90 degrees. A Camera object also stores three perpendicular vectors that describe a coordinate system. This is the camera coordinate system and is used for projection. These vectors are computed and updated automatically based on the viewing direction and up direction vectors.
| Constructor Summary | |
Camera()
Constructs a Camera object with all default values as described above. |
|
Camera(Vector location,
Vector viewDirection,
Vector upDirection)
Constructs a Camera object with the specified location, viewing direction, and up direction, but with default focal length and projection dimensions as specified above. |
|
Camera(Vector location,
Vector viewDirection,
Vector upDirection,
double focalLength,
double[] fov)
Constructs a Camera object with the specified location, viewing direction, up direction, and focal length. |
|
Camera(Vector location,
Vector viewDirection,
Vector upDirection,
double focalLength,
double projectionX,
double projectionY)
Constructs a Camera object with the specified location, viewing direction, up direction, focal length, and projection dimensions. |
|
| Method Summary | |
double |
getFocalLength()
Returns the focal length of this Camera object as a double value. |
Vector |
getLocation()
Returns the location of this Camera object as a Vector object. |
double |
getProjectionHeight()
Returns the projection height of this Camera object as a double value. |
double |
getProjectionWidth()
Returns the projection width of this Camera object as a double value. |
TransformMatrix |
getRotationMatrix()
|
Vector |
getUpDirection()
Returns the up direction of this Camera object as a Vector object. |
Vector |
getViewDirection()
Calls the getViewingDirection() method and returns the result. |
Vector |
getViewingDirection()
Returns the viewing direction of this Camera object as a Vector object. |
Ray |
rayAt(double i,
double j,
int screenWidth,
int screenHeight)
Returns a Ray object that represents a line of sight from the camera represented by this Camera object. |
void |
setFocalLength(double focalLength)
Sets the focal length of this Camera object to the specified focal length. |
void |
setLocation(Vector location)
Sets the location of this Camera 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 Camera object to the specified projection height. |
void |
setProjectionWidth(double projectionX)
Sets the projection width of this Camera object to the specified projection width. |
void |
setUpDirection(Vector upDirection)
Sets the up direction of this Camera object to the specified up direction. |
void |
setViewDirection(Vector viewDirection)
Calls the setViewingDirection() method. |
void |
setViewingDirection(Vector viewDirection)
Sets the viewing direction of this Camera object to the specified viewing direction. |
void |
updateUVW()
Updates the orthonormal vectors used to describe camera space for this Camera object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Camera()
public Camera(Vector location,
Vector viewDirection,
Vector upDirection)
public Camera(Vector location,
Vector viewDirection,
Vector upDirection,
double focalLength,
double projectionX,
double projectionY)
public Camera(Vector location,
Vector viewDirection,
Vector upDirection,
double focalLength,
double[] fov)
location - Camera location.upDirection - Camera up direction.focalLength - Camera focal length.fov - Camera fields of view (radians) {horizontal FOV, vertical FOV}.| Method Detail |
public void setLocation(Vector location)
public void setViewDirection(Vector viewDirection)
public void setViewingDirection(Vector viewDirection)
public void setUpDirection(Vector upDirection)
public void setFocalLength(double focalLength)
public void setProjectionDimensions(double projectionX,
double projectionY)
public void setProjectionWidth(double projectionX)
public void setProjectionHeight(double projectionY)
public void updateUVW()
public Vector getLocation()
public Vector getViewDirection()
public Vector getViewingDirection()
public Vector getUpDirection()
public double getFocalLength()
public double getProjectionWidth()
public double getProjectionHeight()
public TransformMatrix getRotationMatrix()
public Ray rayAt(double i,
double j,
int screenWidth,
int screenHeight)
|
Rings Version 0.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||