Grasshopper

generative modeling for Rhino

Hello,

I know it's a really silly question, but...how can I translate the crv cp component (closest point on a curve) in C#? I found the ClosestPoint metod but it returns me doubles, I need the point exactly as the component. 

I'm trying to code it because I want to keep the canvas as clean as possible.

I tried also the ClosestPoints method but I didn't understand yet the "IEnumerable" thing and right now I have no time to understand it.

 

Thank you,

bye

Tags: attractor, c#, closest, curve, point

Views: 189

Reply to This

Replies to This Discussion

Hi Andrea,

 

IEnumerable is an interface (all interfaces in the .NET framework start with upper case I). An interface is basically an agreement that a certain class makes. When a class implements IEnumerable it must provide certain functions. Practically all classes in .NET that represent some sort of data list (Array, ArrayList, List(Of T), etc. etc.) implement IEnumerable which means you can use a For...Each loop for iterate over all of them.

 

The difference between classes and interfaces is very important. If you don't understand it, you'll run into the same problems over and over again.

 

The ClosestPoint method returns curve parameters. If you want the coordinate at that specific curve parameter, you need to use Curve.PointAt()

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thank you David, for the explantion.

Yes I know I have to understand it, but at the moment I can't even find time to sleep...

 

Curve parameters! It was so obvious! I will try it right now.

thank you again, 

bye

 

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2013   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service