Second partial derivatives from first and mixed derivative of bicubic Bezier Surface Patch?

323 Views Asked by At

Given the definition of the bicubic Bezier Surface Patch function: $$f(u,v) = \begin{bmatrix} u^3 & u^2 & u & 1 \end{bmatrix} \begin{bmatrix} -1 & 3 & -3 & 1 \\ 3 & -6 & 3 & 0 \\ -3 & 3 & 0 & 0 \\ 1 & 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} P_{00} & P_{01} & P_{02} & P_{03} \\ P_{10} & P_{11} & P_{12} & P_{13} \\ P_{20} & P_{21} & P_{22} & P_{23} \\ P_{30} & P_{31} & P_{32} & P_{33} \end{bmatrix} \begin{bmatrix} -1 & 3 & -3 & 1 \\ 3 & -6 & 3 & 0 \\ -3 & 3 & 0 & 0 \\ 1 & 0 & 0 & 0 \end{bmatrix}^T \begin{bmatrix} v^3 \\ v^2 \\ v \\ 1 \end{bmatrix},$$ is it possible to compute the second partial derivatives $f_{uu}$ and $f_{vv}$ knowing the values for $f$, $f_{u}$, $f_{v}$ and $f_{uv}$ for each of the 4 corners?

I have reasons to believe that it is indeed possible, but I do not know how.

Thank you!

2

There are 2 best solutions below

0
On BEST ANSWER

So here is the solution I managed to deduce. We note (C style) the 16 control points of the bicubic Bezier patch as: $$\begin{bmatrix} p1\_1 & p1\_2 & p1\_3 & p1\_4 \\ p2\_1 & p2\_2 & p2\_3 & p2\_4 \\ p3\_1 & p3\_2 & p3\_3 & p3\_4 \\ p4\_1 & p4\_2 & p4\_3 & p4\_4 \end{bmatrix}$$ In a similar manner we note the values for the 4 corners starting with $w$ and using $x$ and $y$ for the two directions. For example the following are the first partial derivatives on $x$ for the 4 corners: $$\begin{bmatrix} wx1\_1 & wx1\_2 \\ wx2\_1 & wx2\_2 \\ \end{bmatrix}$$ The following are the formulas for computing the control points given the value, first partial derivatives and the mixed derivative for each of the 4 corners:

// values -> control-points
p1_1 = w1_1;
p1_2 = wx1_1/3+w1_1;
p1_3 = w1_2-wx1_2/3;
p1_4 = w1_2;
p2_1 = wy1_1/3+w1_1;
p2_2 = wx1_1/3+wy1_1/3+w1_1+wxy1_1/9;
p2_3 = wy1_2/3+w1_2-wx1_2/3-wxy1_2/9;
p2_4 = wy1_2/3+w1_2;
p3_1 = w2_1-wy2_1/3;
p3_2 = wx2_1/3+w2_1-wxy2_1/9-wy2_1/3;
p3_3 = w2_2-wx2_2/3+wxy2_2/9-wy2_2/3;
p3_4 = w2_2-wy2_2/3;
p4_1 = w2_1;
p4_2 = wx2_1/3+w2_1;
p4_3 = w2_2-wx2_2/3;
p4_4 = w2_2;

And the following are the formulas for computing the second partial derivatives given the value, first partial derivatives and the mixed derivative for each of the 4 corners:

// control-points -> second-derivative-values
wxx1_1 =  w1_2*6-w1_1*6-wx1_1*4-wx1_2*2;
wyy1_1 =  w2_1*6-w1_1*6-wy1_1*4-wy2_1*2;
wxx1_2 = -w1_2*6+w1_1*6+wx1_1*2+wx1_2*4;
wyy1_2 = -w1_2*6+w2_2*6-wy1_2*4-wy2_2*2;
wxx2_1 = -w2_1*6+w2_2*6-wx2_1*4-wx2_2*2;
wyy2_1 = -w2_1*6+w1_1*6+wy1_1*2+wy2_1*4;
wxx2_2 =  w2_1*6-w2_2*6+wx2_1*2+wx2_2*4;
wyy2_2 =  w1_2*6-w2_2*6+wy1_2*2+wy2_2*4;

One can observe that the second partial derivatives for a corner depend not only on the values for that corner but also on the values of the two neighbor corners (which is logic, but unfortunate for my optimization).

2
On

Yes. If you know the values of $f$, $f_u$, $f_v$ and $f_{uv}$, then you can write the equation of the patch in Hermite form, and you can then use this to obtain derivatives of any order.

Thinking of the problem another way ... you can used the 16 known values to compute the 16 control points $P_{ij}$ you used in your equation, and you can then use that equation to calculate anything you like. Computing the $P_{ij}$ from the known 16 quantities is easy; you just have to solve linear equations. In fact, the solution can be written explicitly: we have $$ P_{00} = F_{00} \; ; \; P_{03} = F_{01} \; ; \; \text{etc.} $$ $$ P_{01} = F_{00} + \tfrac13 F_{00}^{u}\; ; \; P_{02} = F_{01} - \tfrac13 F_{01}^{u}\; ; \; \text{etc.} $$ $$ P_{10} = F_{10} + \tfrac13 F_{10}^{v}\; ; \; P_{20} = F_{10} - \tfrac13 F_{10}^{v}\; ; \; \text{etc.} $$ $$ P_{11} = F_{00} + \tfrac13 F_{00}^{u} + \tfrac13 F_{00}^{v} - \tfrac19 F_{00}^{uv}\; ; \; \text{etc.} $$ The notation here is the obvious one: $$ F_{00}^{uv} = \frac{\partial^2 F}{\partial u \partial v}(u=0, v=0) $$ and so on.

If possible, I suggest you rearrange your optimization problem so that the $P_{ij}$ are the independent variables. This will probably improve numerical stability, and will remove the need for the conversions outlined above.