CAD 中空间平面方程计算
程序代码: | [ 复制代码到剪贴板 ] |
'***********************************************************************************************************************************
'空间平面方程***********************************************************空间平面方程**************************************************
'
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
'空间平面方程
Private Sub CommandButton3_Click()
Me.Hide
On Error Resume Next
Dim A As Double, B As Double, C As Double, D As Double
Dim P1 As Variant, P2 As Variant, P3 As Variant
ThisDrawing.Utility.InitializeUserInput 1, ""
P1 = ThisDrawing.Utility.GetPoint(, "空间不共线三点中的第一点:")
ThisDrawing.Utility.InitializeUserInput 1, ""
P2 = ThisDrawing.Utility.GetPoint(, "空间不共线三点中的矩形的第二点:")
ThisDrawing.Utility.InitializeUserInput 1, ""
P3 = ThisDrawing.Utility.GetPoint(, "空间不共线三点中的矩形的第三点:")
KJPMFC P1, P2, P3, A, B, C, D
ThisDrawing.Utility.Prompt "空间平面方程: Ax+By+Cz+D=0." & vbCrLf
ThisDrawing.Utility.Prompt "A=" & A & vbCrLf
ThisDrawing.Utility.Prompt "B=" & B & vbCrLf
ThisDrawing.Utility.Prompt "C=" & C & vbCrLf
ThisDrawing.Utility.Prompt "D=" & D & vbCrLf
End Sub
'空间平面方程***********************************************************空间平面方程**************************************************
'
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
'空间平面方程
Private Sub CommandButton3_Click()
Me.Hide
On Error Resume Next
Dim A As Double, B As Double, C As Double, D As Double
Dim P1 As Variant, P2 As Variant, P3 As Variant
ThisDrawing.Utility.InitializeUserInput 1, ""
P1 = ThisDrawing.Utility.GetPoint(, "空间不共线三点中的第一点:")
ThisDrawing.Utility.InitializeUserInput 1, ""
P2 = ThisDrawing.Utility.GetPoint(, "空间不共线三点中的矩形的第二点:")
ThisDrawing.Utility.InitializeUserInput 1, ""
P3 = ThisDrawing.Utility.GetPoint(, "空间不共线三点中的矩形的第三点:")
KJPMFC P1, P2, P3, A, B, C, D
ThisDrawing.Utility.Prompt "空间平面方程: Ax+By+Cz+D=0." & vbCrLf
ThisDrawing.Utility.Prompt "A=" & A & vbCrLf
ThisDrawing.Utility.Prompt "B=" & B & vbCrLf
ThisDrawing.Utility.Prompt "C=" & C & vbCrLf
ThisDrawing.Utility.Prompt "D=" & D & vbCrLf
End Sub
[本日志由 田草 于 2007-04-01 01:31 PM 编辑]
|
tiancao1001 于 2007-04-08 11:38 PM 发表评论:
z=(z2-z1)t+z2
发表评论 - 不要忘了输入验证码哦! |