Javascript Math dist( point1, point2 )
function dist( point1, point2 ){ var xs = 0;/* w ww . ja va 2 s. c o m*/ var ys = 0; xs = point2.x - point1.x; xs = xs * xs; ys = point2.y - point1.y; ys = ys * ys; return Math.sqrt( xs + ys ); }