链接:
原文链接
(1)二维:
theta=acosd(dot([x1-x2,y1-y2],[x3-x4,y3-y4])/(norm([x1-x2,y1-y2])*norm([x3-x4,y3-y4])))
(2)三维:
theta=acosd(dot([x1-x2,y1-y2,z2-z1],[x3-x4,y3-y4,z4-z3])/(norm([x1-x2,y1-y2,z2-z1])*norm([x3-x4,y3-y4,z4-z3])))