Abstract base class for Cameras.
Cameras are the primary source of rays in a scene. A camera is defined by its castRay() function, which generates a ray given image plane co-ordinates.
As an abstract base class, you cannot create a Camera directly. Instead one of its concrete subclasses must be created.
virtual Ray Camera::castRay |
( |
double |
x, |
|
|
double |
y |
|
) |
| const |
|
pure virtual |
Generate a ray for a given image plane co-ordinate.
Given a point on a virtual image plane, this method generates a ray for a given camera model. Note that image plane co-ordinates are not the same as pixel co-ordinates. There are two main differences:
- The origin of the image plane co-ordinates are in the centre of the image plane, while pixels usually count from the top left corner.
- Image plane co-ordinates are continuous (real) values, wheras pixel values are discrete.
By convention, x-values are in the range [-1,1], and the range of y-values depends on the aspect ratio of the image. For wide (landscape) images y-values will lie in a narrower range, while for tall (portrait) images, y-values will exceed this range. This is, however, merely a convention so is neither required nor enforced.
- Parameters
-
x | the horizontal location |
y | the vertical location |
- Returns
- The Ray that passes from the Camera through (x,y) in the image plane.
Implemented in PinholeCamera.