SimpleVector - Interactive examples

back

Distance methods

v1
x:0, y:5
v2
x:2.5, y:0
v1.absDistanceX(v2)
2.50
v1.distanceX(v2)
-2.50
v1.absDistanceY(v2)
5.00
v1.distanceY(v2)
5.00
v1.distance(v2)
5.59
v1.distanceSq(v2)
31.25
v1.distanceManhattan(v2)
7.5
v1.distanceChebyshev(v2)
5.0

Note that in this page the precision of the results is fixed by applying .toFixed() to the output of the methods. When you use theses methods in your code you will get the raw results without a fixed precision.