algorithm - Filling a Polygon: Performance of Winding Rule vs Even Odd Rule -


The choice between a complex polygon (i.e.: intersecting itself) or even filling the odd rules There is a difference in the way the polygon is filled.

But there is no difference between the rotation or even the filling rules to incorporate the polygon. I think this will be implantation, but which of the algorithms is more effective for non-complex polygon.

A follow-up question is the complexity of each algorithm (ie what?) I want to know that getting rid of some points in the polygon (mainly duplicates or which are on the same line). PS: If it matters at all, then I'm using it Xlib

PPS: I can confirm the problem that any other graphics card connected to the hardware

Most of today's implementation of the graphics card using 2D hardware of your graphics card So, the difference between the two is probably negligible.

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

Can help.

You can get the algorithm for the hardware Fill the free polygon here:

There is a second version that is very fast if you are sure that your polygon is convex:

The second version ignores the fill rule (which does not apply to convex polygon). Comments about algorithm:

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

By trying to improve the display by customizing the polygon's framework, you will not buy more in the general case, even if you know that your polygon contains a large number of unnecessary digits (say , A common case can get rid of half-digit number). To convert a polygon to & lt; The cost of 10 points will probably be higher than that.

But again: all of this is based on knowledge of the goat or old article. If you want to know that your GFX card driver with the result is worms in disturbance, then you should have your hands dirty and write a test, how long it takes each case. Because of external factors, there is no way to tell the runtime of any complex algorithms: the amount of memory allocation, the amount of free memory (when you start swapping), you can use the number of CPU numbers , How many other processes will you fight for the CPU, the last polygon clipping on the screen, implementation details and optimization, bugs etc.


Comments