de.grogra.ray.physics
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
 void add(Spectrum spec)
          Adds the function spec to this function.
 void clampMinZero()
           
 Spectrum clone()
          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 getMax()
           
 double integrate()
          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.
 Spectrum newInstance()
          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 setIdentity()
          Sets this spectrum to the identity, i.e., its value is 1 everywhere.
 void setZero()
          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 Detail

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

clampMinZero

void clampMinZero()

clone

Spectrum clone()
Returns a clone of this spectrum.

Returns:
clone of this spectrum

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

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

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

get

void get(Tuple3d color)
Computes the RGB spectrum color for this spectrum.

Parameters:
color - RGB spectrum will be placed in here

get

void get(Tuple3f color)
Computes the RGB spectrum color for this spectrum.

Parameters:
color - RGB spectrum will be placed in here

getMax

double getMax()

integrate

double integrate()
Returns the integral over all frequencies of this spectrum.

Returns:
integrated spectrum over all frequencies

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

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

scale

void scale(double factor)
Scales this spectrum by the given factor.

Parameters:
factor - scaling factor

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

set

void set(Tuple3d color)
Sets this spectrum to the spectrum of the specified RGB color.

Parameters:
color - RGB color

set

void set(Tuple3f color)
Sets this spectrum to the spectrum of the specified RGB color.

Parameters:
color - RGB color

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.


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

sum

double sum()
Computes the spectrum sum