# LinearApproximation

engine/Source/Core/LinearApproximation.js 4
An `InterpolationAlgorithm` for performing linear interpolation.

### Methods

#### static Cesium.LinearApproximation.getRequiredDataPoints(degree) → number
engine/Source/Core/LinearApproximation.js 21

Given the desired degree, returns the number of data points required for interpolation. Since linear interpolation can only generate a first degree polynomial, this function always returns 2.

Name | Type | Description
--- | --- | ---
`degree` | number | The desired degree of interpolation.

##### Returns:

This function always returns 2.

#### static Cesium.LinearApproximation.interpolateOrderZero(x, xTable, yTable, yStride, result) → Array.<number>
engine/Source/Core/LinearApproximation.js 38

Interpolates values using linear approximation.

Name | Type | Description
--- | --- | ---
`x` | number | The independent variable for which the dependent variables will be interpolated.
`xTable` | Array.<number> | The array of independent variables to use to interpolate. The values in this array must be in increasing order and the same value must not occur twice in the array.
`yTable` | Array.<number> | The array of dependent variables to use to interpolate. For a set of three dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
`yStride` | number | The number of dependent variable values in yTable corresponding to each independent variable value in xTable.
`result` | Array.<number> | optional An existing array into which to store the result.

##### Returns:

The array of interpolated values, or the result parameter if one was provided.

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.