Graphics Reference
In-Depth Information
If only one expression is zero - the point is on the boundary.
If two expressions are zero - the point is a boundary vertex.
If any expression is negative - the point is outside the boundary.
If all expressions are positive - the point is inside the boundary.
Table 3.1 summarises some of these conditions.
Table 3.1
Point
x
+
y
+
1
x
y
+
5
x
y
+
1
x
+
y
3
Partition
22
+
+
+
+
inside
11
+
+
+
outside
20
+
+
outside
31
+
+
+
outside
42
+
+
outside
33
+
+
+
outside
24
+
+
outside
13
+
+
+
outside
02
+
+
outside
21
0
+
+
0
vertex
32
0
0
+
+
vertex
+
+
23
0
0
vertex
+
+
12
0
0
vertex
The reader may wish to verify other points, but the contents of Table 3.1 should be sufficient to
demonstrate the integrity of this strategy. However, this technique is sensitive to the boundary's
vertex sequence. For if the vertices are taken in a clockwise order, the four line equations are
effectively multiplied by
1, which flips the normal vectors:
x
+
y
+
1
x
y
1
x
y
+
5
x
+
y
5
x
y
+
1
⇒−
x
+
y
1
x
+
y
3
⇒−
x
y
+
3
Now the normal vectors point away from the boundary's inside, which makes the inside partition
negative and the outside positive. This still works, but it highlights the care required when using
this technique.
3.6 A line perpendicular to a vector
In this section we examine how to define a straight line that is perpendicular to a given vector
and passes through a specific point. Figure 3.13 shows this scenario where the reference unit
vector
n passes through the origin O and the specified point is T x T y T .
ˆ
 
Search WWH ::




Custom Search