Imagine that I have got 16 nodes in a 3D space, each node with its (x,y,z) coordinates. The nodes are ordered in a grid and numbered (i,j) in accordance with their position, so i [1,4] and j [1,4]. I also know that the nodes are part of a curved surface (a topological square) and that the borders i=1, i=4, j=1 and j=4 of my ordered grid form the borders of the original continuous surface, now represented by these 16 discrete nodes.
I would like to span a surface through these nodes by 9 tiles of cubic Bezier patches, each patch with the controlpoints P00 upto P33 like in the figure below (not all control points are numbered in that figure), in such a way that the corners of each Bezier patch P00, P03, P30 and P33 coincide with 4 of these 16 nodes of my grid, to be precise with node (i,j), (i+1,j), (i,j+1) and (i+1,j+1). This is why I end up with 9 tiles, like in the second figure.
Now I would like to make up a smooth surface upto the second derivative out of these patches, however, though I know this can be done with lines, I don't end up with the right amound of equations and unknowns in case of surfaces like here.
Now, let's not bother about x,y,z components, so I call each vector P one unknown (and not 3, later on I will solve the matrix for each vector component separately) and each vector equation one equation.
Let's start counting the amount of unknowns and equations:
-- First of all I have 16 unknowns per patch of which I know the coordinates of the 4 corner points, so 12 unknowns per patch, namely all control points except P00, P03, P30 and P33. So for 9 patches, I end up with: 9x12=108 unknowns.
-- I want them to connect, so each border between the patches gives me an equation to fullfill. With 12 interconnecting borders between patches (for example between patch 1 and 4, between patch 1 and 2 etc.) this condition gives me my first 12 equations.
-- I also want the derivatives to be the same between conncting paches, in parameter u as well as in parameter v (which have the same consistent direction for each patch). This gives me 24 more equations.
-- The same for the second derivative, again 24 more equations (remember that I equalise the derivative in u and v on the interconecting borders between patches).
-- And lastly, in analogy with what seems to work for cubic bezier curves, I place a condition on the original surface's borders, namely that the second derivative for the parameter perpendicular to the surface border equals zero, so for te bottom of patch 1, d2Surf/du2=0 but for its left border d2Surf/dv2=0. Having 12 outer borders, thi gives me 12 extra equations.
So, to get the 108 unknown control points, I've got 12+24+24+12=72 equations. Er, 108-72 is not 0
My question is: Where are the missing 36 equations.
As far as I know, I applied te same philosophy as what one does when catenating cubic bezier curves, what amI doing wrong?
P.S.: I used the folowing cubic Bezier equation: