Optionalx: numberOptionaly: numberOptionalwidth: numberOptionalheight: numberProtected_Protected_Protected_Protected_Gets the Y position of the bottom edge.
Gets the X position of the left edge.
Gets the X position of the right edge.
Gets the Y position of the top edge.
Clones this instance and returns a new Rect2 with identical values.
Insets this rectangle by the given amount.
The amount to inset the rectangle by.
This rectangle modified by the given inset.
Insets this rectangle by the given amount.
This rectangle modified by the given inset.
Rounds the vector to the nearest multiple.
Multiple to round to.
This instance.
Computes the absolute area of the rectangle.
Computes the signed area of the rectangle.
Insets a rectangle by the given amount.
The amount to inset the rectangle by.
Returns a new rectangle with the insets applied.
Performs a segment/rectangle intersection using the Liang-Barsky line clipping algorithm.
Returns the intersection point or null if no intersection was found.
Returns whether the provided rect, given a error margin, has the same rect components values as this one.
True if equal, false otherwise.
Outsets a rectangle by the given amount.
The amount to outset the rectangle by.
Returns a new rectangle with the outsets applied.
Returns a copy of the rectangle rounded to the nearest multiple.
Multiple to round to.
This instance.
Assigns the values to the rectangle.
Optionalx: numberOptionaly: numberOptionalwidth: numberOptionalheight: numberReturns a string representation of an object.
StaticisStaticisStaticwith
The Rect2 implements a 2D rectangle with an origin in top left and a width and height. The class follows the 'copy-on-write' pattern, which means that every operation such as Rect2#inset or Rect2#outset returns a copy of the rect with updates values. It also implies that the values of the rect cannot be directly modified.
The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.