last day (22 days later) » 

13:49
Hi, @J.M. I am sorry for disturbing you:)
Recently, I have a problem about the cubic B-spline interpolation. The detail shown as below:
Please refer to the "The NURBS Book" on page 371
My question is how to determine the D0 and Dn automatically? Rather than using tha author's methods.
About the author's method, I needs to specify the unit length vector by hand, which is not reasonable because I don't know that value.
In a paper, the author said the D0 and Dn could be estimated
Unfortunately, I cannot refer to/find any useful information about that estimation in literature 24 and 26.
14:07
Hi. Usually, in a spline interpolation, the end slopes are something that has to be given by the user.
In your case, they gave suggestions on how to determine an initial unit tangent vector.
You can fit either a parabola or a circle to those three points at the beginning and at the end, and determine the slope (and thus, the unit tangent vector) at the corresponding endpoints.
i.e. either an interpolating parabola, or a circumcircle.
Then, just follow their suggestion for the $\alpha$s.
(I'd personally go with the parabola; it's easier to compute.)
In fact, I have implemented that algorithm in Mathematica.
cubicSpline[pts_, endTangent_] :=
Module[{paras, knots, mat, len, n, aList, bList, cList, P1, Pn1, vec,
ctrlpts},
paras =
FoldList[Plus, 0, Normalize[(Norm /@ Differences[pts]), Total]] //
N;
len = Total[Norm /@ Differences[pts]] // N;
n = Length@pts - 1;
knots = ArrayPad[paras, 3, "Fixed"];
aList =
MapIndexed[BSplineBasis[{3, knots}, First@#2, #1] &,
paras[[2 ;; -2]]];
bList = MapIndexed[BSplineBasis[{3, knots}, First@#2 + 1, #1] &,
paras[[2 ;; -2]]];
cList = MapIndexed[BSplineBasis[{3, knots}, First@#2 + 2, #1] &,
pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}, {4, -2}, {5, -3}, {6, -2}};
cubicSpline[pts, {{1, 2}, {-1, 1}}]
(Unfortunately, my Mathematica is busy with something, so I can't run anything for now.)
I set the tangent vector to {{1, 2}, {-1, 1}} at the first and last end-points respectively.
You can easily check if your tangent vectors were reproduced: just differentiate your BSplineFunction and evaluate at the endpoints. Normalize if need be.
Yes, I have checked it yesterday.
14:16
@ShutaoTANG So, to check visually, add Arrow[{{0, 0}, {0, 0} + {1, 2}}] and Arrow[{{6, -2}, {6, -2} + {-1, 1}}].
I have understood your idea. Namely, using the parabola to interpolate the first three points and last three points, respectively. Then using the expression of parabola to estimate the first derivative/tangent vector.
@ShutaoTANG Yes, that's about it. The other suggestion is to use the circumcircle; it's more algebraically complicated, but if you like challenges... :)
@ShutaoTANG See? :) It works! Your tangents are correct.
The $\alpha$s are further adjustable parameters; you can multiply a nonzero factor with any of your tangent vectors to adjust the shape.
The lazy suggestion is, as mentioned, to use the total chord length (which you would have already computed during the parametrization using Lee's method.)
@J.M. Thanks a lot. In fact, I would like to reproduce a paper. In that paper the tangent vector estimation is needed., but I cannot find the method via the literature. So I asked help for you:)
14:24
If you don't get the expected results, at least you know what to adjust. (But to make adjusting easier, normalize your tangent vectors, and then play around with the factors.)
OK, got it. Next step I will apply your suugesstion.
Here is a screenshots about the blade when the interpolation points are tensor construction
It's more art than science at that point. You'll get a feel for things with enough experience.
@ShutaoTANG That's just a cylinder, no? Or did you implement the lofting procedure by Piegl and Tiller?
That paper above I mentioned mainly deal with the case that the interpolation points are not tenor. Namely, every contour owns different points.
14:29
Then one usually uses lofting for that.
@J.M. It is not a cylinder rather than a lofting(or called interpolate the contour with closed B-spline surface).
Which is more complicated to program. :)
I mainly learnt/developed the B-spline theroy at evening. Just owing to my interest:D
In addtion, thanks for your guide of the Mathematica programming and B-spline theory in recently two years.
@ShutaoTANG No problem; I'm glad it was useful for you.
BTW, did you know the knot removal technique? I have never understood its theory. It is more complicated that knot insertion.
14:40
@ShutaoTANG I haven't tried implementing it yet; the description by Piegl and Tiller looks complicated.
But the idea is to try if removing a knot will still result in the same B-spline, just with different parametrization.
@J.M. Same feeling. Piegl and Tiller just given the C-like code which is hard to understand the work principle, so I cannot rewrite it to Mathematica.
@ShutaoTANG at least for a first attempt, you could emulate the procedural style first; just worry about making it functional/rule-based later.
The indexing is something to be careful about, since they start at 0 (exactly like C).
I have got a copy of that paper, I can send a copy to you if you need.
@ShutaoTANG No need, I have it in my files too. What I don't have is time. :)
@J.M. Anyway, very glad to discuss with you. In addtion, sorry for my poor English.
14:49
@ShutaoTANG I can understand you; it's okay. :)
@J.M. It's time to sleep. Good night:)

  last day (22 days later) »