org.opensha.nshmp.util
Class Interpolation

java.lang.Object
  extended by org.opensha.nshmp.util.Interpolation

public final class Interpolation
extends java.lang.Object

Title: Interpolation

Description: This class provides the generic capability of Log and Linear Interpolation.

Version:
1.0
Author:
Ned Field, Nitin Gupta and E.V.Leyendecker

Constructor Summary
Interpolation()
           
 
Method Summary
static double getBilinearInterpolatedY(double x1, double y1, double x2, double y2, double[] z1, double x, double y)
          Returns the interpolated value at a given point.
static double getInterpolatedX(double x1, double x2, double y1, double y2, double y)
          Returns the Interpolated X Value in Linear space
static double getInterpolatedY(double x1, double x2, double y1, double y2, double x)
          Returns the Interpolated Y Value in Linear space
static double getLogInterpolatedX(double x1, double x2, double y1, double y2, double y)
           
static double getLogInterpolatedY(double x1, double x2, double y1, double y2, double x)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Interpolation

public Interpolation()
Method Detail

getInterpolatedX

public static double getInterpolatedX(double x1,
                                      double x2,
                                      double y1,
                                      double y2,
                                      double y)
Returns the Interpolated X Value in Linear space

Parameters:
x1 - double
x2 - double
y1 - double
y2 - double
y - double
Returns:
double

getInterpolatedY

public static double getInterpolatedY(double x1,
                                      double x2,
                                      double y1,
                                      double y2,
                                      double x)
Returns the Interpolated Y Value in Linear space

Parameters:
x1 - double
y1 - double
x2 - double
y2 - double
x - double
Returns:
double

getLogInterpolatedX

public static double getLogInterpolatedX(double x1,
                                         double x2,
                                         double y1,
                                         double y2,
                                         double y)
Parameters:
x1 - double
x2 - double
y1 - double
y2 - double
y - double
Returns:
double

getLogInterpolatedY

public static double getLogInterpolatedY(double x1,
                                         double x2,
                                         double y1,
                                         double y2,
                                         double x)
Parameters:
x1 - double
x2 - double
y1 - double
y2 - double
y - double
Returns:
double

getBilinearInterpolatedY

public static double getBilinearInterpolatedY(double x1,
                                              double y1,
                                              double x2,
                                              double y2,
                                              double[] z1,
                                              double x,
                                              double y)
                                       throws InterpolationException
Returns the interpolated value at a given point. It can do bi-linear interpolation only for the rectangular region. x1y1 is considered the SW point of the region x1y2 is considered the NW point of the region x2y1 is considered the SE point of the region x2y2 is considered the NE point of the region Values for these 4 corner points should be in same order xy is the point in the region where we have to find the interpolated z value.

Parameters:
x1 - double
y1 - double
x2 - double
y2 - double
z1 - double[] : Values at each of the 4 points in the region
x - double
y - double
Returns:
double
Throws:
InterpolationException