How to fit a surface to points in 3D and determine its center?

915 Views Asked by At

I have 8 points in space which form one finite element's face made of 4 corner nodes and 4 midnodes, and to which I would like to fit a surface and then, determine the coordinates of its center.

https://i.stack.imgur.com/28K7a.png

The nodes are not in the same plane.

Let's assume that the coordinates of my 8 points are stored in 3 vectors called x, y, and z.

I am using octave (= matlab syntax) to try and solve this problem but I struggle with the maths.

Any help is much appreciated.

3

There are 3 best solutions below

5
On BEST ANSWER

If this is just one patch in a parametrized surface, we'd need to know (some of) the points in the neighbouring patches to make it continuous.

If we assume this is a solitary patch -- that is, we ignore continuity at the edge of the patch --, we can quite easily fit a polynomial to it. First, let's renumber the known points in the patch first: $$\begin{array}{r|rrr} v=1 & p_{02} & p_{12} & p_{22} \\ \; & p_{01} & \; & p_{21} \\ \; & p_{00} & p_{10} & p_{20} \\ \hline 0 & \; & \; & u=1 \end{array}$$

Let's construct an interpolating polynomial with eight coefficients. We cannot use $$f(u,v) = \sum_{i,j=0}^{2} C_{ij} u^i v^j$$ because that has nine coefficients. We also want to make it symmetric with respect to $u$ and $v$ (no directional bias, that is), so let's use interpolating quartic polynomial $$\begin{array}{rccl} f(u,v) \; = & (1-u) & (1-v) & C_{00} \\ + & u & (1-v) & C_{20} \\ + & (1-u) & v & C_{02} \\ + & u & v & C_{22} \\ + & (1-u) u & (1-v) & C_{10} \\ + & (1-u) u & v & C_{12} \\ + & (1-u) & (1-v) v & C_{01} \\ + & u & (1-v) v & C_{21} \end{array}$$ This construction allows us to drop one coefficient ($C_{11}$, which would correspond to term $(1-u) u (1-v) v C_{11}$ above).

(I formed the above in the order shown; the idea is to make it obvious we want to be symmetric with respect to $u$, $1-u$ and $v$, $1-v$, without assuming any coefficient is zero -- like we would if we were to just use the sum and assume $C_{11}=0$. I wanted to restrict the behaviour of the interpolating polynomial, not force one of its coefficients to zero. This seemed like the simplest way. Edited to add: I now noticed that there is no coefficient corresponding to $u^2 v^2$, so I could have used the sum instead with $C_{22}=0$. Ho hum; me not being a mathematician really shows, eh? )

Now, if we use f(u,v) to interpolate the point coordinates, we find that the coefficients are $$\begin{cases} C_{00} = x_{00} \\ C_{01} = 4 x_{01} - 2 ( x_{00} + x_{02} ) \\ C_{02} = x_{02} \\ C_{10} = 4 x_{10} - 2 ( x_{00} + x_{20} ) \\ C_{12} = 4 x_{12} - 2 ( x_{22} + x_{02} ) \\ C_{20} = x_{20} \\ C_{21} = 4 x_{21} - 2 ( x_{22} + x_{20} ) \\ C_{22} = x_{22} \end{cases}$$ and same for $y$ and $z$ coordinates.

Substituting the above to $f(1/2,1/2)$ we get the coordinates for the middle point $(x_{11}, y_{11}, z_{11})$, $$\begin{cases} x_{11} = \frac{x_{10} + x_{01} + x_{12} + x_{21}}{2} - \frac{x_{00} + x_{02} + x_{20} + x_{22}}{4} \\ y_{11} = \frac{y_{10} + y_{01} + y_{12} + y_{21}}{2} - \frac{y_{00} + y_{02} + y_{20} + y_{22}}{4} \\ z_{11} = \frac{z_{10} + z_{01} + z_{12} + z_{21}}{2} - \frac{z_{00} + z_{02} + z_{20} + z_{22}}{4} \end{cases}$$

Indeed, if we consider the symmetry requirements, it should be clear that all interpolating polynomials (that only use the data given here, and not from e.g. neighbouring patches), the midpoint coordinates are, and have to be, $$\begin{cases} x_{11} = A ( x_{00} + x_{02} + x_{20} + x_{22}) + B (x_{10} + x_{01} + x_{12} + x_{21} ) \\ y_{11} = A ( y_{00} + y_{02} + y_{20} + y_{22}) + B (y_{10} + y_{01} + y_{12} + y_{21} ) \\ z_{11} = A ( z_{00} + z_{02} + z_{20} + z_{22}) + B (z_{10} + z_{01} + z_{12} + z_{21} ) \\ \end{cases}$$ with $A$ and $B$ depending only on the interpolation polynomial used; otherwise, the direction selected for $u$ and $v$ affects the interpolation!

1
On

You can use Coons patch in the following way:

  1. Create a quadratic polynomial curve interpolating 3 points for each edge,
  2. Use Coons patch to blend the 4 edges to create your surface. See this (link) for details about Coons patch.
  3. Evaluate your "center" point at (s,t)=(0.5,0.5)
1
On

Any number of surfaces can be fitted through 4 corner points and 4 mid corner points to define a surface with second order continuity across the edges.

Its scalar invariants like $H,K$ (Mean & Gauss curvatures) need to be specified to complete its spatial definition, but even then it is tough, not well developed so far afik.

A quick/dirty way for each of the three $(x,y,z) $ coordinates is :-

$$(c_1+c_2+c_3+c_4+2 m_1+2 m_2+2 m_3+2 m_4)/12$$

where $c$ is for corner point and $m$ mid-point.

EDIT1

A quartic polynomial with eight coefficients could also be attempted numerically.

$$ a1\, x^4+ a2\, y^4 + z^4 + a3 \,x^2y^2 + a4\, y^2z^2 + a5\, z^2 x^2 + a6 \,xy + a7\, yz + a8 \,zx =1 $$