de.jreality.math

## Class CubicBSpline

• All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CubicBSpline.Default, CubicBSpline.Natural, CubicBSpline.Periodic

```public class CubicBSpline
extends Object
implements Serializable```
Interpolates a sorted function table y[i] = f( x[i] ) by cubic B-splines. The x values have to be sorted, that is, x[i] <= x[i+1].

The underlying mathematics is described in the classic scientific computing cookbook, Numerical Recipes.

There are three subclasses to choose from (TODO: document them):

• Default:
• Natural:
• Periodic:
Serialized Form
• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
`static class ` `CubicBSpline.Default`
`static class ` `CubicBSpline.Natural`
`static class ` `CubicBSpline.Periodic`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double[]` `getDDY()`
`int` `getIndexOfClosestXValue(double X)`
`int` `getLengthOfTable()`
`double[]` `getX()`
`double` `getX(int index)`
`double[]` `getY()`
`double` `getY(int index)`
`void` `setX(double[] x)`
`void` ```setXY(double[] x, double[] y)```
`void` ```setXY(int index, double X, double Y)```
`void` `setY(double[] y)`
`double` `valueAt(double x)`
`double` ```valueAt(double X, int derivative)```
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Method Detail

• #### valueAt

`public double valueAt(double x)`
• #### valueAt

```public double valueAt(double X,
int derivative)```
• #### getLengthOfTable

`public int getLengthOfTable()`
• #### getX

`public double[] getX()`
• #### getX

`public double getX(int index)`
• #### getY

`public double getY(int index)`
• #### getY

`public double[] getY()`
• #### getDDY

`public double[] getDDY()`
• #### setX

`public void setX(double[] x)`
• #### setY

`public void setY(double[] y)`
• #### setXY

```public void setXY(int index,
double X,
double Y)```
• #### getIndexOfClosestXValue

`public int getIndexOfClosestXValue(double X)`
• #### setXY

```public void setXY(double[] x,
double[] y)```