本帖最后由 作者 于 2007-4-21 10:14:40 编辑
多谢楼上的大侠,您的图我看得不是很明白,我贴出自己勉强写出来的程序,运行结果基本达到要求,但t2处有一点问题,圆弧与t2p2直线的切点处总是无法正确连接好,有0.0000017间隙,但p3t1与t1处的切点却没有问题,百思不得其解,请各位帮忙看一看程序到底哪有问题,先谢谢了! Private Sub Fil() Dim Tmp As Variant Dim p1(0 To 2) As Double Dim p2(0 To 2) As Double Dim p3(0 To 2) As Double Dim pc(0 To 2) As Double Dim t1(0 To 2) As Double Dim t2(0 To 2) As Double Dim Angp1p2Radian As Double Dim Angp1p3Radian As Double Dim Angpct1Radian As Double Dim Angpct2Radian As Double Dim AngJJ1 As Double Dim AngJJ2 As Double Dim Dstp1pc As Double Dim Dstp1t1 As Double Dim Dstp1t2 As Double p1(0) = 5#: p1(1) = 45#: p1(2) = 0# p2(0) = 50#: p2(1) = 50#: p2(2) = 0# p3(0) = 0#: p3(1) = 0#: p3(2) = 0# 'p1到p2的角度 Angp1p2Radian = ThisDrawing.Utility.AngleFromXAxis(p1, p2) 'p1到p3的角度 Angp1p3Radian = ThisDrawing.Utility.AngleFromXAxis(p1, p3) '算出P2P1P3的角度的一半 AngJJ1 = ((3.1415926 * 2 - Angp1p3Radian + Angp1p2Radian) / 2) Dstp1pc = 1 / Sin(AngJJ1) * dRadius Dstp1t1 = Cos(AngJJ1) * Dstp1pc Dstp1t2 = Dstp1t1 AngJJ2 = Angp1p3Radian + AngJJ1 Tmp = ThisDrawing.Utility.PolarPoint(p1, AngJJ2, Dstp1pc) pc(0) = Tmp(0) pc(1) = Tmp(1) pc(2) = Tmp(2) Tmp = ThisDrawing.Utility.PolarPoint(p1, Angp1p3Radian, Dstp1t1) t1(0) = Tmp(0) t1(1) = Tmp(1) t1(2) = Tmp(2) Tmp = ThisDrawing.Utility.PolarPoint(p1, Angp1p2Radian, Dstp1t2) t2(0) = Tmp(0) t2(1) = Tmp(1) t2(2) = Tmp(2) Angpct1Radian = ThisDrawing.Utility.AngleFromXAxis(pc, t1) Angpct2Radian = ThisDrawing.Utility.AngleFromXAxis(pc, t2) Call ThisDrawing.ModelSpace.AddLine(p2, t2) Call ThisDrawing.ModelSpace.AddArc(pc, dRadius, Angpct2Radian, Angpct1Radian) Call ThisDrawing.ModelSpace.AddLine(p3, t1) End Sub
|