# Interpolation

## Description

`static` `class` `Tinman.Terrain.Util.Interpolation`

Helper class that provides common methods for sample interpolation.

## Public / Methods

### Catmull​Rom_4x4_​Float32

`[Pure]`
`public` `static` `method` `CatmullRom_4x4_Float32` → `(6)`

samples in : float32 [ ]

The input samples.

offset in : int32

Offset of `(0,0)` in input samples in.

strideX in : int32

Offset difference between samples columns.

strideY in : int32

Offset difference between samples rows.

fx in : int32

Horizontal interpolation factor, in the range `[0..65536]`.

fy in : int32

Vertical interpolation factor, in the range `[0..65536]`.

returns → float32

The interpolated value.

Perform cubic interpolation on the given `4x4` matrix of 32-bit floating point values.

Interpolation occurs between `(1,1)`, `(2,1)`, `(1,2)` and `(2,2)`:

```(0,0)--(1,0)--(2,0)--(3,0)
|      |      |      |
|      |      |      |
(0,1)--(1,1)--(2,1)--(3,1)
|      |      |      |
|      |      |      |
(0,2)--(1,2)--(2,2)--(3,2)
|      |      |      |
|      |      |      |
(0,3)--(1,3)--(2,3)--(3,3)```

The interpolation factors are mapped as follows:

• `(fx = 0, fy = 0)` => `(1,1)`

• `(fx = 65536, fy = 0)` => `(2,1)`

• `(fx = 0, fy = 65536)` => `(1,2)`

• `(fx = 65536, fy = 65536)` => `(2,2)`

### Catmull​Rom_4x4_​Int16

`[Pure]`
`public` `static` `method` `CatmullRom_4x4_Int16` → `(6)`

samples in : int16 [ ]

The input samples.

offset in : int32

Offset of `(0,0)` in input samples in.

strideX in : int32

Offset difference between samples columns.

strideY in : int32

Offset difference between samples rows.

fx in : int32

Horizontal interpolation factor, in the range `[0..65536]`.

fy in : int32

Vertical interpolation factor, in the range `[0..65536]`.

returns → int16

The interpolated value.

Perform cubic interpolation on the given `4x4` matrix of signed 16-bit integer values.

Interpolation occurs between `(1,1)`, `(2,1)`, `(1,2)` and `(2,2)`:

```(0,0)--(1,0)--(2,0)--(3,0)
|      |      |      |
|      |      |      |
(0,1)--(1,1)--(2,1)--(3,1)
|      |      |      |
|      |      |      |
(0,2)--(1,2)--(2,2)--(3,2)
|      |      |      |
|      |      |      |
(0,3)--(1,3)--(2,3)--(3,3)```

The interpolation factors are mapped as follows:

• `(fx = 0, fy = 0)` => `(1,1)`

• `(fx = 65536, fy = 0)` => `(2,1)`

• `(fx = 0, fy = 65536)` => `(1,2)`

• `(fx = 65536, fy = 65536)` => `(2,2)`

### Catmull​Rom_4x4_​Int32

`[Pure]`
`public` `static` `method` `CatmullRom_4x4_Int32` → `(6)`

samples in : int32 [ ]

The input samples.

offset in : int32

Offset of `(0,0)` in input samples in.

strideX in : int32

Offset difference between samples columns.

strideY in : int32

Offset difference between samples rows.

fx in : int32

Horizontal interpolation factor, in the range `[0..65536]`.

fy in : int32

Vertical interpolation factor, in the range `[0..65536]`.

returns → int32

The interpolated value.

Perform cubic interpolation on the given `4x4` matrix of unsigned 32-bit integer values.

Interpolation occurs between `(1,1)`, `(2,1)`, `(1,2)` and `(2,2)`:

```(0,0)--(1,0)--(2,0)--(3,0)
|      |      |      |
|      |      |      |
(0,1)--(1,1)--(2,1)--(3,1)
|      |      |      |
|      |      |      |
(0,2)--(1,2)--(2,2)--(3,2)
|      |      |      |
|      |      |      |
(0,3)--(1,3)--(2,3)--(3,3)```

The interpolation factors are mapped as follows:

• `(fx = 0, fy = 0)` => `(1,1)`

• `(fx = 65536, fy = 0)` => `(2,1)`

• `(fx = 0, fy = 65536)` => `(1,2)`

• `(fx = 65536, fy = 65536)` => `(2,2)`

### Catmull​Rom_4x4_​UInt16x4

`[Pure]`
`public` `static` `method` `CatmullRom_4x4_UInt16x4` → `(6)`

samples in : int64 [ ]

The input samples.

offset in : int32

Offset of `(0,0)` in input samples in.

strideX in : int32

Offset difference between samples columns.

strideY in : int32

Offset difference between samples rows.

fx in : int32

Horizontal interpolation factor, in the range `[0..65536]`.

fy in : int32

Vertical interpolation factor, in the range `[0..65536]`.

returns → int64

The interpolated value.

Perform cubic interpolation on the given `4x4` matrix of four-component 8-bit unsigned integer vectors.

Interpolation occurs between `(1,1)`, `(2,1)`, `(1,2)` and `(2,2)`:

```(0,0)--(1,0)--(2,0)--(3,0)
|      |      |      |
|      |      |      |
(0,1)--(1,1)--(2,1)--(3,1)
|      |      |      |
|      |      |      |
(0,2)--(1,2)--(2,2)--(3,2)
|      |      |      |
|      |      |      |
(0,3)--(1,3)--(2,3)--(3,3)```

The interpolation factors are mapped as follows:

• `(fx = 0, fy = 0)` => `(1,1)`

• `(fx = 65536, fy = 0)` => `(2,1)`

• `(fx = 0, fy = 65536)` => `(1,2)`

• `(fx = 65536, fy = 65536)` => `(2,2)`

### Catmull​Rom_​Int32

`[Pure]`
`public` `static` `method` `CatmullRom_Int32` → `(5)`

in : int32

Input value for interpolation (see above).

in : int32

Input value for interpolation (see above).

in : int32

Input value for interpolation (see above).

in : int32

Input value for interpolation (see above).

in : int32

Interpolation factor, in the range `[0..65536]`.

returns → int32

The interpolated value.

Perform cubic interpolation on the given signed 32-bit integer values.

Interpolation occurs between `(b)` and `(c)`:

`(a)--(b)--(c)--(d)`

The interpolation factors are mapped as follows:

• `(fx = 0)` => `b`

• `(fx = 65536)` => `c`

### Catmull​Rom_​UInt16x4

`[Pure]`
`public` `static` `method` `CatmullRom_UInt16x4` → `(5)`

in : int64

Input value for interpolation (see above).

in : int64

Input value for interpolation (see above).

in : int64

Input value for interpolation (see above).

in : int64

Input value for interpolation (see above).

in : int32

Interpolation factor, in the range `[0..65536]`.

returns → int64

The interpolated value.

Perform cubic interpolation on the given four-component 16-bit unsigned integer vectors.

Interpolation occurs between `(b)` and `(c)`:

`(a)--(b)--(c)--(d)`

The interpolation factors are mapped as follows:

• `(fx = 0)` => `b`

• `(fx = 65536)` => `c`

### Linear_​Int32

`[Pure]`
`public` `static` `method` `Linear_Int32` → `(3)`

in : int32

Input value for interpolation (see above).

in : int32

Input value for interpolation (see above).

in : int32

Interpolation factor, in the range `[0..65536]`.

returns → int32

The interpolated value.

Perform linear interpolation on the given signed 32-bit integer values.

Interpolation occurs between `(b)` and `(c)`:

`(b)--(c)`

The interpolation factors are mapped as follows:

• `(fx = 0)` => `b`

• `(fx = 65536)` => `c`

### Point_​Int32

`[Pure]`
`public` `static` `method` `Point_Int32` → `(3)`

in : int32

Input value for interpolation (see above).

in : int32

Input value for interpolation (see above).

in : int32

Interpolation factor, in the range `[0..65536]`.

returns → int32

The interpolated value.

Perform nearest-point interpolation on the given signed 32-bit integer values.

Interpolation occurs between `(b)` and `(c)`:

`(b)--(c)`

The interpolation factors are mapped as follows:

• `(fx <= 32768)` => `b`

• `(fx > 32768)` => `c`

### Uniform​B_4x4_​Float32

`[Pure]`
`public` `static` `method` `UniformB_4x4_Float32` → `(6)`

samples in : float32 [ ]

The input samples.

offset in : int32

Offset of `(0,0)` in input samples in.

strideX in : int32

Offset difference between samples columns.

strideY in : int32

Offset difference between samples rows.

fx in : int32

Horizontal interpolation factor, in the range `[0..65536]`.

fy in : int32

Vertical interpolation factor, in the range `[0..65536]`.

returns → float32

The interpolated value.

Perform cubic interpolation on the given `4x4` matrix of 32-bit floating point values.

Interpolation occurs between `(1,1)`, `(2,1)`, `(1,2)` and `(2,2)`:

```(0,0)--(1,0)--(2,0)--(3,0)
|      |      |      |
|      |      |      |
(0,1)--(1,1)--(2,1)--(3,1)
|      |      |      |
|      |      |      |
(0,2)--(1,2)--(2,2)--(3,2)
|      |      |      |
|      |      |      |
(0,3)--(1,3)--(2,3)--(3,3)```

The interpolation factors are mapped as follows:

• `(fx = 0, fy = 0)` => `(1,1)`

• `(fx = 65536, fy = 0)` => `(2,1)`

• `(fx = 0, fy = 65536)` => `(1,2)`

• `(fx = 65536, fy = 65536)` => `(2,2)`

### Uniform​B_4x4_​Int16

`[Pure]`
`public` `static` `method` `UniformB_4x4_Int16` → `(6)`

samples in : int16 [ ]

The input samples.

offset in : int32

Offset of `(0,0)` in input samples in.

strideX in : int32

Offset difference between samples columns.

strideY in : int32

Offset difference between samples rows.

fx in : int32

Horizontal interpolation factor, in the range `[0..65536]`.

fy in : int32

Vertical interpolation factor, in the range `[0..65536]`.

returns → int16

The interpolated value.

Perform cubic interpolation on the given `4x4` matrix of signed 16-bit integer values.

Interpolation occurs between `(1,1)`, `(2,1)`, `(1,2)` and `(2,2)`:

```(0,0)--(1,0)--(2,0)--(3,0)
|      |      |      |
|      |      |      |
(0,1)--(1,1)--(2,1)--(3,1)
|      |      |      |
|      |      |      |
(0,2)--(1,2)--(2,2)--(3,2)
|      |      |      |
|      |      |      |
(0,3)--(1,3)--(2,3)--(3,3)```

The interpolation factors are mapped as follows:

• `(fx = 0, fy = 0)` => `(1,1)`

• `(fx = 65536, fy = 0)` => `(2,1)`

• `(fx = 0, fy = 65536)` => `(1,2)`

• `(fx = 65536, fy = 65536)` => `(2,2)`

### Uniform​B_4x4_​Int32

`[Pure]`
`public` `static` `method` `UniformB_4x4_Int32` → `(6)`

samples in : int32 [ ]

The input samples.

offset in : int32

Offset of `(0,0)` in input samples in.

strideX in : int32

Offset difference between samples columns.

strideY in : int32

Offset difference between samples rows.

fx in : int32

Horizontal interpolation factor, in the range `[0..65536]`.

fy in : int32

Vertical interpolation factor, in the range `[0..65536]`.

returns → int32

The interpolated value.

Perform cubic interpolation on the given `4x4` matrix of unsigned 32-bit integer values.

Interpolation occurs between `(1,1)`, `(2,1)`, `(1,2)` and `(2,2)`:

```(0,0)--(1,0)--(2,0)--(3,0)
|      |      |      |
|      |      |      |
(0,1)--(1,1)--(2,1)--(3,1)
|      |      |      |
|      |      |      |
(0,2)--(1,2)--(2,2)--(3,2)
|      |      |      |
|      |      |      |
(0,3)--(1,3)--(2,3)--(3,3)```

The interpolation factors are mapped as follows:

• `(fx = 0, fy = 0)` => `(1,1)`

• `(fx = 65536, fy = 0)` => `(2,1)`

• `(fx = 0, fy = 65536)` => `(1,2)`

• `(fx = 65536, fy = 65536)` => `(2,2)`

### Uniform​B_4x4_​UInt16x4

`[Pure]`
`public` `static` `method` `UniformB_4x4_UInt16x4` → `(6)`

samples in : int64 [ ]

The input samples.

offset in : int32

Offset of `(0,0)` in input samples in.

strideX in : int32

Offset difference between samples columns.

strideY in : int32

Offset difference between samples rows.

fx in : int32

Horizontal interpolation factor, in the range `[0..65536]`.

fy in : int32

Vertical interpolation factor, in the range `[0..65536]`.

returns → int64

The interpolated value.

Perform cubic interpolation on the given `4x4` matrix of four-component 16-bit unsigned integer vectors.

Interpolation occurs between `(1,1)`, `(2,1)`, `(1,2)` and `(2,2)`:

```(0,0)--(1,0)--(2,0)--(3,0)
|      |      |      |
|      |      |      |
(0,1)--(1,1)--(2,1)--(3,1)
|      |      |      |
|      |      |      |
(0,2)--(1,2)--(2,2)--(3,2)
|      |      |      |
|      |      |      |
(0,3)--(1,3)--(2,3)--(3,3)```

The interpolation factors are mapped as follows:

• `(fx = 0, fy = 0)` => `(1,1)`

• `(fx = 65536, fy = 0)` => `(2,1)`

• `(fx = 0, fy = 65536)` => `(1,2)`

• `(fx = 65536, fy = 65536)` => `(2,2)`

### Uniform​B_​Int32

`[Pure]`
`public` `static` `method` `UniformB_Int32` → `(5)`

in : int32

Input value for interpolation (see above).

in : int32

Input value for interpolation (see above).

in : int32

Input value for interpolation (see above).

in : int32

Input value for interpolation (see above).

in : int32

Interpolation factor, in the range `[0..65536]`.

returns → int32

The interpolated value.

Perform cubic interpolation on the given signed 32-bit integer values.

Interpolation occurs between `(b)` and `(c)`:

`(a)--(b)--(c)--(d)`

The interpolation factors are mapped as follows:

• `(fx = 0)` => `b`

• `(fx = 65536)` => `c`

### Uniform​B_​UInt16x4

`[Pure]`
`public` `static` `method` `UniformB_UInt16x4` → `(5)`

in : int64

Input value for interpolation (see above).

in : int64

Input value for interpolation (see above).

in : int64

Input value for interpolation (see above).

in : int64

Input value for interpolation (see above).

in : int32

Interpolation factor, in the range `[0..65536]`.

returns → int64

The interpolated value.

Perform cubic interpolation on the given four-component 8-bit unsigned integer vectors.

Interpolation occurs between `(b)` and `(c)`:

`(a)--(b)--(c)--(d)`

The interpolation factors are mapped as follows:

• `(fx = 0)` => `b`

• `(fx = 65536)` => `c`