xkitty 发表于 2004-6-22 21:30:00

为何运行结果不是直线与圆弧相切

过三点 cp1 、cp2、 cp3作曲线,其中cp1 、cp2段为直线,cp2 、cp3段为圆弧,且圆弧与直线相切,有以下程序段:
sub test()
        Dim cp1(1), cp2(1), cp3(1) As Double
        Dim ang1 As Double, ang2 As Double, ang As Double
        Dim cp(5) As Double
       
        cp1(0) = pnts1(0): cp1(1) = pnts1(1)
        cp2(0) = pnts(0): cp2(1) = pnts(1)
        cp3(0) = mc(0) + d / 2 + m + r: cp3(1) = mc(1) + r * (1 - Cos(r0))
       
        cp(0) = cp1(0): cp(1) = cp1(1)
        cp(2) = cp2(0): cp(3) = cp2(1)
        cp(4) = cp3(0): cp(5) = cp3(1)
       
        ang1 = ThisDrawing.Utility.AngleFromXAxis(cp1, cp2)
ang2 = ThisDrawing.Utility.AngleFromXAxis(cp2, cp3)
ang = ang2 - ang1
Dim pl As AcadLWPolyline
Set pl = ThisDrawing.ModelSpace.AddLightWeightPolyline(cp)
pl.SetBulge 1, Tan(ang / 2)
end sub
程序段中, mc(0)        、 d 、m 、r、 mc(1) 、r0、pnts1(0)、pnts1(1)
pnts(0)、pnts(1)值已给出。为何运行结果不是直线与圆弧相切,而仅是直线段?
请大家帮忙看看!!

efan2000 发表于 2004-6-22 21:39:00

凸度的概念有错吧,它是弓高与半弦长的比值。

xkitty 发表于 2004-6-23 10:22:00

伊凡老师,凸度没错阿!我检查过了,可就是结果不正确,到底怎末回事呀??

雪山飞狐_lzh 发表于 2004-6-23 10:28:00

你看看3楼的链接
页: [1]
查看完整版本: 为何运行结果不是直线与圆弧相切