# Quad

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

*** ** * ** ***


```
public final class Quad
```

<br />

*** ** * ** ***

Represents a 4-point quadrilateral polygon in 2D space.

Can represent mathematically skewed or distorted geometry that breaks strict axis constraints.

## Summary

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quad#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quad` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quad#fromCorners(androidx.xr.runtime.math.Vector2,androidx.xr.runtime.math.Vector2,androidx.xr.runtime.math.Vector2,androidx.xr.runtime.math.Vector2)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 upperLeft, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 upperRight, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 lowerRight, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 lowerLeft )` Creates a Quad from 4 explicitly defined corners allowing for arbitrary skew. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quad` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quad#fromMinMax(androidx.xr.runtime.math.Vector2,androidx.xr.runtime.math.Vector2)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 min, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 max)` Creates a perfectly axis-aligned rectangular Quad. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quad#getLowerLeft()()` The bottom-left `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quad#getLowerRight()()` The bottom-right `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quad#getUpperLeft()()` The top-left `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quad#getUpperRight()()` The top-right `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner. |
| `int` | `https://developer.android.com/reference/androidx/xr/runtime/math/Quad#hashCode()()` |
| `@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/Quad#toString()()` |

## Public methods

### equals

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

### fromCorners

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

```
public static final @NonNull Quad fromCorners(
    @NonNull Vector2 upperLeft,
    @NonNull Vector2 upperRight,
    @NonNull Vector2 lowerRight,
    @NonNull Vector2 lowerLeft
)
```

Creates a Quad from 4 explicitly defined corners allowing for arbitrary skew.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 upperLeft` | The top-left `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 upperRight` | The top-right `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 lowerRight` | The bottom-right `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 lowerLeft` | The bottom-left `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quad` | A newly constructed `https://developer.android.com/reference/androidx/xr/runtime/math/Quad` containing the specified geometry. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if any of the provided coordinates contain a NaN float. |

### fromMinMax

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

```
public static final @NonNull Quad fromMinMax(@NonNull Vector2 min, @NonNull Vector2 max)
```

Creates a perfectly axis-aligned rectangular Quad.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 min` | A `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` representing the absolute minimum coordinate corner. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector2 max` | A `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` representing the absolute maximum coordinate corner. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Quad` | A newly constructed `https://developer.android.com/reference/androidx/xr/runtime/math/Quad` encompassing the bounding box limit. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if any coordinate is NaN, or if min bounding coordinates are greater than their respective max bounding coordinates. |

### getLowerLeft

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

```
public final @NonNull Vector2 getLowerLeft()
```

The bottom-left `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner.

### getLowerRight

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

```
public final @NonNull Vector2 getLowerRight()
```

The bottom-right `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner.

### getUpperLeft

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

```
public final @NonNull Vector2 getUpperLeft()
```

The top-left `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner.

### getUpperRight

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

```
public final @NonNull Vector2 getUpperRight()
```

The top-right `https://developer.android.com/reference/androidx/xr/runtime/math/Vector2` corner.

### hashCode

```
public int hashCode()
```

### toString

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