'gile的函数
http://www.theswamp.org/index.php?topic=30428.msg360469#msg360469
'顺时针判断方法
'如果p1,p2,p3是顺时针,返回1,
'如果p1,p2,p3三点共线,则为0
'如果p1,p2,p3是逆时针,则为-1
Public Shared Function Clockwise(p1 As Point3d, p2 As Point3d, p3 As Point3d, normal As Vector3d) As Integer
Const pi As Double = 3.14159265358979
Dim v1 As Vector3d = p1.GetVectorTo(p2)
Dim v2 As Vector3d = p1.GetVectorTo(p3)
Dim angle As Double = v1.GetAngleTo(v2, normal)
If angle = 0.0 OrElse angle = pi Then
Return 0
Else
If v1.GetAngleTo(v2, normal) < pi Then
Return -1
Else
Return 1
End If
End If
End Function