Sign in to follow this  
sofakng

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

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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this