You are viewing the course site for a past offering of this course. The current offering may be found here.
Lecture 5: Texture Mapping (19)
woojinko

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:

PQ=[xqxpyqyp]PQ = \begin{bmatrix} x_q - x_p \\ y_q - y_p \end{bmatrix}

To take the clockwise direction normal,

Normal([ab])=[ba] Normal(\begin{bmatrix} a \\ b \end{bmatrix}) = \begin{bmatrix} -b \\ a \end{bmatrix}

Thus,

Normal(PQ)=[(yqyp)xqxp]Normal(PQ) = \begin{bmatrix} -(y_q - y_p) \\ x_q - x_p \end{bmatrix}

LPQ(x,y)=(LinefromPto(x,y))Normal(PQ)L_{PQ}(x, y) = (Line from P to (x,y)) \cdot Normal(PQ)

=[xxpyyp][(yqyp)xqxp] = \begin{bmatrix} x - x_p \\ y - y_p \end{bmatrix} \cdot \begin{bmatrix} -(y_q - y_p) \\ x_q - x_p \end{bmatrix}

=(xxp)(yqyp)+(yyp)(xqxp) = -(x - x_p)(y_q - y_p) + (y - y_p)(x_q - x_p)

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)L_{PQ}(x,y)

You must be enrolled in the course to comment