Grasshopper

algorithmic modeling for Rhino

Does anyone understands Catmull-Rom interpolation?

I've managed to do an implementation of Catmull-Rom splines using Bezier Spans, even though I don't completly understand the math involved.

My objective was to be able to constrain the curve to avoid the overshooting that the native interpolate occasionally does. I was able to constrain the max distance from the curve to the control polygon controlling the length of the vectors.

The problem is I don't really know how to resolve the start and end segments. I put together a hack but I'm a bit unsure about it.

Also I would like some critique on the definition itself.

Views: 2720

Attachments:

Replies to This Discussion

BTW: Interesting thread where the Master talks and explains things:

https://bytes.com/topic/c-sharp/answers/583291-difference-between-p...

You've just sent me on a reading spiral of c# stuff by Jon Skeet...

Heavy stuff.

Ok I think I got it - if I declare the variables as public, I can just use them in the methods without having to pass them. 

Thanks for all the tips. Still a lot to learn...

Jon Skeet, John Sharp, J/B Albahari = The 3 (4 actually) top dogs on C# matters.

BTW: Say that you want to do this type of recursion:

The usage of public variables yields a far neater code (see Fold Method) than using locals and passing them to Methods in locomotive like lines:

I'm probably missing something but wouldn't a while loop instead of recursion do the same thing? 

Here's a task for you during the long winter nights (or the short summer ones):

Replace recursion with while/do and discover the truth out there.

Attachments:

I can't be sure because of the random nature of the algorithm, but it seems to be working without recursion...

Attachments:

Recursion is very frustrating, if you do something wrong you risk an endless loop... Anyway, I've done an interesting recursive thing, used your tips. Check it out:

Attachments:

Recursion is like riding a superbike: avoid if there's some issue with the brakes (or you like hospital food/mortuary).

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