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 328

<static> height :Number

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

<static> left :Number

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

<static> top :Number

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

<static> width :Number

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

Methods

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

clone this rectangle
Source:
rectangle.js, line 136
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 225
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 242
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 147
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 79
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 208
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 64
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 90
Returns:
this shape bounding box Rectangle object
Type
me.Rect

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

set new value to the rectangle shape
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 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 260
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 159
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 174
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 186
Returns:
the union(ed) rectangle
Type
me.Rect

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

update the bounding box for this shape.
Source:
rectangle.js, line 125
Returns:
this shape bounding box Rectangle object
Type
me.Rect
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:41+08:00 using the DocStrap template modified by codename-.