Constructor
new MoverPoint(x, y)
Name | Type | Description |
---|---|---|
x |
Number | The x position of the MoverPoint |
y |
Number | The y position of the MoverPoint |
Members
_angle
_length
The square root of the squared length of the point. Math.sqrt(xx + yy); Use .getLength();
constructor
x
The x position of the MoverPoint
y
The y position of the MoverPoint.
Methods
(static) angleBetweenMoverPoints(mp1, mp2) → {Number}
Returns the angel between the two given MoverPoints
Name | Type | Description |
---|---|---|
mp1 |
MoverPoint | |
mp2 |
MoverPoint |
- Type
- Number
(static) distBetween(mp1, mp2) → {Number}
Returns the distance between the two points.
Name | Type | Description |
---|---|---|
mp1 |
MoverPoint | |
mp2 |
MoverPoint |
- Type
- Number
(static) squaredDistanceBetween(mp1, mp2) → {Number}
Returns the squared distance between the two MoverPoints.
Name | Type | Description |
---|---|---|
mp1 |
MoverPoint | |
mp2 |
MoverPoint |
- Type
- Number
add(mp, makeNew) → {MoverPoint}
Name | Type | Description |
---|---|---|
mp |
MoverPoint | |
makeNew |
Boolean |
- Type
- MoverPoint
addBy(xAmount, yAmount, makeNew) → {MoverPoint}
Name | Type | Description |
---|---|---|
xAmount |
Number | |
yAmount |
Number | |
makeNew |
Boolean |
- Type
- MoverPoint
clone() → {MoverPoint}
Returns a new MoverPoint that has the same values as this.
- Type
- MoverPoint
dist(mp) → {Number}
Returns the distance between the given MoverPoint and this.
Name | Type | Description |
---|---|---|
mp |
MoverPoint |
- Type
- Number
divide(value, makeNew) → {MoverPoint}
Name | Type | Description |
---|---|---|
value |
Number | The amount to divide x and y by. |
makeNew |
Boolean |
- Type
- MoverPoint
dotProduct(mp) → {Number}
Name | Type | Description |
---|---|---|
mp |
moverPoint |
- Type
- Number
equals(mp) → {Boolean}
Returns true if the given MoverPoint has the same values as this.
Name | Type | Description |
---|---|---|
mp |
MoverPoint |
- Type
- Boolean
getAngle() → {Number}
Sets ._angle to the atangent of y and x if it is not set, then returns _angle.
- Type
- Number
getLength() → {Number}
Returns the length of the MoverPoint.
- Type
- Number
getSquaredLength() → {Number}
- Type
- Number
getX() → {Number}
- Type
- Number
getY() → {Number}
- Type
- Number
lesserClone() → {MoverPoint}
Uses a MoverPoint from a pool of premade MoverPoints.
- Type
- MoverPoint
multiply(value, makeNew) → {MoverPoint}
Name | Type | Description |
---|---|---|
value |
||
makeNew |
- Type
- MoverPoint
normalize() → {MoverPoint}
Divides x and y by length. Normalizes the point to a unit vector.
- Type
- MoverPoint
perp() → {MoverPoint}
A MoverPoint perpendicular to this one.
- Type
- MoverPoint
reset()
Resets the values of the MoverPoint.
reverse() → {MoverPoint}
Returns this MoverPoint with its values reversed.
- Type
- MoverPoint
setAngle(toThis)
Sets _angle to the value given.
Name | Type | Description |
---|---|---|
toThis |
Number |
setLength(toThis)
Sets the length of the MoverPoint to the value given.
Name | Type | Description |
---|---|---|
toThis |
Number |
setX(toThis)
Name | Type | Description |
---|---|---|
toThis |
setY(toThis)
Name | Type | Description |
---|---|---|
toThis |
sign(mp) → {Number}
Name | Type | Description |
---|---|---|
mp |
MoverPoint |
- Type
- Number
squaredDistance(mp) → {Number}
Name | Type | Description |
---|---|---|
mp |
MoverPoint |
- Type
- Number
subtract(mp, makeNew) → {MoverPoint}
Subtracts the values of mp from this MoverPoint and returns this or a new MoverPoint.
Name | Type | Description |
---|---|---|
mp |
MoverPoint | |
makeNew |
Boolean |
- Type
- MoverPoint
subtractBy(xAmount, yAmount, makeNew) → {MoverPoint}
Name | Type | Description |
---|---|---|
xAmount |
Number | |
yAmount |
Number | |
makeNew |
Boolean | If true a new MoverPoint is returned, otherwise this is returned. |
- Type
- MoverPoint
truncate(max) → {MoverPoint}
Name | Type | Description |
---|---|---|
max |
Number |
- Type
- MoverPoint