Tangent Arc Between Two Non-Joining Lines/Curves

Tangent Arc Between Two Non-Joining Lines/Curves

willjbird
Contributor Contributor
2,282 Views
8 Replies
Message 1 of 9

Tangent Arc Between Two Non-Joining Lines/Curves

willjbird
Contributor
Contributor

Hi all,

 

I'm trying to replicate a method from the DesignScript/Dynamo library using purely the Revit API. The method is:

Arc.ByStartEndAndTangencies(point1, line1Vector, point2, line2Vector)

 

As the name suggests, it draws an arc/curve between two non-joined non-parallel lines at a tangent. E.g.:

willjbird_0-1681776574798.png

 

 

I've tried myself many times but it is a bit past my knowledge. Any help is appreciated.

 

Thanks

2,283 Views
8 Replies
Replies (8)
Message 2 of 9

jeremy_tammik
Alumni
Alumni

The curve between the two red dots that you show in the image does not look like a circular arc to me. It looks as if its curvature varies from the left to the upper right.I also doubt that it is mathematically possible to create an arc between arbitrary end points with predefined fixed tangents. It is probably possible by combining an arc and a straight line segment, for instance, though. That said, afaik, Dynamo is completely open source, so you should be able to research how Dynamo calculates this solution and transfers it into the Revit model just by looking at the right piece of Dynamo source code. Please let us know what you find out. Thank you!

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 9

willjbird
Contributor
Contributor

Hi Jeremy

 

Thanks for the reply. This particular node is in the Autodesk DesignScript library and as far as I'm aware is unfortunately not open source. If you are aware of otherwise could you please let me know.

0 Likes
Message 4 of 9

RPTHOMAS108
Mentor
Mentor

It is a geometrical problem quite easy to solve in many different ways. Sketching out the problem may help you but ultimately to get a perfect arc you can only use either point 'A' or 'B' below, as they are shown in your sketch the end points don't compliment one another to form an arc.

 

Find intersection of lines and bisect the angle is a good starting point (can use an unbound line in direction 'v3')

Then you can either find 'R' and 'Hyp' via trigonometry (since you know 'Adj' and 'a/2') or find centre of arc via intersection between perpendicular line to original from A with unbound line in direction 'v3'.

 

There is a similar problem where 'R' is known and you want to form an arc of radius 'R' between two lines. For your case  however either point 'A' or point 'B' dictate 'R' and are only compatible if they are both the same distance from the intersection of the lines.

 

RPTHOMAS108_0-1681855746385.png

 

0 Likes
Message 5 of 9

willjbird
Contributor
Contributor

Thanks, I'll look into this.

 

I guess I said arc because easy for me to describe, I am wanting to duplicate that exact functionality of that node. I do notice that is is not an arc, more of an ellipse I suppose?

0 Likes
Message 6 of 9

RPTHOMAS108
Mentor
Mentor

That looks like some form of spline such as Hermite spline with end tangents.

 

Looks exponential not elliptical.

 

When you pick it what does it say it is?

0 Likes
Message 7 of 9

willjbird
Contributor
Contributor

It appears the Dynamo node is generating two Arcs: 

willjbird_0-1681858698893.png

[0] Arc(Normal = Vector(X = 0.000, Y = 0.000, Z = 1.000, Length = 1.000), CenterPoint = Point(X = 304.800, Y = 120.873, Z = 0.000), Radius = 120.873, StartAngle = 270.000, SweepAngle = 28.966)
[1] Arc(Normal = Vector(X = 0.000, Y = 0.000, Z = 1.000, Length = 1.000), CenterPoint = Point(X = 331.443, Y = 72.741, Z = 0.000), Radius = 65.859, StartAngle = 10.305, SweepAngle = 50.729)

0 Likes
Message 8 of 9

jeremy_tammik
Alumni
Alumni

Yes. As I said above, one possible solution would be to lengthen one of the two lines that @RPTHOMAS108  describes to achieve equidistant points A and B. I think that is a simple and clean solution. A fillet, so to speak. Another solution might be to calculate two arcs that join tangentially somewhere in the middle, like the DesignScript solution. you hint at  So, this can be solved with a spline, or an arc and a line, or two arcs. There are certainly other possibilities as well. Your choice. Looking forward to see your solution. Thank you!

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 9 of 9

jeremy_tammik
Alumni
Alumni

Here is some inspiration:

  

  

So, given two lines La and Lb and their endpoints A and B. Determine two circles Ca and Cb that are tangent to the lines in their respective endpoints. Vary their diameters until they intersect. Et voila, you have your two arc segments.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes