me.Line(x, y, points)

new Line(x, y, points)

a line segment Object.

Parameters:
Name Type Description
x Number

origin point of the Line

y Number

origin point of the Line

points Array.<me.Vector2d>

array of vectors defining the Line

Extends

Members

points :Array.<me.Vector2d>

Array of points defining the Polygon
Note: If you manually change points, you must call recalcafterwards so that the changes get applied correctly.

Inherited From:

pos :me.Vector2d

origin point of the Polygon

Inherited From:

Methods

clone() → {me.Line}

clone this line segment

Returns:
me.Line -

new Line

Overrides:

containsPoint(x, y) → {boolean}

check if this line segment contains the specified point

Parameters:
Name Type Description
x Number

x coordinate

y Number

y coordinate

Returns:
boolean -

true if contains

Overrides:

containsPointV(point) → {boolean}

check if this line segment contains the specified point

Parameters:
Name Type Description
point me.Vector2d
Returns:
boolean -

true if contains

Overrides:

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

Inherited From:

getIndices(a) → {me.Polygon}

returns a list of indices for all triangles defined in this polygon

Parameters:
Name Type Description
a Array.<Vector2d>

list of vector

Returns:
me.Polygon -

this Polygon

Inherited From:

recalc()

Computes the calculated collision edges and normals. This must be called if the points array, angle, or offset is modified manually.

Overrides:

rotate(angle) → {me.Polygon}

Rotate this Polygon (counter-clockwise) by the specified angle (in radians).

Parameters:
Name Type Description
angle Number

The angle to rotate (in radians)

Returns:
me.Polygon -

Reference to this object for method chaining

Inherited From:

scale(x, yopt) → {me.Polygon}

Scale this Polygon by the given scalar.

Parameters:
Name Type Attributes Default Description
x Number
y Number <optional>
x
Returns:
me.Polygon -

Reference to this object for method chaining

Inherited From:

scaleV(v) → {me.Polygon}

Scale this Polygon by the given vector

Parameters:
Name Type Description
v me.Vector2d
Returns:
me.Polygon -

Reference to this object for method chaining

Inherited From:

setShape(x, y, points)

set new value to the Polygon

Parameters:
Name Type Description
x Number

position of the Polygon

y Number

position of the Polygon

points Array.<me.Vector2d>

array of vector defining the Polygon

Inherited From:

to2d() → {me.Polygon}

apply a 2d projection to this shape

Returns:
me.Polygon -

Reference to this object for method chaining

Inherited From:

toIso() → {me.Polygon}

apply an isometric projection to this shape

Returns:
me.Polygon -

Reference to this object for method chaining

Inherited From:

transform(matrix) → {me.Polygon}

apply the given transformation matrix to this Polygon

Parameters:
Name Type Description
matrix me.Matrix2d

the transformation matrix

Returns:
me.Polygon -

Reference to this object for method chaining

Inherited From:

translate(x, y) → {me.Polygon}

translate the Polygon by the specified offset

Parameters:
Name Type Description
x Number

x offset

y Number

y offset

Returns:
me.Polygon -

this Polygon

Inherited From:

translateV(v) → {me.Polygon}

translate the Polygon by the specified vector

Parameters:
Name Type Description
v me.Vector2d

vector offset

Returns:
me.Polygon -

Reference to this object for method chaining

Inherited From:

updateBounds() → {me.Rect}

update the bounding box for this shape.

Returns:
me.Rect -

this shape bounding box Rectangle object

Inherited From: