I want to calculate the distance between two points in Java

后端 未结 7 1448
花落未央
花落未央 2020-12-29 21:31

OK, so I\'ve written most of a program that will allow me to determine if two circles overlap.

I have no problems whatsoever with my program aside from one issue: t

7条回答
  •  遥遥无期
    2020-12-29 21:57

    This may be OLD, but here is the best answer:

        float dist = (float) Math.sqrt(
                Math.pow(x1 - x2, 2) +
                Math.pow(y1 - y2, 2) );
    

提交回复
热议问题