new Point()
- Source:
Members
-
x
-
- Source:
Properties:
Name Type Description xnumber The x value of the point.
-
y
-
- Source:
Properties:
Name Type Description ynumber The y value of the point.
Methods
-
<static> add(a, b, out) → {Phaser.Point}
-
Adds the coordinates of two points together to create a new point.
Parameters:
Name Type Argument Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> angle(a, b) → {number}
-
Returns the angle between two Point objects.
Parameters:
Name Type Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
- Source:
Returns:
The angle between the two Points.
- Type
- number
-
<static> angleSq(a, b) → {number}
-
Returns the angle squared between two Point objects.
Parameters:
Name Type Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
- Source:
Returns:
The angle squared between the two Points.
- Type
- number
-
<static> centroid(points, out) → {Phaser.Point}
-
Calculates centroid (or midpoint) from an array of points. If only one point is provided, that point is returned.
Parameters:
Name Type Argument Description pointsPhaser.Point[] The array of one or more points.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> distance(a, b, round) → {number}
-
Returns the distance of this Point object to the given object (can be a Circle, Point or anything with x/y properties).
Parameters:
Name Type Argument Description aobject The target object. Must have visible x and y properties that represent the center of the object.
bobject The target object. Must have visible x and y properties that represent the center of the object.
roundboolean <optional>
Round the distance to the nearest integer (default false).
- Source:
Returns:
The distance between this Point object and the destination Point object.
- Type
- number
-
<static> divide(a, b, out) → {Phaser.Point}
-
Divides the coordinates of two points to create a new point.
Parameters:
Name Type Argument Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> equals(a, b) → {boolean}
-
Determines whether the two given Point objects are equal. They are considered equal if they have the same x and y values.
Parameters:
Name Type Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
- Source:
Returns:
A value of true if the Points are equal, otherwise false.
- Type
- boolean
-
<static> interpolate(a, b, f, out) → {Phaser.Point}
-
Interpolates the two given Points, based on the
fvalue (between 0 and 1) and returns a new Point.Parameters:
Name Type Argument Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
fnumber The level of interpolation between the two points. Indicates where the new point will be, along the line between pt1 and pt2. If f=1, pt1 is returned; if f=0, pt2 is returned.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> multiply(a, b, out) → {Phaser.Point}
-
Multiplies the coordinates of two points to create a new point.
Parameters:
Name Type Argument Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> multiplyAdd(a, b, s, out) → {Phaser.Point}
-
Adds two 2D Points together and multiplies the result by the given scalar.
Parameters:
Name Type Argument Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
snumber The scaling value.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> negative(a, out) → {Phaser.Point}
-
Creates a negative Point.
Parameters:
Name Type Argument Description aPhaser.Point The first Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> normalize(a, out) → {Phaser.Point}
-
Normalize (make unit length) a Point.
Parameters:
Name Type Argument Description aPhaser.Point The Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> normalRightHand(a, out) → {Phaser.Point}
-
Right-hand normalize (make unit length) a Point.
Parameters:
Name Type Argument Description aPhaser.Point The Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> perp(a, out) → {Phaser.Point}
-
Return a perpendicular vector (90 degrees rotation)
Parameters:
Name Type Argument Description aPhaser.Point The Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> project(a, b, out) → {Phaser.Point}
-
Project two Points onto another Point.
Parameters:
Name Type Argument Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> projectUnit(a, b, out) → {Phaser.Point}
-
Project two Points onto a Point of unit length.
Parameters:
Name Type Argument Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> rotate(a, x, y, angle, asDegrees, distance) → {Phaser.Point}
-
Rotates a Point around the x/y coordinates given to the desired angle.
Parameters:
Name Type Argument Default Description aPhaser.Point The Point object to rotate.
xnumber The x coordinate of the anchor point
ynumber The y coordinate of the anchor point
anglenumber The angle in radians (unless asDegrees is true) to rotate the Point to.
asDegreesboolean <optional>
false Is the given rotation in radians (false) or degrees (true)?
distancenumber <optional>
An optional distance constraint between the Point and the anchor.
- Source:
Returns:
The modified point object.
- Type
- Phaser.Point
-
<static> rperp(a, out) → {Phaser.Point}
-
Return a perpendicular vector (-90 degrees rotation)
Parameters:
Name Type Argument Description aPhaser.Point The Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
<static> subtract(a, b, out) → {Phaser.Point}
-
Subtracts the coordinates of two points to create a new point.
Parameters:
Name Type Argument Description aPhaser.Point The first Point object.
bPhaser.Point The second Point object.
outPhaser.Point <optional>
Optional Point to store the value in, if not supplied a new Point object will be created.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
add(x, y) → {Phaser.Point}
-
Adds the given x and y values to this Point.
Parameters:
Name Type Description xnumber The value to add to Point.x.
ynumber The value to add to Point.y.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
angle(a, asDegrees) → {number}
-
Returns the angle between this Point object and another object with public x and y properties.
Parameters:
Name Type Argument Default Description aPhaser.Point | any The object to get the angle from this Point to.
asDegreesboolean <optional>
false Is the given angle in radians (false) or degrees (true)?
- Source:
Returns:
The angle between the two objects.
- Type
- number
-
angleSq(a) → {number}
-
Returns the angle squared between this Point object and another object with public x and y properties.
Parameters:
Name Type Description aPhaser.Point | any The object to get the angleSq from this Point to.
- Source:
Returns:
The angleSq between the two objects.
- Type
- number
-
clamp(min, max) → {Phaser.Point}
-
Clamps this Point object values to be between the given min and max.
Parameters:
Name Type Description minnumber The minimum value to clamp this Point to.
maxnumber The maximum value to clamp this Point to.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
clampX(min, max) → {Phaser.Point}
-
Clamps the x value of this Point to be between the given min and max.
Parameters:
Name Type Description minnumber The minimum value to clamp this Point to.
maxnumber The maximum value to clamp this Point to.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
clampY(min, max) → {Phaser.Point}
-
Clamps the y value of this Point to be between the given min and max
Parameters:
Name Type Description minnumber The minimum value to clamp this Point to.
maxnumber The maximum value to clamp this Point to.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
clone(output) → {Phaser.Point}
-
Creates a copy of the given Point.
Parameters:
Name Type Argument Description outputPhaser.Point <optional>
Optional Point object. If given the values will be set into this object, otherwise a brand new Point object will be created and returned.
- Source:
Returns:
The new Point object.
- Type
- Phaser.Point
-
copyFrom(source) → {Phaser.Point}
-
Copies the x and y properties from any given object to this Point.
Parameters:
Name Type Description sourceany The object to copy from.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
copyTo(dest) → {Object}
-
Copies the x and y properties from this Point to any given object.
Parameters:
Name Type Description destany The object to copy to.
- Source:
Returns:
The dest object.
- Type
- Object
-
cross(a) → {number}
-
The cross product of this and another Point object.
Parameters:
Name Type Description aPhaser.Point The Point object to get the cross product combined with this Point.
- Source:
Returns:
The result.
- Type
- number
-
distance(dest, round) → {number}
-
Returns the distance of this Point object to the given object (can be a Circle, Point or anything with x/y properties)
Parameters:
Name Type Argument Description destobject The target object. Must have visible x and y properties that represent the center of the object.
roundboolean <optional>
Round the distance to the nearest integer (default false).
- Source:
Returns:
The distance between this Point object and the destination Point object.
- Type
- number
-
divide(x, y) → {Phaser.Point}
-
Divides Point.x and Point.y by the given x and y values.
Parameters:
Name Type Description xnumber The value to divide Point.x by.
ynumber The value to divide Point.x by.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
dot(a) → {number}
-
The dot product of this and another Point object.
Parameters:
Name Type Description aPhaser.Point The Point object to get the dot product combined with this Point.
- Source:
Returns:
The result.
- Type
- number
-
equals(a) → {boolean}
-
Determines whether the given objects x/y values are equal to this Point object.
Parameters:
Name Type Description aPhaser.Point | any The object to compare with this Point.
- Source:
Returns:
A value of true if the x and y points are equal, otherwise false.
- Type
- boolean
-
getMagnitude() → {number}
-
Calculates the length of the Point object.
- Source:
Returns:
The length of the Point.
- Type
- number
-
getMagnitudeSq() → {number}
-
Calculates the length squared of the Point object.
- Source:
Returns:
The length ^ 2 of the Point.
- Type
- number
-
invert() → {Phaser.Point}
-
Inverts the x and y values of this Point
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
isZero() → {boolean}
-
Determine if this point is at 0,0.
- Source:
Returns:
True if this Point is 0,0, otherwise false.
- Type
- boolean
-
multiply(x, y) → {Phaser.Point}
-
Multiplies Point.x and Point.y by the given x and y values. Sometimes known as
Scale.Parameters:
Name Type Description xnumber The value to multiply Point.x by.
ynumber The value to multiply Point.x by.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
normalize() → {Phaser.Point}
-
Alters the Point object so that its length is 1, but it retains the same direction.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
normalRightHand() → {Phaser.Point}
-
Right-hand normalize (make unit length) this Point.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
perp() → {Phaser.Point}
-
Make this Point perpendicular (90 degrees rotation)
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
rotate(x, y, angle, asDegrees, distance) → {Phaser.Point}
-
Rotates this Point around the x/y coordinates given to the desired angle.
Parameters:
Name Type Argument Description xnumber The x coordinate of the anchor point.
ynumber The y coordinate of the anchor point.
anglenumber The angle in radians (unless asDegrees is true) to rotate the Point to.
asDegreesboolean Is the given rotation in radians (false) or degrees (true)?
distancenumber <optional>
An optional distance constraint between the Point and the anchor.
- Source:
Returns:
The modified point object.
- Type
- Phaser.Point
-
rperp() → {Phaser.Point}
-
Make this Point perpendicular (-90 degrees rotation)
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
set(x, y) → {Phaser.Point}
-
Sets the
xandyvalues of this Point object to the given values. If you omit theyvalue then thexvalue will be applied to both, for example:Point.setTo(2)is the same asPoint.setTo(2, 2)Parameters:
Name Type Argument Description xnumber The horizontal value of this point.
ynumber <optional>
The vertical value of this point. If not given the x value will be used in its place.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
setMagnitude(magnitude) → {Phaser.Point}
-
Alters the length of the Point without changing the direction.
Parameters:
Name Type Description magnitudenumber The desired magnitude of the resulting Point.
- Source:
Returns:
This Point object.
- Type
- Phaser.Point
-
setTo(x, y) → {Phaser.Point}
-
Sets the
xandyvalues of this Point object to the given values. If you omit theyvalue then thexvalue will be applied to both, for example:Point.setTo(2)is the same asPoint.setTo(2, 2)Parameters:
Name Type Argument Description xnumber The horizontal value of this point.
ynumber <optional>
The vertical value of this point. If not given the x value will be used in its place.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
subtract(x, y) → {Phaser.Point}
-
Subtracts the given x and y values from this Point.
Parameters:
Name Type Description xnumber The value to subtract from Point.x.
ynumber The value to subtract from Point.y.
- Source:
Returns:
This Point object. Useful for chaining method calls.
- Type
- Phaser.Point
-
toString() → {string}
-
Returns a string representation of this object.
- Source:
Returns:
A string representation of the instance.
- Type
- string