6.6.
MODIFYING
THE
TOPOLOGY
307
Algorithm
#1
As
suggested
in figure
(6.29),
considering
two
adjacent triangles
T and
T*
of
T(«S)
sharing
a
common edge,
let
cr(T\T*)
and
cr(T*|T)
be the two new
triangles deduced
from
T and
T*
by
"swapping"
the
common edge:
the
triangulated
surface
T(<S).
This
suggests
the
following "beautifying algo-
rithm," whose convergence
is
ensured because,
at
each
step
of the
iterative
value
(i -
|T(5)|):
//
beautifier#l
do
{
flag
<—
false
for_all(TeT*(<S)
) {
let
A(T)
be the set of
triangles
adjacent
to T
let T* be the
triangle
of
A(T)
such
that
6(cr(T*|T))
=
max
b(a(t\T}}
t€A(T)
if(6(a(T|T*))
+
b(a(T*|r))
>
6(T)
+
&(T*))
{
replace
T by
<r(T|T*)
replace
T* by
<r(T*|T)
flag
<—
£rue
} //
end:
if
} //
end:
for_all
}
while(
flag ) //
end:
do
figure
(6.30)-B
gives
an
example
of the
result obtained with this algorithm
when
applied
to the
triangulated surface shown
in figure
(6.30)-A.
Algorithm
#2
It
should
be
noted
that
the
beautifying algorithm presented above preserves
the
location
of the
vertices
of the
triangulated surface
to be
"beautified."
Obviously, relaxing
this
constraint would normally result
in a
nicer surface
T*(tS);
this suggests
the
following
algorithm derived
from
the
above algorithm:
//
beautifier#2
let
TO*
(S) be a
copy
of
T(«S)
let i = 0
do
{
i
<—
i +
1
In general, the swapping operation so defined modifies the global beanty of
process, the global beauty B(T(S)) increases and is upper bounded by the
let T*(S) be a copy of T(S)