The PLplot development team have just implemented a demanding 2D fill rendering test for the X stack where we modify our standard example 27 (see http://plplot.sourceforge.net/examples.php?demo=27) to change from drawing the boundary line of "spirographic" (e.g., hypotrochoid and epitrochoid) curves to filling those curves. The boundaries of the 9 test curves are illustrated in the first attachment. The fills of those test curves (implemented using XFillPolygon with a Complex shape and 20000 points in the polygon describing the boundary) have rendering errors. If the fill is done with the EvenOddRule filling rule (set using XSetFillRule) the rendering errors are severe. The first through 3rd test cases show blank results (not illustrated) and the 4th test case (second attachment) and remaining more complex fill cases (not illustrated) show severe rendering errors with many fills missing and some areas filled that should not be. If the fill is done with the WindingRule filling rule, the fill rendering errors are much less severe than in the case of the EvenOddRule filling rule. The first (attached), second (not illustrated) , and 3rd (not illustrated) test cases look fine, but the fourth (attached) and remaining (not illustrated) test cases have minor rendering errors (areas filled which should not be on the right-hand side of the figure so the total result is asymmetric rather than symmetric as it should be for the symmetric hypotrochoid and epitrochoid boundary curves of the fill. Because most applications and libraries (including the PLplot one) have great success with X filling with a small (3 or 4) number of points in the boundary for the normal default EvenOddRule filling rule, I tried the experiment of reducing the number of points from 20000 to 200, but that made no qualitative difference to the severely bad fill rendering for the EvenOddRule filling rule. My platform is Debian Squeeze with Intel (g33) video chipset. I first reported this bug at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=615491. My original report was for the intel driver, but at Michel Dänzer's suggestion, I also tried the fbdev and vesa drivers which also showed the identical issue. The following steps (which need just a few minutes) are required to replicate this bug: * Get latest svn trunk version of PLplot source code following the directions (including appending '/trunk' to the HTTPS URL) at http://sourceforge.net/scm/?type=svn&group_id=2915. This download should only take a few minutes. * Optionally modify drivers/xwin.c to change XSetFillRule call from WindingRule to EvenOddRule (if you want to see the horrendous results from that filling rule as opposed to the mildly bad results from WindingRule). * Optionally modify examples/c/x27c.c (say to change the number of points in the boundary from 20000 to 200 or 2000000). * Build this particular PLplot x27c test and the xwin driver in an initially empty build tree. This should only take a minute or so. mkdir build_dir cd build_dir cmake -DBUILD_TEST=ON /PATH/TO/TOP/OF/SOURCE/TREE make xwin x27c * Run example to show fill problems for self-intersecting boundaries. examples/c/x27c -dev xwin You advance from one page of that test example to the next by hitting the return/enter key. The first set of pages should display just the self-intersecting boundaries, and the last set of pages should display the filled results for those boundaries. For the EvenOddRule fill rule, the first three "fill" pages are blank and the remaining pages badly filled. For the WindingRule fill rule, the first three "fill" pages are fine, but the remaining ones have small fill errors (showing as fill asymmetries on the right of the figure). Alan W. Irwin
Created attachment 43980 [details] The complex boundary curves for the nine fill-rendering tests
Created attachment 43981 [details] Illustration of fill errors for the 4th test case with the EvenOddRule fill rule
Created attachment 43982 [details] Illustration of the good fill result for first test case with the WindingRule fill rule
Created attachment 43983 [details] Illustration of fill errors for the 4th test case with the WindingRule fill rule
For the svn trunk version of PLplot, you can now choose the two different fill rules at run-time as follows: # non-zero winding number fill rule examples/c/x27c -dev xwin # even-odd fill rule examples/c/x27c -dev xwin -eofill
As of revision 11591 of PLplot svn trunk, I have changed example 27 so that the maximum phi and phiw values are the smallest possible integers times 2 pi. The previous incorrect maximum values for these numbers so complicated the boundary (with many duplicate boundaries) that correct fills were being generated that looked incorrect for the -eofill case. The incorrect maximums also caused a large last boundary segment that introduced small but noticable asymmetries into the case without -eofill. Now these example 27 issues have been fixed, the results with -eofill are not only correct but also beautiful while results without -eofill are also correct (symmetrical). Accordingly I am changing the status of the "bug" to RESOLVED/NOTOURBUG. My thanks to M Joonas Pihlaja of the cairo team for a strong hint that lead me to a solution for these initial extremely puzzling fill results for the self-intersecting boundary case.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.