Math.distance(x1,y1,x2,y2) +
Previous
Top
Next
Syntax
Math.distance(x1,y1,x2,y2)
Arguments
x1, y1, x1, y2: Numbers or expressions.
Returns
A number, the distance between the two points (x1, y1) and (x2, y2).
Description
Calculates the distance between the two points (x1, y1) and (x2, y2) using Math.sqrt((x2-x1)*(x2-x2)+(y2-y1)*(y2-y1)).
Sample
Math.distance(1,1,10,10); // returns 12.727
Math.distance(3,5,30,40); // returns 44.204
Note:
Requires Advanced Math Support. See
here
for more information
See Also
Math.distanceSq()