Pergunta

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. :-)

Foi útil?

Solução

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

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

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

Outras dicas

pythagoras gave that answer

sqrt(((A.X - B.X) * (A.X - B.X)) + (((A.Y - B.Y) * (A.Y - B.Y)));
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top