小编jNo*_*oob的帖子

Calculating the angle between two lines without having to calculate the slope? (Java)

I have two Lines: L1 and L2. I want to calculate the angle between the two lines. L1 has points: {(x1, y1), (x2, y2)} and L2 has points: {(x3, y3), (x4, y4)}.

How can I calculate the angle formed between these two lines, without having to calculate the slopes? The problem I am currently having is that sometimes I have horizontal lines (lines along the x-axis) and the following formula fails (divide by zero exception):

arctan((m1 - m2) / …
Run Code Online (Sandbox Code Playgroud)

java math geometry trigonometry coordinates

33
推荐指数
5
解决办法
6万
查看次数

标签 统计

coordinates ×1

geometry ×1

java ×1

math ×1

trigonometry ×1