Grasshopper

algorithmic modeling for Rhino

I want to get the points on two curves which have the shortest distance to the other curve similar to _CrvDeviation in Rhino. I use a C# Component with the "Curve.GetDistancesBetweenCurves" Method from Rhino.Common. Sometimes it works, sometimes it leads to obviously wrong points way off the position where they should be. Extending the curve-ends by a (very) large value sometimes helps solving it but sometimes it wont. Is this Method unstable or do I have to fulfil some special conditions to make it work properly? I reduced the complexity of my curves already so I have one vertical Line and a CP-Curve with evenly spaced CPs. The Script is as follows:

    double max_a, max_b, max_d;
    double min_a, min_b, min_d;
    Point3d crvEvlZ;
    double tol = 0.001;
    bool rc = Curve.GetDistancesBetweenCurves(CurveA, LineZ, tol,
      out max_d,
      out max_a,
      out max_b,
      out min_d,
      out min_a,
      out min_b);
    crvEvlZ = LineZ.PointAt(min_b);
    ZPt= crvEvlZ;

 

Because I need the closest point on the vertical line (LineZ) i only return the min_b value to the Output ZPt. Any help is greatly appreciated.

curves_deviation_problem.gh

Curve_Deviation_Problem.3dm

Views: 579

Replies to This Discussion

I need to dig into this a bit more, but the function is returning false so at least you know it is failing.

Hi Jan-Ruben,

when the "Curve.GetDistancesBetweenCurves" method doesn't work you can also use the "Curve.ClosestPoints" method.

But this method is just working in Rhino 5.

This shouldn't be a problem for you, as I can see you already using Rhino 5.

Hope this is still useful for you.

Best,

Martin.

Attachments:

Hi Martin,

Perfect. Thats the Method I was actually looking for, but have overseen it because I was searching for "deviation" and such. Thanks for the tip.

I was worried if the biggest distance was right.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service