Class: Rect

me. Rect

new Rect(x, y, w, h)

a rectangle Object
Parameters:
Name Type Description
x Number position of the Rectangle
y Number position of the Rectangle
w Number width of the rectangle
h Number height of the rectangle
Source:
rectangle.js, line 19

Extends

Members

<static> bottom :Number

bottom coordinate of the Rectangle
Type:
  • Number
Source:
rectangle.js, line 332

<static> height :Number

height of the Rectangle
Type:
  • Number
Source:
rectangle.js, line 375

<static> left :Number

left coordinate of the Rectangle
Type:
  • Number
Source:
rectangle.js, line 280
right coordinate of the Rectangle
Type:
  • Number
Source:
rectangle.js, line 297

<static> top :Number

top coordinate of the Rectangle
Type:
  • Number
Source:
rectangle.js, line 315

<static> width :Number

width of the Rectangle
Type:
  • Number
Source:
rectangle.js, line 350

Methods

<static> clone() → {me.Rect}

clone this rectangle
Source:
rectangle.js, line 140
Returns:
new rectangle
Type
me.Rect

<static> contains(rect) → {boolean}

check if this rectangle contains the specified one
Parameters:
Name Type Description
rect me.Rect
Source:
rectangle.js, line 229
Returns:
true if contains
Type
boolean

<static> containsPoint(x, y) → {boolean}

check if this rectangle contains the specified point
Parameters:
Name Type Description
x Number x coordinate
y Number y coordinate
Source:
rectangle.js, line 246
Returns:
true if contains
Type
boolean

<static> copy(rect) → {me.Rect}

copy the position and size of the given rectangle into this one
Parameters:
Name Type Description
rect me.Rect Source rectangle
Source:
rectangle.js, line 151
Returns:
new rectangle
Type
me.Rect

<static> getBounds() → {me.Rect}

returns the bounding box for this shape, the smallest rectangle object completely containing this shape.
Source:
rectangle.js, line 83
Returns:
this shape bounding box Rectangle object
Type
me.Rect

<static> overlaps(rect) → {boolean}

check if this rectangle is intersecting with the specified one
Parameters:
Name Type Description
rect me.Rect
Source:
rectangle.js, line 212
Returns:
true if overlaps
Type
boolean

<static> resize(w, h) → {me.Rect}

resize the rectangle
Parameters:
Name Type Description
w Number new width of the rectangle
h Number new height of the rectangle
Source:
rectangle.js, line 68
Returns:
this rectangle
Type
me.Rect

<static> setPoints(points) → {me.Rect}

resize the rectangle to contain all the given points coordinates.
Parameters:
Name Type Description
points Array.<me.Vector2d> array of vector defining a shape
Source:
rectangle.js, line 94
Returns:
this shape bounding box Rectangle object
Type
me.Rect

<static> setShape(x, y, w|points, h) → {me.Rect}

set new value to the rectangle shape
Parameters:
Name Type Argument Description
x Number position of the Rectangle
y Number position of the Rectangle
w|points Number | Array width of the rectangle, or an array of vector defining the rectangle
h Number <optional>
height of the rectangle, if a numeral width parameter is specified
Source:
rectangle.js, line 37
Returns:
this rectangle
Type
me.Rect

<static> toPolygon() → {me.Polygon}

Returns a polygon whose edges are the same as this box.
Source:
rectangle.js, line 264
Returns:
a new Polygon that represents this rectangle.
Type
me.Polygon

<static> translate(x, y) → {me.Rect}

translate the rect by the specified offset
Parameters:
Name Type Description
x Number x offset
y Number y offset
Source:
rectangle.js, line 163
Returns:
this rectangle
Type
me.Rect

<static> translateV(v) → {me.Rect}

translate the rect by the specified vector
Parameters:
Name Type Description
v me.Vector2d vector offset
Source:
rectangle.js, line 178
Returns:
this rectangle
Type
me.Rect

<static> union(rect) → {me.Rect}

merge this rectangle with another one
Parameters:
Name Type Description
rect me.Rect other rectangle to union with
Source:
rectangle.js, line 190
Returns:
the union(ed) rectangle
Type
me.Rect

<static> updateBounds() → {me.Rect}

update the bounding box for this shape.
Source:
rectangle.js, line 129
Returns:
this shape bounding box Rectangle object
Type
me.Rect