Jump to content

Recommended Posts

Posted

Dear all,

 

This is the last revision of a lisp I posted last week to draw clothoid curves.

 

The improvements are:

 

* Possibility to draw a clothoid tangent to an alignment (alignment must be a line or a 2 vertexes polyline but the lisp will tell you so). Be carefull that the pick point is important as it will define the alignment's side on which the clothoid will be drawn.

* Extended clothoid parameter imput. Now a clothoid can be define by a set of 2 parameters chosen between (length / Radius / Parameter A=sqrt(LR) / Angle of deviation)

* Possibility to extract the clothoid parameters once drawn

 

-> To draw a clothoid, use the "clotho" function

-> To extract clothoid parameters use the "clotho?" function

 

I hope this lisp will help some of you and entertain the others.

I also hope you could give me some feed back on the coding. As a baby programmer in lisp (and in any language for that matter) this would be very useful to me.

 

Finally, I have two small questions (among many more...) :

1. How do you get the negative of a number in lisp? I do it the hard way with

a-> (- 0 a) but this doesn't feel right.

2. I use a mapcar in the program with a 2 variable function, let's say f(l , a)

I have a n-list of values for l but my a stays the same. I created a n-list with only the value a to get it to work. Is there something simplier ?

 

Hope I wasn't too long.

 

Regards,

 

J.BREARD

Clothoid Plot-rev4.lsp

Posted
How do you get the negative of a number in lisp? I do it the hard way with

a-> (- 0 a) but this doesn't feel right.

That is correct, although I feel to be more natural like this:

(* -1 a)

Posted
1. How do you get the negative of a number in lisp? I do it the hard way with

a-> (- 0 a) but this doesn't feel right.

 

No need for the '0':

(- a)

Posted

Ok,

 

Thanks to you both. I have try both and will update my code. Guess I will go with the more concise.

 

As for my second question, I might reformulate after re-reading my post.

 

So I have a function f(l, a). I want to evaluate it on n couples of value where only the l value is changing namely (l1,a) (l2,a) (l3,a)...(ln,a)

 

I have the n-list (l1, l2, l3, ...., ln). In order to use mapcar I had to create as well a n-list (a, a, a....,a). Is there a way to still use mapcar and avoid the creation of the second list ?

 

Hope this is possible.

 

On another note, did someone try the lisps and if yes is it working fine with you ?

 

Regards,

 

J.BREARD

Posted
So I have a function f(l, a). I want to evaluate it on n couples of value where only the l value is changing namely (l1,a) (l2,a) (l3,a)...(ln,a)

 

I have the n-list (l1, l2, l3, ...., ln). In order to use mapcar I had to create as well a n-list (a, a, a....,a). Is there a way to still use mapcar and avoid the creation of the second list ?

 

(mapcar '(lambda ( l ) (f l a)) lst)

  • 1 month later...
Posted
Ok,

 

Thanks to you both. I have try both and will update my code. Guess I will go with the more concise.

 

As for my second question, I might reformulate after re-reading my post.

 

So I have a function f(l, a). I want to evaluate it on n couples of value where only the l value is changing namely (l1,a) (l2,a) (l3,a)...(ln,a)

 

I have the n-list (l1, l2, l3, ...., ln). In order to use mapcar I had to create as well a n-list (a, a, a....,a). Is there a way to still use mapcar and avoid the creation of the second list ?

 

Hope this is possible.

 

On another note, did someone try the lisps and if yes is it working fine with you ?

 

Regards,

 

J.BREARD

 

Hi, I tried your lisp but I don't think I understand how it works but it seems it draws the clothoid in relation to a line right? is it possible to draw it in relation to two lines?

 

I'm sorry if this is stupid, my math skills are pretty rudimentary

  • 5 months later...
Posted

I'm having no luck at all getting this to work. Or even load.

 

Can somebody post an example of what to type please just to make sure I'm doing it right.

Best

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