|
|
On Wed, 28 Apr 1999 13:38:03 -0400, Phil Clute <plc### [at] tiacnet> wrote:
>Anyhow my question is: What is the math behind keeping those
>seams together, and from causing cracks in the patch?
I find that it helps to look at a collection of connected patches as
a solid mesh composed of quadrilateral (four-sided) elements, rather
than as a bunch of independent patches. In my bedsheet code, I used
a whopping big array to store the control points for all of the
patches.
If you look at that code, you'll see a lot of 3's but not very many
4's. This might seem strange: after all, patches have a 4 x 4 array
of control points, right? So if you were going to have an n x n mesh
of patches, you would need a 4n x 4n array, right? No. You need a
(3n+1) x (3n+1) array. Why? Because to keep from having cracks in
your mesh, you must ensure that all of the points (four altogether)
on the boundary between two patches are the same for both patches.
Here's an ugly ASCII-art representation of a 2 x 1 mesh of patches:
0 1 2 3 4 5 6
0 O---O---O---O---O---O---O
| | |
| | |
1 O O O O O O O
| | |
| | |
2 O O O O O O O
| | |
| | |
3 O---O---O---O---O---O---O
(figure 1)
The lines mark patch boundaries. The O's are control points. The
numbers above and to the side are the indices of the points in the
array. Notice how every control point in column 3 is in both patches.
As long as you adhere to this model, you can never have a crack in
your patch mesh.
Now, let's draw that picture again, but with a 2 x 2 mesh:
A###B...B###A###B...B###A
# | | # | | #
# | | # | | #
B---C C---B---C C---B
. . .
. . .
B---C C---B---C C---B
# | | # | | #
# | | # | | #
A###B...B###A###B...B###A
# | | # | | #
# | | # | | #
B---C C---B---C C---B
. . .
. . .
B---C C---B---C C---B
# | | # | | #
# | | # | | #
A###B...B###A###B...B###A
(figure 2)
This is a little more complicated, because it's trying to get across
a more complicated point (I should really write this thing up as a web
page and put fancy graphics on it!)
The # signs are patch boundaries. So are the dots. The A's, B's,
and C's are control points. The other lines mean something else.
A points are the corners. It's already been noted that a patch will
always intersect its corner points. B points are the remaining edge
points. They exert an influence on the slope of the patch at the
adjacent A point. For the sake of discussion, these 'lines of
influence' are represented by the # signs. The dots are just there
to show the patch boundaries.
C points are the interior points. Each of them exerts an influence on
the slope of the patch at two undetermined points along the edge of the
patch, roughly corresponding to the adjacent B points.
Now, the payoff: if you want your patches to abut smoothly, without a
visible crease at the edges, all you have to do is make sure that
anywhere you see three control points joined by a straight line,
which is to say a line of #'s, -'s, or |'s but not a line of dots,
all of those control points must be in a straight line in 3D space.
This means that if you drew lines between their locations in 3D space,
you would not get a triangle but a straight line.
So, reverse your thinking about patches. They're not a 4 x 4 mesh of
control points, or even a 3 x 3 mesh of 'grid squares'. A patch mesh
consists of a grid of vertex points, represented by the points marked
'A' in figure 2. Each vertex point in the grid is surrounded by a
cloud of up to eight control points that determine the shape of the
surface at that point. The points marked 'B' in figure 2 directly
determine the normal of the surface at the vertex, while the points
marked 'C' have a more indirect effect, specifying the evolution of
the surface as you move away from the vertex point in each direction.
There's something I haven't addressed in this discussion. How do
you deal with a situation where your patches are not in a regular
grid, as shown below:
+----------+----------+
| # |
| # B |
| # |
| A *----------+
| # |
| # C |
| # |
+----------+----------+
My simplistic answer is "Don't do that!" It might be possible to
figure out the correct control points for patch A to make it pass
through the vertex marked *, but it'll be really hard to keep from
having a crack somewhere along the joint indicated with # signs.
Yes, it can be done. It will put severe constraints on the edges
of the B and C patches that abut the A patch. But the math is
almost certainly quite nasty, and you'd probably be better off just
splitting patch A in half. If someone has some foolproof math for
this case, I'd like to see it too.
Post a reply to this message
|
|