RectExtension extension

on

Methods

containsPoint(Vector2 point) bool
Whether this Rect contains a Vector2 point or not
intersectsLineSegment(LineSegment segment) bool
Whether the LineSegment intersects the Rect
intersectsSegment(Vector2 pointA, Vector2 pointB) bool
Whether the segment formed by pointA and pointB intersects this Rect
randomPoint([Random? random]) Vector2
Generates a random point within the bounds of this Rect.
toFlameRectangle() Rectangle
Converts this Rect into a flame.Rectangle.
toMathRectangle() Rectangle<num>
Converts this Rect into a math.Rectangle.
toOffset() Offset
Creates an Offset from this Rect
toRectangleComponent() RectangleComponent
Converts this Rect into a RectangleComponent.
toVector2() Vector2
Creates a Vector2 starting in top left and going to (width, height).
toVertices() List<Vector2>
transform(Matrix4 matrix) Rect
Transform Rect using the transformation defined by matrix.

Static Methods

fromCenter({required Vector2 center, required double width, required double height}) Rect
Constructs a Rect with a width and height around the center point.
getBounds(List<Vector2> pts) Rect
Creates a Rect that represents the bounds of the list pts.