Java: Calculating the angle between two points in degrees

后端 未结 7 1668
故里飘歌
故里飘歌 2020-11-30 00:46

I need to calculate the angle in degrees between two points for my own Point class, Point a shall be the center point.

Method:

public float getAngle(         


        
7条回答
  •  甜味超标
    2020-11-30 00:54

    The javadoc for Math.atan(double) is pretty clear that the returning value can range from -pi/2 to pi/2. So you need to compensate for that return value.

提交回复
热议问题