<div class='sourceset sourceset-android'>Android</div>

```kotlin
public interface SpatialAlignment
```

An interface to calculate the position of a sized box inside of an available 3D space.
[SpatialAlignment](/jetpack-compose/androidx.xr.compose/compose/interfaces/SpatialAlignment) is often used to define the alignment of a layout inside a parent layout.

## Functions

<h2 id="horizontaloffset-width-space-layoutdirection">horizontalOffset</h2>

```kotlin
public fun horizontalOffset(
        width: Int,
        space: Int,
        layoutDirection: LayoutDirection = LayoutDirection.Ltr,
    ): Int
```

Provides the horizontal offset from the origin of the space to the origin of the content.

#### Parameters

| | |
| --- | --- |
| width | The content width in pixels. |
| space | The available space in pixels. |
| layoutDirection | LTR or RTL. |

<hr class="docs-overload-divider">

<h2 id="verticaloffset-height-space">verticalOffset</h2>

```kotlin
public fun verticalOffset(height: Int, space: Int): Int
```

Provides the vertical offset from the origin of the space to the origin of the content.

#### Parameters

| | |
| --- | --- |
| height | The content height in pixels. |
| space | The available space in pixels. |

<hr class="docs-overload-divider">

<h2 id="depthoffset-depth-space">depthOffset</h2>

```kotlin
public fun depthOffset(depth: Int, space: Int): Int
```

Provides the depth offset from the origin of the space to the origin of the content.

#### Parameters

| | |
| --- | --- |
| depth | The content depth in pixels. |
| space | The available space in pixels. |

<hr class="docs-overload-divider">

<h2 id="position-size-space-layoutdirection">position</h2>

```kotlin
public fun position(
        size: IntVolumeSize,
        space: IntVolumeSize,
        layoutDirection: LayoutDirection = LayoutDirection.Ltr,
    ): Vector3
```

Provides the origin-based position of the content in the available space.

#### Parameters

| | |
| --- | --- |
| size | The content size in pixels. |
| space | The available space in pixels. |
| layoutDirection | LTR or RTL. |