mkazhdan / PoissonRecon

Poisson Surface Reconstruction
MIT License
1.51k stars 422 forks source link

question about BSplineElements #276

Open sjunwl opened 9 months ago

sjunwl commented 9 months ago

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 commented 8 months ago

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 commented 8 months ago

thank you very much