Package lighting

Class NarrowSpotlight


public class NarrowSpotlight
extends Spotlight
This class is represents an directional light source that attenuates with respect to distance.
  • Field Summary

    Fields inherited from class lighting.Light

    colour
  • Constructor Summary

    Constructors
    Constructor Description
    NarrowSpotlight​(Colour colour, Point position, NormalizedVector direction, double q, double l, double c, double focus)
    Construct a Spotlight from a Colour, a direction, and 3 doubles that represent the attenuation constants and the focus factor.
  • Method Summary

    Modifier and Type Method Description
    protected double factor​(Point point)
    Calculate the factor by which to scale the colour at a given point, based on the direction of the spotlight.

    Methods inherited from class lighting.Spotlight

    colourAt

    Methods inherited from class lighting.PointLight

    squareDistance, vectorTo

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NarrowSpotlight

      public NarrowSpotlight​(Colour colour, Point position, NormalizedVector direction, double q, double l, double c, double focus)
      Construct a Spotlight from a Colour, a direction, and 3 doubles that represent the attenuation constants and the focus factor.
      Parameters:
      colour - The colour of the light
      position - The position in space of the light source
      direction - The direction of the spot light
      q - The quadratic factor
      l - The linear factor
      c - The constant factor
      focus - The focus factor, between 0 and 1. (The closer to 0, the wider the spotlight)
  • Method Details

    • factor

      protected double factor​(Point point)
      Description copied from class: Spotlight
      Calculate the factor by which to scale the colour at a given point, based on the direction of the spotlight.
      Overrides:
      factor in class Spotlight
      Parameters:
      point - The intersection point of the light at which to calculate the factor.
      Returns:
      The factor to scale the colour at a point.