本帖最后由 cchessbd 于 2022-10-15 23:20 编辑
经过仔细核对,楼主的函数有误。(atan y x) 参数用反了。幸亏我发现了这个错误!下面贴出autocad 2006自带的atan函数英文说明。
Returns the arctangent of a number in radians (atan num1 [num2]) Arguments num1 A number. num2 A number. Return Values The arctangent of num1, in radians, if only num1 is supplied. If you supply both num1 and num2 arguments, atan returns the arctangent of num1/num2, in radians. If num2 is zero, it returns an angle of plus or minus 1.570796 radians (+90 degrees or –90 degrees), depending on the sign of num1. The range of angles returned is −pi/2 to +pi/2 radians. Examples Command: (atan 1) 0.785398 Command: (atan 1.0) 0.785398 Command: (atan 0.5) 0.463648 Command: (atan 1.0) 0.785398 Command: (atan -1.0) -0.785398 Command: (atan 2.0 3.0) 0.588003 Command: (atan 2.0 -3.0) 2.55359 Command: (atan 1.0 0.0) 1.5708
将y x参数改过来后,实际上得到的是极坐标下与x轴夹角的角度。极坐标下的方位角有更简单的函数。
而且与地勘的方位角是2个概念,因为地勘是以北向为轴。
好了,不多说了,我还是再去搬砖吧,因为刚刚做了几十个错的地勘方位角。。。
|