views:

44

answers:

3

Hi. now i making some problem with JAVA, but don't remember how get lenght between to coordinate-system.

Ex. point A (3,7) Point B (7,59)

I want to know how count distance between point a and b. very thanks for your answers. :-)

+2  A: 

A = (xa, ya), B = (xb, yb)

Assuming you want euclidean distance ("natural" distance):

distance = sqrt((xa - xb)^2 + (ya - yb)^2).

Alexandre C.
Would be nice to give an example in Java.
fredley
@fredley: I don't do Java. Feel free to add whatever you want to my answer. But seriously is this so hard to implement by yourself ???
Alexandre C.
A: 

pythagoras gave that answer

sqrt(((A.X - B.X) * (A.X - B.X)) + (((A.Y - B.Y) * (A.Y - B.Y)));
Mark Mullin
A: 
dx = PointA.x - PointB.x;
dy = PointA.y - PointB.y;
dist_squared = dx*dx + dy*dy;
dist = Math.sqrt(dist_squared);
sleepynate