algorithmic modeling for Rhino
I am doing some work which requires CurveCurveIntersection testing. I am intersecting a 600 millimeter straight line with a long polycurve. They are both planar and in the same plane. The apparent intersection point cannot be detected by scripting both in vb and python. I tried to tune my units and tolerances to exceptionally high and it does not make any difference. I really don't know what's happening under the hood. Could anyone tell me the underlying mechanism of this testing and is there a way to deal with it?
A million thanks!!!
I have attached the screenshots below.
Tags:
Can you post both curves?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
David,
Thank you very much for your reply!
I have posted both curves here. The initial deviation of the curves are 1mm(the largest gap that I can accept). In later experiment, I also found some intersected curves with 2mm initial deviation and cannot be detected by the curvecurveintersection method!
David,
I post another pair of curves here for demo. The initial deviation is as large as 1cm. But it simply fails to detect the intersection.
If I select these curves in Rhino and run the _Intersect command, it also doesn't find the intersection. I noticed your tolerances were set to 1e-25. That is an insanely accurate demand that will screw with a lot of algorithms.
If I bring the tolerance back to a reasonable Absolute=0.01, Relative=0.1, Angle=0.1 then the intersection works again in both Rhino and Grasshopper (Grasshopper uses the current Document Tolerances whenever it needs to).
Did you set these tolerances yourself? If so, I think it means you misunderstand what the tolerance settings are for.
A tolerance is not an indication of how accurate Rhino is. Rhino is always as accurate as it can be within the double-precision floating point range. If it isn't, that's a bug. Tolerance is used to indicate a fuzzy area when no accuracy is possible or where complete accuracy would be insanity.
For example, if you run an intersection on two curves in 3D space, the chances that they really intersect is vanishingly small. It is far more likely that they approach each other to within some small distance, then depart again. In 2D, an intersection is guaranteed, but not in 3D. So when we figure out the curves approach each other to within 0.1 mm, and the tolerance of the document is set to 0.5 mm, we assume an intersection was implied. If the tolerance was set to 0.05 mm, we assume an intersection was not implied. Since the result of a curve/curve intersection is a single coordinate, we can make it as accurate as we want.
If on the other hand you compute a surface/surface intersection, the result is a curve. And this curve has been simplified to within tolerance of the real intersection. We do this because the real intersection has so incredibly many points and such a high degree, that it would be a pointless object to have in your model.
When you set your tolerance to something as small as 1e-25, Rhino will run into all sorts of binary rounding problems.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
We have a Wiki page that explains a bit about tolerances, though it's aimed at modeling, not programming:
http://wiki.mcneel.com/rhino/faqtolerances
--
David Rutten
david@mcneel.com
Poprad, Slovakia
David,
You are right! I misunderstood the meaning of tolerance settings. I brought the tolerance back to normal and it works perfectly with my project which relies heavily on intersection test. I read through the article on the Wiki page and it's clairvoyant!
Thank you!
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by