openrndr / org.openrndr.shape / Rectangle

Rectangle

data class Rectangle (source)

Constructors

<init>

Rectangle(x: Double, y: Double, width: Double, height: Double)
Rectangle(corner: Vector2, width: Double, height: Double)

Properties

area

the unitless area covered by this rectangle

val area: Double

center

the center of the rectangle

val center: Vector2

contour

ShapeContour representation of the rectangle

val contour: ShapeContour

corner

val corner: Vector2

dimensions

the dimensions of the rectangle

val dimensions: Vector2

height

val height: Double

shape

Shape representation of the rectangle

val shape: Shape

width

val width: Double

x

val x: Double

y

val y: Double

Functions

contains

operator fun contains(point: Vector2): Boolean

heightScaledTo

creates a new Rectangle with height set to fitHeight and width scaled proportionally

fun heightScaledTo(fitHeight: Double): Rectangle

moved

creates a new Rectangle with its position offset by offset

fun moved(offset: Vector2): Rectangle

offsetEdges

create a new Rectangle instance with offset edges

fun offsetEdges(offset: Double, offsetY: Double = offset): Rectangle

position

returns a position for parameterized coordinates u and v between 0 and 1

fun position(u: Double, v: Double): Vector2

scaled

creates a new Rectangle with dimensions scaled by scale and scaleY

fun scaled(scale: Double, scaleY: Double = scale): Rectangle

widthScaledTo

creates a new Rectangle with width set to fitWidth and height scaled proportionally

fun widthScaledTo(fitWidth: Double): Rectangle

Companion Object Functions

fromCenter

creates a Rectangle around center with dimensions width and height

fun fromCenter(center: Vector2, width: Double, height: Double): Rectangle