Path Tracer
Public Member Functions | List of all members
PerspectiveCamera Class Reference

Models a perspective camera. More...

#include <PerspectiveCamera.h>

Public Member Functions

 PerspectiveCamera ()
 Default constructor. More...
 
 PerspectiveCamera (unsigned int numberPixelsX, unsigned int numberPixelsY, DoubleVec3D origin=DoubleVec3D(0.0), DoubleVec3D focal=DoubleVec3D(0, 0, -0.75))
 Main constructor. More...
 
 PerspectiveCamera (const PerspectiveCamera &camera)
 Copy constructor. More...
 
unsigned int getNumberPixelsX () const
 Getter for the number of pixels in x. More...
 
unsigned int getNumberPixelsY () const
 Getter for the number of pixels in y. More...
 
DoubleVec3D getOrigin () const
 Getter for the camera origin. More...
 
DoubleVec3D getFocal () const
 Getter for the camera focal. More...
 
double getWorldWidth () const
 Getter for the camera world width. More...
 
double getWorldHeight () const
 Getter for the camera world height. More...
 
void setNumberPixelsX (unsigned int numberPixelsX)
 Setter for the number of pixels in x. More...
 
void setNumberPixelsY (unsigned int numberPixelsY)
 Setter for the number of pixels in y. More...
 
void setOrigin (DoubleVec3D origin)
 Setter for the camera origin. More...
 
void setFocal (DoubleVec3D focal)
 Setter for the camera focal. More...
 
Ray getRayGoingThrough (double pixelX, double pixelY) const
 Returns a ray going through some pixels. More...
 

Detailed Description

Models a perspective camera.

Constructor & Destructor Documentation

◆ PerspectiveCamera() [1/3]

PerspectiveCamera::PerspectiveCamera ( )

Default constructor.

numberPixelsX and numberpixelsY are set to 500 by default.

◆ PerspectiveCamera() [2/3]

PerspectiveCamera::PerspectiveCamera ( unsigned int  numberPixelsX,
unsigned int  numberPixelsY,
DoubleVec3D  origin = DoubleVec3D(0.0),
DoubleVec3D  focal = DoubleVec3D(0, 0, -0.75) 
)

Main constructor.

Parameters
numberPixelsXThe width of the camera in pixels. It will define the width of the render.
numberPixelsYThe height of the camera in pixels. It will define the height of the render.
originFrom where the rays are casted.
focalIts direction defines the camera's and its length defines the camera length.

◆ PerspectiveCamera() [3/3]

PerspectiveCamera::PerspectiveCamera ( const PerspectiveCamera camera)

Copy constructor.

Parameters
cameraThe camera that will be copied.

Member Function Documentation

◆ getFocal()

DoubleVec3D PerspectiveCamera::getFocal ( ) const

Getter for the camera focal.

Returns
The camera focal.

◆ getNumberPixelsX()

unsigned int PerspectiveCamera::getNumberPixelsX ( ) const

Getter for the number of pixels in x.

Returns
The number of pixels that compose the camera on the x axis.

◆ getNumberPixelsY()

unsigned int PerspectiveCamera::getNumberPixelsY ( ) const

Getter for the number of pixels in y.

Returns
The number of pixels that compose the camera on the y axis.

◆ getOrigin()

DoubleVec3D PerspectiveCamera::getOrigin ( ) const

Getter for the camera origin.

Returns
The camera origin.

◆ getRayGoingThrough()

Ray PerspectiveCamera::getRayGoingThrough ( double  pixelX,
double  pixelY 
) const

Returns a ray going through some pixels.

See my TM's report for an explanation on how the computations work.

Parameters
pixelXThe x coordinate of the pixel through which we want the ray.
pixelYThe y coordinate of the pixel through which we want the ray.
Returns
A ray which origin is the camera's and which direction is such that it goes through the requested pixel.

◆ getWorldHeight()

double PerspectiveCamera::getWorldHeight ( ) const

Getter for the camera world height.

Returns
The width of the camera in the virtual world.

◆ getWorldWidth()

double PerspectiveCamera::getWorldWidth ( ) const

Getter for the camera world width.

Returns
The width of the camera in the virtual world.

◆ setFocal()

void PerspectiveCamera::setFocal ( DoubleVec3D  focal)

Setter for the camera focal.

Parameters
focalThe new camera focal.

◆ setNumberPixelsX()

void PerspectiveCamera::setNumberPixelsX ( unsigned int  numberPixelsX)

Setter for the number of pixels in x.

Parameters
numberPixelsXThe new number of pixels that compose the camera on the x axis.

◆ setNumberPixelsY()

void PerspectiveCamera::setNumberPixelsY ( unsigned int  numberPixelsY)

Setter for the number of pixels in y.

Parameters
numberPixelsYThe new number of pixels that compose the camera on the y axis.

◆ setOrigin()

void PerspectiveCamera::setOrigin ( DoubleVec3D  origin)

Setter for the camera origin.

Parameters
originThe new camera origin.

The documentation for this class was generated from the following files: