Ray Tracer  2020
Public Member Functions | Private Attributes | List of all members
PointLightSource Class Reference

Light emitted from a Point. More...

#include <PointLightSource.h>

Inheritance diagram for PointLightSource:
LightSource

Public Member Functions

 PointLightSource (const Colour &colour, const Point &location)
 PointLightSource constructor. More...
 
 PointLightSource (const PointLightSource &lightSource)
 PointLightSource copy constructor. More...
 
 ~PointLightSource ()
 PointLightSource destructor. More...
 
PointLightSourceoperator= (const PointLightSource &lightSource)
 PointLightSource assignment operator. More...
 
Colour getIlluminationAt (const Point &point) const
 Determine how much light reaches a Point from this PointLightSource. More...
 
double getDistanceToLight (const Point &point) const
 Determine how far away the light source is from a given Point. More...
 
Direction getLightDirection (const Point &point) const
 Direction from light source to a point. More...
 

Private Attributes

Point location_
 Location of this PointLightSource. More...
 

Additional Inherited Members

- Protected Member Functions inherited from LightSource
 LightSource (const Colour &colour)
 LightSource constructor. More...
 
 LightSource (const LightSource &lightSource)
 LightSource copy constructor. More...
 
virtual ~LightSource ()
 LightSource destructor. More...
 
LightSourceoperator= (const LightSource &lightSource)
 LightSource assignment operator. More...
 
- Protected Attributes inherited from LightSource
Colour colour_
 The Colour of this LightSource's illumination. More...
 

Detailed Description

Light emitted from a Point.

A PointLightSource represents light emitted from a point in the Scene. The amount of light that reaches any given part of the scene follows a \(1/r^2\) law, so more distant Objects receive less illumination.

Constructor & Destructor Documentation

◆ PointLightSource() [1/2]

PointLightSource::PointLightSource ( const Colour colour,
const Point location 
)

PointLightSource constructor.

This creates a LightSource with a specified Colour at a given Location.

Parameters
colourThe Colour of the PointLightSource
locationThe location of the PointLightSource

◆ PointLightSource() [2/2]

PointLightSource::PointLightSource ( const PointLightSource lightSource)

PointLightSource copy constructor.

Parameters
lightSourceThe PointLightSource to copy to this.

◆ ~PointLightSource()

PointLightSource::~PointLightSource ( )

PointLightSource destructor.

Member Function Documentation

◆ getDistanceToLight()

double PointLightSource::getDistanceToLight ( const Point point) const
virtual

Determine how far away the light source is from a given Point.

Returns
The distance between this light source and the point.
See also
getDirectionToLight()

Implements LightSource.

◆ getIlluminationAt()

Colour PointLightSource::getIlluminationAt ( const Point point) const
virtual

Determine how much light reaches a Point from this PointLightSource.

The colour property determines the basic amount of light emitted by a PointLightSource. This is the illumination received at distance 1 from the PointLightSource, but it will appear brighter or darker if the illuminated Point is closer or further away. The amount of light received by a Point is scaled by \(1/d^2\), where \(d\) is the distance between the Point and the PointLightSource.

Parameters
pointThe Point at which light is measured.
Returns
The illumination that reaches the Point.

Implements LightSource.

◆ getLightDirection()

Direction PointLightSource::getLightDirection ( const Point point) const
virtual

Direction from light source to a point.

Return a Direction pointing from the given point towards the light source.

Parameters
pointThe point where the ray is being computed.
Returns
The Direction from the point towards the light.
See also
getDistanceToLight()

Implements LightSource.

◆ operator=()

PointLightSource & PointLightSource::operator= ( const PointLightSource lightSource)

PointLightSource assignment operator.

Parameters
lightSourceThe PointLightSource to copy to this.
Returns
A reference to this to allow for chaining of assignment.

Member Data Documentation

◆ location_

Point PointLightSource::location_
private

Location of this PointLightSource.


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