Top Description Inners Fields Constructors Methods
org.apache.commons.math3.analysis.interpolation

public Class InterpolatingMicrosphere

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.math3.analysis.interpolation.InterpolatingMicrosphere2D
Imports
java.util.List, .ArrayList, org.apache.commons.math3.random.UnitSphereRandomVectorGenerator, org.apache.commons.math3.exception.DimensionMismatchException, .NotPositiveException, .NotStrictlyPositiveException, .MaxCountExceededException, .OutOfRangeException, org.apache.commons.math3.util.FastMath, .MathArrays

Utility class for the MicrosphereProjectionInterpolator algorithm.
Since
3.6

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
InterpolatingMicrosphere.Facet

Microsphere "facet" (surface element).

private static class
InterpolatingMicrosphere.FacetData

Data associated with each Facet.

Field Summary

Modifier and TypeField and Description
private final double
background

Background value.

private final double
darkThreshold

Lowest non-zero illumination.

private final int
dimension

Space dimension.

private final double
maxDarkFraction

Maximum fraction of the facets that can be dark.

private final List<InterpolatingMicrosphere.Facet>
microsphere

Microsphere.

private final List<InterpolatingMicrosphere.FacetData>
microsphereData

Microsphere data.

private final int
size

Number of surface elements.

Constructor Summary

AccessConstructor and Description
protected
InterpolatingMicrosphere(int
Dimension of the data space.
dimension
,
int
Number of surface elements of the sphere.
size
,
double
Maximum fraction of the facets that can be dark. If the fraction of "non-illuminated" facets is larger, no estimation of the value will be performed, and the background value will be returned instead.
maxDarkFraction
,
double
Value of the illumination below which a facet is considered dark.
darkThreshold
,
double
Value returned when the maxDarkFraction threshold is exceeded.
background
)

Create an unitialiazed sphere.

public
InterpolatingMicrosphere(int
Dimension of the data space.
dimension
,
int
Number of surface elements of the sphere.
size
,
double
Maximum fraction of the facets that can be dark. If the fraction of "non-illuminated" facets is larger, no estimation of the value will be performed, and the background value will be returned instead.
maxDarkFraction
,
double
Value of the illumination below which a facet is considered dark.
darkThreshold
,
double
Value returned when the maxDarkFraction threshold is exceeded.
background
,
UnitSphereRandomVectorGenerator
Unit vector generator for creating the microsphere.
rand
)

Create a sphere from randomly sampled vectors.

protected
InterpolatingMicrosphere(InterpolatingMicrosphere
Instance to copy.
other
)

Copy constructor.

Method Summary

Modifier and TypeMethod and Description
protected void
add(double[]
Facet's normal vector.
normal
,
boolean
Whether to copy the given array.
copy
)

Replace i-th facet of the microsphere.

private void
clear()

Reset the all the facets data to zero.

public InterpolatingMicrosphere

Returns:

a copy of this instance.
copy
()

Perform a copy.

public int

Returns:

the number of space dimensions.
getDimension
()

Get the space dimensionality.

public int

Returns:

the number of surface elements of the microspshere.
getSize
()

Get the size of the sphere.

private void
illuminate(double[]
Vector whose origin is at the interpolation point and tail is at the sample location.
sampleDirection
,
double
Data value of the sample.
sampleValue
,
double
Weight.
weight
)

Illumination.

private double

Returns:

the value estimated from the current illumination of the microsphere.
interpolate
()

Interpolation.

public double

Returns:

the estimated value at the given point.
value
(double[]
Interpolation point.
point
,
double[][]
Sampling data points.
samplePoints
,
double[]
Sampling data values at the corresponding samplePoints.
sampleValues
,
double
Exponent used in the power law that computes the weights (distance dimming factor) of the sample data.
exponent
,
double
When the distance between the point and one of the samplePoints is less than this value, no interpolation will be performed, and the value of the sample will just be returned.
noInterpolationTolerance
)

Estimate the value at the requested location.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

backgroundback to summary
private final double background

Background value.

darkThresholdback to summary
private final double darkThreshold

Lowest non-zero illumination.

dimensionback to summary
private final int dimension

Space dimension.

maxDarkFractionback to summary
private final double maxDarkFraction

Maximum fraction of the facets that can be dark.

microsphereback to summary
private final List<InterpolatingMicrosphere.Facet> microsphere

Microsphere.

microsphereDataback to summary
private final List<InterpolatingMicrosphere.FacetData> microsphereData

Microsphere data.

sizeback to summary
private final int size

Number of surface elements.

Constructor Detail

InterpolatingMicrosphereback to summary
protected InterpolatingMicrosphere(int dimension, int size, double maxDarkFraction, double darkThreshold, double background)

Create an unitialiazed sphere. Sub-classes are responsible for calling the add(double[]) add method in order to initialize all the sphere's facets.

Parameters
dimension:int

Dimension of the data space.

size:int

Number of surface elements of the sphere.

maxDarkFraction:double

Maximum fraction of the facets that can be dark. If the fraction of "non-illuminated" facets is larger, no estimation of the value will be performed, and the background value will be returned instead.

darkThreshold:double

Value of the illumination below which a facet is considered dark.

background:double

Value returned when the maxDarkFraction threshold is exceeded.

Exceptions
NotStrictlyPositiveException:
if dimension <= 0 or size <= 0.
NotPositiveException:
if darkThreshold < 0.
OutOfRangeException:
if maxDarkFraction does not belong to the interval [0, 1].
InterpolatingMicrosphereback to summary
public InterpolatingMicrosphere(int dimension, int size, double maxDarkFraction, double darkThreshold, double background, UnitSphereRandomVectorGenerator rand)

Create a sphere from randomly sampled vectors.

Parameters
dimension:int

Dimension of the data space.

size:int

Number of surface elements of the sphere.

maxDarkFraction:double

Maximum fraction of the facets that can be dark. If the fraction of "non-illuminated" facets is larger, no estimation of the value will be performed, and the background value will be returned instead.

darkThreshold:double

Value of the illumination below which a facet is considered dark.

background:double

Value returned when the maxDarkFraction threshold is exceeded.

rand:UnitSphereRandomVectorGenerator

Unit vector generator for creating the microsphere.

Exceptions
DimensionMismatchException:
if the size of the generated vectors does not match the dimension set in the constructor.
NotStrictlyPositiveException:
if dimension <= 0 or size <= 0.
NotPositiveException:
if darkThreshold < 0.
OutOfRangeException:
if maxDarkFraction does not belong to the interval [0, 1].
InterpolatingMicrosphereback to summary
protected InterpolatingMicrosphere(InterpolatingMicrosphere other)

Copy constructor.

Parameters
other:InterpolatingMicrosphere

Instance to copy.

Method Detail

addback to summary
protected void add(double[] normal, boolean copy)

Replace i-th facet of the microsphere. Method for initializing the microsphere facets.

Parameters
normal:double[]

Facet's normal vector.

copy:boolean

Whether to copy the given array.

Exceptions
DimensionMismatchException:
if the length of n does not match the space dimension.
MaxCountExceededException:
if the method has been called more times than the size of the sphere.
clearback to summary
private void clear()

Reset the all the facets data to zero.

copyback to summary
public InterpolatingMicrosphere copy()

Perform a copy.

Returns:InterpolatingMicrosphere

a copy of this instance.

getDimensionback to summary
public int getDimension()

Get the space dimensionality.

Returns:int

the number of space dimensions.

getSizeback to summary
public int getSize()

Get the size of the sphere.

Returns:int

the number of surface elements of the microspshere.

illuminateback to summary
private void illuminate(double[] sampleDirection, double sampleValue, double weight)

Illumination.

Parameters
sampleDirection:double[]

Vector whose origin is at the interpolation point and tail is at the sample location.

sampleValue:double

Data value of the sample.

weight:double

Weight.

interpolateback to summary
private double interpolate()

Interpolation.

Returns:double

the value estimated from the current illumination of the microsphere.

valueback to summary
public double value(double[] point, double[][] samplePoints, double[] sampleValues, double exponent, double noInterpolationTolerance)

Estimate the value at the requested location. This microsphere is placed at the given point, contribution of the given samplePoints to each sphere facet is computed (illumination) and the interpolation is performed (integration of the illumination).

Parameters
point:double[]

Interpolation point.

samplePoints:double[][]

Sampling data points.

sampleValues:double[]

Sampling data values at the corresponding samplePoints.

exponent:double

Exponent used in the power law that computes the weights (distance dimming factor) of the sample data.

noInterpolationTolerance:double

When the distance between the point and one of the samplePoints is less than this value, no interpolation will be performed, and the value of the sample will just be returned.

Returns:double

the estimated value at the given point.

Exceptions
NotPositiveException:
if exponent < 0.
org.apache.commons.math3.analysis.interpolation back to summary

private Class InterpolatingMicrosphere.Facet

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.commons.math3.analysis.interpolation.InterpolatingMicrosphere.Facet

Microsphere "facet" (surface element).

Field Summary

Modifier and TypeField and Description
private final double[]
normal

Normal vector characterizing a surface element.

Constructor Summary

AccessConstructor and Description
pack-priv
Facet(double[]
Normal vector characterizing a surface element of the microsphere. No copy is made.
n
)

Method Summary

Modifier and TypeMethod and Description
public double[]

Returns:

the normal vector.
getNormal
()

Return a reference to the vector normal to this facet.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

normalback to summary
private final double[] normal

Normal vector characterizing a surface element.

Constructor Detail

Facetback to summary
pack-priv Facet(double[] n)
Parameters
n:double[]

Normal vector characterizing a surface element of the microsphere. No copy is made.

Method Detail

getNormalback to summary
public double[] getNormal()

Return a reference to the vector normal to this facet.

Returns:double[]

the normal vector.

org.apache.commons.math3.analysis.interpolation back to summary

private Class InterpolatingMicrosphere.FacetData

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.commons.math3.analysis.interpolation.InterpolatingMicrosphere.FacetData

Data associated with each Facet.

Field Summary

Modifier and TypeField and Description
private final double
illumination

Illumination received from the sample.

private final double
sample

Data value of the sample.

Constructor Summary

AccessConstructor and Description
pack-priv
FacetData(double
Illumination.
illumination
,
double
Data value.
sample
)

Method Summary

Modifier and TypeMethod and Description
public double

Returns:

the illumination.
illumination
()

Get the illumination.

public double

Returns:

the data value.
sample
()

Get the data value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

illuminationback to summary
private final double illumination

Illumination received from the sample.

sampleback to summary
private final double sample

Data value of the sample.

Constructor Detail

FacetDataback to summary
pack-priv FacetData(double illumination, double sample)
Parameters
illumination:double

Illumination.

sample:double

Data value.

Method Detail

illuminationback to summary
public double illumination()

Get the illumination.

Returns:double

the illumination.

sampleback to summary
public double sample()

Get the data value.

Returns:double

the data value.