# How to connect cubic bezier surface patches continuous upto the 2nd derivative

• Sep 22nd 2012, 02:09 PM
gerritgroot
How to connect cubic bezier surface patches continuous upto the 2nd derivative
Hi,

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 $\in$[1,4] and j $\in$[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.

Attachment 24887

Attachment 24892

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:

Attachment 24889
• Sep 22nd 2012, 09:51 PM
chiro
Re: How to connect cubic bezier surface patches continuous upto the 2nd derivative
Hey gerritgroot.

Maintaining both continuity and differentiability on a Bezier patch (or between a set of patches) is basically maintaining differentiability between successive control points. So for example if have a shared corner where four patches meet, then you need to have the gradient from this point to any other point in the same direction (so you have two: x direction and y direction) to have the same slope.

So to be explicit, lets say you have a shared node X and you have four control points directly surrounding this corresponding to the orientation North, South, East and West (N,S,E,W). This means that the gradient of vector (N-X) is the same as (X-S) and also (E-X) = (X-W) to maintain both differentiability and continuity.

You apply this principle to any shared node and you get those requirements.

So when you do all this, you get criteria now for all the nodes since all these nodes must be on a common line, it means that since a line is parameterized by one variable, you find out the minimum number of parameters and this becomes the dimension of this particular system.

Then the only thing left to do is to find out the number of constraints possible for the actual number of direction vectors for the parameterizations, and that's going to depend on the constraints for your edges, but once you do this you can basically choose any valid direction vector for this linear parametrizations between the patches and plug these in to generate all the control points and thus generate a definition for the total patch.
• Sep 23rd 2012, 10:37 AM
gerritgroot
Re: How to connect cubic bezier surface patches continuous upto the 2nd derivative
Hi chiro,

The criteria you mention seem far from enough to me.

First of all, you only assure yourself of continuity upto the first derivative. For the second derivative to be continuous you need to include some condition relating not only the 4 surrounding nodes, but also one node further in each direction (N,S,E,W).

Next, if I understood you well, this only causes continuity over the specific line on the borders of each patch, but continuity between the patches over the whole surface is not fixed as this depends on the interior points of each patch.

However, one error I already discovered in my approach in the mean time is that my equations between patches or on borders of patches have to be valid for all u (at v=0 or v=1) or for all v (at u=0 or u=1). The problem is that this gives me an overdetermined set with more equations than unknowns, so that doesn't work either.
• Sep 23rd 2012, 06:57 PM
chiro
Re: How to connect cubic bezier surface patches continuous upto the 2nd derivative
Be aware that I'm talking about the control points of the various patches: the generated patches will not run through these points but only be influenced by them.

If you want to prove this, you might want to mathematically use the conditions I highlighted and see if you get a smooth curve for two patches.
• Sep 24th 2012, 04:07 AM
gerritgroot
Re: How to connect cubic bezier surface patches continuous upto the 2nd derivative
I am talking about the control points as well
• Sep 24th 2012, 04:21 AM
chiro
Re: How to connect cubic bezier surface patches continuous upto the 2nd derivative
What I'd recommend doing is looking at a one dimension Bezier curve x 2 and see what minimum conditions you need to maintain the differentiability conditions (since you can easily get a cubic polynomial given the control points for both) and then look if my condition above either satisfies or doesn't satisfy this condition.

Once you find it for this condition you can then look at for the patch conditions and you're done.
• Sep 24th 2012, 07:04 AM
gerritgroot
Re: How to connect cubic bezier surface patches continuous upto the 2nd derivative
I did that before placing my first post. For curves, continuity upto the second derivative at the connecting nodes, gives you exactly the right amount of equations if you assume the second derivative to be zero on the borders.

Does anyone know any pro literature on this?
• Sep 25th 2012, 03:39 AM
gerritgroot
Re: How to connect cubic bezier surface patches continuous upto the 2nd derivative
It can't be solved as the stitching line gives 5C-3 equations (C for the 0th derivative, C+C-1 for the first and C+C-2 for continuity on the second derivative in u and v) for a patch with CxC control points.

Assuming the same amount of equations on each patch border (independently whether it's a stitching line or a border of the final surface) and looking for a proper C quantity, C is never an integer (not to mention to make it independent on the amount of nodes in my grid).

So, higher order Bezier interpolation in stead of connecting tiles would be the way to do it I guess.