Grasshopper

algorithmic modeling for Rhino

I want to create Blend Surface component.

So I choose that 4 curves and blend curve for first step.

But as you can see, that "Blend Curve" method has "Direction(?)" or something.

Curve.DoDirectionsMatch(c1, c3);
Curve.DoDirectionsMatch(c2, c4);

Curve ref1 = Curve.CreateBlendCurve(c1, 0.5, true, BlendContinuity.Tangency, c3, 0.5, false, BlendContinuity.Tangency);
Curve ref2 = Curve.CreateBlendCurve(c2, 0.5, false, BlendContinuity.Tangency, c4, 0.5, true, BlendContinuity.Tangency);

That script is correct 50%. (Last picture)

You guys have any tip ?


Views: 2607

Replies to This Discussion

What if you compare distances between end-points to figure out whether or not to flip the curves?

                     curve A

    A0---------------------------A1

     

                                                                       curve B

                                                        B1--------------------------B0

You define distances:

  1. |A0 B0|
  2. |A0 B1|
  3. |A1 B0|
  4. |A1 B1|

And find the smallest one. Then, based on the number of the shortest distance:

  1. Flip A, Leave B
  2. Flip A, Flip B
  3. Leave A, Leave B
  4. Leave A, Flip B

A more advanced metric would be to create all 4 blends, then pick the one that is shortest. Maybe that works better for what you want, maybe not.

--

David Rutten

david@mcneel.com

Hi David ~ 

That's so nice !

Ah ! One more question.

"Line" has the "Flip" method and "Curve" has the "Reverse" method.

All those methods have same effect ? (Flip direction)

They are not entirely the same. When you flip a line, the line domain is still [0,1] as lines always use a [0,1] domain. However when you reverse a curve, the domain changes from [a,b] to [-b,-a]

--

David Rutten

david@mcneel.com

How can I do "Flip Curve" ?

Flip is only for the "Line" ..

You use Reverse on Curve. You just have to realize that the curve domain will be different before and after. If you want to keep the same domain, then you need to use:

Dim domain As Interval = crv.Domain

crv.Reverse()

crv.Domain = domain

--

David Rutten

david@mcneel.com

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