Calculating the distance between 2 points

后端 未结 7 2285
青春惊慌失措
青春惊慌失措 2020-12-17 18:37

I have two points (x1,y1) and (x2,y2). I want to know whether the points are within 5 meters of one another.

7条回答
  •  萌比男神i
    2020-12-17 19:39

    You can use the below formula to find the distance between the 2 points:

    distance*distance = ((x2 − x1)*(x2 - x1)) + ((y2 − y1)*(y2 - y1))
    

提交回复
热议问题