Grasshopper

algorithmic modeling for Rhino

How to find the tangent point on a planar curve throught another point in the same plane?

Hi,

I have solved this maths before using recursion with bi-section inside C# component inside grasshopper, but the speed seem to be quite slow if I want to yield a good result.

It seems that Rhino could snap to the tangent point while modelling. I looked through the help doc on rhinocommon but could find anything helpful.

Is there a powerful function out there which could solve this problem? or, Is there a cleverer way to solve this math in a more mathmatical way?(with less guessing, thus more suffienct)

 

Thanks,

-Jerome

Views: 2764

Replies to This Discussion

Nope. AFIAK recursion is the only way, and if it was too slow for you, then I would suggest revisiting.  I remember putting together a function that did this and tracked mouse movements in Rhino so you could get realtime feedback.  There was no lag and the response was pretty smooth, so I'd imagine a faster result is certainly possible.

 

You should be able to use some pretty light math to get this done. Just create a line from the tangent at a given point, then test the distance between the point and that infinite line (I believe there is a Rhino function that does this, although the math for it shouldn't be too outrageous). As that distance approaches zero, you've got something that's closer to intersecting. After that, its just a matter of structuring the recursion in a good manner.

 

I'll see if I can find where I did this, but I'm not really recalling many details about it other than what I mentioned above.

Thanks, Damien

Yeah, your suggestion of combining the mouse movements to find the answer is a good way to go, I will try it these days. However, what I really what to achieve is the fully automatic finding without any human interference.

Damien, I don' quite understand the next process you mentioned. How to detect "distance approaches zero"? Maybe this would be another kind of robust calculations that would take time. or, Maybe I just misunderstand your method.

 

Thanks,

-Jerome

In this definition, I sample a line at some (t) parameter and find the Tangent vector (vector1) of the curve at that parameter.  A vector (vector2) is created from this point on the curve to the point you want to draw the tangent line.  Both vector1 and vector2 are unitized.  I used Galapagos to minimize the distance between the these two unitized vector.   

 

This took less than 15 seconds to find.  I suppose this method needs tweaking if there are more than one possible tangential points on the curve.

 

Hope this helps.

 

 

Thanks, Tuan

Galapagos is a way to go, but it seems that it needs a lot of tweaking before it could yeild a fast result. The first population in galapagos is just some random seed and this will consume a lot of time. Bi-section, however, it goes toward the answer from the beginning to the end. It took bi-secion less than 0.1 second to find the answer, but for me, too long. More mathmatical may be a better idea than these robust ways.

Thanks!

-Jerome

Hello Tuan;

Can you help me about my problem.

Firstly, i dont know about galapagos.

Secondly, my challeng is with with a curve that i cannot assur if it is planar and [n] point(s) on it with non regular intervals.

I want to generate a perpendicualr plane to the cure OR tangent vector with respect to curve.

I mean i need a tip for my GH definition in wich the only variables are points and main curvs in order to achieve to goal above.

Thanks & Regards

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service