Jump to content
  • Advertisement
Sign in to follow this  
sofakng

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.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!