geometry-processing-mesh-reconstruction icon indicating copy to clipboard operation
geometry-processing-mesh-reconstruction copied to clipboard

partial derivative matrix D confusion

Open chanlenn opened this issue 5 years ago • 4 comments

I'm trying to understand the section in the handout called "Gradients on a regular grid". Suppose we have a $4\times4$ matrix. $D^x$ will have a size of $12 \times 16$. The first row (i=1), according to the handout, should have the value $1$ on the first entry, since $l = 1$, but no -1 value, since there is no $i=0$. My intuition is that the first row should have -1 on the first entry and 1 on the second entry. Is my intuition correct or is the handout correct?

chanlenn avatar Sep 27 '20 22:09 chanlenn

Hint: read Section "Indexing 3D arrays" carefully (I can confirm that the handout is correct for this part)

ErisZhang avatar Sep 28 '20 19:09 ErisZhang

That section does not answer my question at all. I am not confused about translating a 3d index into 1d. I am confused about the definition of D^x (The piecewise definition of D^x right above "Indexing 3d arrays"). Let's just consider the first row D^x_{1/2,1,1}. At the first entry of this row vector (l=1), we have 1. Is this correct, yes or no?

Please do not refer me to the handout. The reason I am asking is because I am confused from reading the handout over and over again.

chanlenn avatar Sep 28 '20 20:09 chanlenn

Short answer: Yes and no. "the first entry" in your word is actually "the 0th entry" in the handout. In Section "Indexing 3D arrays", the sentence "g_{i,j,k} refers to g(i+jn_x+kn_y*n_x)" already suggests you that index starts from 0. As a result, 1. the first row of D^x should be D^x_{1/2,0,0} instead of D^x_{1/2,1,1} 2. At the 0th entry of D^x_{1/2,0,0} i.e. l = 0, we have -1. At the 1st entry of D^x_{1/2,0,0} i.e. l = 1, we have 1.

Please carefully read my hint :-)

ErisZhang avatar Sep 28 '20 22:09 ErisZhang

I think I get it. Thanks

chanlenn avatar Sep 28 '20 22:09 chanlenn