How to manually construct a Nurbs curve / blend with g2

Hey guys!

I was trying to built a slightly different weighted curve blend tool in grasshopper. (think of apple typical blends, I saw at least five feature request for a parametric / reproducable blend :slight_smile:

While its easy to determine the position of the CVs while blending two first-degree curves, I couldn’t find the geometric definition of that second point if the curves are not straight lines themself.

Any hints anyone? :slight_smile:

The problem is that the number of ‘answers’ quickly goes to infinity. Also, Apple makes their blends through sheer brute-force-point pushing for days until it’s perfect, nothing so predictable as an ‘algorithm.’

yeah, I guess Apple doesn’t rely on some out of the box setting or an algorithm.

Anyway, not every 3D model has to have apple quality or maybe I’d just like to use my weights as a starting point.

Is there really no easy way to determin the position of those second points?

Another hack I am now thinking of would be to generate a BlendC and then move the CVs along the vector defined by themselves and the previous point in line.

Ok, it seem i still don’t understand how the geometry works.
I moved the CVs by a fraction of the vector of their prior neighbour, but I lost G2 gain. :frowning:

Yeah just moving one point, outside of trivial examples like they’re all in a line, will throw off G2, there’s a relationship between them…and lol that’s the extent of my knowledge on the subject, and probably a bit beyond that.

@TomTom if he is still around is a wealth of knowledge on the topic of curve and surface blending.

He developed and was supporting an add-on tool-kit for a while.

1 Like

Hi,

here is a repro which also contains a binary (.gha) for matching a curve onto another:

Just a couple of word on how that works.

Pos: P0 and P0’ need to be coincident (obviously)
Tan: P1’ must be on the tangent of (P0-P1). Moving on that tangent is what we call the factor. Where the factor 1 is located is up to you. You either make it the vector length of P0P1 or you divide the length of the curve-to-match by the amount of cps
Cur: Moving P2’ on the tangent of P0P1 does not change the curvature. You can use it to mody the factor as well (G2). If you rotate the tangent in 90 degrees (CrossProduct with P0P1 and Z axis), you need step for 1, calculate the curvature change (delta). Once you have that delta you do a simple ratio calculation to see how far you need to move in the normal direction to match up the curvature. Thats it.

Hope this helps

Hi Tom!
thanks for your response, very insightful!
I just played with the CV a bit and it seems like:

Moving P2’ on the tangent of P0P1 does not change the curvature. You can use it to mody the factor as well (G2). 

is only true, if P1 is not moved, right?

As long as you move P1, P2 or P1’ or P2’ in direction of the tangent (darker blue) you won’t change curvature.

This image is more precise:

Thanks for coming back at me!
However, by moving the points in rhino I could not reproduce your last statement:
Moving p1 along p0p1 in a g2 layout will break continuity.

Sorry, if I missing something here!

Then this means we are not talking about the thing. My plugin should prove that this works. It offers the option to provide a tangency factor and a curvature factor. They both are based on what I have said. Have you actually tried it?

If P0, P1 and P2 are colinear (on the same line) the curvature will be zero at P0.

:joy:

Displaying the curvature graph is very helpful to see what’s going on when manually moving CVs

Yes, thanks for your patience! Playing with the tool made your explanation clear to me. I tried to move p1 without touching p2, my bad.

I am still figuring out how to calculate the offset distance for the correction of p2’s location along the normal of p0p1.

I did have a look at the code:
Where are curvatureA and curvatureB0 / curvatureB1 measured? (In my case t is p0)

They are all measured at the location to match. ‘A’ refers to the curve to match against, and ‘B’ to the curve to match. ‘B0’ is before moving for one step, whereas ‘B1’ is after that. In other words, this is the curvature change or delta. After the delta is known for one step, you can compute the correct offset, due to its linear relationship.

2 Likes