# MathHelper

Added in 1.0.0

*** ** * ** ***


```
public final class MathHelper
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/MathHelper#clamp(kotlin.Float,kotlin.Float,kotlin.Float)(float x, float min, float max)` Clamps a value. |
| `static final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/MathHelper#lerp(kotlin.Float,kotlin.Float,kotlin.Float)(float a, float b, float t)` Linearly interpolates between two values. |
| `static final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/MathHelper#toDegrees(kotlin.Float)(float angleInRadians)` Converts `https://developer.android.com/reference/androidx/xr/runtime/math/package-summary#toDegrees(kotlin.Float)` from radians to degrees. |
| `static final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/MathHelper#toRadians(kotlin.Float)(float angleInDegrees)` Converts `https://developer.android.com/reference/androidx/xr/runtime/math/package-summary#toRadians(kotlin.Float)` from degrees to radians. |

## Public methods

### clamp

Artifact: [androidx.xr.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/xr-runtime) [View Source](https://cs.android.com/search?q=file:androidx/xr/runtime/math/FloatExt.kt+function:clamp) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final float clamp(float x, float min, float max)
```

Clamps a value.

| Parameters |
|---|---|
| `float x` | the value to clamp |
| `float min` | the minimum value |
| `float max` | the maximum value |

### lerp

Artifact: [androidx.xr.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/xr-runtime) [View Source](https://cs.android.com/search?q=file:androidx/xr/runtime/math/FloatExt.kt+function:lerp) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final float lerp(float a, float b, float t)
```

Linearly interpolates between two values.

| Parameters |
|---|---|
| `float a` | the start value |
| `float b` | the end value |
| `float t` | the ratio between the two floats |

| Returns |
|---|---|
| `float` | the interpolated value between `https://developer.android.com/reference/androidx/xr/runtime/math/package-summary#lerp(kotlin.Float,kotlin.Float,kotlin.Float)` and `https://developer.android.com/reference/androidx/xr/runtime/math/package-summary#lerp(kotlin.Float,kotlin.Float,kotlin.Float)` |

### toDegrees

Artifact: [androidx.xr.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/xr-runtime) [View Source](https://cs.android.com/search?q=file:androidx/xr/runtime/math/FloatExt.kt+function:toDegrees) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final float toDegrees(float angleInRadians)
```

Converts `https://developer.android.com/reference/androidx/xr/runtime/math/package-summary#toDegrees(kotlin.Float)` from radians to degrees.

| Parameters |
|---|---|
| `float angleInRadians` | the angle in radians |

### toRadians

Artifact: [androidx.xr.runtime:runtime](https://developer.android.com/jetpack/androidx/releases/xr-runtime) [View Source](https://cs.android.com/search?q=file:androidx/xr/runtime/math/FloatExt.kt+function:toRadians) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final float toRadians(float angleInDegrees)
```

Converts `https://developer.android.com/reference/androidx/xr/runtime/math/package-summary#toRadians(kotlin.Float)` from degrees to radians.

| Parameters |
|---|---|
| `float angleInDegrees` | the angle in degrees |