# Phaser API Documentation

Version:
Namespace: Distance
Phaser.Math.Distance
Source: src/math/distance/index.js (Line 7)

### Methods

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

#### Description:

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.

##### Description:

The distance between each point.

##### Type:
• number
Since: 3.0.0
<static> BetweenPoints(a, b)

#### Description:

Calculate the distance between two points.

#### Parameters:

name type description
a Phaser.Types.Math.Vector2Like

The first point.

b Phaser.Types.Math.Vector2Like

The second point.

##### Description:

The distance between the points.

##### Type:
• number
Since: 3.22.0
<static> BetweenPointsSquared(a, b)

#### Description:

Calculate the squared distance between two points.

#### Parameters:

name type description
a Phaser.Types.Math.Vector2Like

The first point.

b Phaser.Types.Math.Vector2Like

The second point.

##### Description:

The squared distance between the points.

##### Type:
• number
<static> Chebyshev(x1, y1, x2, y2)

#### Description:

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

Chebyshev distance (or chessboard distance) is the maximum of the horizontal and vertical distances. It's the effective distance when movement can be horizontal, vertical, or diagonal.

#### 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.

##### Description:

The distance between each point.

##### Type:
• number
Since: 3.22.0
<static> Power(x1, y1, x2, y2, pow)

#### Description:

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.

##### Description:

The distance between each point.

##### Type:
• number
Since: 3.0.0
<static> Snake(x1, y1, x2, y2)

#### Description:

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

Snake distance (rectilinear distance, Manhattan distance) is the sum of the horizontal and vertical distances. It's the effective distance when movement is allowed only horizontally or vertically (but not both).

#### 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.

##### Description:

The distance between each point.

##### Type:
• number
Since: 3.22.0
<static> Squared(x1, y1, x2, y2)

#### Description:

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.

##### Description:

The distance between each point, squared.

• number
Since: 3.0.0