Ray Tracer
2020
|
Light emitted from a Point. More...
#include <PointLightSource.h>
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... | |
PointLightSource & | operator= (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 | |
![]() | |
LightSource (const Colour &colour) | |
LightSource constructor. More... | |
LightSource (const LightSource &lightSource) | |
LightSource copy constructor. More... | |
virtual | ~LightSource () |
LightSource destructor. More... | |
LightSource & | operator= (const LightSource &lightSource) |
LightSource assignment operator. More... | |
![]() | |
Colour | colour_ |
The Colour of this LightSource's illumination. More... | |
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.
PointLightSource constructor.
This creates a LightSource with a specified Colour at a given Location.
colour | The Colour of the PointLightSource |
location | The location of the PointLightSource |
PointLightSource::PointLightSource | ( | const PointLightSource & | lightSource | ) |
PointLightSource copy constructor.
lightSource | The PointLightSource to copy to this . |
PointLightSource::~PointLightSource | ( | ) |
PointLightSource destructor.
|
virtual |
Determine how far away the light source is from a given Point.
Implements LightSource.
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.
point | The Point at which light is measured. |
Implements LightSource.
Direction from light source to a point.
Return a Direction pointing from the given point towards the light source.
point | The point where the ray is being computed. |
Implements LightSource.
PointLightSource & PointLightSource::operator= | ( | const PointLightSource & | lightSource | ) |
PointLightSource assignment operator.
lightSource | The PointLightSource to copy to this . |
this
to allow for chaining of assignment.
|
private |
Location of this PointLightSource.