public final 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 methods

boolean
equals(Object other)
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.

static final @NonNull Quad

Creates a perfectly axis-aligned rectangular Quad.

final @NonNull Vector2

The bottom-left Vector2 corner.

final @NonNull Vector2

The bottom-right Vector2 corner.

final @NonNull Vector2

The top-left Vector2 corner.

final @NonNull Vector2

The top-right Vector2 corner.

int
@NonNull String

Public methods

equals

public boolean equals(Object other)

fromCorners

Added in 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
@NonNull Vector2 upperLeft

The top-left Vector2 corner.

@NonNull Vector2 upperRight

The top-right Vector2 corner.

@NonNull Vector2 lowerRight

The bottom-right Vector2 corner.

@NonNull Vector2 lowerLeft

The bottom-left Vector2 corner.

Returns
@NonNull 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
public static final @NonNull Quad fromMinMax(@NonNull Vector2 min, @NonNull Vector2 max)

Creates a perfectly axis-aligned rectangular Quad.

Parameters
@NonNull Vector2 min

A Vector2 representing the absolute minimum coordinate corner.

@NonNull Vector2 max

A Vector2 representing the absolute maximum coordinate corner.

Returns
@NonNull 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.

getLowerLeft

Added in 1.1.0-alpha02
public final @NonNull Vector2 getLowerLeft()

The bottom-left Vector2 corner.

getLowerRight

Added in 1.1.0-alpha02
public final @NonNull Vector2 getLowerRight()

The bottom-right Vector2 corner.

getUpperLeft

Added in 1.1.0-alpha02
public final @NonNull Vector2 getUpperLeft()

The top-left Vector2 corner.

getUpperRight

Added in 1.1.0-alpha02
public final @NonNull Vector2 getUpperRight()

The top-right Vector2 corner.

hashCode

public int hashCode()

toString

public @NonNull String toString()