# Quaternion

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/Quaternion.kt+class:androidx.xr.runtime.math.Quaternion) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

*** ** * ** ***


```
public final class Quaternion
```

<br />

*** ** * ** ***

Rotation component in three-dimensional space. Any vector can be provided and the resulting quaternion will be normalized at construction time. A zero-length input (all components zero) cannot be normalized and falls back to the identity rotation.

## Summary

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#Identity()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#Quaternion(androidx.xr.runtime.math.Quaternion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion other)` Creates a new quaternion with the same values as the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#(androidx.xr.runtime.math.Quaternion)` quaternion. |
| `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#Quaternion(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)(float x, float y, float z, float w)` |

| ### Public methods |
|---|---|
| `static final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#angle(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion start, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion end)` Returns the angle between `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#angle(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion)` and `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#angle(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion)` quaternion in degrees. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#copy(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float)(float x, float y, float z, float w)` Returns a copy of the quaternion. |
| `final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#dot(androidx.xr.runtime.math.Quaternion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion other)` Returns the dot product of this quaternion and the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#dot(androidx.xr.runtime.math.Quaternion)` quaternion. |
| `static final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#dot(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion lhs, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion rhs)` Returns the dot product of two quaternions. |
| `boolean` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` Returns true if this quaternion is equal to the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#equals(kotlin.Any)`. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#fromAxisAngle(androidx.xr.runtime.math.Vector3,kotlin.Float)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 axis, float degrees)` Creates a new quaternion using an axis/angle to define the rotation. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#fromEulerAngles(androidx.xr.runtime.math.Vector3)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 eulerAngles)` Creates a quaternion using Euler angles (in degrees) in YXZ (yaw, pitch, roll) order. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#fromEulerAngles(kotlin.Float,kotlin.Float,kotlin.Float)(float pitch, float yaw, float roll)` Creates a quaternion using Euler angles (in degrees) in YXZ (yaw, pitch, roll) order. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#fromLookTowards(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 forward, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 up)` Returns a new quaternion with the specified forward and upward directions. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#fromRotation(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion start, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion end)` Returns a new quaternion representing the rotation from one quaternion to another. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#fromRotation(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 start, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 end)` Returns a new quaternion representing the rotation from one vector to another. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Float.html>` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#getAxisAngle()()` Returns this quaternion as an axis/angle (in degrees) pair. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#getEulerAngles()()` Returns this quaternion as Euler angles (in degrees) applied in YXZ (yaw, pitch, roll) order. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#getInverse()()` Returns a new quaternion with the inverse rotation. |
| `final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#getW()()` The normalized w component of the quaternion. |
| `final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#getX()()` The normalized x component of the quaternion. |
| `final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#getY()()` The normalized y component of the quaternion. |
| `final float` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#getZ()()` The normalized z component of the quaternion. |
| `int` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#hashCode()()` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#lerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion start, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion end, float ratio)` Linearly interpolates between `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#lerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` and `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#lerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` by `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#lerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#minus(androidx.xr.runtime.math.Quaternion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion other)` Returns a new quaternion with the difference of this quaternion and the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#minus(androidx.xr.runtime.math.Quaternion)` quaternion. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#plus(androidx.xr.runtime.math.Quaternion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion other)` Returns a new quaternion with the sum of this quaternion and `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#plus(androidx.xr.runtime.math.Quaternion)` quaternion. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion start, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion end, float ratio)` Spherically interpolates between `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` and `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` by `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#times(androidx.xr.runtime.math.Quaternion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion other)` Returns a new quaternion with the product of this quaternion and the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#times(androidx.xr.runtime.math.Quaternion)` quaternion. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#times(androidx.xr.runtime.math.Vector3)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 src)` Rotates a `https://developer.android.com/reference/androidx/xr/runtime/math/Vector3` by this quaternion. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#toString()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#unaryMinus()()` Flips the sign of the quaternion, but represents the same rotation. |

## Public fields

### Identity

```
public static final @NonNull Quaternion Identity
```

## Public constructors

### Quaternion

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public Quaternion(@NonNull Quaternion other)
```

Creates a new quaternion with the same values as the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#(androidx.xr.runtime.math.Quaternion)` quaternion.

### Quaternion

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public Quaternion(float x, float y, float z, float w)
```

## Public methods

### angle

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final float angle(@NonNull Quaternion start, @NonNull Quaternion end)
```

Returns the angle between `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#angle(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion)` and `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#angle(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion)` quaternion in degrees.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion start` | the starting quaternion |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion end` | the ending quaternion |

### copy

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final @NonNull Quaternion copy(float x, float y, float z, float w)
```

Returns a copy of the quaternion.

| Parameters |
|---|---|
| `float x` | the new x value for the copied quaternion |
| `float y` | the new y value for the copied quaternion |
| `float z` | the new z value for the copied quaternion |
| `float w` | the new w value for the copied quaternion |

### dot

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final float dot(@NonNull Quaternion other)
```

Returns the dot product of this quaternion and the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#dot(androidx.xr.runtime.math.Quaternion)` quaternion.

### dot

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final float dot(@NonNull Quaternion lhs, @NonNull Quaternion rhs)
```

Returns the dot product of two quaternions.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion lhs` | the first quaternion |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion rhs` | the second quaternion |

### equals

```
public boolean equals(Object other)
```

Returns true if this quaternion is equal to the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#equals(kotlin.Any)`.

### fromAxisAngle

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final @NonNull Quaternion fromAxisAngle(@NonNull Vector3 axis, float degrees)
```

Creates a new quaternion using an axis/angle to define the rotation.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 axis` | the axis of rotation |
| `float degrees` | the angle of rotation in degrees |

### fromEulerAngles

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final @NonNull Quaternion fromEulerAngles(@NonNull Vector3 eulerAngles)
```

Creates a quaternion using Euler angles (in degrees) in YXZ (yaw, pitch, roll) order.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 eulerAngles` | the Euler angles in degrees |

### fromEulerAngles

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final @NonNull Quaternion fromEulerAngles(float pitch, float yaw, float roll)
```

Creates a quaternion using Euler angles (in degrees) in YXZ (yaw, pitch, roll) order.

| Parameters |
|---|---|
| `float pitch` | the pitch in degrees |
| `float yaw` | the yaw in degrees |
| `float roll` | the roll in degrees |

### fromLookTowards

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final @NonNull Quaternion fromLookTowards(@NonNull Vector3 forward, @NonNull Vector3 up)
```

Returns a new quaternion with the specified forward and upward directions. If `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#fromLookTowards(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)` is parallel (or antiparallel) to `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#fromLookTowards(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)`, an alternate up axis is chosen so the resulting orientation basis is still well-defined.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 forward` | the forward direction |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 up` | the upward direction |

### fromRotation

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final @NonNull Quaternion fromRotation(@NonNull Quaternion start, @NonNull Quaternion end)
```

Returns a new quaternion representing the rotation from one quaternion to another.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion start` | the starting quaternion |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion end` | the ending quaternion |

### fromRotation

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final @NonNull Quaternion fromRotation(@NonNull Vector3 start, @NonNull Vector3 end)
```

Returns a new quaternion representing the rotation from one vector to another.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 start` | the starting vector |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 end` | the ending vector |

### getAxisAngle

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final @NonNull Pair<@NonNull Vector3, @NonNull Float> getAxisAngle()
```

Returns this quaternion as an axis/angle (in degrees) pair.

### getEulerAngles

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final @NonNull Vector3 getEulerAngles()
```

Returns this quaternion as Euler angles (in degrees) applied in YXZ (yaw, pitch, roll) order.

### getInverse

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final @NonNull Quaternion getInverse()
```

Returns a new quaternion with the inverse rotation. Assumes unit length.

### getW

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final float getW()
```

The normalized w component of the quaternion.

### getX

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final float getX()
```

The normalized x component of the quaternion.

### getY

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final float getY()
```

The normalized y component of the quaternion.

### getZ

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final float getZ()
```

The normalized z component of the quaternion.

### hashCode

```
public int hashCode()
```

### lerp

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final @NonNull Quaternion lerp(@NonNull Quaternion start, @NonNull Quaternion end, float ratio)
```

Linearly interpolates between `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#lerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` and `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#lerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` by `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#lerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)`.

If `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#lerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` is outside of the range `[0, 1]`, the returned quaternion will be extrapolated.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion start` | the starting quaternion |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion end` | the ending quaternion |
| `float ratio` | the interpolation ratio |

### minus

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final @NonNull Quaternion minus(@NonNull Quaternion other)
```

Returns a new quaternion with the difference of this quaternion and the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#minus(androidx.xr.runtime.math.Quaternion)` quaternion.

### plus

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final @NonNull Quaternion plus(@NonNull Quaternion other)
```

Returns a new quaternion with the sum of this quaternion and `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#plus(androidx.xr.runtime.math.Quaternion)` quaternion.

### slerp

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public static final @NonNull Quaternion slerp(@NonNull Quaternion start, @NonNull Quaternion end, float ratio)
```

Spherically interpolates between `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` and `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` by `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)`. If `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` is 0, this returns `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)`. As `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` approaches 1, the result of this function may approach either `+end` or `-end` (whichever is closest to `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)`).

If `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion.Companion#slerp(androidx.xr.runtime.math.Quaternion,androidx.xr.runtime.math.Quaternion,kotlin.Float)` is outside of the range `[0, 1]`, the returned quaternion will be extrapolated.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion start` | the starting quaternion |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion end` | the ending quaternion |
| `float ratio` | the interpolation ratio |

### times

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final @NonNull Quaternion times(@NonNull Quaternion other)
```

Returns a new quaternion with the product of this quaternion and the `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#times(androidx.xr.runtime.math.Quaternion)` quaternion. The order of the multiplication is this \* `https://developer.android.com/reference/androidx/xr/runtime/math/Quaternion#times(androidx.xr.runtime.math.Quaternion)`.

### times

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final @NonNull Vector3 times(@NonNull Vector3 src)
```

Rotates a `https://developer.android.com/reference/androidx/xr/runtime/math/Vector3` by this quaternion.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 src` | the vector to rotate |

### toString

```
public @NonNull String toString()
```

### unaryMinus

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-runtime#1.0.0)

```
public final @NonNull Quaternion unaryMinus()
```

Flips the sign of the quaternion, but represents the same rotation.