Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question about BSplineElements #276

Open
sjunwl opened this issue Oct 7, 2023 · 2 comments
Open

question about BSplineElements #276

sjunwl opened this issue Oct 7, 2023 · 2 comments

Comments

@sjunwl
Copy link

sjunwl commented Oct 7, 2023

hi professor,I could not understand the class BSplineElements, and what is the function of the class BSplineElements?
image
1、suppose; Degree =2 and res =8 = 1<<3 ; I get BSplineElements b1(res, k, 1, 0);[k indexes the center of the B-spline]
2、when k =0 ;then b1 is 7 Triples : { {0,1,1}; {0,0,1};{0,0,0}; {0,0,0};{0,0,0};{0,0,0};{0,0,0};}
does the b1 on interval [0,1] is 1*(-x^2 + x + 1/2) + 1*(1/2 x^2 - x + 1/2) , and on interval[1,2] is 1*(1/2 x^2 - x + 1/2) and 0 on the other intervals? and if I am right , why ?
3、 when k =1; then b1 is 7 thriples:{ {1,0,0}; {0,1,0};{0,0,1}; {0,0,0};{0,0,0};{0,0,0};{0,0,0};}
does the b1 on interval [0,1] is 1*(1/2 x^2) , and on interval[1,2] is 1*(-x^2 + x + 1/2) and on interval [2,3] is 1*(1/2 x^2 - x + 1/2) and 0 on the other intervals? and if I am right , why ?

@mkazhdan
Copy link
Owner

mkazhdan commented Oct 9, 2023

For degree 2, the B-spline is composed of three quadratic components which (up to shift) are
B_0(x) = 1/2 * x^2
B_1(x) = -x^2 + 3 * x -3/2
B_2(x) = 1/2 * x^2 - 3 * x + 9/2
The BSplineElementCoefficients describe how much of these three functions "sit" over each of the res intervals.
So, for example, if we were considering the B-spline at k=1, it would have:
-- a component of B_0 over [0,1] -> {1,0,0}
-- a component of B_1 over [1,2] -> {0,1,0}
-- a component of B_2 over [2,3] -> {0,0,1}
Which is what you are seeing in { {1,0,0}; {0,1,0};{0,0,1}; {0,0,0};{0,0,0};{0,0,0};{0,0,0};}

The case of k=0 is a bit more tricky since you have specified that you want Neumann boundary conditions.
Suppose first that we had ignored the boundary conditions, the B-spline at k=0 would have (ignoring the effect of shifts):
-- a component of B_0 over [-1,0] -> {1,0,0}
-- a component of B_1 over [0,1] -> {0,1,0}
-- a component of B_2 over [1,2] -> {0,0,1}
But this function is not reflectively symmetric x=0.
To fix this, we also consider the reflected B-spline at k=-1 which has:
-- a component of B_0 over [-2,-1] -> {1,0,0}
-- a component of B_1 over [-1,0] -> {0,1,0}
-- a component of B_2 over [0,1] -> {0,0,1}
Summing the B-spline at k=0 with its reflection (the B-spline at k=-1) we get a B-spline with:
-- a component of B_1 and a component of B_2 over [0,1] -> {0,1,0} + {0,0,1} = {0,1,1}
-- a component of B_2 over [1,2] -> {0,0,1}
Which is what you are seeing in { {0,1,1}; {0,0,1};{0,0,0}; {0,0,0};{0,0,0};{0,0,0};{0,0,0};}

@sjunwl
Copy link
Author

sjunwl commented Oct 10, 2023

thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants