uk.ac.starlink.diva.interp

## Interface Interpolator

• ### Method Summary

All Methods
Modifier and Type Method and Description
`void` ```appendValue(double newx, double newy)```
Append a new position to the existing coordinates.
`double` `evalYData(double xp)`
Return the interpolated value corresponding to some arbitrary X coordinate.
`double[]` `evalYDataArray(double[] xps)`
Return an array of interpolated value corresponding to some array of arbitrary X coordinates.
`int` `getCount()`
Get the number of coordinate positions that are being used by this interpolator.
`double` `getXCoord(int index)`
Get an X coordinate by index.
`double[]` `getXCoords()`
Get the X coordinates.
`double` `getYCoord(int index)`
Get a Y coordinate by index.
`double[]` `getYCoords()`
Get the Y coordinates.
`double` `interpolate(double xp)`
Return the interpolated value corresponding to some arbitrary X coordinate.
`boolean` `isFull()`
Return if the Interpolator is full.
`boolean` `isIncreasing()`
Return the direction being used by this interpolator.
`void` ```setCoords(double[] x, double[] y, boolean check)```
Set or reset the coordinates used by this interpolator.
`int` `stepGuess()`
A guess at the number of steps needed between the actual X coordinates that may be used to draw a reasonable representation of the curve being interpolated.
• ### Method Detail

• #### stepGuess

`int stepGuess()`
A guess at the number of steps needed between the actual X coordinates that may be used to draw a reasonable representation of the curve being interpolated.
• #### setCoords

```void setCoords(double[] x,
double[] y,
boolean check)```
Set or reset the coordinates used by this interpolator.
Parameters:
`x` - the X coordinates.
`y` - the Y coordinates.
`check` - whether to check the monotonic direction (compares 0 and 1 values of x). Use this when you need to preserve the direction temporarily even though the order may currently be switched, but take care to reorder before interpolating.
• #### isIncreasing

`boolean isIncreasing()`
Return the direction being used by this interpolator.
• #### appendValue

```void appendValue(double newx,
double newy)```
Append a new position to the existing coordinates.
Parameters:
`x` - the X coordinate.
`y` - the Y coordinate.
• #### getCount

`int getCount()`
Get the number of coordinate positions that are being used by this interpolator.
Returns:
the number of positions that will be used.
• #### isFull

`boolean isFull()`
Return if the Interpolator is full. This may mean that the instance will ignore or refuse any further vectices.
• #### getXCoords

`double[] getXCoords()`
Get the X coordinates.
Returns:
the X coordinate array. Note this is not a copy, if you modify it you need to re-apply `setCoords`.
• #### getXCoord

`double getXCoord(int index)`
Get an X coordinate by index. If the index is invalid an out of bound exception will be thrown.
Returns:
the X coordinate.
• #### getYCoords

`double[] getYCoords()`
Get the Y coordinates.
Returns:
the Y coordinate array. Note this is not a copy, if you modify it you need to re-apply `setCoords`.
• #### getYCoord

`double getYCoord(int index)`
Get a Y coordinate by index. If the index is invalid an out of bound exception will be thrown.
Returns:
the Y coordinate.
• #### interpolate

`double interpolate(double xp)`
Return the interpolated value corresponding to some arbitrary X coordinate.
Parameters:
`xp` - the X coordinate at which an interpolated Y coordinate is required.
Returns:
the interpolated value.
• #### evalYData

`double evalYData(double xp)`
Return the interpolated value corresponding to some arbitrary X coordinate.
Parameters:
`xp` - the X coordinate at which an interpolated Y coordinate is required.
Returns:
the interpolated value.
• #### evalYDataArray

`double[] evalYDataArray(double[] xps)`
Return an array of interpolated value corresponding to some array of arbitrary X coordinates.
Parameters:
`xps` - the X coordinates at which interpolated Y coordinates are required.
Returns:
the interpolated values.

Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.