Graphics Reference
In-Depth Information
Y
X
a
Fig. 12.6. Two lines intersecting at an angle α .
Y
P 3
X
P 2
P 1
Fig. 12.7. Three points on a common line.
12.8 Test If Three Points Lie On a Straight Line
Three points either create a triangle or lie on a straight line as shown in
Figure 12.7. To determine when this occurs we compare two vectors formed
from the points.
For example, given P 1 ( x 1 ,y 1 ) ,P 2 ( x 2 ,y 2 ) ,P 3 ( x 3 ,y 3 )and r = −−→
P 1 P 2 and s = −−→
P 1 P 3
the three points lie on a straight line when s = λ r where λ is a scalar.
If the points are
P 1 (0 ,
2) P 2 (1 ,
1) P 3 (4 , 2)
then
r = i + j and s =4 i +4 j
and
s =4 r
therefore, the points lie on a straight line as confirmed by the diagram.
 
Search WWH ::




Custom Search