Module raytracer

Interface Spectrum

All Superinterfaces:
DoubleToDouble
All Known Subinterfaces:
Collector
All Known Implementing Classes:
Collector3d, Collector3dList, CollectorW3d, Spectrum3d, Spectrum3f

public interface Spectrum extends DoubleToDouble
This interface represents a spectrum, i.e., a function f(ν) of frequency ν of a wave.
Author:
Ole Kniemeyer
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Spectrum spec)
    Adds the function spec to this function.
    void
     
    Returns a clone of this spectrum.
    void
    div(Spectrum factor)
    Performs an componentwise division of this spectrum by spec.
    void
    div(Tuple3d factor)
    Performs a pointwise division of this spectrum by the given RGB spectum factor.
    void
    div(Tuple3f factor)
    Performs a pointwise division of this spectrum by the given RGB spectum factor.
    void
    dot(Spectrum spec, Tuple3d out)
    Computes the scalar product of this spectrum with spec, i.e., the integral of the pointwise product of both spectra over all frequencies.
    double
    evaluateDouble(double nu)
    Evaluates the spectrum at frequency nu (measured in Hz).
    void
    get(Tuple3d color)
    Computes the RGB spectrum color for this spectrum.
    void
    get(Tuple3f color)
    Computes the RGB spectrum color for this spectrum.
    double
     
    double
    Returns the integral over all frequencies of this spectrum.
    void
    mul(Spectrum factor)
    Performs an componentwise multiplication of this spectrum by spec.
    void
    mul(Tuple3d factor)
    Performs a pointwise multiplication of this spectrum by the given RGB spectum factor.
    void
    mul(Tuple3f factor)
    Performs a pointwise multiplication of this spectrum by the given RGB spectum factor.
    Returns a new instance of the class of this spectrum.
    void
    scale(double factor)
    Scales this spectrum by the given factor.
    void
    set(Spectrum spec)
    Sets this spectrum to spec.
    void
    set(Tuple3d color)
    Sets this spectrum to the spectrum of the specified RGB color.
    void
    set(Tuple3f color)
    Sets this spectrum to the spectrum of the specified RGB color.
    void
    Sets this spectrum to the identity, i.e., its value is 1 everywhere.
    void
    Sets this spectrum to the zero function.
    void
    sub(Spectrum spec)
    Subtracts the function spec from this function.
    double
    sum()
    Computes the spectrum sum
  • Method Details

    • clone

      Spectrum clone()
      Returns a clone of this spectrum.
      Returns:
      clone of this spectrum
    • newInstance

      Spectrum newInstance()
      Returns a new instance of the class of this spectrum. It is initialized to the zero function.
      Returns:
      new instance of same class
    • evaluateDouble

      double evaluateDouble(double nu)
      Evaluates the spectrum at frequency nu (measured in Hz).
      Specified by:
      evaluateDouble in interface DoubleToDouble
      Parameters:
      nu - frequency in Hz
      Returns:
      function value at nu
    • scale

      void scale(double factor)
      Scales this spectrum by the given factor.
      Parameters:
      factor - scaling factor
    • setIdentity

      void setIdentity()
      Sets this spectrum to the identity, i.e., its value is 1 everywhere.
    • setZero

      void setZero()
      Sets this spectrum to the zero function.
    • integrate

      double integrate()
      Returns the integral over all frequencies of this spectrum.
      Returns:
      integrated spectrum over all frequencies
    • set

      void set(Spectrum spec)
      Sets this spectrum to spec. spec has to be compatible with this spectrum (usually this means that it has to be of the same class).
      Parameters:
      spec - another spectrum
    • add

      void add(Spectrum spec)
      Adds the function spec to this function. spec has to be compatible with this spectrum (usually this means that it has to be of the same class).
      Parameters:
      spec - the spectrum to add
    • sub

      void sub(Spectrum spec)
      Subtracts the function spec from this function. spec has to be compatible with this spectrum (usually this means that it has to be of the same class).
      Parameters:
      spec - the spectrum to subtract
    • clampMinZero

      void clampMinZero()
    • dot

      void dot(Spectrum spec, Tuple3d out)
      Computes the scalar product of this spectrum with spec, i.e., the integral of the pointwise product of both spectra over all frequencies. The integration is split into three parts: The first part ranges over the red part of the spectrum, its result is stored in out.x. The second part ranges over the green part of the spectrum and is stored in out.y, the third part ranges over the blue part and is stored in out.z.
      Parameters:
      spec - another spectrum
      out - result of dot product, split into three integration domains
    • mul

      void mul(Spectrum factor)
      Performs an componentwise multiplication of this spectrum by spec. spec has to be compatible with this spectrum (usually this means that it has to be of the same class). The result of each component is stored in this spectrum.
      Parameters:
      factor - the spectrum to multiply with
    • mul

      void mul(Tuple3d factor)
      Performs a pointwise multiplication of this spectrum by the given RGB spectum factor.
      Parameters:
      factor - the multiplicator
    • mul

      void mul(Tuple3f factor)
      Performs a pointwise multiplication of this spectrum by the given RGB spectum factor.
      Parameters:
      factor - the multiplicator
    • div

      void div(Spectrum factor)
      Performs an componentwise division of this spectrum by spec. spec has to be compatible with this spectrum (usually this means that it has to be of the same class). The result of each component is stored in this spectrum. Note that a factor with 0 causes a ArithmeticException
      Parameters:
      factor - the spectrum to divide with
    • div

      void div(Tuple3d factor)
      Performs a pointwise division of this spectrum by the given RGB spectum factor. Note that a factor with 0 causes a ArithmeticException
      Parameters:
      factor - the divisor
    • div

      void div(Tuple3f factor)
      Performs a pointwise division of this spectrum by the given RGB spectum factor. Note that a factor with 0 causes a ArithmeticException
      Parameters:
      factor - the divisor
    • set

      void set(Tuple3d color)
      Sets this spectrum to the spectrum of the specified RGB color.
      Parameters:
      color - RGB color
    • get

      void get(Tuple3d color)
      Computes the RGB spectrum color for this spectrum.
      Parameters:
      color - RGB spectrum will be placed in here
    • set

      void set(Tuple3f color)
      Sets this spectrum to the spectrum of the specified RGB color.
      Parameters:
      color - RGB color
    • get

      void get(Tuple3f color)
      Computes the RGB spectrum color for this spectrum.
      Parameters:
      color - RGB spectrum will be placed in here
    • sum

      double sum()
      Computes the spectrum sum
    • getMax

      double getMax()