Jump to content

Recommended Posts

Posted

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?

Posted
 
;;; 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))))
)

Posted

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

Posted

Can you give a sketch or screen shot of what you are trying to accomplish..

looks like automatic parking bay setout ??

Posted

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))))))))

Posted
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?:shock: 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.

Posted

(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!!!

Posted

Sorry twood I dont have something,

just the long hand way..

try CarlB's let us know how it goes,

Posted

Lisp uses angles in radians. If you want answer in degrees, multiply by 180/pi and you'll have it.

Posted

Why are you doubling the radius..

 

The radius is basically the hypotenuse ?

Posted

Yeah I knew that!:P Sorry, not a math genius here. I just didn't know where to go after what I had started. Thanks for all the help!!!!

Posted

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!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...