Graphics Reference
In-Depth Information
From Figure 12.5
y y 1
x
y 2 y 1
x 2
=
x 1
x 1
( x 2
x 1 )( y
y 1 )=( y 2
y 1 )( x
x 1 )
( y 2
y 1 ) x
( y 2
y 1 ) x 1 =( x 2
x 1 ) y
( x 2
x 1 ) y 1
( y 2
y 1 ) x +( x 1
x 2 ) y = x 1 y 2
x 2 y 1
therefore
a = y 2 − y 1 b = x 1 − x 2 c = ( x 1 y 1 − x 2 y 1 )
If the two points are P 1 (1 , 0) and P 2 (3 , 4) then
(4
0) x +(1
3) y
(1
×
4
3
×
0) = 0
and
4 x
2 y
4=0
or
2 x
y
2=0
12.7 Calculate the Angle between Two Straight Lines
Given two line equations it is possible to compute the angle between them
using the scalar product. For example, if the line equations are
a 1 x + b 1 y + c 1 =0
a 2 x + b 2 y + c 2 =0
their normal vectors are n = a 1 i + b 1 j and m = a 2 i + b 2 j respectively
therefore
. m = n m cos( α )
and the angle between the lines α is given by
α =cos 1 n
n
. m
n m
Figure 12.6 shows two lines represented by
2 x +2 y
4=0
and
2 x +4 y
4=0
Therefore
α =cos 1 2
=18 . 435
4
2 2 +2 2 2 2 +4 2
×
2+2
×
Search WWH ::




Custom Search