Devan Patel eab1d0be48 Adding distance
Adding source + test + docs + fixing index.
2015-08-30 13:05:07 -04:00

830 B

Function distance

Calculates the distance between two 2-dimensional points. The inputs are in the form of arrays.

Syntax

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

Parameters

Parameter Type Description
a Array | Matrix Co-ordinates of first end-point
b Array | Matrix Co-ordinates of second end-point

Returns

Type Description
Number | BigNumber Returns the distance between two points

Examples

math.distance([0, 0], [10, 10]) // Returns 14.142135623730951
math.distance(math.matrix([0,0]),math.matrix([10,10])) // Returns 14.142135623730951

See also

intersect