Game Development Reference
InDepth Information
angle to each other, then the effect of removing the vertex will be
dramatic. For any vertex we can define the error with respect to the
current vertex as the sum of the distance to planes. To find a distance will
require us to use a square root, which is a computationally expensive
procedure. Since we are concerned with the error rather than the
distance, we can just use the squared distance.
If we describe each of the
n
planes using
p
and a vertex as
v
, then the
error becomes
n
p
=1
(
p
T
v
)
2
A plane
p
is defined by the equation
ax
+
by
+
cy
+
d
= 0
where
a
2
+
b
2
+
c
2
= 1
Deriving the values for
a
,
b
,
c
and
d
using the three vertices of a triangle
requires some careful algebra. The exercise becomes one of solving four
simultaneous equations in four unknowns. If we define the three vertices
of the triangle as
p
,
q
and
r
, then the equations are:
ap
x
+
bp
y
+
cp
z
+
d
= 0
(1)
aq
x
+
bq
y
+
cq
z
+
d
= 0
(2)
ar
x
+
br
y
+
cr
z
+
d
= 0
(3)
a
2
+
b
2
+
c
2
= 1
(4)
Let
k
=
r
x
/
q
x
Therefore, we can create E5 using E2 
k
(E3) (where E represents
equation):
b
(
q
y

kr
y
) +
c
(
q
z

kr
z
) +
d
+
kd
= 0
(5)
Let
m
=
p
x
/
q
x
Search Nedrilad ::
Custom Search