'计算夹角函数 p"w"/[8
Function ff_angle(x1 As Single, y1 As Single, x2 As Single, y2 As Single, x3 As Single, y3 As Single) As Single =}F &jl
cax = x2 - x1 4;x{@Ln
cay = y2 - y1 SO9j/
cbx = x2 - x3 "d9"Md0k
cby = y2 - y3 ml\A)8O]j/
mo_jj = cax * cbx + cay * cby Y`w+?}(M
mo_ca = Sqr(cax * cax + cay * cay) y^?7de}
mo_cb = Sqr(cbx * cbx + cby * cby) >HXT:0
cos_acb = mo_jj / (mo_ca * mo_cb) V |)3l7IC<
'ff_cos = cos_acb l@%MS\{
If cos_acb >= 1 Then $)mK]57
nn = 0 #2s$dI
ElseIf cos_acb <= -1 Then 7?xTJN)G
nn = 3.14159265258979 ;~3CuN8
Else xM'bb5
nn = Atn(-cos_acb / Sqr(-cos_acb * cos_acb + 1)) + 2 * Atn(1) vdV@G`)HPr
End If #3leMZ6
'ff_angle = nn QOB>TvE
ff_angle = nn * 180 / 3.14159265258979 1ve
%xF
End Function