<s>
In	O
Euclidean	O
geometry	O
,	O
the	O
intersection	B-Algorithm
of	O
a	O
line	O
and	O
a	O
line	O
can	O
be	O
the	O
empty	O
set	O
,	O
a	O
point	O
,	O
or	O
another	O
line	O
.	O
</s>
<s>
Distinguishing	O
these	O
cases	O
and	O
finding	O
the	O
intersection	B-Algorithm
have	O
uses	O
,	O
for	O
example	O
,	O
in	O
computer	O
graphics	O
,	O
motion	O
planning	O
,	O
and	O
collision	O
detection	O
.	O
</s>
<s>
In	O
three-dimensional	O
Euclidean	O
geometry	O
,	O
if	O
two	O
lines	O
are	O
not	O
in	O
the	O
same	O
plane	O
,	O
they	O
have	O
no	O
point	B-Algorithm
of	I-Algorithm
intersection	I-Algorithm
and	O
are	O
called	O
skew	O
lines	O
.	O
</s>
<s>
If	O
they	O
are	O
in	O
the	O
same	O
plane	O
,	O
however	O
,	O
there	O
are	O
three	O
possibilities	O
:	O
if	O
they	O
coincide	O
(	O
are	O
not	O
distinct	O
lines	O
)	O
,	O
they	O
have	O
an	O
infinitude	O
of	O
points	O
in	O
common	O
(	O
namely	O
all	O
of	O
the	O
points	O
on	O
either	O
of	O
them	O
)	O
;	O
if	O
they	O
are	O
distinct	O
but	O
have	O
the	O
same	O
slope	O
,	O
they	O
are	O
said	O
to	O
be	O
parallel	O
and	O
have	O
no	O
points	O
in	O
common	O
;	O
otherwise	O
,	O
they	O
have	O
a	O
single	O
point	B-Algorithm
of	I-Algorithm
intersection	I-Algorithm
.	O
</s>
<s>
The	O
distinguishing	O
features	O
of	O
non-Euclidean	O
geometry	O
are	O
the	O
number	O
and	O
locations	O
of	O
possible	O
intersections	B-Algorithm
between	O
two	O
lines	O
and	O
the	O
number	O
of	O
possible	O
lines	O
with	O
no	O
intersections	B-Algorithm
(	O
parallel	O
lines	O
)	O
with	O
a	O
given	O
line	O
.	O
</s>
<s>
First	O
we	O
consider	O
the	O
intersection	B-Algorithm
of	I-Algorithm
two	I-Algorithm
lines	I-Algorithm
and	O
in	O
two-dimensional	O
space	O
,	O
with	O
line	O
being	O
defined	O
by	O
two	O
distinct	O
points	O
and	O
,	O
and	O
line	O
being	O
defined	O
by	O
two	O
distinct	O
points	O
and	O
.	O
</s>
<s>
The	O
intersection	B-Algorithm
of	O
line	O
and	O
can	O
be	O
defined	O
using	O
determinants	O
.	O
</s>
<s>
The	O
intersection	B-Algorithm
point	O
above	O
is	O
for	O
the	O
infinitely	O
long	O
lines	O
defined	O
by	O
the	O
points	O
,	O
rather	O
than	O
the	O
line	O
segments	O
between	O
the	O
points	O
,	O
and	O
can	O
produce	O
an	O
intersection	B-Algorithm
point	O
not	O
contained	O
in	O
either	O
of	O
the	O
two	O
line	O
segments	O
.	O
</s>
<s>
In	O
order	O
to	O
find	O
the	O
position	O
of	O
the	O
intersection	B-Algorithm
in	O
respect	O
to	O
the	O
line	O
segments	O
,	O
we	O
can	O
define	O
lines	O
and	O
in	O
terms	O
of	O
first	O
degree	O
Bézier	O
parameters	O
:	O
</s>
<s>
There	O
will	O
be	O
an	O
intersection	B-Algorithm
if	O
and	O
.	O
</s>
<s>
The	O
intersection	B-Algorithm
point	O
falls	O
within	O
the	O
first	O
line	O
segment	O
if	O
,	O
and	O
it	O
falls	O
within	O
the	O
second	O
line	O
segment	O
if	O
.	O
</s>
<s>
These	O
inequalities	O
can	O
be	O
tested	O
without	O
the	O
need	O
for	O
division	O
,	O
allowing	O
rapid	O
determination	O
of	O
the	O
existence	O
of	O
any	O
line	O
segment	O
intersection	B-Algorithm
before	O
calculating	O
its	O
exact	O
point	O
.	O
</s>
<s>
The	O
and	O
coordinates	O
of	O
the	O
point	B-Algorithm
of	I-Algorithm
intersection	I-Algorithm
of	O
two	O
non-vertical	O
lines	O
can	O
easily	O
be	O
found	O
using	O
the	O
following	O
substitutions	O
and	O
rearrangements	O
.	O
</s>
<s>
If	O
as	O
well	O
,	O
the	O
lines	O
are	O
different	O
and	O
there	O
is	O
no	O
intersection	B-Algorithm
,	O
otherwise	O
the	O
two	O
lines	O
are	O
identical	O
and	O
intersect	O
at	O
every	O
point	O
.	O
</s>
<s>
By	O
using	O
homogeneous	O
coordinates	O
,	O
the	O
intersection	B-Algorithm
point	O
of	O
two	O
implicitly	O
defined	O
lines	O
can	O
be	O
determined	O
quite	O
easily	O
.	O
</s>
<s>
Assume	O
that	O
we	O
want	O
to	O
find	O
intersection	B-Algorithm
of	O
two	O
infinite	O
lines	O
in	O
2-dimensional	O
space	O
,	O
defined	O
as	O
and	O
.	O
</s>
<s>
The	O
intersection	B-Algorithm
of	I-Algorithm
two	I-Algorithm
lines	I-Algorithm
can	O
be	O
generalized	O
to	O
involve	O
additional	O
lines	O
.	O
</s>
<s>
Then	O
if	O
and	O
only	O
if	O
the	O
rank	O
of	O
the	O
augmented	B-Algorithm
matrix	I-Algorithm
is	O
also	O
2	O
,	O
there	O
exists	O
a	O
solution	O
of	O
the	O
matrix	O
equation	O
and	O
thus	O
an	O
intersection	B-Algorithm
point	O
of	O
the	O
lines	O
.	O
</s>
<s>
where	O
is	O
the	O
Moore	O
–	O
Penrose	O
generalized	B-Algorithm
inverse	I-Algorithm
of	O
(	O
which	O
has	O
the	O
form	O
shown	O
because	O
has	O
full	O
column	O
rank	O
)	O
.	O
</s>
<s>
But	O
if	O
the	O
rank	O
of	O
is	O
only	O
1	O
,	O
then	O
if	O
the	O
rank	O
of	O
the	O
augmented	B-Algorithm
matrix	I-Algorithm
is	O
2	O
there	O
is	O
no	O
solution	O
but	O
if	O
its	O
rank	O
is	O
1	O
then	O
all	O
of	O
the	O
lines	O
coincide	O
with	O
each	O
other	O
.	O
</s>
<s>
But	O
if	O
an	O
intersection	B-Algorithm
does	O
exist	O
it	O
can	O
be	O
found	O
,	O
as	O
follows	O
.	O
</s>
<s>
In	O
two	O
or	O
more	O
dimensions	O
,	O
we	O
can	O
usually	O
find	O
a	O
point	O
that	O
is	O
mutually	O
closest	O
to	O
two	O
or	O
more	O
lines	O
in	O
a	O
least-squares	B-Algorithm
sense	O
.	O
</s>
<s>
In	O
order	O
to	O
find	O
the	O
intersection	B-Algorithm
point	O
of	O
a	O
set	O
of	O
lines	O
,	O
we	O
calculate	O
the	O
point	O
with	O
minimum	O
distance	O
to	O
them	O
.	O
</s>
<s>
where	O
is	O
the	O
identity	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
This	O
is	O
a	O
matrix	O
,	O
with	O
solution	O
,	O
where	O
is	O
the	O
pseudo-inverse	B-Algorithm
of	O
.	O
</s>
