How do I find the inverse tangent of a line?

后端 未结 4 1817
长发绾君心
长发绾君心 2021-02-19 07:57

I\'ve got a line (x1,y1) and (x2,y2). I\'d like to use tan inverse to find the angle of that line, how would I do so in java?

I\'d like to see what angle the line makes

4条回答
  •  故里飘歌
    2021-02-19 08:23

    You need

    Math.toDegrees(Math.atan((y2-y1)/(x2-x1)))

    Do notice exception when x1=x2.

提交回复
热议问题