class Quad


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

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

Summary

Public companion functions

Quad
fromCorners(
    upperLeft: Vector2,
    upperRight: Vector2,
    lowerRight: Vector2,
    lowerLeft: Vector2
)

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

Quad
fromMinMax(min: Vector2, max: Vector2)

Creates a perfectly axis-aligned rectangular Quad.

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

Vector2

The bottom-left Vector2 corner.

Vector2

The bottom-right Vector2 corner.

Vector2

The top-left Vector2 corner.

Vector2

The top-right Vector2 corner.

Public companion functions

fromCorners

Added in 1.1.0-alpha02
fun fromCorners(
    upperLeft: Vector2,
    upperRight: Vector2,
    lowerRight: Vector2,
    lowerLeft: Vector2
): Quad

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

Parameters
upperLeft: Vector2

The top-left Vector2 corner.

upperRight: Vector2

The top-right Vector2 corner.

lowerRight: Vector2

The bottom-right Vector2 corner.

lowerLeft: Vector2

The bottom-left Vector2 corner.

Returns
Quad

A newly constructed Quad containing the specified geometry.

Throws
IllegalArgumentException

if any of the provided coordinates contain a NaN float.

fromMinMax

Added in 1.1.0-alpha02
fun fromMinMax(min: Vector2, max: Vector2): Quad

Creates a perfectly axis-aligned rectangular Quad.

Parameters
min: Vector2

A Vector2 representing the absolute minimum coordinate corner.

max: Vector2

A Vector2 representing the absolute maximum coordinate corner.

Returns
Quad

A newly constructed Quad encompassing the bounding box limit.

Throws
IllegalArgumentException

if any coordinate is NaN, or if min bounding coordinates are greater than their respective max bounding coordinates.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

lowerLeft

Added in 1.1.0-alpha02
val lowerLeft: Vector2

The bottom-left Vector2 corner.

lowerRight

Added in 1.1.0-alpha02
val lowerRight: Vector2

The bottom-right Vector2 corner.

upperLeft

Added in 1.1.0-alpha02
val upperLeft: Vector2

The top-left Vector2 corner.

upperRight

Added in 1.1.0-alpha02
val upperRight: Vector2

The top-right Vector2 corner.