Grasshopper

algorithmic modeling for Rhino

Hi everybody,

im looking for a test condition if a point is on a curve.
I could find the ReferencesCurve Method from the GH_Point Class in the SDK but this doesn´t work...

any ideas?

thanks,

Christoph

Views: 10712

Replies to This Discussion

Hi Christoph,

nice to see you again!
The GH_Point class is a Grasshopper point, which is a container for points and not the "real" point.
This is the content of a scripting component: private void RunScript(Curve x, Point3d y, ref object A)
{

  //We only use this method if there is a curve
  if(x != null)
  {
    //"t" is the parameter on the curve
    double t;

    //A is assigned true if closest point to y is within tolerance,
    //otherwise it will be assigned false, and t will not be calculated
    A = x.GetClosestPoint(y, out t, doc.ModelAbsoluteTolerance);
  }

}


I hope this is helpful,

- Giulio
Attachments:
Thank you!!
this helps a lot,

Christoph

Hello Giulio,

I try to use the definition, but the outcome is null.

Any idea what might be going wrong?

Chris

Hi Chris

this is an updated component with upgraded code.
Now the GetClosestPoint() call in RhinoCommon changed to:

x.ClosestPoint(y, out t, doc.ModelAbsoluteTolerance)

The attached file also shows a Grasshopper-only approach to this.

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Attachments:

Thank you Giulio

hey Giulio , your component is for one cure. what about we have several curve and several point to test?

Grasshopper can handle several curves and several points with the same component. It's a question of how the data structure looks like. You can read the section on Data Trees to understand this better, inside the GH 101 Manual.

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