# Thread: Clothoid drawing revised lisp

1. ## Clothoid drawing revised lisp

Registered forum members do not see this ad.

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

2. Originally Posted by jbreard
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:
Code:
`(* -1 a)`

3. Originally Posted by jbreard
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':
Code:
`(- a)`

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

5. Originally Posted by jbreard
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 ?
Code:
`(mapcar '(lambda ( l ) (f l a)) lst)`

6. Originally Posted by jbreard
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

7. Registered forum members do not see this ad.

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

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts