Calculates the distance between two points.
The version of dist()
with four parameters calculates distance in two dimensions.
The version of dist()
with six parameters calculates distance in three dimensions.
Use p5.Vector.dist() to calculate the distance between two p5.Vector objects.
Examples
Syntax
dist(x1, y1, x2, y2)
dist(x1, y1, z1, x2, y2, z2)
Parameters
x-coordinate of the first point.
y-coordinate of the first point.
x-coordinate of the second point.
y-coordinate of the second point.
z-coordinate of the first point.
z-coordinate of the second point.