Filling the polygon: fulfilling the winding rule against the even rule

For a complex polygon (i.e., self-intersecting), the choice between winding rules or Magnitude-Oddity distinguishes the way the polygon is filled.

But for disjoint polygons, there is some difference in performance between the winding rules or the Parity value. I understand that this will be specific for implantation, but which of the algorithms is more effective for non-complex polygons.

The question is what is the complexity (i.e. O (what?)) Of each of these algorithms. I want to know whether it is worth getting rid of some points in the polygon (mostly duplicates or those that are on the same line) to improve performance.

PS: If it matters at all, I use xlib

PPS: I can confirm that the problem is not hardware related, since using a different video card does not change the performance

+3
source share
1 answer

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

Since this is a performance issue, the likelihood that my answer will be correct is around 10%, though (with a performance you have a 90% chance of making a mistake without measuring). If you want to be sure, there is no way to write a small performance test and see for yourself.

x11perf can help.

: http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/mi/mipolygen.c?rev=HEAD

, , , : http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/mi/mipolycon.c?rev=HEAD

( ). : http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/mi/mipoly.h?rev=HEAD

: , ( x, y ) . EvenOdd, span , . (, ), , miFillPolygon (.. ).

, , , (, ). < 10 , , , .

: . , gfx- , , , . , - : , ( ), , , , , , ..

+4

Source: https://habr.com/ru/post/1702346/


All Articles