me.Rect(x, y, w, h)

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

Extends

Members

static bottom :Number

bottom coordinate of the Rectangle

static centerX :Number

absolute center of this rectangle on the horizontal axis

static centerY :Number

absolute center of this rectangle on the vertical axis

static height :Number

height of the Rectangle

static left :Number

left coordinate of the Rectangle

static right :Number

right coordinate of the Rectangle

static top :Number

top coordinate of the Rectangle

static width :Number

width of the Rectangle

Methods

static clone() → {me.Rect}

clone this rectangle

Returns:
me.Rect -

new rectangle

static contains(rect) → {boolean}

check if this rectangle contains the specified one

Parameters:
Name Type Description
rect me.Rect
Returns:
boolean -

true if contains

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

Returns:
boolean -

true if contains

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

Returns:
me.Rect -

new rectangle

static equals(rect) → {boolean}

check if this rectangle is identical to the specified one

Parameters:
Name Type Description
rect me.Rect
Returns:
boolean -

true if equals

static getBounds() → {me.Rect}

returns the bounding box for this shape, the smallest rectangle object completely containing this shape.

Returns:
me.Rect -

this shape bounding box Rectangle object

static isFinite() → {boolean}

determines whether all coordinates of this rectangle are finite numbers.

Returns:
boolean -

false if all coordinates are positive or negative Infinity or NaN; otherwise, true.

static overlaps(rect) → {boolean}

check if this rectangle is intersecting with the specified one

Parameters:
Name Type Description
rect me.Rect
Returns:
boolean -

true if overlaps

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

Returns:
me.Rect -

this rectangle

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

Returns:
me.Rect -

this shape bounding box Rectangle object

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

set new value to the rectangle shape

Parameters:
Name Type Attributes 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

Returns:
me.Rect -

this rectangle

static toPolygon() → {me.Polygon}

Returns a polygon whose edges are the same as this box.

Returns:
me.Polygon -

a new Polygon that represents this rectangle.

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

Returns:
me.Rect -

this rectangle

static translateV(v) → {me.Rect}

translate the rect by the specified vector

Parameters:
Name Type Description
v me.Vector2d

vector offset

Returns:
me.Rect -

this rectangle

static union(rect) → {me.Rect}

merge this rectangle with another one

Parameters:
Name Type Description
rect me.Rect

other rectangle to union with

Returns:
me.Rect -

the union(ed) rectangle

static updateBounds() → {me.Rect}

update the bounding box for this shape.

Returns:
me.Rect -

this shape bounding box Rectangle object