java.lang.Object
javax.vecmath.Tuple3d
de.grogra.ray.physics.Spectrum3d
de.grogra.ray.physics.Collector3d
- All Implemented Interfaces:
Collector,Spectrum,DoubleToDouble,Serializable,Cloneable
- Direct Known Subclasses:
Collector3dList
This class stores some useful information about incoming rays of an
corresponding object, which has received a certain ray. This class extended
all properties of
Spectrum3d. It means that this Collector is
also a Spectrum.- Author:
- Stephan Rogge
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected longprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected double -
Constructor Summary
ConstructorsConstructorDescriptionJust a new instance of this class.Collector3d(double x, double y, double z) This constructor creates a Collector-instance with a certainSpectrum.Collector3d(Spectrum spectrum) This constructor creates a Collector-instance with a certainSpectrum. -
Method Summary
Modifier and TypeMethodDescriptionvoidTo combine two Collector-instances.voidAdd the newSpectrum to the spectrum of this Collector-instance and update the statistics.voidaddToStatistic(Tuple3d rayOrigin, Spectrum3d spectrum, double scaleFactor, boolean isPrimary) Add the Vector of the origin of a certain ray, which hits the object for this corresponding Collector-instance.voidaddToStatistic(Tuple3d rayOrigin, Spectrum spectrum, double scaleFactor, boolean isPrimary) Here the information ofcomputation are stored.invalid reference
LightModelclone()Creates a copy of the Spectrum or a deep-copy of this instance.voidgetCollectedValues(Tuple3d sumDir, Tuple3d sumSquareDir, Tuple3d sumSpec, Tuple3d sumSquareSpec) voidSet the arithmetic mean of all directions (not normalized) tovector.voidvoidgetDirectionVariance(Tuple3d tuple) This methods returns the variance of the light-direction (not normalized).voidgetDirectionVariance(Tuple3f tuple) longReturns the number of rays which hit the corresponding object of this instance.voidgetSpectrumArithmeticMean(Spectrum spectrum) Set the arithmetic mean of all spectra tospectrum.voidgetSpectrumVariance(Spectrum spectrum) This methods returns the variance of the spectrums.booleanIf the collector should works like a Spectrum, this method returns false, otherwise true.Returns a new instance of this class.static voidstatic voidvoidThe initial value ofasCollectoris false.voidsetZero()Sets all values the instance to zero.Methods inherited from class de.grogra.ray.physics.Spectrum3d
clampMinZero, div, div, div, dot, evaluateDouble, get, getMax, integrate, mul, mul, mul, set, setIdentity, sub, sumMethods inherited from class javax.vecmath.Tuple3d
absolute, absolute, add, add, clamp, clamp, clamp, clamp, clampMax, clampMax, clampMax, clampMax, clampMin, clampMin, clampMin, clampMin, epsilonEquals, equals, equals, get, get, get, hashCode, interpolate, interpolate, interpolate, interpolate, max, min, negate, negate, scale, scale, scaleAdd, scaleAdd, set, set, set, set, sub, sub, toString
-
Field Details
-
rayCount
protected long rayCount -
asCollector
protected boolean asCollector -
squareSumDirectionX
protected double squareSumDirectionX -
squareSumDirectionY
protected double squareSumDirectionY -
squareSumDirectionZ
protected double squareSumDirectionZ -
sumDirectionX
protected double sumDirectionX -
sumDirectionY
protected double sumDirectionY -
sumDirectionZ
protected double sumDirectionZ -
squareSumSpectrumX
protected double squareSumSpectrumX -
squareSumSpectrumY
protected double squareSumSpectrumY -
squareSumSpectrumZ
protected double squareSumSpectrumZ -
sumSpectrumX
protected double sumSpectrumX -
sumSpectrumY
protected double sumSpectrumY -
sumSpectrumZ
protected double sumSpectrumZ
-
-
Constructor Details
-
Collector3d
public Collector3d()Just a new instance of this class. -
Collector3d
public Collector3d(double x, double y, double z) This constructor creates a Collector-instance with a certainSpectrum.- Parameters:
x- Red-component ofSpectrum3dy- Green-component ofSpectrum3dz- Blue-component ofSpectrum3d
-
Collector3d
This constructor creates a Collector-instance with a certainSpectrum.- Parameters:
spectrum- Spectrum, which is used by the LightModel
-
-
Method Details
-
newInstance
Returns a new instance of this class.- Specified by:
newInstancein interfaceCollector- Specified by:
newInstancein interfaceSpectrum- Overrides:
newInstancein classSpectrum3d- Returns:
- new instance of same class
-
setAsCollector
public void setAsCollector()The initial value ofasCollectoris false. It means that the collector works like aSpectrum. Thats useful when this Collector-instance is used for the calculations in.invalid reference
LightModel- Specified by:
setAsCollectorin interfaceCollector
-
isCollector
public boolean isCollector()If the collector should works like a Spectrum, this method returns false, otherwise true.- Specified by:
isCollectorin interfaceCollector- Returns:
-
add
Add the newSpectrum to the spectrum of this Collector-instance and update the statistics.- Specified by:
addin interfaceSpectrum- Overrides:
addin classSpectrum3d- Parameters:
spectrum- the spectrum to addnewSpectrum- New to added spectrum.
-
addToStatistic
public void addToStatistic(Tuple3d rayOrigin, Spectrum spectrum, double scaleFactor, boolean isPrimary) Description copied from interface:CollectorHere the information ofcomputation are stored.invalid reference
LightModel- Specified by:
addToStatisticin interfaceCollector- Parameters:
rayOrigin- May this contains a certain vector (direction for example).spectrum- To addedSpectrum.scaleFactor- For the addedSpectrum.isPrimary- To distinguish from primary or secondary rays.
-
addToStatistic
public void addToStatistic(Tuple3d rayOrigin, Spectrum3d spectrum, double scaleFactor, boolean isPrimary) Add the Vector of the origin of a certain ray, which hits the object for this corresponding Collector-instance. Notice: The direction and the weight of the direction doesn't depends on the absorbed power but on the intensity of the incoming ray.- Parameters:
rayOrigin- Where the light comes from.scale- The factor for weighting this direction (usually intensity of incoming light)
-
getSpectrumVariance
This methods returns the variance of the spectrums. The calculation for this is: sigma^2 = 1/N * ((sum of all spectra^2) - (N * x^2)) N ... The number of rays x ... The arithmetic mean of all direction To get the standard deviation, just extract the root of the variance. For more information see .- Specified by:
getSpectrumVariancein interfaceCollector
-
getDirectionVariance
This methods returns the variance of the light-direction (not normalized). The calculation for this is: sigma^2 = 1/N * ((sum of all directions^2) - (N * x^2)) N ... The number of rays x ... The arithmetic mean of all direction To get the standard deviation, just extract the root of the variance. For more information see .- Specified by:
getDirectionVariancein interfaceCollector
-
getDirectionVariance
-
getDirectionArithmeticMean
Set the arithmetic mean of all directions (not normalized) tovector. The parametervectorshould be initialized before.- Specified by:
getDirectionArithmeticMeanin interfaceCollector- Parameters:
vector- Returns the arithmetic mean of all direction for this Collector-instance.
-
getDirectionArithmeticMean
-
getSpectrumArithmeticMean
Set the arithmetic mean of all spectra tospectrum. The parameterspectrumshould be initialized before.- Specified by:
getSpectrumArithmeticMeanin interfaceCollector- Parameters:
spectrum- Returns the arithmetic mean of all spectra for this Collector-instance.
-
getRayCount
public long getRayCount()Returns the number of rays which hit the corresponding object of this instance.- Specified by:
getRayCountin interfaceCollector- Returns:
- Number of rays.
-
setZero
public void setZero()Sets all values the instance to zero. Useful when the instance is still used as container for information/ results of thecomputation.invalid reference
LightModel- Specified by:
setZeroin interfaceSpectrum- Overrides:
setZeroin classSpectrum3d
-
normalize
-
normalize
-
add
To combine two Collector-instances. All values ofcoladded to the values of this instance. -
getCollectedValues
public void getCollectedValues(Tuple3d sumDir, Tuple3d sumSquareDir, Tuple3d sumSpec, Tuple3d sumSquareSpec) - Specified by:
getCollectedValuesin interfaceCollector
-
clone
Creates a copy of the Spectrum or a deep-copy of this instance.
-