Ray Tracer
2020
|
PinholeCamera class. More...
#include <PinholeCamera.h>
Public Member Functions | |
PinholeCamera (double f=1) | |
PinholeCamera constructor. More... | |
PinholeCamera (const PinholeCamera &camera) | |
PinholeCamera copy constructor. More... | |
~PinholeCamera () | |
PinholeCamera destructor. More... | |
PinholeCamera & | operator= (const PinholeCamera &camera) |
PinholeCamera assignment operator. More... | |
Ray | castRay (double x, double y) const |
Generate a ray for a given image plane co-ordinate. More... | |
Public Attributes | |
double | focalLength |
The distance from the camera centre to the image plane. More... | |
Public Attributes inherited from Camera | |
Transform | transform |
Transformation to apply to the Camera. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Camera | |
Camera () | |
Camera default constructor. More... | |
Camera (const Camera &camera) | |
Camera copy constructor. More... | |
virtual | ~Camera () |
Camera destructor. More... | |
Camera & | operator= (const Camera &camera) |
Camera assignment operator. More... | |
PinholeCamera class.
PinholeCamera implements a common Camera model that gives ideal perspective projections. The camera is defined by a point (the camera centre) and an image plane at some distance along the Z-axis (the focal distance). The projection of a 3D point into the image is the intersection of the line from the camera centre to the 3D point with the image plane.
PinholeCamera::PinholeCamera | ( | double | f = 1 | ) |
PinholeCamera constructor.
This creates a new PinholeCamera with the camera centre at the origin, looking along the positive Z-axis. The focal length is provided as a parameter (default: 1 unit). The position and orientation of a Camera can be altered via its transform member.
f | The focalLength of the new camera. |
PinholeCamera::PinholeCamera | ( | const PinholeCamera & | camera | ) |
PinholeCamera copy constructor.
camera | The PinholeCamera to copy to this . |
PinholeCamera::~PinholeCamera | ( | ) |
PinholeCamera destructor.
|
virtual |
Generate a ray for a given image plane co-ordinate.
For a untransformed PinholeCamera the ray starts at the origin and passes through (x, y, focalLength).
x | the horizontal location |
y | the vertical location |
Implements Camera.
PinholeCamera & PinholeCamera::operator= | ( | const PinholeCamera & | camera | ) |
PinholeCamera assignment operator.
camera | The PinholeCamera to assign to this . |
this
to allow for chaining of assignments. double PinholeCamera::focalLength |
The distance from the camera centre to the image plane.