Name 
dist() 
Examples 
# Sets the background gray value based on the distance
# of the mouse from the center of the screen
def draw():
noStroke()
d = dist(width/2, height/2, mouseX, mouseY)
maxDist = dist(0, 0, width/2, height/2)
gray = map(d, 0, maxDist, 0, 255)
fill(gray)
rect(0, 0, width, height)

Description 
Calculates the distance between two points.

Syntax  dist(x1, y1, x2, y2)
dist(x1, y1, z1, x2, y2, z2)

Parameters 
x1  float: xcoordinate of the first point 
y1  float: ycoordinate of the first point 
z1  float: zcoordinate of the first point 
x2  float: xcoordinate of the second point 
y2  float: ycoordinate of the second point 
z2  float: zcoordinate of the second point 

Updated on Fri Aug 16 21:51:56 2019.