java.lang.Object
javax.vecmath.Tuple3f
javax.vecmath.Color3f
de.grogra.ray.physics.Spectrum3f
- All Implemented Interfaces:
Spectrum
,DoubleToDouble
,Serializable
,Cloneable
This class implements a spectrum which is represented by three
float
values which are interpreted as the red,
green and blue part of the spectrum. Specta of this class are
compatible with each other and with spectra
of class Spectrum3d
.- Author:
- Ole Kniemeyer
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the functionspec
to this function.void
clone()
Returns a clone of this spectrum.void
Performs an componentwise division of this spectrum byspec
.void
Performs a pointwise division of this spectrum by the given RGB spectumfactor
.void
Performs a pointwise division of this spectrum by the given RGB spectumfactor
.void
Computes the scalar product of this spectrum withspec
, i.e., the integral of the pointwise product of both spectra over all frequencies.double
evaluateDouble
(double nu) Evaluates the spectrum at frequencynu
(measured in Hz).void
Computes the RGB spectrumcolor
for this spectrum.double
getMax()
double
Returns the integral over all frequencies of this spectrum.void
Performs an componentwise multiplication of this spectrum byspec
.void
Performs a pointwise multiplication of this spectrum by the given RGB spectumfactor
.void
Performs a pointwise multiplication of this spectrum by the given RGB spectumfactor
.Returns a new instance of the class of this spectrum.void
scale
(double factor) Scales this spectrum by the givenfactor
.void
Sets this spectrum tospec
.void
Sets this spectrum to the identity, i.e., its value is 1 everywhere.void
setZero()
Sets this spectrum to the zero function.void
Subtracts the functionspec
from this function.double
sum()
Computes the spectrum sumMethods inherited from class javax.vecmath.Tuple3f
absolute, absolute, add, add, clamp, clamp, clampMax, clampMax, clampMin, clampMin, epsilonEquals, equals, equals, get, get, hashCode, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, set, set, set, set, sub, sub, toString
-
Constructor Details
-
Spectrum3f
public Spectrum3f() -
Spectrum3f
public Spectrum3f(float x, float y, float z)
-
-
Method Details
-
clampMinZero
public void clampMinZero()- Specified by:
clampMinZero
in interfaceSpectrum
-
evaluateDouble
public double evaluateDouble(double nu) Description copied from interface:Spectrum
Evaluates the spectrum at frequencynu
(measured in Hz).- Specified by:
evaluateDouble
in interfaceDoubleToDouble
- Specified by:
evaluateDouble
in interfaceSpectrum
- Parameters:
nu
- frequency in Hz- Returns:
- function value at
nu
-
setZero
public void setZero()Description copied from interface:Spectrum
Sets this spectrum to the zero function. -
setIdentity
public void setIdentity()Description copied from interface:Spectrum
Sets this spectrum to the identity, i.e., its value is 1 everywhere.- Specified by:
setIdentity
in interfaceSpectrum
-
clone
Description copied from interface:Spectrum
Returns a clone of this spectrum. -
newInstance
Description copied from interface:Spectrum
Returns a new instance of the class of this spectrum. It is initialized to the zero function.- Specified by:
newInstance
in interfaceSpectrum
- Returns:
- new instance of same class
-
scale
public void scale(double factor) Description copied from interface:Spectrum
Scales this spectrum by the givenfactor
. -
add
Description copied from interface:Spectrum
Adds the functionspec
to this function.spec
has to be compatible with this spectrum (usually this means that it has to be of the same class). -
sub
Description copied from interface:Spectrum
Subtracts the functionspec
from this function.spec
has to be compatible with this spectrum (usually this means that it has to be of the same class). -
dot
Description copied from interface:Spectrum
Computes the scalar product of this spectrum withspec
, 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 inout.x
. The second part ranges over the green part of the spectrum and is stored inout.y
, the third part ranges over the blue part and is stored inout.z
. -
mul
Description copied from interface:Spectrum
Performs an componentwise multiplication of this spectrum byspec
.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. -
mul
Description copied from interface:Spectrum
Performs a pointwise multiplication of this spectrum by the given RGB spectumfactor
. -
mul
Description copied from interface:Spectrum
Performs a pointwise multiplication of this spectrum by the given RGB spectumfactor
. -
div
Description copied from interface:Spectrum
Performs an componentwise division of this spectrum byspec
.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 -
div
Description copied from interface:Spectrum
Performs a pointwise division of this spectrum by the given RGB spectumfactor
. Note that a factor with 0 causes a ArithmeticException -
div
Description copied from interface:Spectrum
Performs a pointwise division of this spectrum by the given RGB spectumfactor
. Note that a factor with 0 causes a ArithmeticException -
get
Description copied from interface:Spectrum
Computes the RGB spectrumcolor
for this spectrum. -
integrate
public double integrate()Description copied from interface:Spectrum
Returns the integral over all frequencies of this spectrum. -
set
Description copied from interface:Spectrum
Sets this spectrum tospec
.spec
has to be compatible with this spectrum (usually this means that it has to be of the same class). -
sum
public double sum()Description copied from interface:Spectrum
Computes the spectrum sum -
getMax
public double getMax()
-