Sketcher: B-Spline pages

Discussions about the wiki documentation of FreeCAD and its translation.
User avatar
uwestoehr
Veteran
Posts: 4290
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: Sketcher: B-Spline pages

Post by uwestoehr »

jnxd wrote: Tue Mar 22, 2022 5:41 am And I feel you're mixing up some things yourself :mrgreen:.
Can you please argument according to my arguments please.

I explained you what makes a function rational. Your argumentation was that e.g. 5*x^2 is a ration function compared to x^2 and this is wrong.
As we agree now what a rational spline is, what makes it non-uniform? The weights.
Here another derivation: https://www.cl.cam.ac.uk/teaching/2000/ ... node5.html

And since you are free to choose the basis function, your are free to choose the knot vector. The forumula is completely independent on the knot vector. The vector is however important to determine the spline propertied (derivatives knot positions etc.).
User avatar
uwestoehr
Veteran
Posts: 4290
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: Sketcher: B-Spline pages

Post by uwestoehr »

In this video they explain it nicely: https://www.youtube.com/watch?v=w-l5R70y6u0
They move the slider for h2, meaning, they change this weight. The changing knot vector is the result. However, as you can see at the beginning of the video, the base N1,3 has the same definition range, but is only changed by a factor. But this in turn results in a change of the definition range for N0,3.

I think it should be more clear now.
jnxd
Posts: 582
Joined: Mon Mar 30, 2015 2:30 pm

Re: Sketcher: B-Spline pages

Post by jnxd »

Hi @uwestoehr. Just wanted to let you know I'm trying to formulate something coherent about your argument, and I'll probably take a few days before replying, if at all. Replying too early is only taking this conversation nowhere fast.

However, one quick nit-pick before the break.
uwestoehr wrote: Tue Mar 22, 2022 3:37 pm In this video they explain it nicely: https://www.youtube.com/watch?v=w-l5R70y6u0
They move the slider for h2, meaning, they change this weight.
Please note that h2 here is the distance between knots and not a weight of a control point. Note how decreasing h2 brings the curve closer to the control points, whereas increasing weights makes the curve closer to that one control point.
jnxd
Posts: 582
Joined: Mon Mar 30, 2015 2:30 pm

Re: Sketcher: B-Spline pages

Post by jnxd »

uwestoehr wrote: Tue Mar 22, 2022 1:14 am What does your definition says about the basis functions? What order must they have, what are in turn their base functions? Are these Bernstein polynoms? I don't see there a definition about this.
Hello Uwe. Now that we have a bit more time after the release, let's try to get this clarified. I'm still not being too mathematically rigorous here, so excuse the broad strokes.

Thing is, it seems you're mixing up the concepts of "Bezier curves" and "B-Splines". Bernstein polynomials form the basis for Bezier curves only. When weights are applied, we get what is called a rational Bezier curve. The rational part comes from the fact that certain normalization has to be done, as you wrote in the wiki (note the function is now a rational function in the parameter, which is t in the case of the previous link). Uniform or non-uniform does not come into picture yet. That comes into picture for splines.

Now, a spline is a combination of Bezier curves. B-splines are basis functions for a general spline that respect the continuity, but let us set that aside for now, and look at the spline in terms of the bases of the constituent Bezier curves. In that case, the basis functions look something like these (sorry for the transparent background, you can open these in a new tab if they're not clear):
first bezier curve bases
first bezier curve bases
Bernstein_Polynomials_1.png (35.87 KiB) Viewed 237 times
second bezier curve bases
second bezier curve bases
Bernstein_Polynomials_2.png (37.71 KiB) Viewed 237 times

In this case, the first curve spans a 0<=t<0.5, and the second spans 0.5<=t<=1.0. We define the functions to be zero outside of their respective ranges. Now, if we consider the pole at t = 0.5 to be the same for both curves, we have 7 poles, and this is equivalent to a cubic spline with a 3-multiplicity knot at t=0.5. However, if we want continuity at higher derivatives, we have to impose more restrictions on these poles. This effectively reduces the number of poles, since one new point dictates two other points at every derivative continuity imposed. I will not go into the details of how, but the lectures we have been discussing can shed some light on that.

Finally, we come to the "non-uniform" part: instead of doing the split at 0.5, if we did the split at, say 0.6 (so the first curve spans a 0<=t<0.6, and the second spans 0.6<=t<=1.0), that is an example of a "non-uniform" spline. I cannot properly explain what difference it makes with the present "broad strokes" explanation, but that is exactly what is being done in this video that you previously shared: https://www.youtube.com/watch?v=w-l5R70y6u0.
User avatar
uwestoehr
Veteran
Posts: 4290
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany

Re: Sketcher: B-Spline pages

Post by uwestoehr »

jnxd wrote: Fri Jun 24, 2022 9:29 pm Hello Uwe. Now that we have a bit more time after the release
:shock: It is much, much more work than before the release, I get tons of mails and citations in the forum. However, I also have a private life and simply cannot reply to all nor work on all topics.

Here in short, I think your analysis is correct - like in the video. For me the point is, what in the Wiki page is wrong in your opinion and what needs to be changed.

A friend of mine ins a Ph.D. mathematician and I will then ask him to review your suggestions.
jnxd
Posts: 582
Joined: Mon Mar 30, 2015 2:30 pm

Re: Sketcher: B-Spline pages

Post by jnxd »

uwestoehr wrote: Sat Jun 25, 2022 12:08 pm
jnxd wrote: Fri Jun 24, 2022 9:29 pm Hello Uwe. Now that we have a bit more time after the release
:shock: It is much, much more work than before the release, I get tons of mails and citations in the forum. However, I also have a private life and simply cannot reply to all nor work on all topics.
Sorry, didn't meant to undermine the amount of work you have with that statement, not your personal life. I shouldn't have made assumptions.
uwestoehr wrote: Sat Jun 25, 2022 12:08 pm For me the point is, what in the Wiki page is wrong in your opinion and what needs to be changed.

A friend of mine ins a Ph.D. mathematician and I will then ask him to review your suggestions.
I'll get back to you with a better write-up. I think it is a good idea to simply reference some other more rigorous literature about these topics.
Post Reply