# Surface interpolation in 3D

If given three points ##P_0 = (x_0, y_0)##, ##P_1 = (x_1, y_1)## and ##P_2 = (x_2, y_2)##, the polynomial function ##f(x)## that intersect those points is ##f(x) = a_2 x^2 + a_1 x^1 + a_0 x^0##.

where:
##
\begin{bmatrix}
a_0\\
a_1\\
a_2\\
\end{bmatrix}
=

\begin{bmatrix}
x_0^0 & x_1^0 & x_2^0 \\
x_0^1 & x_1^1 & x_2^1 \\
x_0^2 & x_1^2 & x_2^2 \\
\end{bmatrix}^{-T}

\begin{bmatrix}
y_0\\
y_1\\
y_2\\
\end{bmatrix}##

Ok, but if is given points in the space with coordinates ##P_1 = (x_1 ,y_1 ,z_1)##, ##P_2 = (x_2 ,y_2 ,z_2)##, ##P_3 = (x_3 ,y_3 ,z_3)##, ..., ##P_n = (x_n ,y_n ,z_n)##... is possible to determine the coefficients of the polynomial function of 2 variables, ##f(x,y) = Ax^2+Bxy+Cy^2+Dx+Ey+F##, in function of the point's coordinates (like above in the 2D case)?

Hi !
The method to solve this problem is given in section 4, pages 8-9 of the paper : http://fr.scribd.com/doc/14819165/Regressions-coniques-quadriques-circulaire-spherique
The correspondance of notations with your notations is as follows :
The polynomial function of 2 variables is: ##f(x,y) = a_1x^2+a_2xy+a_3y^2+a_4x+a_5y+a_6##
The given points are ##P_1 = (x_1 ,y_1 ,z_1)##, ##P_2 = (x_2 ,y_2 ,z_2)##, ##P_3 = (x_3 ,y_3 ,z_3)##, ..., ##P_n = (x_n ,y_n ,z_n)##...
##F_1(x,y)=x^2##
##F_2(x,y)=xy##
##F_3(x,y)=y^2##
##F_4(x,y)=x##
##F_5(x,y)=y##
##F_6(x,y)=1##
The number of coefficients is ##p=6##
Then with the formulas given in the paper, compute the sums ##B_{i,j}## and ##C_i## where ##0<i<7## and ##0<j<7##
In the formula of ##C_i## written in the paper, the symbol ##y_k## must be replaced by your symbol ##z_k##
Then, solve the matrix system as shown in the paper page 9, leading to the values of the coefficients.