其他分享
首页 > 其他分享> > Maltab之求两条直线相交的锐角

Maltab之求两条直线相交的锐角

作者:互联网

function theta=getAcuteAngleOfTwoLines(point1,point2,point3,point4)
[x1,y1]=deal(point1(1),point1(2));
[x2,y2]=deal(point2(1),point2(2));
[x3,y3]=deal(point3(1),point3(2));
[x4,y4]=deal(point4(1),point4(2));
t =[x2-x1,y2-y1];
s =[x4-x3,y4-y3];
theta=acosd(dot(t,s)/(norm(t)*norm(s)));
if theta>180
    theta=180-theta;
end
end

line1:[point1,point2]
line2:[point3,point4]

标签:锐角,之求,Maltab,deal,point1,point2,point3,point4,theta
来源: https://blog.csdn.net/yq_forever/article/details/121213725