Rect
A 2D Rectangle defined by X and Y position, width and height.
Members
Properties
Name | Description |
---|---|
Rect .center | The position of the center of the rectangle. |
Rect .height | The height of the rectangle, measured from the Y position. |
Rect .max | The position of the maximum corner of the rectangle. |
Rect .min | The position of the minimum corner of the rectangle. |
Rect .position | The X and Y position of the rectangle. |
Rect .size | The width and height of the rectangle. |
Rect .width | The width of the rectangle, measured from the X position. |
Rect .x | The X coordinate of the rectangle. |
Rect .xMax | The maximum X coordinate of the rectangle. |
Rect .xMin | The minimum X coordinate of the rectangle. |
Rect .y | The Y coordinate of the rectangle. |
Rect .yMax | The maximum Y coordinate of the rectangle. |
Rect .yMin | The minimum Y coordinate of the rectangle. |
Static Properties
Name | Description |
---|---|
Rect .zero | Shorthand for writing new Rect(0,0,0,0). |
Constructor
Name | Description |
---|---|
Rect(x, y, width, height) | Creates a new rectangle. |
Rect(position, size) | Creates a rectangle given a size and position. |
Methods
Name | Description |
---|---|
Rect .Contains(point) | Returns true if the x and y components of point is a point inside this rectangle. |
Rect .Contains(point) | Returns true if the x and y components of point is a point inside this rectangle. |
Rect .Contains(point, allowInverse) | Returns true if the x and y components of point is a point inside this rectangle. If allowInverse is present and true, the width and height of the Rect are allowed to take negative values (ie, the min value is greater than the max), and the test will still work. |
Rect .Overlaps(other) | Returns true if the other rectangle overlaps this one. |
Rect .Overlaps(other, allowInverse) | Returns true if the other rectangle overlaps this one. If allowInverse is present and true, the widths and heights of the Rects are allowed to take negative values (ie, the min value is greater than the max), and the test will still work. |
Rect .Set(x, y, width, height) | Set components of an existing Rect. |
Static Methods
Name | Description |
---|---|
Rect .MinMaxRect(xmin, ymin, xmax, ymax) | Creates a rectangle from min/max coordinate values. |
Rect .NormalizedToPoint(rectangle , normalizedRectCoordinates) | Returns a point inside a rectangle, given normalized coordinates. |
Rect .PointToNormalized(rectangle, point) | Returns the normalized coordinates cooresponding the the point. |
Operators
Name | Description |
---|---|
Operator (Rect==Rect) | Returns true if the rectangles are the same. |