Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.j3d.threeD.raytracer.camera
Class PinholeCamera

    java.lang.Object
      net.sf.j3d.threeD.raytracer.camera.OrthographicCamera
          net.sf.j3d.threeD.raytracer.camera.PinholeCamera

All Implemented Interfaces:
  Camera

Direct Known Subclasses:
  CameraObject, ThinLensCamera

    public class PinholeCamera

extends OrthographicCamera

A PinholeCamera object represents a camera in 3D. A PinholeCamera object stores the location, viewing direction, up direction, focal length, and projection dimensions which are used for rendering. When constructing a PinholeCamera 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 to 0.36 by 0.24 to produce a 35mm film aspect ratio. 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.

Author:
  Mike Murray

Constructor Summary
`PinholeCamera()` Constructs a PinholeCamera object with all default values as described above.
`PinholeCamera(Vector location, Vector viewDirection, Vector upDirection)` Constructs a PinholeCamera object with the specified location, viewing direction, and up direction, but with default focal length and projection dimensions as specified above.
`PinholeCamera(Vector location, Vector viewDirection, Vector upDirection, double focalLength, double[] fov)` Constructs a PinholeCamera object with the specified location, viewing direction, up direction, and focal length.
`PinholeCamera(Vector location, Vector viewDirection, Vector upDirection, double focalLength, double projectionX, double projectionY)` Constructs a PinholeCamera object with the specified location, viewing direction, up direction, focal length, and projection dimensions.

Method Summary
`double` | `getBlur()`
`double` | `getFocalLength()` Returns the focal length of this PinholeCamera object as a double value.
`double[]` | `getFOV()`
`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 PinholeCamera object.
`void` | `setBlur(double blur)`
`void` | `setFocalLength(double focalLength)` Sets the focal length of this PinholeCamera object to the specified focal length.
`String` | `toString()`

Methods inherited from class net.sf.j3d.threeD.raytracer.camera.OrthographicCamera
`getLocation, getProjectionHeight, getProjectionWidth, getRotationMatrix, getUpDirection, getViewDirection, getViewingDirection, setLocation, setProjectionDimensions, setProjectionHeight, setProjectionWidth, setUpDirection, setViewDirection, setViewingDirection, updateUVW`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PinholeCamera

    public PinholeCamera()

  Constructs a PinholeCamera object with all default values as described above.

### PinholeCamera

    public PinholeCamera(Vector location,
                         Vector viewDirection,
                         Vector upDirection)

  Constructs a PinholeCamera object with the specified location, viewing direction, and up direction, but with default focal length and projection dimensions as specified above.

### PinholeCamera

    public PinholeCamera(Vector location,
                         Vector viewDirection,
                         Vector upDirection,
                         double focalLength,
                         double projectionX,
                         double projectionY)

  Constructs a PinholeCamera object with the specified location, viewing direction, up direction, focal length, and projection dimensions.

### PinholeCamera

    public PinholeCamera(Vector location,
                         Vector viewDirection,
                         Vector upDirection,
                         double focalLength,
                         double[] fov)

  Constructs a PinholeCamera object with the specified location, viewing direction, up direction, and focal length. Projection dimensions are determined using the specified fields of view.

  Parameters:
    `location` - Camera location.
    `viewDiretion` - Camera viewing direction.
    `upDirection` - Camera up direction.
    `focalLength` - Camera focal length.
    `fov` - Camera fields of view (radians) {horizontal FOV, vertical FOV}.

Method Detail

### setFocalLength

    public void setFocalLength(double focalLength)

  Sets the focal length of this PinholeCamera object to the specified focal length.

### getFocalLength

    public double getFocalLength()

  Returns the focal length of this PinholeCamera object as a double value.

### getFOV

    public double[] getFOV()

  Returns:
    {Horizontal FOV, Vertical FOV} Measured in radians.

### setBlur

    public void setBlur(double blur)

### getBlur

    public double getBlur()

### rayAt

    public 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 PinholeCamera object. The first two parameters are the coordinates across the camera. These coordinates corespond to the pixels on the rendered image. The second two parameters specifiy the total integer width and height of the screen. Although the pixels on the screen must be in integer coordinates, this method provides the ability to create super high resolution images by allowing you to devote a single pixel to only a fraction of the theoretical camera surface. This effect can be used to produce large images from small scenes while retaining acuracy.

  Specified by:
    `rayAt` in interface `Camera`
  Overrides:
    `rayAt` in class `OrthographicCamera`
  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)`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD