Rect

open class Rect

A Rect is a set of two generic Vector2d instances that define a united upright rectangle.

Author

Lucas Bubner, 2024

Since

5.1.0

Constructors

Link copied to clipboard
constructor(@NonNull p1: Vector2d, @NonNull p2: Vector2d, @NonNull unit: Distance)
Create a new Rect based on two points.

Properties

Link copied to clipboard
open var point1: Vector2d
The first point making up this Rect.
Link copied to clipboard
open var point2: Vector2d
The second point making up this Rect.
Link copied to clipboard
The distance unit these Rect dimensions were constructed with.

Functions

Link copied to clipboard
Calculates the area of this Rect.
Link copied to clipboard
open fun centeredAt(@NonNull center: Vector2d): Rect
Return a new Rect such that the center of the new Rect is at the supplied point.
Link copied to clipboard
open fun contains(@NonNull other: Rect): Boolean
Check whether this Rect fully contains another Rect.
open fun contains(@NonNull point: Vector2d, @NonNull unit: Distance): Boolean
Check whether this Rect contains this Vector2d.
Link copied to clipboard
open fun copy(): Rect
Link copied to clipboard
open fun draw(@NonNull canvas: Canvas)
Draw this Rect on an FtcDashboard canvas.
Link copied to clipboard
open fun equals(other: Any): Boolean
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
open fun normalise(@NonNull rect: Rect): Rect
Normalise a Rect such that the first point is the bottom left and the second point is the top right.
Link copied to clipboard
open fun overlaps(@NonNull other: Rect): Boolean
Check whether this Rect overlaps another Rect in some way.
Link copied to clipboard
open fun toString(): String