Skip to content

# `Rect`

## FL.Rect = class Rect(object)

      ===============================================
        Rect - base class to represent rectangle
      ===============================================
      Integer or float values are accepted as coordinates

      CONSTRUCTOR:
        Rect() - generic constructor, creates a Rect with zero coordinates
        Rect(Rect r) - copy constructor
        Rect(Point p) - creates rectangle with one corner at (0, 0) and another - at coordinates defined by p
        Rect(Point p0, Point p1) - creates rectangle defined by the corner points
        Rect(x0, y0, x1, y1) - creates a rectangle defined by the coordinates of the corner points

      ATTRIBUTES:
        ll (Point) - position of the left/bottom corner
        ur (Point) - position of the right/top corner
        x (integer or float) - horizontal position of the left corner
        y (integer or float) - vertical position of the bottom corner
        width (integer or float) - width of the rectangle
        height (integer or float) - height of the rectangle

      OPERATIONS:
        add - Point or Rect must be second operand, rectangle is expanded to include this point or rectange
        multiply - second operand must be Matrix. Matrix transformation is applied to the rectangle

      METHODS
        Assign(Rect r) | (Point p0, Point p1) | (x0, y0, x1, y1) - assigns new values to a Rect, the same as constructor
        Shift(Point p) | (x, y) - shifts Rect on a position defined by p or x and y values
        Transform(Matrix m) - applies Matrix transformation to the Rect (see Matrix().__doc__)
        Resize(width, height) - resizes rectangle to new width and height
        Include(Rect r) | (Point p) | (x, y)  - expands rectangle to include new rectangle or point
        Check(Rect r) - returns True if r overlaps current rectangle
        Check(Point p) - returns True if p is insude current rectangle
        Validate() - corrents rectangle's orientation

#### Methods

Assign(...)

      Assign(Rect r) | (Point p0, Point p1) | (x0, y0, x1, y1) - assigns new values to a Rect, the same as constructor

Check(...)

      Check(Rect r) - returns True if r overlaps current rectangle
      Check(Point p) - returns True if p is insude current rectangle

Include(...)

      Include(Rect r) | (Point p) | (x, y)  - expands rectangle to include new rectangle or point

Resize(...)

      Resize(width, height) - resizes rectangle to new width and height

Shift(...)

      Shift(Point p) | (x, y) - shifts Rect on a position defined by p or x and y values

Transform(...)

      Transform(Matrix m) - applies Matrix transformation to the Rect (see Matrix().__doc__)

Validate(...)

      Validate() - corrents rectangle's orientation

__add__(...)

      x.__add__(y) <==> x+y

__delattr__(...)

      x.__delattr__('name') <==> del x.name

__getattribute__(...)

      x.__getattribute__('name') <==> x.name

__init__(...)

      x.__init__(...) initializes x; see help(type(x)) for signature

__mul__(...)

      x.__mul__(y) <==> x*y

__radd__(...)

      x.__radd__(y) <==> y+x

__repr__(...)

      x.__repr__() <==> repr(x)

__rmul__(...)

      x.__rmul__(y) <==> y*x

__setattr__(...)

      x.__setattr__('name', value) <==> x.name = value

#### Descriptors

height

ll

ur

width

x

y

#### Attributes

__new__ = <built-in method __new__ of type object>

      T.__new__(S, ...) -> a new object with type S, a subtype of T

## `Assign`

FL.Rect.Assign = Assign(...)

      Assign(Rect r) | (Point p0, Point p1) | (x0, y0, x1, y1) - assigns new values to a Rect, the same as constructor

## `Check`

FL.Rect.Check = Check(...)

      Check(Rect r) - returns True if r overlaps current rectangle
      Check(Point p) - returns True if p is insude current rectangle

## `Include`

FL.Rect.Include = Include(...)

      Include(Rect r) | (Point p) | (x, y)  - expands rectangle to include new rectangle or point

## `Resize`

FL.Rect.Resize = Resize(...)

      Resize(width, height) - resizes rectangle to new width and height

## `Shift`

FL.Rect.Shift = Shift(...)

      Shift(Point p) | (x, y) - shifts Rect on a position defined by p or x and y values

## `Transform`

FL.Rect.Transform = Transform(...)

      Transform(Matrix m) - applies Matrix transformation to the Rect (see Matrix().__doc__)

## `Validate`

FL.Rect.Validate = Validate(...)

      Validate() - corrents rectangle's orientation