两条线之间的角度从同一点开始 [英] Angle between two line start at the same point
本文介绍了两条线之间的角度从同一点开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过使用atan2()有一些想法,但没有像我想要的那样工作。
谢谢
解决方案
将点转换为矢量(从每个端点减去中心点)并使用点积来计算角度。
Lets say I am any two points on 2d plane (p1(x1,y1), p2(x2,y1)) and both points forms a line with the center(c(c1,c2)). Therefore I am two lines end at same point. I want to know how can I calculate angle between those two lines. I want to be able to show angle range from 0-2pi. Also 0-(-2pi) which let the line form by p1 and c to be line 1 and other line 2. I do have some idea by using atan2() but did not work out like I want it to. Thanks
解决方案
Convert the points to vectors (subtract the center point from each end point) and use the dot product to compute the angle.
这篇关于两条线之间的角度从同一点开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文