Game Development Reference

In-Depth Information

we can see that the result
x
(
t
) will be a vector-valued function, as we are sub-

tracting two points and then scaling by 1
/h
. It can be similarly shown that the

derivative of a vector-valued function is a vector-valued function. Note that we

often write such a time derivative as simply
x
.

1.3

Lines and Planes

1.3.1 Definitions

If we parameterize an affine combination, we can create new entities: lines and

planes. A line can be represented as a point plus a parameterized vector:

l
(
t
)=
x
+
t
v
.

R

3
can be represented as a point plus two parameterized

Similarly, a plane in

vectors:

p
(
s, t
)=
x
+
s
u
+
t
v
.

An alternative definition of a plane is to take a vector
n
and a point
p
0
and

state that for any given point
p
on the plane,

0=
n

·

(
p

−

p
0
)
.

If we set (
a, b, c
)=
n
, (
x, y, z
)=
p
,and
d
=

−

n

·

(
p
0
−

o
), we can rewrite this

as

0=
ax
+
by
+
cz
+
d,

(1.2)

which should be a familiar formula for a plane.

For an arbitrary point
p
, we can substitute
p
into Equation (1.2) to test whether

it is on one side or another of the plane. If the result is greater than zero, we know

the point is on one side, if less than zero, it is on the other. And if the result is

close to zero, we know that the point is close to the plane.

We can further restrict our affine combinations to create half-infinite or fully

finite entities. For example, in our line equation, if we constrain
t ≥
0,wegeta

ray. If we restrict
t
to lie between 0 and 1, then we have a line segment. We can

rewrite the line equation in an alternate form to make it clearer:

S
(
t
)=(1

−

t
)
x
0
+
t
x
1
.

In this case,
x
0
and
x
1
are the two endpoints of the line segment.

We can perform a similar operation with three points to create a triangle:

T
(
s, t
)=(1

−

s

−

t
)
x
0
+
s
x
1
+
t
x
2
,

where, again,
s
and
t
are constrained to lie between 0 and 1.