Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Distance between two Points(x,y) Pythagorean Theorem
function distanceBetweenPoints(p1, p2) {
// or
// Math.sqr((p2.x - p1.x) + (p2.y - p1.y))
return Math.hypot(p2.x - p1.x, p2.y - p1.y)
distance(P1, P2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment