[VBA函数]:返回 空间平面方程
'空间平面方程
Function KJPMFC(P1 As Variant, P2 As Variant, P3 As Variant, ByRef A As Double, ByRef B As Double, ByRef C As Double, ByRef D As Double) As Integer
'判断三点是否在一条直线上
If ThreeP_IsOnline(P1, P2, P3) = True Then
ThisDrawing.Utility.Prompt "出现三点共线情况" & vbCrLf
Exit Function
End If
Dim M(0 To 5) As Double
'计算平面方程系数
M(0) = P2(0) - P1(0)
M(1) = P2(1) - P1(1)
M(2) = P2(2) - P1(2)
M(3) = P3(0) - P1(0)
M(4) = P3(1) - P1(1)
M(5) = P3(2) - P1(2)
'计算平面方程系数( Ax+By+Cz+D=0)
A = M(1) * M(5) - M(2) * M(4)
B = -(M(0) * M(5) - M(2) * M(3))
C = M(0) * M(4) - M(1) * M(3)
D = -A * P1(0) - B * P1(1) - C * P1(2)
End Function
学习了!! 终于找到源码了的,谢谢
页:
[1]