2015-09-19 20:46:51 +02:00

758 B

Function distance

Calculates the Euclidean distance between two points.

Syntax

math.distance([x1, y1], [x2, y2]);
math.distance([[x1, y1], [x2, y2]);

Parameters

Parameter Type Description
x Array | Matrix Co-ordinates of first end-point of first line
y Array | Matrix Co-ordinates of second end-point of first line

Returns

Type Description
Number | BigNumber Returns the distance from two points

Examples

math.distance([0,0], [4,4]) //returns 5.6569
math.distance([[0,0], [4,4]]) //returns 5.6569