Rectangle

data class Rectangle<T : Number, Comparable<T>>(val left: T, val bottom: T, val right: T, val top: T, val type: KClass<T>) : Shape<T>

2D rectangle.

Since

v2.0.0

Constructors

Link copied to clipboard
constructor(left: T, bottom: T, right: T, top: T, type: KClass<T>)

Functions

Link copied to clipboard
open operator override fun contains(point: <Error class: unknown class><T>): Boolean

Returns true if given point is inside this rectangle.

Link copied to clipboard
open override fun distanceTo(point: <Error class: unknown class><T>): T

Returns the distance between this rectangle and the given point.

Link copied to clipboard
open infix override fun intersects(circle: Circle<T>): Boolean

Returns true if given circle intersects this rectangle.

open infix override fun intersects(polygon: Polygon<T>): Boolean

Returns true if given polygon intersects this rectangle.

open infix override fun intersects(section: Section2<T>): Boolean

Returns true if given section intersects this rectangle.

open infix override fun intersects(other: Shape<T>): Boolean

Returns true if given other shape intersects this rectangle.

open infix fun intersects(rectangle: Rectangle<T>): Boolean

Returns true if given rectangle intersects this shape.

Link copied to clipboard
open override fun rotate(angle: <Error class: unknown class><T>): Polygon<T>

Returns this rectangle as polygon rotated by given angle around origin point.

open override fun rotate(angle: <Error class: unknown class><T>, pivot: <Error class: unknown class><T>): Polygon<T>

Returns this rectangle as polygon rotated by given angle around given pivot point.

Link copied to clipboard
open override fun scale(scale: T): Rectangle<T>

Returns this rectangle scaled by given scale value relative to origin point.

open override fun scale(scale: T, center: <Error class: unknown class><T>): Rectangle<T>

Returns this rectangle scaled by given scale value relative to given center point.

Link copied to clipboard
fun transform(matrix: <Error class: unknown class><T>): Polygon<T>

Returns this rectangle as polygon transformed using given matrix.

Link copied to clipboard
open override fun translate(vector: <Error class: unknown class><T>): Rectangle<T>

Returns this rectangle translated by given vector.

Properties

Link copied to clipboard

Polygon representation of this rectangle.

Link copied to clipboard
val bottom: T

Y coordinate of the bottom side of this rectangle.

Link copied to clipboard
open override val boundingBox: Rectangle<T>

Bounding box of this rectangle.

Link copied to clipboard
val height: T

Height of this rectangle.

Link copied to clipboard
val left: T

X coordinate of the left side of this rectangle.

Link copied to clipboard
open override val midpoint: <Error class: unknown class><T>

Midpoint of this rectangle.

Link copied to clipboard
val right: T

X coordinate of the right side of this rectangle.

Link copied to clipboard
val top: T

Y coordinate of the top side of this rectangle.

Link copied to clipboard
open override val type: KClass<T>

Type of coordinates in this rectangle.

Link copied to clipboard
val width: T

Width of this rectangle.