开发者

math, coordinates

开发者 https://www.devze.com 2023-01-16 21:47 出处:网络
now i making some problem with JAVA, but don\'t remember how get lenght between to coordinate-system.

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


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

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

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


pythagoras gave that answer

sqrt(((A.X - B.X) * (A.X - B.X)) + (((A.Y - B.Y) * (A.Y - B.Y)));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号