Finding an Angle between two lines in Matlab

人走茶凉 提交于 2019-12-23 01:54:42

问题


I have 2 lines with coordinates A(x1,y1; x2,y2) and B (x3,y3; x4,y4). Can I find the angle between them using MatLab.


回答1:


I guess if you are just looking for the code, something like this should do?

v1=[x2,y2]-[x1,y1];
v2=[x4,y4]-[x3,y3];
angle=acos(sum(v1.*v2)/(norm(v1)*norm(v2)));


来源:https://stackoverflow.com/questions/37589661/finding-an-angle-between-two-lines-in-matlab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!