From: Arjen M. <arj...@wl...> - 2003-08-26 12:17:23
|
Arjen Markus wrote: > > Maurice LeBrun wrote: > > > > > > > Polygon clipping is fairly complex. The issue really raised its head when I > > implemented zooming in the plplot TK interface and started doing a lot of > > shade plotting, way back in '94 or so. I worked on it for a while before > > giving up due to lack of progress even though there were still a lot of > > problems with it. As an example, run "x16c -dev tk", zoom in on a section and > > then pan around. > > > > Anyway I decided to take another look at the code and noticed right away > > problems with the existing approach. Emboldened, I set about to improve it > > and now am happy to say it works much better than before. Grab the latest > > src/plline.c from cvs HEAD and see if the new code fixes your problem. > > > > Note it still does not work perfectly -- at a sufficiently high level of > > zooming we start to get clipping problems again. These I suspect are due to a > > fidelity problem, either in clipline() or somewhere else. Anyway no more time > > to work on it for now. > > > > > > That sounds great. When I wrote the original e-mail, I started thinking > how > this could be improved - I soon realised that a completely general > solution > is very difficult/tedious. I will have a look at the new source. > > Thanks for looking into it. > I just tried with this new version. The result is the same: severed polygons. As I am having problems with gdb - it shows very strange lines to be executed next (see below for a transcript) - it is difficult to make sure that all is being as it should. Looking further ... Regards, Arjen ------------------------- Transcript of gdb session ------------------------- (gdb) break 63 Breakpoint 2 at 0x81d651b: file plfill.c, line 63. (gdb) c Continuing. Breakpoint 2, c_plfill (n=21, x=0xbfffd074, y=0xbfffd014) at plfill.c:64 64 plP_plfclp(xpoly, ypoly, n, plsc->clpxmi, plsc->clpxma, (gdb) s plP_plfclp (x=0xbfffcbd4, y=0xbfffc7d4, npts=22, xmin=5461, xmax=27306, ymin=5461, ymax=22755, draw=0x81cf71c <plP_fill>) at plline.c:551 551 (gdb) n 545 * correct. For the fill cases encountered in plplot, this treatment should (gdb) n 547 * the typical return value is 3 or -3, since 3 turns are necessary in order 548 * to complete the fill region. Only for really oddly shaped fill regions 549 * will it give the wrong answer. 550 \*----------------------------------------------------------------------*/ 551 552 static int 553 circulation(PLINT *x, PLINT *y, PLINT npts) 554 { 555 int xproduct, direction = 0; 556 PLINT i, x1, y1, x2, y2, x3, y3; (gdb) n 553 circulation(PLINT *x, PLINT *y, PLINT npts) (gdb) n 554 { (gdb) n 555 int xproduct, direction = 0; (gdb) n 557 for (i = 0; i < npts - 1; i++) { (gdb) n --- gdb shows the header of a routine I am not in yet ... |