Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 125765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:12:39+00:00 2026-05-11T05:12:39+00:00

For a complex polygon (ie: self intersecting) the choice between the Winding or the

  • 0

For a complex polygon (ie: self intersecting) the choice between the Winding or the Even-Odd filling rules makes a difference in the way the polygon is filled.

But for non intersecting polygons is there any performance difference between the Winding or the Even Odd filling rules. I understand it would be implentation specific but which of the algorithms is more effecient for non complex polygons.

A follow up question what is the complexity (ie O(what?) )of each of these algorithms. I want to know whether it is worth getting rid of some points in the polygon (mainly duplicates or ones that are on the same line) to improve performance.

PS: If it matters at all, I am using xlib

PPS: I can confirm the problem is not hardware related as using a different graphics card doesn’t change the performance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:12:40+00:00Added an answer on May 11, 2026 at 5:12 am

    Today, most implementations of X use the 2D hardware of your graphics card so the difference between the two is probably negligible.

    Since this is a performance question, chances of my answer being correct is about 10%, though (with performance, you have a 90% chance to be wrong without measuring). If you want to be sure, there is no way but to write a small performance test and see for yourself.

    x11perf might help.

    You can find the algorithm for the hardware independent polygon fill here: http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/mi/mipolygen.c?rev=HEAD

    There is a second version which is much faster if you are sure your polygon is convex: http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/mi/mipolycon.c?rev=HEAD

    The second version ignores the fill rule (which doesn’t apply to convex polygons). Comments about the algorithm: http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/mi/mipoly.h?rev=HEAD

    The algorithm works this way: It calculates the outline, then creates span objects (which are just a x,y coordinate and a width) between the edges. If you use the EvenOdd rule, more span objects will be created if there are intersections. If there are none (for example, when the polygon is convex), then you will not notice a runtime difference because the filling rule amounts to a boolean variable in the main loop of the miFillPolygon (i.e. most of the code is the same for both fill rules).

    Trying to improve performance by optimizing the outline of the polygon will not buy you much in the common case except if you know that your polygons contain a very high number of unnecessary points (say, you can get rid of half the number of points in the common case). Optimizing a polygon with < 10 points will probably cost more than it achieves.

    But again: This are all based on gut feeling or the knowledge of an old article. If you want to know if bugs in your gfx card driver mess with the result, you have to get your hands dirty and write a test which measures how long each case takes. There is no way to tell the runtime of any complex algorithm by simply looking at it because of external factors: Speed of the memory allocation routines, amount of free memory (when does swapping start), number of CPU cores you can use, how many other processes will fight you for the CPU, clipping of the final polygon on the screen, implementation details and optimizations, bugs, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 100k
  • Answers 100k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I guess you could do something like this: function MyClass… May 11, 2026 at 7:59 pm
  • Editorial Team
    Editorial Team added an answer Line 56 is probably the line after it, where you… May 11, 2026 at 7:59 pm
  • Editorial Team
    Editorial Team added an answer I imagine the installation and configuration process might go off… May 11, 2026 at 7:59 pm

Related Questions

I have to code a simple control in .Net that draws geometry that looks
For drawing complex concave polygons with OpenGL, is it better to tesselate it into
I have a mature MFC C++ application that displays on screen and prints using
I am developing a simple platform game using Java using BlueJ as the IDE.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.