jbreard Posted June 27, 2012 Posted June 27, 2012 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 Quote
MSasu Posted June 27, 2012 Posted June 27, 2012 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) Quote
Lee Mac Posted June 27, 2012 Posted June 27, 2012 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) Quote
jbreard Posted June 27, 2012 Author Posted June 27, 2012 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 Quote
Lee Mac Posted June 28, 2012 Posted June 28, 2012 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) Quote
Brick_top Posted August 2, 2012 Posted August 2, 2012 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 Quote
nathanjh13 Posted January 14, 2013 Posted January 14, 2013 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 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.