Public Group

# Question about filling a polygon... (tutorial question)

This topic is 4072 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've been following the polygon filling tutorial located here: http://www.cs.rit.edu/~icss571/filling/index.html ...and it's REALLY good but it seems to contradict itself quite badly. When you are initializing the Global Edge Table, it says to NOT add any lines with a slope = 0 but then in the example they do infact add them! See here: http://www.cs.rit.edu/~icss571/filling/how_to.html Under the "2. Initializing the Global Edge Table", it says:
Quote:
 If the slope of the edge is zero, do not add that edge to the global edge table.
...and then, two pages later (http://www.cs.rit.edu/~icss571/filling/example.html), it gives a full example of how to fill a polygon. However, in the example where they initialize the Global Edge Table, they say:
Quote:
 For the first edge, the slope is not zero so it is placed in the global edge table at index=0.
...but they show a screenshot right below this text where the slope is in-fact zero. I'm really trying to learn how to fill a polygon in a simple, easy, way and this tutorial was amazing up until this point. Can anybody help me out? (eg. what should the tutorial say about slope?) Thanks, John

##### Share on other sites
Nobody can help me out? :(

##### Share on other sites
m is the slope, they give 1/m in the box you must have been looking at. If 1/m equals 0, then the line is completely vertical. If m = 0, then the line is horizontal. Which makes sense when you think about it.

1/m = (x2 - x1) / (y2 - y1)

right? This means that for 1/m to equal 0 then x2-x1 equals 0. This in turn means that x2 equals x1 which means that y2 and y1 give the start and end points of a vertical line.

In summary: the slope isn't 0, 1/slope IS 0.

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
16
5. 5

• 14
• 29
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631774
• Total Posts
3002290
×