Posts

Showing posts from March, 2020

HW 2D CGA - PPT 8 - Polygon Fill

Image
Question Solution: First of all, we need to know the element to be inserted into SET and AEL. The element must contain \(y_{max}\), \(x \ of \ y_{min}\), \(dx\), and \(dy\). Also carry but only in AEL, carry doesn't need to be inserted into SET. With that said, let's begin with the first polygon. Polygon 1 A(1, 6), B(5,4), C(3,1) From these 3 vertices we need to find the edges element containing \(y_{max}\), \(x \ of \ y_{min}\), \(dx\), and \(dy\). Let's take a look at edge AB , the \(y_{max}\) is 6, the \(x \ of \ y_{min}\) is 5, the \(dx\) is 4, and the \(dy\) is -2. Now if we found \(dy < 0\) we need to make it positive, by multiplying \(dx\) and \(dy\) with -1, so we got \(dx\) = -4 and \(dy\) = 2. The same rule applies with edges BC and CA. After we've found all of the elements then, we put it into the SET just like below. SET y Edges \(y_{max}\) 6 5 4 \( \rightarrow AB \) 6 5 -4 2 3 2 \(y_{min}\) 1 \( \rightarrow