Skip to content
Armen edited this page Apr 29, 2012 · 16 revisions

extends a2d.Vector

Defined in types.js

Summary

a2d.Position(x, y)
Position

Method Summary

**[add](#add)** (diff) Adds coordinates.
*a2d.Position* **[clone](#clone)** Returns a Position object with the same coordinates
_number_ **[distanceTo](#distanceTo)** (position2) Get the distance between two points
**[divide](#divide)** (diff) Divides this position by another
_boolean_ **[is](#is)** (position2) Checks if two positions are equal
**[isInside](#isInside)** (rectangle) Checks if this position is inside a given rectangle.
_boolean_ **[not](#not)** (position2) Checks if two positions are not equal
**[scale](#scale)** (_scale) Scales coordinates.
**[substract](#substract)** (diff) Subtracts coordinates.
**[subtract](#subtract)** (diff) Subtracts other position from this one
#### Properties inherited from a2d.Vector: X, Y

Detail

a2d.Position(x, y)
Position

Parameters:

{number} x
{number} y


Method Detail

add (diff)
Adds coordinates.

Parameters:

{a2d.Position} diff

-- {a2d.Position} clone
Returns a Position object with the same coordinates

Returns:

{a2d.Position}
a clone of this Position object

-- {number} distanceTo (position2)
Get the distance between two points

Parameters:

{a2d.Position} position2

Returns:

{number}
The distance between the two points

-- divide (diff)
Divides this position by another

Parameters:

{a2d.Position} diff

-- {boolean} is (position2)
Checks if two positions are equal

Parameters:

{a2d.Position} position2

Returns:

{boolean}
true if the positions are the same

-- isInside (rectangle)
Checks if this position is inside a given rectangle.

Parameters:

{a2d.Rectangle} rectangle

-- {boolean} not (position2)
Checks if two positions are not equal

Parameters:

{a2d.Position} position2

Returns:

{boolean}
true if the positions are not the same

-- scale (_scale)
Scales coordinates.

Parameters:

{a2d.Position} _scale

-- substract (diff)
Subtracts coordinates.

Parameters:

{a2d.Position} diff

Deprecated:

In favor of a2d.Position#subtract

See:

a2d.Position#subtract

-- subtract (diff)
Subtracts other position from this one

Parameters:

{a2d.Position} diff


Clone this wiki locally