我简单的举个例子下面是一个代码: Public Function GetPointAR(ByVal ptBase As Variant, ByVal angle As Double, ByVal Length As Double) As Variant
Dim pt(0 To 2) As Double pt(0) = ptBase(0) + Length * Cos(angle) pt(1) = ptBase(1) + Length * Sin(angle) pt(2) = ptBase(2) GetPointAR = pt End Function '这是一个得到和已知点偏移一定角度和距离的点的自定义函数 Dim yuanxing(0 To 2) As Double Dim point As Variant Dim point1 As Variant Dim AddLineXY As AcadLine yuanxing(0 )=0:yuanxing(1 )=0:yuanxing(2 )=0 point=GetPointAR(yuanxing,3.14-50*3.14/180,5) '从圆心用函数得到偏移-50度距离5的一个点 point1=GetPointAR(yuanxing,-50*3.14/180,5) '从圆心用函数得到偏移130度距离5的一个点
Set AddLineXY = ThisDrawing.ModelSpace.AddLine(point, point1) '用得到的两个点画一条直线
画完之后 我发现 我画的这条直线 居然不过
圆心的那个点 有误差
???? 请问高手们 有没有遇到过这中情况 ,是我的算法有错误?还有因为
计算弧度引入∏(3.14)的问题? 怎么解决 ? 谢谢
了!!! |