Given two lines, create two tangent arcs that connect them, with the connections beeing tangent too.

Given two lines, create two tangent arcs that connect them, with the connections beeing tangent too.

aitorm
Advocate Advocate
6,870 Views
54 Replies
Message 1 of 55

Given two lines, create two tangent arcs that connect them, with the connections beeing tangent too.

aitorm
Advocate
Advocate

Hi there!

 

I usually face this situation where I need to connect two lines with a curve and I don't like the blend command because it is not a polyline and I don't like to transform a spline to a polyline because it is not accurate and simple.

 

The best would be to create two curves, connected to each other and the two lines and that are tangent to each other and to the lines.

 

Do you think it is possible to create a Lisp for that? I couldn't even imagine how to start. Thank you so much

Accepted solutions (1)
6,871 Views
54 Replies
Replies (54)
Message 41 of 55

Kent1Cooper
Consultant
Consultant

@john.uhden wrote:

.... I don't see why the lines segments have to end where they are. ....


I assumed that from the original Message and much of the follow-up, but maybe that's not a requirement.  But if it's not, the infinity of the possible solutions increases significantly.

Kent Cooper, AIA
0 Likes
Message 42 of 55

john.uhden
Mentor
Mentor

@Kent1Cooper 

1st - How does one increase infinity?

2nd - I thought a 3-point circle with two tangents would be a piece of cake for your (command) skills.

 

If the OP is trying to draw a compound curve, the US has standards for geometric roadway design that are straight forward.  I'd wager maybe even I could put that to music, maybe.  I mean I know how to draw one, but have never tried programming one.  It's not worth it because the radii and offsets vary depending on things like design speed and the  type and size of the turning vehicle.

John F. Uhden

0 Likes
Message 43 of 55

Sea-Haven
Mentor
Mentor

That is why I suggested there is various options to the answer to the question, a rad1 rad2 answer is pretty straight forward,  rad1 10, rad2 20. Perhaps code by Leeminardi with known values.

0 Likes
Message 44 of 55

Kent1Cooper
Consultant
Consultant

@john.uhden wrote:

1st - How does one increase infinity? ....


I expected you to have an issue with that.  But in fact, mathematicians do talk about >infinities of different sizes<.

Kent Cooper, AIA
0 Likes
Message 45 of 55

Sea-Haven
Mentor
Mentor

Leeminardi if you look at a two arcs and add a arc between there is 4 solutions, a old civil package solved this by picking a point near the center of the new arc can then look at a geometry solution. 

SeaHaven_0-1648081136332.png

 

0 Likes
Message 46 of 55

ВeekeeCZ
Consultant
Consultant

@leeminardi 

 

thank you very much for your effort. I have tried... but, it is a bit beyond my acceptable level of complexity. 

 

But here's my homework. I cheated a bit using the TTR circle command... but looks quite good so far. It's not finished yet, but the circle-circle relation seems reliable. Circle-Line somehow works but is unstable - ttr pick point (one or another) is possibly wrong. It would require more research. Line-Line is left behind for now. 

0 Likes
Message 47 of 55

leeminardi
Mentor
Mentor

@Sea-Haven there are actually up to 8 solutions of an arc of a given radius being tangent to 2 existing arcs.  The circle Tangent Tangent radius option provides a nice approach for getting the one you want.

leeminardi_0-1648230514282.png

As I understood the OP's original post based on what he asked for and the parametrically constrained solution he posted was that each of the two arcs generated had to be tangent to each other and one of the lines AT THE LINE's END POINT.  As noted, there is an infinite number of potential solutions. I experimented a bit with the code I posted how the "smooth" number affected the ratio and absolute values of the two arcs.  It lead me to the conclusion that picking a radius or a ratio is problematic and I should settle for a vague smoothness factor and more experimentation. 

 

lee.minardi
Message 48 of 55

leeminardi
Mentor
Mentor

@ВeekeeCZ 

1. regarding a process for finding the intersection of two circles closest to a bias point the closed form solution @john.uhden posted may be better. For me, using vector algebra is more intuitive.   I wanted to compare my results with John's for case where the two circles may be on different planes.  You would need to translate the circle center coordinates for the circle not on the world XY plane provided  by ssget to world coordinates first. DO you know the format of the trans command to do that?   

Regarding the complexity of the numerical solution I think its fairly straightforward once you knw a few basic rules of vector algebra and the use of mapcar to implement them.  I was thinking of putting together a few tips on working with vectors and lisp for solving 2D and 3D geometry problems.  BTW, I'm still struggling with "lambderizing" my code (that's Boston speak for using the lambda function).

 

2. I tried out your GRREAD-TTR program.  It is not clear to me how to use it.  What "objects" should be selected at the prompt? I assumed two circles or two arcs.  In both cases I got a circle that would be the result if I had just used circle TTR.  I could not get any dynamic action that I thought grread would provide.  

lee.minardi
Message 49 of 55

ВeekeeCZ
Consultant
Consultant

As it seems, it works great just under ACAD 2022 - see HERE . It does not in 2020 for some reason. 

It's just a visual TTR with R driven by a mouse movement with the handling of extremes. As you could see, it works quite well for circles, other object combinations not yet.

Sorry, not versed with advanced usage of trans.

 

Message 50 of 55

ВeekeeCZ
Consultant
Consultant

Another video for you HERE 

Just quickly modified for grread. And again, for 2022 only.

If you rewrite (command "pline") to (entmake), it could work in 2020 too.

 

Message 51 of 55

leeminardi
Mentor
Mentor

I am using AutoCAD 2022.  Object tangent is active when I give the GA command.  After picking the second circle a circle is added and then when I slowly moving the cursor I get an error message as seen in this dialog.

 

Command: GA
Pick first object:
Pick second object:
D: 3.10,   R: 8.72
D: 3.10,   R: 8.72
D: 3.10,   R: 8.72
D: 3.09,   R: 8.76
No found for specified point.
Requires a TAN object-snap and selection of Circle, Arc, or Line.
; error: Function cancelled
Specify point on object for first tangent of circle: *Cancel*

 

 

lee.minardi
Message 52 of 55

ВeekeeCZ
Consultant
Consultant

I got the same error in 2020. I have 2 different 2022, both are good.

I'll take a look later.

Message 53 of 55

john.uhden
Mentor
Mentor

@leeminardi 

I'm pretty sure my function has no regard for circles in different planes.  It was originally developed c. 1997 for my swimming pool liner people.  Though the pools are 3D, the location points are developed in 2D using 3D distances.  Remember that each panel will be some amoeba or trapezoidal shape on a flat plane and are cut from a roll of vinyl.

Grread is very special as it can not only interpret keystrokes (incl. Esc) but also every movement of your pointer.  Combined with nentselp it can pick up nested entities without hitting a mouse button.  F'rinstance, my LABEL_IT program highlights the endpoints of a nested polyline segment (with what I call glyphs) before you've made a pick so that when you do make a pick you can be sure what you're picking.  It's built so that I can Esc all I want and never lose control, well, until you're back at the beginning, but it always exits cleanly.  Interpreting menu picks is allegedly possible but it has always stumped me.

John F. Uhden

Message 54 of 55

john.uhden
Mentor
Mentor

@leeminardi 

I still don't see why the OP is wanting to create a compound curve without any regard for geometric design standards.

Then again, he may be designing decorative shapes out of metal rods and the endpoints have to be held for length reasons.  I had sort of a similar experience writing code for Carpenter Decorating years ago.

John F. Uhden

Message 55 of 55

aitorm
Advocate
Advocate

Hi again. Yes, it is important for the original lines to stay as they are. I understand radius ratio may not be the best input as it can vary a lot between very different scenarios.

 

As @john.uhden says, I am not looking for something very accurate this time, but I think it would be useful if it is as precise as posible.

 

I am very grateful for your passion and work on this topic and thank you so much for what is already done. 👏

 

Regards

0 Likes