Package lighting
Class DirectionalLight
java.lang.Object
lighting.Light
lighting.LightSource
lighting.DirectionalLight
public class DirectionalLight extends LightSource
Abstract base class for all lights which have a source.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DirectionalLight(Colour colour, NormalizedVector direction)Construct a directional light. -
Method Summary
Modifier and Type Method Description ColourcolourAt(Point point)Calculate the colour of the light that this light source is projecting onto a given point.doublesquareDistance(Point point)Return the squared distance between the light source and the given point.NormalizedVectorvectorTo(Point point)Calculate aNormalizedVectorfrom the source of the light to the given point.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
DirectionalLight
Construct a directional light.- Parameters:
colour- The colour of the light.direction- The direction of the light.
-
-
Method Details
-
colourAt
Calculate the colour of the light that this light source is projecting onto a given point.- Specified by:
colourAtin classLightSource- Parameters:
point- The point at which to calculate the colour of the light.- Returns:
- The colour of the light at the given point.
-
vectorTo
Calculate aNormalizedVectorfrom the source of the light to the given point.- Specified by:
vectorToin classLightSource- Parameters:
point- The point the vector will point to from the light source.- Returns:
- The normalized vector from the light source to the given point.
-
squareDistance
Description copied from class:LightSourceReturn the squared distance between the light source and the given point.- Specified by:
squareDistancein classLightSource- Parameters:
point- The point whose squared distance from the light source is to be calculated.- Returns:
- The square of the distance between the light source and the given point.
-