RectExtension extension

on

Methods

containsPoint(Vector2 point) → bool

Available on Rect, provided by the RectExtension extension

Whether this Rect contains a Vector2 point or not
displace(Vector2 delta) → Rect

Available on Rect, provided by the RectExtension extension

Displaces this Rect by the given delta displacement vector, returning a new Rect instance. Equivalent to shift or translate.
intersectsLineSegment(LineSegment segment) → bool

Available on Rect, provided by the RectExtension extension

Whether the LineSegment intersects the Rect
intersectsSegment(Vector2 pointA, Vector2 pointB) → bool

Available on Rect, provided by the RectExtension extension

Whether the segment formed by pointA and pointB intersects this Rect
randomPoint([Random? random]) → Vector2

Available on Rect, provided by the RectExtension extension

Generates a random point within the bounds of this Rect.
toFlameRectangle() → Rectangle

Available on Rect, provided by the RectExtension extension

Converts this Rect into a flame.Rectangle.
toMathRectangle() → Rectangle<num>

Available on Rect, provided by the RectExtension extension

Converts this Rect into a math.Rectangle.
toOffset() → Offset

Available on Rect, provided by the RectExtension extension

Creates an Offset from this Rect
toRectangleComponent() → RectangleComponent

Available on Rect, provided by the RectExtension extension

Converts this Rect into a RectangleComponent.
toVector2() → Vector2

Available on Rect, provided by the RectExtension extension

Creates a Vector2 starting in top left and going to (width, height).
toVertices() → List<Vector2>

Available on Rect, provided by the RectExtension extension

transform(Matrix4 matrix) → Rect

Available on Rect, provided by the RectExtension extension

Transform Rect using the transformation defined by matrix.

Static Methods

fromCenter({required Vector2 center, required double width, required double height}) → Rect

Available on Rect, provided by the RectExtension extension

Constructs a Rect with a width and height around the center point.
getBounds(List<Vector2> pts) → Rect

Available on Rect, provided by the RectExtension extension

Creates a Rect that represents the bounds of the list pts.