Graphics Reference
In-Depth Information
∆=
x
b
1
−
x
b
2
(10.67)
y
b
1
−
y
b
2
which, if zero, implies that the two equations can not yield a solution. As it is
impossible to predict which pair of equations from (10.66) will be independent,
let's express two independent equations as follows:
ra
11
−
sa
12
=
b
1
ra
21
−
sa
22
=
b
2
(10.68)
which yields
r
=
(
a
22
b
1
−
a
12
b
2
)
(10.69)
∆
s
=
(
a
21
b
1
−
a
11
b
2
)
(10.70)
∆
where
∆=
a
11
a
12
(10.71)
a
21
a
22
Solving for
r
and
s
we obtain
r
=
y
b
2
(
x
a
2
−
x
a
1
)
−
x
b
2
(
y
a
2
−
y
a
1
)
(10.72)
x
b
1
y
b
2
−
y
b
1
x
b
2
s
=
y
b
1
(
x
a
2
−
x
a
1
)
−
x
b
1
(
y
a
2
−
y
a
1
)
(10.73)
x
b
1
y
b
2
− y
b
1
x
b
2
As a quick test, consider the intersection of the lines encoded by the following
vectors:
⎡
⎤
⎡
⎤
⎡
⎤
⎡
⎤
0
1
0
0
1
0
3
3
3
2
3
2
⎣
⎦
⎣
⎦
b
1
=
⎣
⎦
a
2
=
⎣
⎦
a
1
=
b
2
=
Substituting the
x
and
y
components in (10.72) and (10.73), we discover
r
=
1
3
and
s
=
1
2
but for these to be consistent, they must satisfy the
z
component of the
original equation:
rz
b
1
=
sz
b
2
=
z
a
2
−
z
a
1
1
3
×
1
2
×
3
−
2=0
−
0
which is correct. Therefore, the point of intersection is given by either
p
i
=
a
1
+
r
b
1
or
p
i
=
a
2
+
s
b
2