BoundingBox

data class BoundingBox(var topLeftX: Float = 0.0f, var topLeftY: Float = 0.0f, var bottomRightX: Float = 0.0f, var bottomRightY: Float = 0.0f)

Bounding box helper class for handling bounding box operations

Parameters

topLeftX

the top left x coordinate

topLeftY

the top left y coordinate

bottomRightX

the bottom right x coordinate

bottomRightY

the bottom right y coordinate

Constructors

Link copied to clipboard
constructor(topLeftX: Float = 0.0f, topLeftY: Float = 0.0f, bottomRightX: Float = 0.0f, bottomRightY: Float = 0.0f)

Functions

Link copied to clipboard

Clone the bounding box

Link copied to clipboard
fun copyFrom(other: BoundingBox)

Set the bounding box to match other

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun expandBy(pixels: Float, clone: Boolean = false): BoundingBox

Expand all coordinates with pixels pixels

Link copied to clipboard
fun expandUpTo(other: BoundingBox, clone: Boolean = false): BoundingBox

Expand the bounding box up-to the other bounding box limits

fun expandUpTo(minX: Float, minY: Float, maxX: Float, maxY: Float, clone: Boolean = false): BoundingBox

Expand the bounding box up-to the given parameters bounding box limits

Link copied to clipboard
fun height(): Float

Return the bounding box height

Link copied to clipboard
fun intersect(other: BoundingBox, clone: Boolean = false): BoundingBox

Intersect the bounding box with the given one

fun intersect(topLeftX: Float, topLeftY: Float, bottomRightX: Float, bottomRightY: Float, clone: Boolean = false): BoundingBox

Intersect the bounding box with the given parameters

Link copied to clipboard
inline fun isEmpty(): Boolean

Return true if the width or height are zero

Link copied to clipboard

Returns true if the bounding box contains x,y

Link copied to clipboard

Returns true if the bounding box intersects other

Link copied to clipboard
fun isSameAs(topLeftX: Float, topLeftY: Float, bottomRightX: Float, bottomRightY: Float): Boolean
Link copied to clipboard
inline fun isValid(): Boolean

Return true if width and height are positive

Link copied to clipboard
inline fun setEmpty()

Set all coordinated to zero

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun union(other: BoundingBox, clone: Boolean = false): BoundingBox

Union the bounding box with the given one

Link copied to clipboard
fun width(): Float

Return the bounding box width

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard