Jump to content

Recommended Posts

Posted

Hello,

 

Because there is no clothoid function in AutoCAD I have been using a seperate C++ program for a while now. This is however not exactly perfect because it still requires a _lot_ of user action. So I decided to try and convert this program to LISP.

 

For those that do not know the clothoid: it's a transition curve used in road and rail design to go from a straight to a bend. Because of the geometry of the curve it reduces sidewards accelleration along with a few other things and is essential for high speed transport.

 

The only real problem I am having at the moment is converting the clothoid's formula to something usable in AutoLISP. At the moment I have the following formulae:

X coordinate: attachment 1

Y coordinate: attachment 2

 

Where 'a' is the 'steepness' of the curve which is defined by an earlier calculation and x the progression along the curve.

 

These formulae are entered into the mathematical software maple, which can convert them directly to string, C, Fortran, Java, MATLAB and Visual Basic format.

 

Is there any way I can use these formulae without having to spend hours converting them to the weird LISP format and probably still not having them work? I hardly have any knowledge about the VB language but would it be possible to use that format in LISP code somehow?

clothoid x.jpg

clothoid y.jpg

Posted

Hi Monkey,

 

How about something like this for the XCoord formula:

 

(defun fact (x)
 (if (< 0 x)
   (* x (fact (1- x))) 1))

(defun XCoord (x a / n i q)
 (setq n 0. i -1 q (/ x (float a)))
 
 (repeat 8
   (setq n
     (+ n
        (* (/ (expt q (1+ (* 4 (setq i (1+ i)))))
              (* (1+ (* 4 i)) (expt 2 (* 2 i)) (fact (* 2 i))))

           (expt -1 i)))))

 (* a n))

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