 |
Question |
Solution:
First of all, we need to know the element to be inserted into SET and AEL. The element must contain , , , and . 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 , , , and . Let's take a look at edge AB, the is 6, the is 5, the is 4, and the is -2. Now if we found we need to make it positive, by multiplying and with -1, so we got = -4 and = 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
After finishing the SET, we can continue to the AEL. There are some rules to follow in calculating AEL as written below.
if |
if |
carry +=
loop (carry )
carry +=
-= 1 |
|
carry +=
loop (carry )
carry -=
+= 1 |
|
AEL
y=1 |
|
y=2 |
|
y=3 |
|
y=4 |
BC has reached y=5 and AB starts
|
|
|
y=5 |
|
y=6
|
AB and CA both ended in y=6
|
Now let's continue to the second polygon.
Polygon 2
A(0, 0), B(5, 3), C(10, 0), D(5, 10)
From these 4 vertices we need to find the edges element containing
, , , and . Let's take a look
at edge AB, the is 3, the is 0,
the is 5, and the is 3. The same rule applies with
edges BC, CD, and DA. After we've found all of the elements then, we put it
into the SET just like below.
SET
| | Edges |
| 10 | |
| 9 | |
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 1 | |
| 0 |
|
Now for the
AEL. Remember the rule for
AEL? Here are the rules to follow in calculating AEL as written below.
if |
if |
carry +=
loop (carry )
carry +=
-= 1 |
|
carry +=
loop (carry )
carry -=
+= 1 |
|
AEL
y=0 |
|
y=1 |
|
y=2 |
|
y=3 |
|
y=4 |
|
y=5 |
|
y=6 |
|
y=7 |
|
y=8 |
|
y=9 |
|
y=10 |
|
Now for the third polygon.
Polygon 3
A(7, 1), B(13, 5), C(13, 11), D(7, 7), E(2, 9), F(2, 3)
From these 6 vertices we need to find the edges element containing
, , , and . Let's take a look
at edge AB, the is 5, the is 7,
the is 6, and the is 4. The same rule applies with
edges BC, CD, DE, EF, and FA. After we've found all of the elements then, we put it
into the SET just like below.
SET
| | Edges |
| 11 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |
|
| 6 | |
| 5 |
|
| 4 | |
| 3 |
|
| 2 | |
| 1 |
|
Now for the
AEL. Remember the rule for
AEL? Here are the rules to follow in calculating AEL as written below.
if |
if |
carry +=
loop (carry )
carry +=
-= 1 |
|
carry +=
loop (carry )
carry -=
+= 1 |
|
AEL
y=1 |
|
y=2 |
|
y=3 |
|
y=4 |
|
EF dx=0 so no need to calculate this one
|
|
y=5 |
EF dx=0 so no need to calculate this one
|
AB popped, insert BC
|
|
y=6 |
EF dx=0 so no need to calculate this one
|
BC dx=0 so no need to calculate this one
|
|
y=7 |
EF dx=0 so no need to calculate this one
|
BC dx=0 so no need to calculate this one
|
insert CD
|
insert DE
|
|
y=8 |
EF dx=0 so no need to calculate this one
|
BC dx=0 so no need to calculate this one
|
|
|
|
y=9 |
EF popped
|
BC dx=0 so no need to calculate this one
|
|
DE popped
|
|
y=10 |
BC dx=0 so no need to calculate this one
|
|
|
y=11 |
|
Now let's continue to the fourth polygon.
Polygon 4
A(3, 3), B(10, 5), C(14, 5), D(8, 1), E(21, 10), F(13, 10), G(3, 17)
From these 7 vertices we need to find the edges element containing
, , , and . Let's take a look
at edge AB, the is 5, the is 3,
the is 7, and the is 2. The same rule applies with
edges BC, CD, DE, EF, FG, and GA. After we've found all of the elements then, we put it
into the SET just like below.
SET
| | Edges |
| 17 | |
| 16 | |
| 15 | |
| 14 | |
| 13 | |
| 12 | |
| 11 | |
| 10 |
|
| 9 | |
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 3 |
|
| 2 | |
| 1 |
|
Notice that out of 7 pairs of edges we only insert 5 of them, that is because we don't need to include horizontal edges where dy=0 such as BC and EF. Now for the
AEL. Remember the rule for
AEL? Here are the rules to follow in calculating AEL as written below.
if |
if |
carry +=
loop (carry )
carry +=
-= 1 |
|
carry +=
loop (carry )
carry -=
+= 1 |
|
AEL
y=1 |
|
y=2 |
|
y=3 |
|
y=4 |
|
|
|
GA dx=0 so no need to calculate this one
|
|
y=5 |
CD popped
|
|
AB popped
|
GA dx=0 so no need to calculate this one
|
|
y=6 |
|
GA dx=0 so no need to calculate this one
|
|
y=7 |
|
GA dx=0 so no need to calculate this one
|
|
y=8 |
|
GA dx=0 so no need to calculate this one
|
|
y=9 |
|
GA dx=0 so no need to calculate this one
|
|
y=10 |
DE popped, insert FG
|
GA dx=0 so no need to calculate this one
|
|
y=11 |
|
GA dx=0 so no need to calculate this one
|
|
y=12 |
|
GA dx=0 so no need to calculate this one
|
|
y=13 |
|
GA dx=0 so no need to calculate this one
|
|
y=14 |
|
GA dx=0 so no need to calculate this one
|
|
y=15 |
|
GA dx=0 so no need to calculate this one
|
|
y=16 |
|
GA dx=0 so no need to calculate this one
|
|
y=17 |
|
And that's that is all the solution for this question.
mantap bang
ReplyDeleteWduch,,, pdhal aq dh bwt programny
ReplyDelete