|
![](/i/fill.gif) |
scott wrote:
>> Because you can use it to determine which side of the line a point is on?
>
> How?
>
> Example: Line through (0,0) and (0,1), and points either side of the
> line at (1,0) and (-1,0)
Suppose you have a line from point A to point B. Compute the vector AB,
the dot product V . A and call it k.
Which side of the line is point X on? Well, take the dot product V . X,
and subtract k. The result is negative on one side, positive on the
other, and zero if X is on the line itself (or at least, parallel to it).
...so basically, it's a ray/plane intersection test, except the "plane"
is a 2D slide - a line.
A = (0,0)
B = (0,1)
AB = (0,1) - (0,0) = (0,1) [already unital]
V = (0,1) * {(0,-1), (1,0)} = (-1,0)
k = (0,0) . (-1,0) = 0
X = (1,0)
X . V - k = (1,0) . (-1,0) - 0 = -1
Y = (-1,0)
Y . V - k = (-1,0) . (-1,0) - 0 = +1
QED.
Post a reply to this message
|
![](/i/fill.gif) |