org.apache.commons.math3.analysis.interpolation

## Class InterpolatingMicrosphere

- java.lang.Object
- - org.apache.commons.math3.analysis.interpolation.InterpolatingMicrosphere

- Direct Known Subclasses:
    InterpolatingMicrosphere2D

      public class InterpolatingMicrosphere
      extends Object

  Utility class for the `MicrosphereProjectionInterpolator` algorithm.
  Since:
    3.6

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `InterpolatingMicrosphere(InterpolatingMicrosphere other)` Copy constructor.
    `protected` | `InterpolatingMicrosphere(int dimension, int size, double maxDarkFraction, double darkThreshold, double background)` Create an unitialiazed sphere.
    `` | `InterpolatingMicrosphere(int dimension, int size, double maxDarkFraction, double darkThreshold, double background, UnitSphereRandomVectorGenerator rand)` Create a sphere from randomly sampled vectors.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `add(double[] normal, boolean copy)` Replace `i`-th facet of the microsphere.
    `InterpolatingMicrosphere` | `copy()` Perform a copy.
    `int` | `getDimension()` Get the space dimensionality.
    `int` | `getSize()` Get the size of the sphere.
    `double` | `value(double[] point, double[][] samplePoints, double[] sampleValues, double exponent, double noInterpolationTolerance)` Estimate the value at the requested location.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### InterpolatingMicrosphere

          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` - Dimension of the data space.
        `size` - Number of surface elements of the sphere.
        `maxDarkFraction` - 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` - Value of the illumination below which a facet is considered dark.
        `background` - Value returned when the `maxDarkFraction` threshold is exceeded.
      Throws:
        `NotStrictlyPositiveException` - if `dimension <= 0` or `size <= 0`.
        `NotPositiveException` - if `darkThreshold < 0`.
        `OutOfRangeException` - if `maxDarkFraction` does not belong to the interval `[0, 1]`.

    - #### InterpolatingMicrosphere

          public InterpolatingMicrosphere(int dimension,
                                  int size,
                                  double maxDarkFraction,
                                  double darkThreshold,
                                  double background,
                                  UnitSphereRandomVectorGenerator rand)

      Create a sphere from randomly sampled vectors.
      Parameters:
        `dimension` - Dimension of the data space.
        `size` - Number of surface elements of the sphere.
        `rand` - Unit vector generator for creating the microsphere.
        `maxDarkFraction` - 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` - Value of the illumination below which a facet is considered dark.
        `background` - Value returned when the `maxDarkFraction` threshold is exceeded.
      Throws:
        `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]`.

    - #### InterpolatingMicrosphere

          protected InterpolatingMicrosphere(InterpolatingMicrosphere other)

      Copy constructor.
      Parameters:
        `other` - Instance to copy.

  - ### Method Detail

    - #### copy

          public InterpolatingMicrosphere copy()

      Perform a copy.
      Returns:
        a copy of this instance.

    - #### getDimension

          public int getDimension()

      Get the space dimensionality.
      Returns:
        the number of space dimensions.

    - #### getSize

          public int getSize()

      Get the size of the sphere.
      Returns:
        the number of surface elements of the microspshere.

    - #### value

          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` - Interpolation point.
        `samplePoints` - Sampling data points.
        `sampleValues` - Sampling data values at the corresponding `samplePoints`.
        `exponent` - Exponent used in the power law that computes the weights (distance dimming factor) of the sample data.
        `noInterpolationTolerance` - 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:
        the estimated value at the given `point`.
      Throws:
        `NotPositiveException` - if `exponent < 0`.

    - #### add

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

      Replace `i`-th facet of the microsphere. Method for initializing the microsphere facets.
      Parameters:
        `normal` - Facet's normal vector.
        `copy` - Whether to copy the given array.
      Throws:
        `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.

Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.