Remember that this line equation is also equivalent to the dot product of the vector from P to (x,y) and the normal vector to PQ. I found this form much easier to implement in code for project part 4!
hershg
If anyone's having confusion with this, here's some more worked out detail:
Remember that this line equation is also equivalent to the dot product of the vector from P to (x,y) and the normal vector to PQ. I found this form much easier to implement in code for project part 4!
If anyone's having confusion with this, here's some more worked out detail:
PQ=[xq−xpyq−yp]
To take the clockwise direction normal,
Normal([ab])=[−ba]
Thus,
Normal(PQ)=[−(yq−yp)xq−xp]
LPQ(x,y)=(LinefromPto(x,y))⋅Normal(PQ)
=[x−xpy−yp]⋅[−(yq−yp)xq−xp]
=−(x−xp)(yq−yp)+(y−yp)(xq−xp)
Which matches what's in the slide!
If we're looking in the counter-clockwise direction instead, we simply negate our expression for LPQ(x,y)