twood1702 Posted November 11, 2008 Posted November 11, 2008 I am having an issue. I need to input inverse sine in lisp. I have tries asin, asine, arcsin, arcsine...... What is the actual input for this or can you even do this. my mathmatic equation is 2 X inverse sine (9\2r)= degrees of rotation in lisp (setq deg (* (inverse sine (/ (width) (* 2 radius))) 2)) What do I put instead of the inverse sine? Quote
PS_Port Posted November 11, 2008 Posted November 11, 2008 ;;; 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)))) ) Quote
twood1702 Posted November 11, 2008 Author Posted November 11, 2008 no workey.... or just me. here is what I put in now I am entering 5784 for radius 108 for width (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)) ) When running this it returns 0.0186725 my hand math (which may be sketchy too:D ) r1 * 2 = 11568 w1 \ 11568 = .009336 arcsine of .009336 = 0.53 0.53 * 2 = 1.07 Drawing this out I have found my math to maybe correct, (please let me know if not:roll: ) soooo something seems to be amiss Quote
PS_Port Posted November 11, 2008 Posted November 11, 2008 Can you give a sketch or screen shot of what you are trying to accomplish.. looks like automatic parking bay setout ?? Quote
CarlB Posted November 11, 2008 Posted November 11, 2008 Here's one from Bill Kramer: ;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)))))))) Quote
twood1702 Posted November 11, 2008 Author Posted November 11, 2008 Can you give a sketch or screen shot of what you are trying to accomplish..looks like automatic parking bay setout ?? That is exactly what I am trying to do. I want to automatically layout parking along a radius with a set width for the bay. Do you have something already? Sorry I don't have a screen shot of what I am trying. This thing is going to test me, as I am just returning to writing lisp after a 6 year layoff from writing them. I was doing structural drawings when I was last at it. Now architectural, so I have new needs. Quote
twood1702 Posted November 11, 2008 Author Posted November 11, 2008 (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)) ) same as before 0.0186725.........I must not be understanding something.....arcsine and inverse sine are the same thing right? The number I need to get to when using the 5784 and 108 should come up to 1.07 degrees of rotation. I'm so frustrated. I have been at this all day!!! Quote
PS_Port Posted November 11, 2008 Posted November 11, 2008 Sorry twood I dont have something, just the long hand way.. try CarlB's let us know how it goes, Quote
CarlB Posted November 11, 2008 Posted November 11, 2008 Lisp uses angles in radians. If you want answer in degrees, multiply by 180/pi and you'll have it. Quote
PS_Port Posted November 12, 2008 Posted November 12, 2008 Why are you doubling the radius.. The radius is basically the hypotenuse ? Quote
twood1702 Posted November 12, 2008 Author Posted November 12, 2008 Yeah I knew that! Sorry, not a math genius here. I just didn't know where to go after what I had started. Thanks for all the help!!!! Quote
twood1702 Posted November 14, 2008 Author Posted November 14, 2008 ahhh got it fianlly on Wednesday! If anyone is interrested in having something like this, let me know and I can give you the code. It's very nice to layout parking along a radius at user set widths of parking! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.