nxy_918 发表于 2006-5-29 11:31:00

求夹角

<P>已知A(xa,ya)、B(xb,yb)、C(xc,yc)三点坐标,如何求取角&lt;ABC得角度?</P>

fjfhgdwfn 发表于 2006-5-30 11:45:00

<P>数学问题啊。看下高中的书就是了。</P>

nxy_918 发表于 2006-5-30 13:48:00

<P>高中没学好</P>

fjfhgdwfn 发表于 2006-5-30 17:09:00

<P>fwj(Xa-Xb,YA-YB)-fwj(...)</P>
<P>再判断下大小180度就是了。</P>
<P>Public Function fwj(ByVal x As Double, ByVal y As Double) As Double<BR>If x = 0 Then<BR>&nbsp;&nbsp;&nbsp; If y &gt; 0 Then<BR>&nbsp;&nbsp;&nbsp; fwj = 3.14159265358979 / 2<BR>&nbsp;&nbsp;&nbsp; Else<BR>&nbsp;&nbsp;&nbsp; fwj = 3.14159265358979 * 1.5<BR>&nbsp;&nbsp;&nbsp; End If<BR>Else<BR>&nbsp;&nbsp;&nbsp; fwj = Atn(y / x)<BR>&nbsp;&nbsp;&nbsp; If x &gt; 0 And y &gt; 0 Then fwj = fwj<BR>&nbsp;&nbsp;&nbsp; If x &gt; 0 And y &lt;= 0 Then fwj = 2 * 3.14159265358979 + fwj<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; If x &lt; 0 Then fwj = fwj + 3.14159265358979<BR>End If<BR>End Function</P>
页: [1]
查看完整版本: 求夹角