Namespace: Distance

Phaser.Math. Distance

Methods


<static> Between(x1, y1, x2, y2)

Calculate the distance between two sets of coordinates (points).

Parameters:
Name Type Description
x1 number

The x coordinate of the first point.

y1 number

The y coordinate of the first point.

x2 number

The x coordinate of the second point.

y2 number

The y coordinate of the second point.

Since: 3.0.0
Source: src/math/distance/DistanceBetween.js (Line 7)
Returns:

The distance between each point.

Type
number

<static> Power(x1, y1, x2, y2, pow)

Calculate the distance between two sets of coordinates (points) to the power of pow.

Parameters:
Name Type Description
x1 number

The x coordinate of the first point.

y1 number

The y coordinate of the first point.

x2 number

The x coordinate of the second point.

y2 number

The y coordinate of the second point.

pow number

The exponent.

Since: 3.0.0
Source: src/math/distance/DistancePower.js (Line 7)
Returns:

The distance between each point.

Type
number

<static> Squared(x1, y1, x2, y2)

Calculate the distance between two sets of coordinates (points), squared.

Parameters:
Name Type Description
x1 number

The x coordinate of the first point.

y1 number

The y coordinate of the first point.

x2 number

The x coordinate of the second point.

y2 number

The y coordinate of the second point.

Since: 3.0.0
Source: src/math/distance/DistanceSquared.js (Line 7)
Returns:

The distance between each point, squared.

Type
number