twood1702 发表于 2022-7-6 17:10:33

逆正弦GRRRR

我有个问题。我需要在lisp中输入反正弦。我试过asin,asine,Arcin,Arcine。。。。。。这方面的实际输入是什么,或者你甚至可以这样做。我的数学方程是
 
2 X反正弦(9\2r)=旋转度
 
在lisp中(setq deg(*(反正弦(/(宽度)(*2半径)))2))
 
用什么代替反正弦?

PS_Port 发表于 2022-7-6 17:18:30


;;; arcsine (inverse sine) accepts an argument in the range
;;; -1.0 to 1.0 inclusive, and returns an angle in radians in
;;; the range (-pi/2) to (pi/2) inclusive.
(defun asin (z /)
(atan z (sqrt (- 1.0 (* z z))))
)

twood1702 发表于 2022-7-6 17:23:37

没有workey。。。。或者只有我。
这是我现在放进去的
 
我输入5784作为半径
宽度为108
 
(defun c:rpark ()
(defun asin (z /)
(atan z (sqrt (- 1.0 (* z z))))
)
(setq r1 (getreal "\nEnter radius of arc in inches: "))
(setq w1 (getreal "\nEnter width of parking spaces in inches: "))
(setq deg (* (asin (/ w1 (* 2 r1)))2))
)
 
运行此函数时,返回0.0186725
 
我的手工数学(可能也很粗略:D)
r1*2=11568
w1\11568=。009336
的反正弦。009336 = 0.53
0.53 * 2 = 1.07
 
画出来后,我发现我的数学可能正确,(如果不正确,请告诉我:滚动:)
 
看来有点不对劲

PS_Port 发表于 2022-7-6 17:25:55

你能给我一个你想要完成的事情的草图或屏幕截图吗。。
看起来像自动停车场??

CarlB 发表于 2022-7-6 17:32:15

这是比尔·克莱默的一句话:
 
;Inverse Sine Arcsin(X) = Atn(X / Sqr(-X * X + 1))
;
(defun arcsin (sn)
(cond
    ((> (abs sn) 1.0) (prompt " Arc-sine error."))
    ((equal (abs sn) 1.0 0.000000001)
       (* sn (/ pi 2)))
    ((zerop sn)
       0.0)
    (t
       (atan (/ sn (sqrt (- 1 (* sn sn))))))))

twood1702 发表于 2022-7-6 17:40:00

 
 
这正是我想要做的。我想自动布局停车沿半径与设置宽度的海湾。你已经有东西了吗?对不起,我没有我正在尝试的屏幕截图。
 
这件事将考验我,因为在写lisp 6年后,我才刚刚回到写lisp。上次做结构图的时候我正在做。现在是建筑,所以我有了新的需求。

twood1702 发表于 2022-7-6 17:43:16

(defun c:rpark ()
(defun arcsin (sn)
(cond
    ((> (abs sn) 1.0) (prompt " Arc-sine error."))
    ((equal (abs sn) 1.0 0.000000001)
       (* sn (/ pi 2)))
    ((zerop sn)
       0.0)
    (t
       (atan (/ sn (sqrt (- 1 (* sn sn))))))))
(setq r1 (getreal "\nEnter radius of arc in inches: "))
(setq w1 (getreal "\nEnter width of parking spaces in inches: "))
(setq deg (* (arcsin (/ w1 (* 2 r1)))2))
)
 
与之前相同0.0186725。。。。。。。。。我一定不明白什么。。。。。反正弦和反正弦是一回事,对吗?当使用5784和108时,我需要达到的数字应该达到1.07度旋转。
 
 
我很沮丧。我已经在这一整天了!!!

PS_Port 发表于 2022-7-6 17:50:06

对不起,我没有东西,
只是一条漫长的路。。
试试CarlB,让我们知道进展如何,

CarlB 发表于 2022-7-6 17:54:44

Lisp使用弧度表示的角度。若你们想要以度为单位的答案,乘以180/pi,你们就得到了。

PS_Port 发表于 2022-7-6 17:59:43

你为什么要把半径加倍。。
 
半径基本上是斜边?
页: [1] 2
查看完整版本: 逆正弦GRRRR