## org.apache.commons.math.analysis.interpolation
Class MicrosphereInterpolatingFunction

    java.lang.Object
      org.apache.commons.math.analysis.interpolation.MicrosphereInterpolatingFunction

All Implemented Interfaces:
  MultivariateRealFunction

    public class MicrosphereInterpolatingFunction

extends java.lang.Object
implements MultivariateRealFunction

Interpolating function that implements the Microsphere Projection.

Version:
  $Revision: 825919 $ $Date: 2009-10-16 10:51:55 -0400 (Fri, 16 Oct 2009) $

Nested Class Summary
`private static class` `MicrosphereInterpolatingFunction.MicrosphereSurfaceElement` Class for storing the accounting data needed to perform the microsphere projection.

Field Summary
`private double` `brightnessExponent` Exponent used in the power law that computes the weights of the sample data.
`private int` `dimension` Space dimension.
`private java.util.List<MicrosphereInterpolatingFunction.MicrosphereSurfaceElement>` `microsphere` Internal accounting data for the interpolation algorithm.
`private java.util.Map<RealVector,java.lang.Double>` `samples` Sample data.

Constructor Summary
`MicrosphereInterpolatingFunction(double[][] xval, double[] yval, int brightnessExponent, int microsphereElements, UnitSphereRandomVectorGenerator rand)`

Method Summary
`private double` `cosAngle(RealVector v, RealVector w)` Compute the cosine of the angle between 2 vectors.
`double` `value(double[] point)` Compute the value for the function at the given point.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### dimension

    private final int dimension

  Space dimension.

### microsphere

    private final java.util.List<MicrosphereInterpolatingFunction.MicrosphereSurfaceElement> microsphere

  Internal accounting data for the interpolation algorithm. Each element of the list corresponds to one surface element of the microsphere.

### brightnessExponent

    private final double brightnessExponent

  Exponent used in the power law that computes the weights of the sample data.

### samples

    private final java.util.Map<RealVector,java.lang.Double> samples

  Sample data.

Constructor Detail

### MicrosphereInterpolatingFunction

    public MicrosphereInterpolatingFunction(double[][] xval,
                                            double[] yval,
                                            int brightnessExponent,
                                            int microsphereElements,
                                            UnitSphereRandomVectorGenerator rand)
                                     throws DimensionMismatchException,
                                            java.lang.IllegalArgumentException

Parameters:
  `xval` - the arguments for the interpolation points. `xval[i][0]` is the first component of interpolation point `i`, `xval[i][1]` is the second component, and so on until `xval[i][d-1]`, the last component of that interpolation point (where `dimension` is thus the dimension of the sampled space).
  `yval` - the values for the interpolation points
  `brightnessExponent` - Brightness dimming factor.
  `microsphereElements` - Number of surface elements of the microsphere.
  `rand` - Unit vector generator for creating the microsphere.
Throws:
  `DimensionMismatchException` - if the lengths of `yval` and `xval` (equal to `n`, the number of interpolation points) do not match, or the the arrays `xval[0]` ... `xval[n]`, have lengths different from `dimension`.
  `java.lang.IllegalArgumentException` - if there are no data (xval null or zero length)

Method Detail

### value

    public double value(double[] point)

  Description copied from interface: `MultivariateRealFunction`
  Compute the value for the function at the given point.

  Specified by:
    `value` in interface `MultivariateRealFunction`
  Parameters:
    `point` - Interpolation point.
  Returns:
    the interpolated value.

### cosAngle

    private double cosAngle(RealVector v,
                            RealVector w)

  Compute the cosine of the angle between 2 vectors.

  Parameters:
    `v` - Vector.
    `w` - Vector.
  Returns:
    cosine of the angle

Copyright (c) 2003-2010 Apache Software Foundation