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).
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. |
The distance between each point.